diff --git a/db/index.js b/db/index.js index 5872ea3..8be5198 100644 --- a/db/index.js +++ b/db/index.js @@ -2,7 +2,10 @@ import Realm from 'realm' import { LocalDate, ChronoUnit } from 'js-joda' import nodejs from 'nodejs-mobile-react-native' import fs from 'react-native-fs' -import restart from 'react-native-restart' +// Current version of react-native-restart doesn't work with our ios setup +// 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 cycleModule from '../lib/cycle' import maybeSetNewCycleStart from '../lib/set-new-cycle-start' @@ -213,7 +216,10 @@ export async function changeEncryptionAndRestartApp(hash) { db.close() await fs.unlink(defaultPath) await fs.moveFile(copyPath, defaultPath) - restart.Restart() + // Current version of react-native-restart doesn't work with our ios setup + // therefore react-native-exit-app-v2 is used to close the app after setting pwd + // restart.Restart() + RNExitApp.exitApp() } export function isDbEmpty() { diff --git a/ios/drip.xcodeproj/project.pbxproj b/ios/drip.xcodeproj/project.pbxproj index 5efee0e..c5d97e3 100644 --- a/ios/drip.xcodeproj/project.pbxproj +++ b/ios/drip.xcodeproj/project.pbxproj @@ -525,6 +525,7 @@ "${BUILT_PRODUCTS_DIR}/RCTTypeSafety/RCTTypeSafety.framework", "${BUILT_PRODUCTS_DIR}/RNCPushNotificationIOS/RNCPushNotificationIOS.framework", "${BUILT_PRODUCTS_DIR}/RNDateTimePicker/RNDateTimePicker.framework", + "${BUILT_PRODUCTS_DIR}/RNExitApp/RNExitApp.framework", "${BUILT_PRODUCTS_DIR}/RNFS/RNFS.framework", "${BUILT_PRODUCTS_DIR}/RNShare/RNShare.framework", "${BUILT_PRODUCTS_DIR}/RNVectorIcons/RNVectorIcons.framework", @@ -563,6 +564,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTTypeSafety.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNCPushNotificationIOS.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNDateTimePicker.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNExitApp.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNFS.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNShare.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNVectorIcons.framework", diff --git a/package.json b/package.json index 684bb71..39125fa 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "react-native": "0.61.0", "react-native-calendars": "^1.19.3", "react-native-document-picker": "^4.2.0", + "react-native-exit-app-v2": "^1.2.2", "react-native-fs": "^2.19.0", "react-native-hyperlink": "0.0.19", "react-native-modal-datetime-picker": "8.0.0",