Skip to content

Commit

Permalink
Merge pull request #169 from VerusCoin/dev
Browse files Browse the repository at this point in the history
v1.0.9
  • Loading branch information
Asherda authored Mar 31, 2024
2 parents 59861e8 + c09e91a commit c67aa58
Show file tree
Hide file tree
Showing 34 changed files with 2,028 additions and 133 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.android.build.OutputFile

def versionMajor = 1
def versionMinor = 0
def versionRevision = 8
def versionRevision = 9
def versionBuild = 0

def keystorePropertiesFile = rootProject.file("keystore.properties");
Expand Down
2 changes: 1 addition & 1 deletion env/main.android.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"APP_VERSION": "1.0.8",
"APP_VERSION": "1.0.9",
"ELECTRUM_PROTOCOL_CHANGE": 1.4,

"KEY_DERIVATION_VERSION": 1,
Expand Down
2 changes: 1 addition & 1 deletion env/main.ios.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"APP_VERSION": "1.0.8",
"APP_VERSION": "1.0.9",
"ELECTRUM_PROTOCOL_CHANGE": 1.4,

"KEY_DERIVATION_VERSION": 1,
Expand Down
6 changes: 3 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ PODS:
- React
- RNGestureHandler (2.9.0):
- React-Core
- RNKeychain (6.2.0):
- React
- RNKeychain (8.1.3):
- React-Core
- RNOS (1.2.7):
- React
- RNPermissions (3.1.0):
Expand Down Expand Up @@ -838,7 +838,7 @@ SPEC CHECKSUMS:
RNDateTimePicker: e073697ac3e8a378968d68ab0581fef542b8af8a
RNFS: 3ab21fa6c56d65566d1fb26c2228e2b6132e5e32
RNGestureHandler: 071d7a9ad81e8b83fe7663b303d132406a7d8f39
RNKeychain: b8e0711b959a19c5b057d1e970d3c83d159b6da5
RNKeychain: f1b48665a4646f61191eb048c4c05c58d9a7596f
RNOS: 728cdea6d232de48cfede274443dbe3f669b86e9
RNPermissions: 4b54095940aea8c03fa3e6c92d4ac3647b31ed4e
RNReactNativeHapticFeedback: 653a8c126a0f5e88ce15ffe280b3ff37e1fbb285
Expand Down
2 changes: 1 addition & 1 deletion ios/assets/env/main.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"APP_VERSION": "1.0.8",
"APP_VERSION": "1.0.9",
"ELECTRUM_PROTOCOL_CHANGE": 1.4,

"KEY_DERIVATION_VERSION": 1,
Expand Down
4 changes: 2 additions & 2 deletions ios/verusMobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-webview\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/rn-fetch-blob\"",
);
MARKETING_VERSION = 1.0.8;
MARKETING_VERSION = 1.0.9;
PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.verusmobile;
PRODUCT_NAME = verusmobile;
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -792,7 +792,7 @@
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-webview\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/rn-fetch-blob\"",
);
MARKETING_VERSION = 1.0.8;
MARKETING_VERSION = 1.0.9;
PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.verusmobile;
PRODUCT_NAME = verusmobile;
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "verusmobile",
"version": "1.0.8",
"version": "1.0.9",
"private": true,
"scripts": {
"postinstall": "./node_modules/.bin/rn-nodeify --hack --install --yarn && npx jetify",
Expand Down Expand Up @@ -77,7 +77,7 @@
"react-native-haptic-feedback": "1.11.0",
"react-native-image-picker": "5.7.0",
"react-native-keyboard-aware-scroll-view": "0.9.5",
"react-native-keychain": "6.2.0",
"react-native-keychain": "8.1.3",
"react-native-level-fs": "3.0.0",
"react-native-loading-spinner-overlay": "1.0.1",
"react-native-modal-datetime-picker": "15.0.0",
Expand Down
34 changes: 15 additions & 19 deletions src/actions/actions/UserData.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import {clearEncryptedServiceStoredDataForUser} from './services/dispatchers/ser
import {clearActiveAccountLifecycles} from './account/dispatchers/account';
import {WYRE_SERVICE_ID} from '../../utils/constants/services';

export const addUser = (
export const addUser = async (
userName,
seeds,
password,
Expand All @@ -60,24 +60,20 @@ export const addUser = (
disabledServices = SERVICES_DISABLED_DEFAULT,
testnetOverrides = {},
) => {
return new Promise((resolve, reject) => {
storeUser(
{
seeds,
password,
userName,
biometry,
keyDerivationVersion,
disabledServices,
testnetOverrides,
},
users,
)
.then(res => {
resolve(setAccounts(res));
})
.catch(err => reject(err));
});
const res = await storeUser(
{
seeds,
password,
userName,
biometry,
keyDerivationVersion,
disabledServices,
testnetOverrides,
},
users,
)

return setAccounts(res);
};

export const resetPwd = (userID, newPwd, oldPwd) => {
Expand Down
69 changes: 36 additions & 33 deletions src/containers/AddCoin/AddCoin.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ const AddCoin = props => {
: CoinDirectory.supportedCoinList;
const activeCoinIds = activeCoinsForUser.map(coinObj => coinObj.id);

// Define the order of priority for currency IDs
const priorityOrder = [
'VRSC', '0xBc2738BA63882891094C99E59a02141Ca1A1C36a',
'VRSCTEST',
'BTC', '0x18084fbA666a33d37592fA2633fD49a74DD93a88', 'iS8TfRPfVpKo5FVfSUzfHBQxo9KuzpnqLU',
'DAI', 'iGBs4DWztRNvNEJBt4mqHszLxfKTNHTkhM',
'MKR', 'iCkKJuJScy4Z6NSDK7Mt42ZAB2NEnAE1o4',
'ETH', 'i9nwxtKuVYX4MSbeULLiK2ttVi6rUEhh4X',
'i3f7tSctFkiPpiedY8QR5Tep9p4qDVebDx', '0xE6052Dcc60573561ECef2D9A4C0FEA6d3aC5B9A2',
'USDC', 'i61cV2uicKSi1rSMQCBNQeSYC3UAi9GVzd',
'0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c', 'iC5TQFrFXSYLQGkiZ8FYmZHFJzaRF5CYgE',
];

return displayedCoinList
.map(x => {
return {
Expand All @@ -63,7 +76,7 @@ const AddCoin = props => {
};
})
.filter(item => {
const {coinObj} = item;
const { coinObj } = item;
const queryLc = query.toLowerCase();
const coinIdLc = coinObj.id.toLowerCase();
const coinNameLc = coinObj.display_name.toLowerCase();
Expand All @@ -77,40 +90,30 @@ const AddCoin = props => {
);
})
.sort((a, b) => {
const {coinObj: currencyA} = a;
const {coinObj: currencyB} = b;

if (
currencyB.id === 'VRSC' ||
currencyB.id === 'BTC' ||
currencyB.id === 'VRSCTEST' ||
currencyB.id === "iGBs4DWztRNvNEJBt4mqHszLxfKTNHTkhM" ||
currencyB.id === "iCkKJuJScy4Z6NSDK7Mt42ZAB2NEnAE1o4" ||
currencyB.id === "i9nwxtKuVYX4MSbeULLiK2ttVi6rUEhh4X" ||
currencyB.id === "i3f7tSctFkiPpiedY8QR5Tep9p4qDVebDx" ||
currencyB.id === '0xBc2738BA63882891094C99E59a02141Ca1A1C36a' ||
currencyB.id === '0xE6052Dcc60573561ECef2D9A4C0FEA6d3aC5B9A2' ||
currencyB.id === 'MKR' ||
currencyB.id === 'DAI'
) {
return 1;
} else if (
currencyA.id === 'VRSC' ||
currencyA.id === 'BTC' ||
currencyA.id === 'VRSCTEST' ||
currencyA.id === "iGBs4DWztRNvNEJBt4mqHszLxfKTNHTkhM" ||
currencyA.id === "iCkKJuJScy4Z6NSDK7Mt42ZAB2NEnAE1o4" ||
currencyA.id === "i9nwxtKuVYX4MSbeULLiK2ttVi6rUEhh4X" ||
currencyA.id === "i3f7tSctFkiPpiedY8QR5Tep9p4qDVebDx" ||
currencyA.id === '0xBc2738BA63882891094C99E59a02141Ca1A1C36a' ||
currencyA.id === '0xE6052Dcc60573561ECef2D9A4C0FEA6d3aC5B9A2' ||
currencyA.id === 'MKR' ||
currencyA.id === 'DAI'
) {
const { coinObj: currencyA } = a;
const { coinObj: currencyB } = b;

// Determine the rank based on the position in the priorityOrder array
const rankA = priorityOrder.indexOf(currencyA.id);
const rankB = priorityOrder.indexOf(currencyB.id);

// If both currencies are in the priority list, sort by their order in the list
if (rankA !== -1 && rankB !== -1) {
return rankA - rankB;
}

// If only currencyA is in the priority list, it should come first
if (rankA !== -1) {
return -1;
} else {
return currencyA.display_ticker <= currencyB.display_ticker ? -1 : 1;
}

// If only currencyB is in the priority list, it should come first
if (rankB !== -1) {
return 1;
}

// If neither currency is in the priority list, sort by display_ticker
return currencyA.display_ticker.localeCompare(currencyB.display_ticker);
});
};

Expand Down
9 changes: 9 additions & 0 deletions src/containers/Coin/ReceiveCoin/ReceiveCoin.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { primitives } from "verusid-ts-client"
import { I_ADDRESS_VERSION, R_ADDRESS_VERSION } from "../../../utils/constants/constants"
import { coinsList } from "../../../utils/CoinData/CoinsList"
import { fromBase58Check } from "verus-typescript-primitives"
import selectNetworkName from "../../../selectors/networkName"

class ReceiveCoin extends Component {
constructor(props) {
Expand Down Expand Up @@ -317,6 +318,13 @@ class ReceiveCoin extends Component {
}
}

networksInfoAlert = () => {
createAlert(
"Supported Blockchain Networks",
"VerusPay invoices can support payment on more than one blockchain network. The QR invoice generated with this form will support payments on any networks listed here."
)
}

validateFormData = (addressIndex) => {
this.setState({
errors: {selectedCoin: null, amount: null, addresses: null, memo: null },
Expand Down Expand Up @@ -408,6 +416,7 @@ const mapStateToProps = (state) => {
displayCurrency: state.settings.generalWalletSettings.displayCurrency || USD,
addresses: selectAddresses(state),
subWallet: state.coinMenus.activeSubWallets[chainTicker],
networkName: selectNetworkName(state),
generalWalletSettings: state.settings.generalWalletSettings
}
};
Expand Down
28 changes: 28 additions & 0 deletions src/containers/Coin/ReceiveCoin/ReceiveCoin.render.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import TextInputModal from "../../../components/TextInputModal/TextInputModal"
import NumberPadModal from "../../../components/NumberPadModal/NumberPadModal"
import ListSelectionModal from "../../../components/ListSelectionModal/ListSelectionModal";
import AnimatedActivityIndicatorBox from "../../../components/AnimatedActivityIndicatorBox";
import { coinsList } from "../../../utils/CoinData/CoinsList";

export const RenderReceiveCoin = function() {
const _price = this.getPrice();
Expand Down Expand Up @@ -110,6 +111,33 @@ export const RenderReceiveCoin = function() {
/>
)}
</Portal>
{this.props.networkName != null &&
(<View style={Styles.wideBlock}>
<View style={Styles.flexRow}>
<TouchableOpacity
onPress={() => this.networksInfoAlert()}
style={{ ...Styles.flex }}>
<TextInput
returnKeyType="done"
label={"Supported networks"}
dense
value={
this.props.subWallet.network !== coinsList.VRSC.currency_id &&
this.props.subWallet.network !== coinsList.VRSCTEST.currency_id ?
`${this.props.networkName}, VRSC`
:
this.props.networkName
}
editable={false}
pointerEvents="none"
style={{
backgroundColor: Colors.secondaryColor,
}}
/>
</TouchableOpacity>
</View>
</View>)
}
{addresses.map((address) => {
const addressInfo =
this.props.subWallet.address_info[this.state.infoIndexes[address]];
Expand Down
52 changes: 49 additions & 3 deletions src/containers/Onboard/CreateProfile/Forms/CreatePassword.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useState} from 'react';
import React, {useEffect, useState} from 'react';
import {
View,
Dimensions,
Expand All @@ -11,23 +11,68 @@ import {createAlert} from '../../../../actions/actions/alert/dispatchers/alert';
import TallButton from '../../../../components/LargerButton';
import Colors from '../../../../globals/colors';
import { getSupportedBiometryType } from '../../../../utils/keychain/keychain';
import scorePassword from '../../../../utils/auth/scorePassword';
import { MIN_PASS_LENGTH, MIN_PASS_SCORE, PASS_SCORE_LIMIT } from '../../../../utils/constants/constants';

export default function CreatePassword({password, setPassword, navigation}) {
const {height} = Dimensions.get('window');

const [firstBox, setFirstBox] = useState('');
const [secondBox, setSecondBox] = useState('');
const [passwordStrength, setPasswordStrength] = useState(null);
const [passwordAffixDetails, setPasswordAffixDetails] = useState({
text: "strength",
color: Colors.tertiaryColor
});

const isKeyboardActive = useSelector(state => state.keyboard.active);

useEffect(() => {
calculatePasswordAffix()
}, [firstBox])

const calculatePasswordAffix = () => {
if (!firstBox) {
setPasswordAffixDetails({
text: "strength",
color: Colors.tertiaryColor
})
} else {
const passScore = scorePassword(firstBox, MIN_PASS_LENGTH, PASS_SCORE_LIMIT);
setPasswordStrength(passScore);

if (passScore < MIN_PASS_SCORE) {
setPasswordAffixDetails({
text: "weak",
color: Colors.warningButtonColor
})
} else if (passScore < PASS_SCORE_LIMIT - ((PASS_SCORE_LIMIT - MIN_PASS_SCORE) / 2)) {
setPasswordAffixDetails({
text: "mediocre",
color: Colors.infoButtonColor
})
} else if (passScore < PASS_SCORE_LIMIT) {
setPasswordAffixDetails({
text: "good",
color: Colors.primaryColor
})
} else {
setPasswordAffixDetails({
text: "excellent",
color: Colors.verusGreenColor
})
}
}
}

const validate = () => {
const res = {valid: false, message: ''};

if (!firstBox || firstBox.length < 1) {
res.message = 'Please enter a password.';
return res;
} else if (firstBox.length < 5) {
res.message = 'Please enter a password longer than 5 characters.';
} else if (passwordStrength < MIN_PASS_SCORE) {
res.message = 'Please enter a stronger password.';
return res;
} else if (firstBox !== secondBox) {
res.message = 'Password and confirm password do not match.';
Expand Down Expand Up @@ -107,6 +152,7 @@ export default function CreatePassword({password, setPassword, navigation}) {
autoCapitalize={'none'}
autoCorrect={false}
secureTextEntry={true}
right={<TextInput.Affix text={passwordAffixDetails.text} textStyle={{color: passwordAffixDetails.color}}/>}
/>
<TextInput
returnKeyType="done"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c67aa58

Please sign in to comment.