Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleChangeText = text => {
// save the value to the state email
const { onEmailChanged } = this.props;
this.setState({ email: text });
AsyncStorage.setItem(Constants.KEY_FIRST_RUN_EMAIL, text);
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'true');
if (onEmailChanged) {
onEmailChanged(text);
}
};
if (validate) {
await Engine.context.KeyringController.exportSeedPhrase(password);
}
await AsyncStorage.setItem('@MetaMask:existingUser', 'true');
if (enabled) {
const authOptions = {
accessControl:
type === 'biometrics'
? SecureKeychain.ACCESS_CONTROL.BIOMETRY_CURRENT_SET_OR_DEVICE_PASSCODE
: SecureKeychain.ACCESS_CONTROL.DEVICE_PASSCODE
};
await SecureKeychain.setGenericPassword('metamask-user', password, authOptions);
if (type === 'biometrics') {
await AsyncStorage.setItem('@MetaMask:biometryChoice', this.state.biometryType);
await AsyncStorage.removeItem('@MetaMask:passcodeChoice');
// If the user enables biometrics, we're trying to read the password
// immediately so we get the permission prompt
if (Platform.OS === 'ios') {
await SecureKeychain.getGenericPassword();
}
} else {
await AsyncStorage.setItem('@MetaMask:passcodeChoice', 'true');
await AsyncStorage.removeItem('@MetaMask:biometryChoice');
}
} else {
await AsyncStorage.removeItem('@MetaMask:biometryChoice');
await AsyncStorage.removeItem('@MetaMask:passcodeChoice');
}
this.props.passwordSet();
const persistNavigationState = async (navState: any) => {
try {
await AsyncStorage.setItem(persistenceKey, JSON.stringify(navState))
} catch (e) {
console.log('Unable to persist state')
}
}
setDatabaseItem(data) {
return AsyncStorage
.setItem(`${this.storageKey}:${data.math}`, JSON.stringify(data))
.catch(err => {
if (err.code === 13) this.clearDatabase();
console.error(err);
});
}
skipWelcomeScreen() {
this.setState({skipLogin: true});
AsyncStorage.setItem('@Discourse.skipLogin', 'loginSkipped');
}
React.useEffect(() => {
const { photos, value, observationId } = state;
AsyncStorage.setItem(
STORE_KEY,
JSON.stringify({ photos, value, observationId })
).catch(e => {
log("Error writing to storage", e);
});
});
async setItem(item: TItem, value: StorageItems[TItem]) {
return AsyncStorage.setItem(item, value);
}
if(note) {
setNote(note)
} else {
isRefreshingToggle(true)
}
try {
const { data } = await detail({ noteId })
if(data.success) {
const note = data.data
setNote(note)
await AsyncStorage.setItem(CACHE_KEY, JSON.stringify(note))
}
} catch(error) {
dispatch(messageShow({ success: false, message: translate.t('common.error.default') }))
} finally {
isRefreshingToggle(false)
}
} else {
navigation.navigate(routesNote.list.name)
}
}
save() {
AsyncStorage.setItem("@Discourse.sites", JSON.stringify(this.sites)).done();
this.updateUnreadBadge();
}
const setThemeId = id =>{
AsyncStorage.setItem('theme_id', id);
}