Fork restart functionality for different platforms
This commit is contained in:
@@ -1,28 +1,32 @@
|
|||||||
import { Alert } from 'react-native'
|
import { Alert, Platform } from 'react-native'
|
||||||
import { shared } from '../../../i18n/en/labels'
|
import { shared } from '../../../i18n/en/labels'
|
||||||
import labels from '../../../i18n/en/settings'
|
import labels from '../../../i18n/en/settings'
|
||||||
|
|
||||||
export default function showBackUpReminder(okHandler, cancelHandler, isDelete) {
|
export default function showBackUpReminder(okHandler, cancelHandler, isDelete) {
|
||||||
let title, message
|
const { title, message } = isDelete
|
||||||
if (isDelete) {
|
? labels.passwordSettings.deleteBackupReminder
|
||||||
title = labels.passwordSettings.deleteBackupReminderTitle
|
: labels.passwordSettings.backupReminder
|
||||||
message = labels.passwordSettings.deleteBackupReminder
|
|
||||||
} else {
|
const { backupReminderAppendix } = labels.passwordSettings
|
||||||
title = labels.passwordSettings.backupReminderTitle
|
const appendix =
|
||||||
message = labels.passwordSettings.backupReminder
|
Platform.OS === 'ios'
|
||||||
}
|
? backupReminderAppendix.ios
|
||||||
|
: backupReminderAppendix.android
|
||||||
|
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
title,
|
title,
|
||||||
message,
|
message + appendix,
|
||||||
[{
|
[
|
||||||
text: shared.cancel,
|
{
|
||||||
onPress: cancelHandler,
|
text: shared.cancel,
|
||||||
style: 'cancel'
|
onPress: cancelHandler,
|
||||||
}, {
|
style: 'cancel',
|
||||||
text: shared.ok,
|
},
|
||||||
onPress: okHandler
|
{
|
||||||
}],
|
text: shared.ok,
|
||||||
|
onPress: okHandler,
|
||||||
|
},
|
||||||
|
],
|
||||||
{ onDismiss: cancelHandler }
|
{ onDismiss: cancelHandler }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-8
@@ -2,10 +2,8 @@ import Realm from 'realm'
|
|||||||
import { LocalDate, ChronoUnit } from 'js-joda'
|
import { LocalDate, ChronoUnit } from 'js-joda'
|
||||||
import nodejs from 'nodejs-mobile-react-native'
|
import nodejs from 'nodejs-mobile-react-native'
|
||||||
import fs from 'react-native-fs'
|
import fs from 'react-native-fs'
|
||||||
// Current version of react-native-restart doesn't work with our ios setup
|
import { restartApp } from './restart-app'
|
||||||
// therefore react-native-exit-app-v2 is used to close the app after setting pwd
|
|
||||||
// import restart from 'react-native-restart'
|
|
||||||
import RNExitApp from 'react-native-exit-app-v2'
|
|
||||||
import schemas from './schemas'
|
import schemas from './schemas'
|
||||||
import cycleModule from '../lib/cycle'
|
import cycleModule from '../lib/cycle'
|
||||||
import maybeSetNewCycleStart from '../lib/set-new-cycle-start'
|
import maybeSetNewCycleStart from '../lib/set-new-cycle-start'
|
||||||
@@ -216,10 +214,7 @@ export async function changeEncryptionAndRestartApp(hash) {
|
|||||||
db.close()
|
db.close()
|
||||||
await fs.unlink(defaultPath)
|
await fs.unlink(defaultPath)
|
||||||
await fs.moveFile(copyPath, defaultPath)
|
await fs.moveFile(copyPath, defaultPath)
|
||||||
// Current version of react-native-restart doesn't work with our ios setup
|
restartApp()
|
||||||
// therefore react-native-exit-app-v2 is used to close the app after setting pwd
|
|
||||||
// restart.Restart()
|
|
||||||
RNExitApp.exitApp()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isDbEmpty() {
|
export function isDbEmpty() {
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
// Current version of react-native-restart doesn't work with our ios setup
|
||||||
|
// therefore we have a fork and use different libraries on the platforms
|
||||||
|
import restart from 'react-native-restart'
|
||||||
|
|
||||||
|
export const restartApp = restart.Restart
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
// Current version of react-native-restart doesn't work with our ios setup
|
||||||
|
// therefore we have a fork and use different libraries on the platforms
|
||||||
|
import RNExitApp from 'react-native-exit-app-v2'
|
||||||
|
|
||||||
|
export const restartApp = RNExitApp.exitApp
|
||||||
+21
-6
@@ -112,12 +112,27 @@ export default {
|
|||||||
enterNew: 'Please enter a new password',
|
enterNew: 'Please enter a new password',
|
||||||
confirmPassword: 'Please confirm your password',
|
confirmPassword: 'Please confirm your password',
|
||||||
passwordsDontMatch: "Password and confirmation don't match",
|
passwordsDontMatch: "Password and confirmation don't match",
|
||||||
backupReminderTitle: 'Read this before making changes to your password',
|
backupReminder: {
|
||||||
backupReminder:
|
title: 'Read this before making changes to your password',
|
||||||
'Just to be safe, please backup your data using the export function before making changes to your password.\n\nLonger passwords are better! Consider using a passphrase.\n\nPlease also make sure you do not lose your password. There is no way to recover your data if you do.\n\nMaking any changes to your password setting will keep your data as it was before. After the password is updated the app will automatically close. At the new app launch please use the new password.',
|
message: `
|
||||||
deleteBackupReminderTitle: 'Read this before deleting your password',
|
Just to be safe, please backup your data using the export function before making any changes to your password.\n
|
||||||
deleteBackupReminder:
|
Longer passwords are better! Consider using a passphrase.\n
|
||||||
'Deleting your password means your data will no longer be encrypted.\n\nJust to be safe, please backup your data using the export function before deleting your password.\n\nMaking any changes to your password setting will keep your data as it was before and restart the app. . After the password is updated the app will automatically close. At the new app launch you will not be prompted to enter the password.',
|
Please also make sure you do not lose your password. There is no way to recover your data if you do.\n
|
||||||
|
Making any changes to your password setting will keep your data as it was before.\n`,
|
||||||
|
},
|
||||||
|
deleteBackupReminder: {
|
||||||
|
title: 'Read this before deleting your password',
|
||||||
|
message: `
|
||||||
|
Deleting your password means your data will no longer be encrypted.\n
|
||||||
|
Just to be safe, please backup your data using the export function before deleting your password.\n
|
||||||
|
Making any changes to your password setting will keep your data as it was before and restart the app.\n
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
backupReminderAppendix: {
|
||||||
|
android:
|
||||||
|
'After the password is updated the app will automatically restart.',
|
||||||
|
ios: 'After the password is updated the app will automatically close. Please reopen it manually.',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
aboutSection: {
|
aboutSection: {
|
||||||
title: 'About',
|
title: 'About',
|
||||||
|
|||||||
Reference in New Issue
Block a user