preference updates. send firebase token.

This commit is contained in:
Akinwale Ariwodola 2019-10-15 10:24:03 +01:00
parent dcbb7f62d6
commit 194e29356f
17 changed files with 117 additions and 100 deletions

8
package-lock.json generated
View file

@ -5640,8 +5640,8 @@
} }
}, },
"lbry-redux": { "lbry-redux": {
"version": "github:lbryio/lbry-redux#dff1ecb195a03c5443526329116058b94d7391f7", "version": "github:lbryio/lbry-redux#91848445aa9e1efb76488947a32a7fc52543d52d",
"from": "github:lbryio/lbry-redux#dff1ecb195a03c5443526329116058b94d7391f7", "from": "github:lbryio/lbry-redux#91848445aa9e1efb76488947a32a7fc52543d52d",
"requires": { "requires": {
"proxy-polyfill": "0.1.6", "proxy-polyfill": "0.1.6",
"reselect": "^3.0.0", "reselect": "^3.0.0",
@ -5649,8 +5649,8 @@
} }
}, },
"lbryinc": { "lbryinc": {
"version": "github:lbryio/lbryinc#02d8571cd7fafd00d1a60f133d884eb8c5f1a306", "version": "github:lbryio/lbryinc#367d987e1f8344761e9fe9602499c583208d3b6b",
"from": "github:lbryio/lbryinc#02d8571cd7fafd00d1a60f133d884eb8c5f1a306", "from": "github:lbryio/lbryinc#367d987e1f8344761e9fe9602499c583208d3b6b",
"requires": { "requires": {
"reselect": "^3.0.0" "reselect": "^3.0.0"
} }

View file

@ -13,7 +13,7 @@
"@expo/vector-icons": "^8.1.0", "@expo/vector-icons": "^8.1.0",
"gfycat-style-urls": "^1.0.3", "gfycat-style-urls": "^1.0.3",
"lbry-redux": "lbryio/lbry-redux#91848445aa9e1efb76488947a32a7fc52543d52d", "lbry-redux": "lbryio/lbry-redux#91848445aa9e1efb76488947a32a7fc52543d52d",
"lbryinc": "lbryio/lbryinc#02d8571cd7fafd00d1a60f133d884eb8c5f1a306", "lbryinc": "lbryio/lbryinc#367d987e1f8344761e9fe9602499c583208d3b6b",
"lodash": ">=4.17.11", "lodash": ">=4.17.11",
"merge": ">=1.2.1", "merge": ">=1.2.1",
"moment": "^2.22.1", "moment": "^2.22.1",

View file

@ -303,7 +303,7 @@ class AppWithNavigationState extends React.Component {
// call /sync/get with interval // call /sync/get with interval
setInterval(() => { setInterval(() => {
this.setState({ syncHashChanged: false }); // reset local state this.setState({ syncHashChanged: false }); // reset local state
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => { NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
dispatch(doGetSync(walletPassword)); dispatch(doGetSync(walletPassword));
}); });
}, SYNC_GET_INTERVAL); }, SYNC_GET_INTERVAL);
@ -321,9 +321,15 @@ class AppWithNavigationState extends React.Component {
getUserSettings = () => { getUserSettings = () => {
const { dispatch } = this.props; const { dispatch } = this.props;
doPreferenceGet('shared', null, null, preference => { doPreferenceGet(
'shared',
preference => {
dispatch(doPopulateSharedUserState(preference)); dispatch(doPopulateSharedUserState(preference));
}); },
error => {
/* failed */
}
);
}; };
componentWillUnmount() { componentWillUnmount() {

View file

@ -155,7 +155,7 @@ export default class ChannelSelector extends React.PureComponent {
} }
// sync wallet // sync wallet
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => getSync(password)); NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => getSync(password));
}; };
const failure = () => { const failure = () => {

View file

@ -34,7 +34,7 @@ class FloatingWalletBalance extends React.PureComponent<Props> {
<Icon name="coins" size={12} style={floatingButtonStyle.balanceIcon} /> <Icon name="coins" size={12} style={floatingButtonStyle.balanceIcon} />
{isNaN(balance) && <ActivityIndicator size="small" color={Colors.White} />} {isNaN(balance) && <ActivityIndicator size="small" color={Colors.White} />}
{(!isNaN(balance) || balance === 0) && ( {(!isNaN(balance) || balance === 0) && (
<Text style={floatingButtonStyle.text}>{formatCredits(parseFloat(balance), 0, true)}</Text> <Text style={floatingButtonStyle.text}>{formatCredits(parseFloat(balance), 1, true)}</Text>
)} )}
</TouchableOpacity> </TouchableOpacity>
</View> </View>

View file

@ -32,7 +32,7 @@ const Constants = {
ABOUT_TAB: 'about', ABOUT_TAB: 'about',
KEY_FIRST_RUN_EMAIL: 'firstRunEmail', KEY_FIRST_RUN_EMAIL: 'firstRunEmail',
KEY_FIRST_RUN_PASSWORD: 'firstRunPassword', KEY_WALLET_PASSWORD: 'firstRunPassword',
KEY_FIRST_USER_AUTH: 'firstUserAuth', KEY_FIRST_USER_AUTH: 'firstUserAuth',
KEY_SHOULD_VERIFY_EMAIL: 'shouldVerifyEmail', KEY_SHOULD_VERIFY_EMAIL: 'shouldVerifyEmail',
KEY_EMAIL_VERIFY_PENDING: 'emailVerifyPending', KEY_EMAIL_VERIFY_PENDING: 'emailVerifyPending',

View file

@ -4,6 +4,7 @@ import { Provider, connect } from 'react-redux';
import { AppRegistry, Text, View, NativeModules } from 'react-native'; import { AppRegistry, Text, View, NativeModules } from 'react-native';
import { import {
Lbry, Lbry,
buildSharedStateMiddleware,
claimsReducer, claimsReducer,
contentReducer, contentReducer,
fileReducer, fileReducer,
@ -13,20 +14,24 @@ import {
searchReducer, searchReducer,
tagsReducer, tagsReducer,
walletReducer, walletReducer,
sharedStateSubscriber, ACTIONS as LBRY_REDUX_ACTIONS,
} from 'lbry-redux'; } from 'lbry-redux';
import { import {
Lbryio, Lbryio,
authReducer, authReducer,
blacklistReducer, blacklistReducer,
costInfoReducer, costInfoReducer,
doGetSync,
filteredReducer, filteredReducer,
homepageReducer, homepageReducer,
rewardsReducer, rewardsReducer,
selectUserVerifiedEmail,
subscriptionsReducer, subscriptionsReducer,
syncReducer, syncReducer,
userReducer, userReducer,
LBRYINC_ACTIONS,
} from 'lbryinc'; } from 'lbryinc';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { createStore, applyMiddleware, compose } from 'redux'; import { createStore, applyMiddleware, compose } from 'redux';
import AppWithNavigationState, { import AppWithNavigationState, {
AppNavigator, AppNavigator,
@ -34,6 +39,7 @@ import AppWithNavigationState, {
reactNavigationMiddleware, reactNavigationMiddleware,
} from 'component/AppNavigator'; } from 'component/AppNavigator';
import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist'; import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4'; import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
import FilesystemStorage from 'redux-persist-filesystem-storage'; import FilesystemStorage from 'redux-persist-filesystem-storage';
import createCompressor from 'redux-persist-transform-compress'; import createCompressor from 'redux-persist-transform-compress';
@ -43,7 +49,6 @@ import formReducer from 'redux/reducers/form';
import drawerReducer from 'redux/reducers/drawer'; import drawerReducer from 'redux/reducers/drawer';
import settingsReducer from 'redux/reducers/settings'; import settingsReducer from 'redux/reducers/settings';
import thunk from 'redux-thunk'; import thunk from 'redux-thunk';
import isEqual from 'utils/deep-equal';
const globalExceptionHandler = (error, isFatal) => { const globalExceptionHandler = (error, isFatal) => {
if (error && NativeModules.Firebase) { if (error && NativeModules.Firebase) {
@ -128,8 +133,43 @@ const reducers = persistCombineReducers(persistOptions, {
wallet: walletReducer, wallet: walletReducer,
}); });
/**
* source: the reducer name
* property: the property in the reducer-specific state
* transform: optional method to modify the value to be stored
*/
const sharedStateActions = [
LBRYINC_ACTIONS.CHANNEL_SUBSCRIBE,
LBRYINC_ACTIONS.CHANNEL_UNSUBSCRIBE,
LBRY_REDUX_ACTIONS.TOGGLE_TAG_FOLLOW,
LBRY_REDUX_ACTIONS.TOGGLE_BLOCK_CHANNEL,
];
const sharedStateFilters = {
tags: { source: 'tags', property: 'followedTags' },
subscriptions: {
source: 'subscriptions',
property: 'subscriptions',
transform: function(value) {
return value.map(({ uri }) => uri);
},
},
};
const sharedStateCallback = ({ dispatch, getState }) => {
const state = getState();
const syncEnabled = makeSelectClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED)(state);
const emailVerified = selectUserVerifiedEmail(state);
if (syncEnabled && emailVerified) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password =>
dispatch(doGetSync(password))
);
}
};
const sharedStateMiddleware = buildSharedStateMiddleware(sharedStateActions, sharedStateFilters, sharedStateCallback);
const bulkThunk = createBulkThunkMiddleware(); const bulkThunk = createBulkThunkMiddleware();
const middleware = [thunk, bulkThunk, reactNavigationMiddleware]; const middleware = [sharedStateMiddleware, thunk, bulkThunk, reactNavigationMiddleware];
// eslint-disable-next-line no-underscore-dangle // eslint-disable-next-line no-underscore-dangle
const composeEnhancers = compose; const composeEnhancers = compose;
@ -148,31 +188,6 @@ const persistor = persistStore(store, persistOptions, err => {
}); });
window.persistor = persistor; window.persistor = persistor;
/**
* source: the reducer name
* property: the property in the reducer-specific state
* transform: optional method to modify the value to be stored
*/
const sharedStateFilters = {
tags: { source: 'tags', property: 'followedTags' },
subscriptions: {
source: 'subscriptions',
property: 'subscriptions',
transform: function(value) {
return value.map(({ uri }) => uri);
},
},
};
store.subscribe(() => {
try {
const state = store.getState();
sharedStateSubscriber(state, sharedStateFilters, '0.1');
} catch (e) {
// handle gracefully?
}
});
// TODO: Find i18n module that is compatible with react-native // TODO: Find i18n module that is compatible with react-native
global.__ = str => str; global.__ = str => str;

View file

@ -449,7 +449,7 @@ export default class ChannelCreator extends React.PureComponent {
this.showChannelList(); this.showChannelList();
// sync wallet // sync wallet
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => getSync(password)); NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => getSync(password));
}; };
const failure = () => { const failure = () => {

View file

@ -4,7 +4,6 @@ import {
doAuthenticate, doAuthenticate,
doCheckSync, doCheckSync,
doGetSync, doGetSync,
doSetDefaultAccount,
doSyncApply, doSyncApply,
doUserEmailNew, doUserEmailNew,
doUserResendVerificationEmail, doUserResendVerificationEmail,
@ -41,12 +40,11 @@ const select = state => ({
const perform = dispatch => ({ const perform = dispatch => ({
addUserEmail: email => dispatch(doUserEmailNew(email)), addUserEmail: email => dispatch(doUserEmailNew(email)),
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)), authenticate: (appVersion, os, firebaseToken) => dispatch(doAuthenticate(appVersion, os, firebaseToken)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)), setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)), syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
getSync: password => dispatch(doGetSync(password)), getSync: password => dispatch(doGetSync(password)),
checkSync: () => dispatch(doCheckSync()), checkSync: () => dispatch(doCheckSync()),
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
notify: data => dispatch(doToast(data)), notify: data => dispatch(doToast(data)),
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)), resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
}); });

View file

@ -3,7 +3,7 @@ import { Lbry } from 'lbry-redux';
import { ActivityIndicator, NativeModules, Platform, Text, View } from 'react-native'; import { ActivityIndicator, NativeModules, Platform, Text, View } from 'react-native';
import AsyncStorage from '@react-native-community/async-storage'; import AsyncStorage from '@react-native-community/async-storage';
import Colors from 'styles/colors'; import Colors from 'styles/colors';
import Constants from 'constants'; import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import firstRunStyle from 'styles/firstRun'; import firstRunStyle from 'styles/firstRun';
class WelcomePage extends React.PureComponent { class WelcomePage extends React.PureComponent {
@ -25,7 +25,7 @@ class WelcomePage extends React.PureComponent {
} else { } else {
// first_user_auth because it's the first time // first_user_auth because it's the first time
AsyncStorage.getItem(Constants.KEY_FIRST_USER_AUTH).then(firstUserAuth => { AsyncStorage.getItem(Constants.KEY_FIRST_USER_AUTH).then(firstUserAuth => {
if ('true' !== firstUserAuth) { if (firstUserAuth !== 'true') {
// first_user_auth // first_user_auth
NativeModules.Firebase.track('first_user_auth', null); NativeModules.Firebase.track('first_user_auth', null);
AsyncStorage.setItem(Constants.KEY_FIRST_USER_AUTH, 'true'); AsyncStorage.setItem(Constants.KEY_FIRST_USER_AUTH, 'true');
@ -47,11 +47,12 @@ class WelcomePage extends React.PureComponent {
const { authenticate } = this.props; const { authenticate } = this.props;
this.setState({ authenticationStarted: true, authenticationFailed: false }); this.setState({ authenticationStarted: true, authenticationFailed: false });
NativeModules.VersionInfo.getAppVersion().then(appVersion => { NativeModules.VersionInfo.getAppVersion().then(appVersion => {
NativeModules.Firebase.getMessagingToken().then(firebaseToken => {
Lbry.status() Lbry.status()
.then(info => { .then(info => {
this.setState({ sdkStarted: true }); this.setState({ sdkStarted: true });
authenticate(appVersion, Platform.OS); authenticate(appVersion, Platform.OS, firebaseToken);
}) })
.catch(error => { .catch(error => {
if (this.state.statusTries >= WelcomePage.MAX_STATUS_TRIES) { if (this.state.statusTries >= WelcomePage.MAX_STATUS_TRIES) {
@ -67,6 +68,7 @@ class WelcomePage extends React.PureComponent {
} }
}); });
}); });
});
}; };
render() { render() {

View file

@ -66,7 +66,7 @@ class FirstRunScreen extends React.PureComponent {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const { emailNewErrorMessage, emailNewPending, syncApplyErrorMessage, syncApplyIsPending, user } = nextProps; const { emailNewErrorMessage, emailNewPending, syncApplyErrorMessage, syncApplyIsPending, user } = nextProps;
const { notify, isApplyingSync, setClientSetting, setDefaultAccount } = this.props; const { notify, isApplyingSync, setClientSetting } = this.props;
if (this.state.emailSubmitted && !emailNewPending) { if (this.state.emailSubmitted && !emailNewPending) {
this.setState({ emailSubmitted: false }); this.setState({ emailSubmitted: false });
@ -86,27 +86,24 @@ class FirstRunScreen extends React.PureComponent {
} else { } else {
// password successfully verified // password successfully verified
NativeModules.UtilityModule.setSecureValue( NativeModules.UtilityModule.setSecureValue(
Constants.KEY_FIRST_RUN_PASSWORD, Constants.KEY_WALLET_PASSWORD,
this.state.walletPassword ? this.state.walletPassword : '' this.state.walletPassword ? this.state.walletPassword : ''
); );
setDefaultAccount(
() => {
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
Lbry.status().then(status => {
// unlock the wallet // unlock the wallet
if (status.wallet.is_locked) {
Lbry.account_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' }) Lbry.account_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' })
.then(() => this.closeFinalPage()) .then(() => this.closeFinalPage())
.catch(err => .catch(err =>
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' }) notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
); );
}, } else {
err => { // wallet not locked. close final page
notify({ this.closeFinalPage();
message:
'The account restore operation could not be completed successfully. Please restart the app and try again.',
});
} }
); });
} }
} }
@ -298,7 +295,7 @@ class FirstRunScreen extends React.PureComponent {
const { getSync, setClientSetting } = this.props; const { getSync, setClientSetting } = this.props;
if (NativeModules.UtilityModule) { if (NativeModules.UtilityModule) {
const newPassword = this.state.walletPassword ? this.state.walletPassword : ''; const newPassword = this.state.walletPassword ? this.state.walletPassword : '';
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, newPassword); NativeModules.UtilityModule.setSecureValue(Constants.KEY_WALLET_PASSWORD, newPassword);
Lbry.account_encrypt({ new_password: newPassword }).then(() => { Lbry.account_encrypt({ new_password: newPassword }).then(() => {
// fresh account, new password set // fresh account, new password set
getSync(newPassword); getSync(newPassword);

View file

@ -23,7 +23,7 @@ const select = state => ({
}); });
const perform = dispatch => ({ const perform = dispatch => ({
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)), authenticate: (appVersion, os, firebaseToken) => dispatch(doAuthenticate(appVersion, os, firebaseToken)),
balanceSubscribe: () => dispatch(doBalanceSubscribe()), balanceSubscribe: () => dispatch(doBalanceSubscribe()),
blacklistedOutpointsSubscribe: () => dispatch(doBlackListedOutpointsSubscribe()), blacklistedOutpointsSubscribe: () => dispatch(doBlackListedOutpointsSubscribe()),
filteredOutpointsSubscribe: () => dispatch(doFilteredOutpointsSubscribe()), filteredOutpointsSubscribe: () => dispatch(doFilteredOutpointsSubscribe()),

View file

@ -90,7 +90,7 @@ class SplashScreen extends React.PureComponent {
this.setState({ shouldAuthenticate: false }, () => { this.setState({ shouldAuthenticate: false }, () => {
// user is authenticated, navigate to the main view // user is authenticated, navigate to the main view
if (user.has_verified_email) { if (user.has_verified_email) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => { NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
getSync(walletPassword); getSync(walletPassword);
this.navigateToMain(); this.navigateToMain();
}); });
@ -105,9 +105,15 @@ class SplashScreen extends React.PureComponent {
getUserSettings = () => { getUserSettings = () => {
const { populateSharedUserState } = this.props; const { populateSharedUserState } = this.props;
doPreferenceGet('shared', null, null, preference => { doPreferenceGet(
'shared',
preference => {
populateSharedUserState(preference); populateSharedUserState(preference);
}); },
error => {
/* failed */
}
);
}; };
finishSplashScreen = () => { finishSplashScreen = () => {
@ -134,14 +140,16 @@ class SplashScreen extends React.PureComponent {
if (user && user.id && user.has_verified_email) { if (user && user.id && user.has_verified_email) {
// user already authenticated // user already authenticated
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => { NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
getSync(walletPassword); getSync(walletPassword);
this.navigateToMain(); this.navigateToMain();
}); });
} else { } else {
NativeModules.VersionInfo.getAppVersion().then(appVersion => { NativeModules.VersionInfo.getAppVersion().then(appVersion => {
NativeModules.Firebase.getMessagingToken().then(firebaseToken => {
this.setState({ shouldAuthenticate: true }); this.setState({ shouldAuthenticate: true });
authenticate(appVersion, Platform.OS); authenticate(appVersion, Platform.OS, firebaseToken);
});
}); });
} }
}); });
@ -171,7 +179,7 @@ class SplashScreen extends React.PureComponent {
}); });
// For now, automatically unlock the wallet if a password is set so that downloads work // For now, automatically unlock the wallet if a password is set so that downloads work
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => { NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => {
if (walletStatus.is_locked) { if (walletStatus.is_locked) {
this.setState({ this.setState({
message: 'Unlocking account', message: 'Unlocking account',

View file

@ -3,7 +3,6 @@ import { doToast } from 'lbry-redux';
import { import {
doCheckSync, doCheckSync,
doGetSync, doGetSync,
doSetDefaultAccount,
doSyncApply, doSyncApply,
doUserEmailNew, doUserEmailNew,
doUserEmailToVerify, doUserEmailToVerify,
@ -60,7 +59,6 @@ const perform = dispatch => ({
verifyPhone: verificationCode => dispatch(doUserPhoneVerify(verificationCode)), verifyPhone: verificationCode => dispatch(doUserPhoneVerify(verificationCode)),
notify: data => dispatch(doToast(data)), notify: data => dispatch(doToast(data)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)), setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)), setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)), syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)), resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),

View file

@ -50,7 +50,7 @@ class SyncVerifyPage extends React.PureComponent {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const { getSyncIsPending, syncApplyIsPending, syncApplyErrorMessage } = nextProps; const { getSyncIsPending, syncApplyIsPending, syncApplyErrorMessage } = nextProps;
const { getSync, hasSyncedWallet, navigation, notify, setClientSetting, setDefaultAccount } = this.props; const { getSync, hasSyncedWallet, navigation, notify, setClientSetting } = this.props;
if (this.state.checkSyncStarted && !getSyncIsPending) { if (this.state.checkSyncStarted && !getSyncIsPending) {
this.setState({ syncChecked: true }); this.setState({ syncChecked: true });
} }
@ -63,17 +63,12 @@ class SyncVerifyPage extends React.PureComponent {
// password successfully verified // password successfully verified
if (NativeModules.UtilityModule) { if (NativeModules.UtilityModule) {
NativeModules.UtilityModule.setSecureValue( NativeModules.UtilityModule.setSecureValue(
Constants.KEY_FIRST_RUN_PASSWORD, Constants.KEY_WALLET_PASSWORD,
this.state.password ? this.state.password : '' this.state.password ? this.state.password : ''
); );
} }
setDefaultAccount(
() => this.finishSync(true), this.finishSync(true);
err => {
// fail silently and still finish
this.finishSync();
}
);
} }
} }
} }

View file

@ -101,7 +101,6 @@ class VerificationScreen extends React.PureComponent {
notify, notify,
addUserPhone, addUserPhone,
getSyncIsPending, getSyncIsPending,
setDefaultAccount,
hasSyncedWallet, hasSyncedWallet,
setSyncIsPending, setSyncIsPending,
syncApplyIsPending, syncApplyIsPending,
@ -162,7 +161,6 @@ class VerificationScreen extends React.PureComponent {
notify={notify} notify={notify}
setEmailVerificationPhase={this.setEmailVerificationPhase} setEmailVerificationPhase={this.setEmailVerificationPhase}
setClientSetting={setClientSetting} setClientSetting={setClientSetting}
setDefaultAccount={setDefaultAccount}
setSyncIsPending={setSyncIsPending} setSyncIsPending={setSyncIsPending}
syncApplyIsPending={syncApplyIsPending} syncApplyIsPending={syncApplyIsPending}
syncApplyErrorMessage={syncApplyErrorMessage} syncApplyErrorMessage={syncApplyErrorMessage}

View file

@ -46,7 +46,7 @@ class WalletPage extends React.PureComponent {
const { deviceWalletSynced, getSync, user } = this.props; const { deviceWalletSynced, getSync, user } = this.props;
if (deviceWalletSynced && user && user.has_verified_email) { if (deviceWalletSynced && user && user.has_verified_email) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => { NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
getSync(walletPassword); getSync(walletPassword);
}); });
} }