Skip to content

Commit

Permalink
Hide Wyre features and currencies by default
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeltout committed Feb 28, 2023
1 parent b98e9c8 commit 8cd74ae
Show file tree
Hide file tree
Showing 21 changed files with 384 additions and 375 deletions.
5 changes: 5 additions & 0 deletions env/main.android.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
"ENABLE_VRPC": true,
"ENABLE_VERUSID": true,

"SERVICES_DISABLED_DEFAULT": {
"wyre_service": true,
"verusid_service": false
},

"ETH_NETWORK": "homestead",

"BIOMETRIC_SECURITY_THRESHOLD": "SECURE_HARDWARE",
Expand Down
5 changes: 5 additions & 0 deletions env/main.ios.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
"ENABLE_VRPC": true,
"ENABLE_VERUSID": true,

"SERVICES_DISABLED_DEFAULT": {
"wyre_service": true,
"verusid_service": false
},

"ETH_NETWORK": "homestead",

"BIOMETRIC_SECURITY_THRESHOLD": "SECURE_HARDWARE",
Expand Down
17 changes: 16 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
/** @format */
import 'react-native-gesture-handler';
import { AppRegistry } from 'react-native';
import { AppRegistry, LogBox } from 'react-native';

const IGNORED_LOGS = [
'Warning: componentWillMount is deprecated',
'Warning: componentWillReceiveProps is deprecated',
'Warning: componentWillUpdate is deprecated',
'RCTRootView cancelTouches',
'Require cycle',
'long period',
'Material Top Tab Navigator:',
'ViewPropTypes will be removed from React Native.',
'Non-serializable values were found in the navigation state.'
];

LogBox.ignoreLogs(IGNORED_LOGS);

import App from './App';
import {name as appName} from './app.json';
import './shims/crypto.js';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@
"metro-react-native-babel-preset": "0.67.0",
"node-fetch": "2.6.7",
"react-test-renderer": "17.0.1",
"remote-redux-devtools": "0.5.16",
"rn-nodeify": "github:tradle/rn-nodeify",
"snyk": "1.996.0"
},
"resolutions": {
"@bitgo/utxo-lib": "git+https://github.com/VerusCoin/BitGoJS.git#f8723bcc2bf4052de171ca8654de23fc06a03337",
"typeforce": "git+https://github.com/michaeltout/typeforce.git",
"bs58check": "2.1.2",
"braces": "3.0.2",
Expand Down
9 changes: 0 additions & 9 deletions src/VerusMobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ class VerusMobile extends React.Component {
loading: true,
securityCover: false
};

LogBox.ignoreLogs([
"Warning: componentWillMount is deprecated",
"Warning: componentWillReceiveProps is deprecated",
"Warning: componentWillUpdate is deprecated",
'RCTRootView cancelTouches',
"Require cycle",
"long period"
]);
}

// TODO: Implement own lifecycle manager to account for
Expand Down
33 changes: 29 additions & 4 deletions src/actions/actions/UserData.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
setUserBiometry,
setUsers,
setUserKeyDerivationVersion,
setUserDisabledServices,
} from "../../utils/asyncStore/asyncStore";
import {
deriveKeyPair
Expand All @@ -22,28 +23,31 @@ import {
decryptkey, encryptkey,
} from '../../utils/seedCrypt'
import { hashAccountId } from '../../utils/crypto/hash';
import { CHANNELS, ELECTRUM, ERC20, ETH, DLIGHT_PRIVATE, VRPC } from '../../utils/constants/intervalConstants';
import { CHANNELS, ELECTRUM, ERC20, ETH, DLIGHT_PRIVATE, VRPC, WYRE_SERVICE } from '../../utils/constants/intervalConstants';
import {
KEY_DERIVATION_VERSION,
SERVICES_DISABLED_DEFAULT
} from "../../../env/index";
import { BIOMETRIC_AUTH, SET_ACCOUNTS } from '../../utils/constants/storeType';
import { BIOMETRIC_AUTH, SET_ACCOUNTS, UPDATE_ACCOUNT_DISABLED_SERVICES } from '../../utils/constants/storeType';
import { removeExistingCoin } from './coins/Coins';
import { initSession, requestPassword, requestSeeds } from '../../utils/auth/authBox';
import { clearEncryptedPersonalDataForUser } from './personal/dispatchers/personal';
import { clearEncryptedServiceStoredDataForUser } from './services/dispatchers/services';
import { clearActiveAccountLifecycles } from './account/dispatchers/account';
import { WYRE_SERVICE_ID } from '../../utils/constants/services';

export const addUser = (
userName,
seeds,
password,
users,
biometry = false,
keyDerivationVersion = KEY_DERIVATION_VERSION
keyDerivationVersion = KEY_DERIVATION_VERSION,
disabledServices = SERVICES_DISABLED_DEFAULT
) => {
return new Promise((resolve, reject) => {
storeUser(
{ seeds, password, userName, biometry, keyDerivationVersion },
{ seeds, password, userName, biometry, keyDerivationVersion, disabledServices },
users
)
.then((res) => {
Expand Down Expand Up @@ -108,6 +112,19 @@ export const setKeyDerivationVersion = async (userID, keyDerivationVersion) => {
});
}

export const setDisabledServices = async (userID, disabledServices) => {
return new Promise((resolve, reject) => {
setUserDisabledServices(userID, disabledServices)
.then((accounts) => {
resolve({
type: UPDATE_ACCOUNT_DISABLED_SERVICES,
payload: { disabledServices, accounts }
})
})
.catch(err => reject(err));
});
}

export const deleteProfile = async (account, dispatch) => {
// Clear existing account lifecycles
await clearActiveAccountLifecycles()
Expand Down Expand Up @@ -149,6 +166,10 @@ export const fetchUsers = () => {
user.keyDerivationVersion == null
? 0
: user.keyDerivationVersion,
disabledServices:
user.disabledServices == null ?
{}
: user.disabledServices
};
} else return user
})
Expand Down Expand Up @@ -235,6 +256,10 @@ export const authenticateAccount = async (account, password) => {
account.keyDerivationVersion == null
? 0
: account.keyDerivationVersion,
disabledServices:
account.disabledServices == null
? account.encryptedKeys && account.encryptedKeys[WYRE_SERVICE] ? {} : { [WYRE_SERVICE_ID]: true }
: account.disabledServices
},
await initSession(password)
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/SetupSeedModal/ImportSeed/ImportSeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ class ImportSeed extends Component {
<View style={Styles.footerContainer}>
<View style={Styles.standardWidthSpaceBetweenBlock}>
<Button
onPress={this.props.createSeed}
onPress={this.props.onBack}
color={Colors.warningButtonColor}
>
{"Back"}
{this.props.backLabel ? this.props.backLabel : "Back"}
</Button>
<Button
onPress={() => this.verifySeed()}
Expand Down
7 changes: 4 additions & 3 deletions src/components/SetupSeedModal/SetupSeedModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SetupSeedModal extends Component {
constructor(props) {
super(props);
this.state = {
firstTimeSeed: true,
firstTimeSeed: props.importOnly ? false : true,
createSeedState: {
newSeed: null,
newSeedWords: null,
Expand Down Expand Up @@ -56,7 +56,7 @@ class SetupSeedModal extends Component {
}

render() {
const { cancel, setSeed, channel } = this.props
const { cancel, setSeed, channel, importOnly } = this.props
const parentProps = {
cancel,
setSeed,
Expand Down Expand Up @@ -91,7 +91,8 @@ class SetupSeedModal extends Component {
this.setState({ importSeedState })
}
initState={this.state.importSeedState}
createSeed={() => this.setState({ firstTimeSeed: true })}
backLabel={importOnly ? "Cancel" : "Back"}
onBack={importOnly ? cancel : () => this.setState({ firstTimeSeed: true })}
/>
)}
</Modal>
Expand Down
Loading

0 comments on commit 8cd74ae

Please sign in to comment.