From cbd2d1702abda73a4095dceaa76be785e8a8f65b Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Fri, 23 Apr 2021 15:43:15 +0200 Subject: [PATCH] fix: remember active tag on launch (#410) * chore: run pod install * fix: use 'application?' * fix: restore selected tag on launch --- ios/Podfile.lock | 8 +- ios/StandardNotes.xcodeproj/project.pbxproj | 172 ++++++------------ src/lib/application.ts | 2 +- src/lib/application_state.ts | 66 ++++--- src/screens/Compose/ComponentView.tsx | 4 +- src/screens/Notes/Notes.tsx | 18 +- .../Settings/Sections/OptionsSection.tsx | 6 +- .../Settings/Sections/PreferencesSection.tsx | 20 +- src/screens/SideMenu/MainSideMenu.tsx | 2 +- 9 files changed, 133 insertions(+), 165 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 0f5d1c38..9a34a6cc 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -299,9 +299,9 @@ PODS: - React-Core - SSZipArchive (= 2.2.3) - sn-textview (1.0.0): - - React-Core + - React - SNReactNative (1.0.0): - - React-Core + - React - SSZipArchive (2.2.3) - TrustKit (1.6.5) - Yoga (1.14.0) @@ -526,8 +526,8 @@ SPEC CHECKSUMS: RNStoreReview: 62d6afd7c37db711a594bbffca6b0ea3a812b7a8 RNVectorIcons: bc69e6a278b14842063605de32bec61f0b251a59 RNZipArchive: 3dd2de5b7f590d79e83270508b78870bf5a54f36 - sn-textview: 43135d1feb6e97994b8475b6a1e6e3c902d6b189 - SNReactNative: 3fa6096f78bea7dbd329c897ee854f73666d20db + sn-textview: f478ee79531da2c7b129c4ea3b20c665e75e1f4b + SNReactNative: c47c4fd6d310eea152cc52e23f4fd306491efee3 SSZipArchive: 62d4947b08730e4cda640473b0066d209ff033c9 TrustKit: 073855e3adecd317417bda4ac9e9ac54a2e3b9f2 Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6 diff --git a/ios/StandardNotes.xcodeproj/project.pbxproj b/ios/StandardNotes.xcodeproj/project.pbxproj index 8ad713d9..e4801350 100644 --- a/ios/StandardNotes.xcodeproj/project.pbxproj +++ b/ios/StandardNotes.xcodeproj/project.pbxproj @@ -25,7 +25,7 @@ 83DCC09F24C0A21200D58E1B /* Red@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8343BD69244F211C0020E9F0 /* Red@2x.png */; }; 83DCC0A024C0A21200D58E1B /* Red@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8343BD68244F211C0020E9F0 /* Red@3x.png */; }; 83F9431824C1EBC5007014C8 /* Dev.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 83F9431724C1EBC5007014C8 /* Dev.xcassets */; }; - 9472713467B26799E9270592 /* Pods_StandardNotes.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 892691A10E7D83241BCA16C1 /* Pods_StandardNotes.framework */; }; + EC7C2A984CBC86DBCA44D3AF /* libPods-StandardNotes.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D9673D75406FE1C6B945FF8 /* libPods-StandardNotes.a */; }; F1AF40B6D465714940D457A3 /* libPods-StandardNotesDev.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 340672DE690D292C12CF8DF2 /* libPods-StandardNotesDev.a */; }; /* End PBXBuildFile section */ @@ -51,6 +51,7 @@ 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = StandardNotes/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = StandardNotes/main.m; sourceTree = ""; }; 340672DE690D292C12CF8DF2 /* libPods-StandardNotesDev.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-StandardNotesDev.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 4D9673D75406FE1C6B945FF8 /* libPods-StandardNotes.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-StandardNotes.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 810594E7EAEF139BFC2FDD3B /* Pods-StandardNotes.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-StandardNotes.release.xcconfig"; path = "Target Support Files/Pods-StandardNotes/Pods-StandardNotes.release.xcconfig"; sourceTree = ""; }; 8343BD67244F211C0020E9F0 /* Red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Red.png; sourceTree = ""; }; 8343BD68244F211C0020E9F0 /* Red@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Red@3x.png"; sourceTree = ""; }; @@ -61,7 +62,6 @@ 83E99B1D24EC4EC5007B8F21 /* SN Dev.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "SN Dev.entitlements"; sourceTree = ""; }; 83E99B1E24EC9953007B8F21 /* StandardNotes.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = StandardNotes.entitlements; path = StandardNotes/StandardNotes.entitlements; sourceTree = ""; }; 83F9431724C1EBC5007014C8 /* Dev.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Dev.xcassets; sourceTree = ""; }; - 892691A10E7D83241BCA16C1 /* Pods_StandardNotes.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_StandardNotes.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 91D5BC0CD8D03CC85FE2AAD4 /* Pods-StandardNotesDev.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-StandardNotesDev.debug.xcconfig"; path = "Target Support Files/Pods-StandardNotesDev/Pods-StandardNotesDev.debug.xcconfig"; sourceTree = ""; }; A905072699998C893CF2B50C /* Pods-StandardNotes.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-StandardNotes.debug.xcconfig"; path = "Target Support Files/Pods-StandardNotes/Pods-StandardNotes.debug.xcconfig"; sourceTree = ""; }; CB9B9DBF83F519AB6584F5FE /* Pods-StandardNotesDev.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-StandardNotesDev.release.xcconfig"; path = "Target Support Files/Pods-StandardNotesDev/Pods-StandardNotesDev.release.xcconfig"; sourceTree = ""; }; @@ -81,7 +81,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9472713467B26799E9270592 /* Pods_StandardNotes.framework in Frameworks */, + EC7C2A984CBC86DBCA44D3AF /* libPods-StandardNotes.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -138,7 +138,7 @@ ED297162215061F000B7C4FE /* JavaScriptCore.framework */, ED2971642150620600B7C4FE /* JavaScriptCore.framework */, 340672DE690D292C12CF8DF2 /* libPods-StandardNotesDev.a */, - 892691A10E7D83241BCA16C1 /* Pods_StandardNotes.framework */, + 4D9673D75406FE1C6B945FF8 /* libPods-StandardNotes.a */, ); name = Frameworks; sourceTree = ""; @@ -220,7 +220,7 @@ 13B07F8C1A680F5B00A75B9A /* Frameworks */, 13B07F8E1A680F5B00A75B9A /* Resources */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - 94C763DAAEF98E4BE76E8F53 /* [CP] Embed Pods Frameworks */, + 1DCF3C40742945E814110BC4 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -349,6 +349,56 @@ shellPath = /bin/sh; shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; }; + 1DCF3C40742945E814110BC4 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-StandardNotes/Pods-StandardNotes-resources.sh", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Entypo.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Feather.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Fontisto.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Foundation.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Octicons.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Zocial.ttf", + "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AntDesign.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Entypo.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EvilIcons.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Feather.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Brands.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Regular.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Solid.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Fontisto.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Foundation.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Ionicons.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MaterialCommunityIcons.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MaterialIcons.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Octicons.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SimpleLineIcons.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Zocial.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-StandardNotes/Pods-StandardNotes-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; 22CF5F27C67390DA618B03A3 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -394,7 +444,7 @@ "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Octicons.ttf", "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf", "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Zocial.ttf", - "${PODS_CONFIGURATION_BUILD_DIR}/React-Core-library/AccessibilityResources.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( @@ -454,116 +504,6 @@ shellPath = /bin/sh; shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n"; }; - 94C763DAAEF98E4BE76E8F53 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-StandardNotes/Pods-StandardNotes-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/TrustKit-framework/TrustKit.framework", - "${BUILT_PRODUCTS_DIR}/BugsnagReactNative-framework/Bugsnag.framework", - "${BUILT_PRODUCTS_DIR}/DoubleConversion-framework/DoubleConversion.framework", - "${BUILT_PRODUCTS_DIR}/FBReactNativeSpec-framework/FBReactNativeSpec.framework", - "${BUILT_PRODUCTS_DIR}/Folly-framework/folly.framework", - "${BUILT_PRODUCTS_DIR}/RCTTypeSafety-framework/RCTTypeSafety.framework", - "${BUILT_PRODUCTS_DIR}/RNCAsyncStorage-framework/RNCAsyncStorage.framework", - "${BUILT_PRODUCTS_DIR}/RNCMaskedView-framework/RNCMaskedView.framework", - "${BUILT_PRODUCTS_DIR}/RNDefaultPreference-framework/RNDefaultPreference.framework", - "${BUILT_PRODUCTS_DIR}/RNFS-framework/RNFS.framework", - "${BUILT_PRODUCTS_DIR}/RNFileViewer-framework/RNFileViewer.framework", - "${BUILT_PRODUCTS_DIR}/RNGestureHandler-framework/RNGestureHandler.framework", - "${BUILT_PRODUCTS_DIR}/RNKeychain-framework/RNKeychain.framework", - "${BUILT_PRODUCTS_DIR}/RNPrivacySnapshot-framework/RNPrivacySnapshot.framework", - "${BUILT_PRODUCTS_DIR}/RNReanimated-framework/RNReanimated.framework", - "${BUILT_PRODUCTS_DIR}/RNScreens-framework/RNScreens.framework", - "${BUILT_PRODUCTS_DIR}/RNSearchBar-framework/RNSearchBar.framework", - "${BUILT_PRODUCTS_DIR}/RNStoreReview-framework/RNStoreReview.framework", - "${BUILT_PRODUCTS_DIR}/RNVectorIcons-framework/RNVectorIcons.framework", - "${BUILT_PRODUCTS_DIR}/React-Core-framework/React.framework", - "${BUILT_PRODUCTS_DIR}/React-CoreModules-framework/CoreModules.framework", - "${BUILT_PRODUCTS_DIR}/React-RCTAnimation-framework/RCTAnimation.framework", - "${BUILT_PRODUCTS_DIR}/React-RCTBlob-framework/RCTBlob.framework", - "${BUILT_PRODUCTS_DIR}/React-RCTImage-framework/RCTImage.framework", - "${BUILT_PRODUCTS_DIR}/React-RCTLinking-framework/RCTLinking.framework", - "${BUILT_PRODUCTS_DIR}/React-RCTNetwork-framework/RCTNetwork.framework", - "${BUILT_PRODUCTS_DIR}/React-RCTSettings-framework/RCTSettings.framework", - "${BUILT_PRODUCTS_DIR}/React-RCTText-framework/RCTText.framework", - "${BUILT_PRODUCTS_DIR}/React-RCTVibration-framework/RCTVibration.framework", - "${BUILT_PRODUCTS_DIR}/React-cxxreact-framework/cxxreact.framework", - "${BUILT_PRODUCTS_DIR}/React-jsi-framework/jsi.framework", - "${BUILT_PRODUCTS_DIR}/React-jsiexecutor-framework/jsireact.framework", - "${BUILT_PRODUCTS_DIR}/React-jsinspector-framework/jsinspector.framework", - "${BUILT_PRODUCTS_DIR}/ReactCommon-framework/ReactCommon.framework", - "${BUILT_PRODUCTS_DIR}/ReactNativeAlternateIcons-framework/ReactNativeAlternateIcons.framework", - "${BUILT_PRODUCTS_DIR}/SNReactNative-framework/SNReactNative.framework", - "${BUILT_PRODUCTS_DIR}/Yoga-framework/yoga.framework", - "${BUILT_PRODUCTS_DIR}/glog-framework/glog.framework", - "${BUILT_PRODUCTS_DIR}/react-native-aes-framework/react_native_aes.framework", - "${BUILT_PRODUCTS_DIR}/react-native-fingerprint-scanner-framework/react_native_fingerprint_scanner.framework", - "${BUILT_PRODUCTS_DIR}/react-native-mail-framework/react_native_mail.framework", - "${BUILT_PRODUCTS_DIR}/react-native-safe-area-context-framework/react_native_safe_area_context.framework", - "${BUILT_PRODUCTS_DIR}/react-native-segmented-control-framework/react_native_segmented_control.framework", - "${BUILT_PRODUCTS_DIR}/react-native-sodium-framework/react_native_sodium.framework", - "${BUILT_PRODUCTS_DIR}/react-native-version-info-framework/react_native_version_info.framework", - "${BUILT_PRODUCTS_DIR}/react-native-webview-framework/react_native_webview.framework", - "${BUILT_PRODUCTS_DIR}/sn-textview-framework/sn_textview.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TrustKit.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Bugsnag.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DoubleConversion.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBReactNativeSpec.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/folly.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTTypeSafety.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNCAsyncStorage.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNCMaskedView.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNDefaultPreference.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNFS.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNFileViewer.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNGestureHandler.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNKeychain.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNPrivacySnapshot.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNReanimated.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNScreens.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNSearchBar.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNStoreReview.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNVectorIcons.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/React.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CoreModules.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTAnimation.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTBlob.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTImage.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTLinking.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTNetwork.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTSettings.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTText.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTVibration.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/cxxreact.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsi.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsireact.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsinspector.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactCommon.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactNativeAlternateIcons.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SNReactNative.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/yoga.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_aes.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_fingerprint_scanner.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_mail.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_safe_area_context.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_segmented_control.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_sodium.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_version_info.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_webview.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sn_textview.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-StandardNotes/Pods-StandardNotes-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; E5E35654B81EF4E64AB5D97C /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/src/lib/application.ts b/src/lib/application.ts index 54896215..716fcd7c 100644 --- a/src/lib/application.ts +++ b/src/lib/application.ts @@ -138,7 +138,7 @@ export class MobileApplication extends SNApplication { return this.MobileServices.backupsService; } - public getPrefsService() { + public getLocalPreferences() { return this.MobileServices.prefsService; } diff --git a/src/lib/application_state.ts b/src/lib/application_state.ts index ed9fd0c8..397e9bc5 100644 --- a/src/lib/application_state.ts +++ b/src/lib/application_state.ts @@ -102,6 +102,7 @@ export class ApplicationState extends ApplicationService { keyboardDidHideListener?: EmitterSubscription; keyboardHeight?: number; appEventObersever: any; + selectedTagRestored = false; selectedTag: SNTag = this.application.getSmartTags()[0]; userPreferences?: SNUserPrefs; tabletMode: boolean = false; @@ -152,24 +153,33 @@ export class ApplicationState extends ApplicationService { this.keyboardDidHideListener = undefined; } + restoreSelectedTag() { + if (this.selectedTagRestored) { + return; + } + const savedTagUuid: string | undefined = this.prefService.getValue( + PrefKey.SelectedTagUuid, + undefined + ); + + if (isNullOrUndefined(savedTagUuid)) { + this.selectedTagRestored = true; + return; + } + + const savedTag = + (this.application.findItem(savedTagUuid) as SNTag) || + this.application.getSmartTags().find(tag => tag.uuid === savedTagUuid); + if (savedTag) { + this.setSelectedTag(savedTag, false); + this.selectedTagRestored = true; + } + } + async onAppStart() { this.removePreferencesLoadedListener = this.prefService.addPreferencesLoadedObserver( () => { this.notifyOfStateChange(AppStateType.PreferencesChanged); - const savedTagUuid: string | undefined = this.prefService.getValue( - PrefKey.SelectedTagUuid, - undefined - ); - - const savedTag = !isNullOrUndefined(savedTagUuid) - ? (this.application.findItem(savedTagUuid) as SNTag) || - this.application - .getSmartTags() - .find(tag => tag.uuid === savedTagUuid) - : undefined; - if (savedTag) { - this.setSelectedTag(savedTag, false); - } } ); @@ -386,11 +396,21 @@ export class ApplicationState extends ApplicationService { private handleApplicationEvents() { this.appEventObersever = this.application.addEventObserver( async eventName => { - if (eventName === ApplicationEvent.Started) { - this.locked = true; - } else if (eventName === ApplicationEvent.Launched) { - this.locked = false; - this.notifyLockStateObservers(LockStateType.Unlocked); + switch (eventName) { + case ApplicationEvent.LocalDataIncrementalLoad: + case ApplicationEvent.LocalDataLoaded: { + this.restoreSelectedTag(); + break; + } + case ApplicationEvent.Started: { + this.locked = true; + break; + } + case ApplicationEvent.Launched: { + this.locked = false; + this.notifyLockStateObservers(LockStateType.Unlocked); + break; + } } } ); @@ -399,8 +419,8 @@ export class ApplicationState extends ApplicationService { /** * Set selected @SNTag */ - public setSelectedTag(tag: SNTag, saveSelection: boolean) { - if (this.selectedTag === tag) { + public setSelectedTag(tag: SNTag, saveSelection: boolean = true) { + if (this.selectedTag.uuid === tag.uuid) { return; } const previousTag = this.selectedTag; @@ -408,7 +428,7 @@ export class ApplicationState extends ApplicationService { if (saveSelection) { this.application - .getPrefsService() + .getLocalPreferences() .setUserPrefValue(PrefKey.SelectedTagUuid, tag.uuid); } @@ -681,7 +701,7 @@ export class ApplicationState extends ApplicationService { } private get prefService() { - return this.application.getPrefsService(); + return this.application.getLocalPreferences(); } public getEnvironment() { diff --git a/src/screens/Compose/ComponentView.tsx b/src/screens/Compose/ComponentView.tsx index 06c7a394..f53fa8eb 100644 --- a/src/screens/Compose/ComponentView.tsx +++ b/src/screens/Compose/ComponentView.tsx @@ -92,7 +92,7 @@ export const ComponentView = ({ useEffect(() => { const warnUnsupportedEditors = async () => { const doNotShowAgainUnsupportedEditors = application - ?.getPrefsService() + ?.getLocalPreferences() .getValue(PrefKey.DoNotShowAgainUnsupportedEditors, false); if (!doNotShowAgainUnsupportedEditors) { const confirmed = await application?.alertService?.confirm( @@ -104,7 +104,7 @@ export const ComponentView = ({ ); if (confirmed) { application - ?.getPrefsService() + ?.getLocalPreferences() .setUserPrefValue(PrefKey.DoNotShowAgainUnsupportedEditors, true); } } diff --git a/src/screens/Notes/Notes.tsx b/src/screens/Notes/Notes.tsx index 266f5140..9dabe616 100644 --- a/src/screens/Notes/Notes.tsx +++ b/src/screens/Notes/Notes.tsx @@ -60,18 +60,20 @@ export const Notes = React.memo( // State const [sortBy, setSortBy] = useState(() => application! - .getPrefsService() + .getLocalPreferences() .getValue(PrefKey.SortNotesBy, CollectionSort.CreatedAt) ); const [sortReverse, setSortReverse] = useState(() => - application!.getPrefsService().getValue(PrefKey.SortNotesReverse, false) + application! + .getLocalPreferences() + .getValue(PrefKey.SortNotesReverse, false) ); const [hideDates, setHideDates] = useState(() => - application!.getPrefsService().getValue(PrefKey.NotesHideDate, false) + application!.getLocalPreferences().getValue(PrefKey.NotesHideDate, false) ); const [hidePreviews, setHidePreviews] = useState(() => application! - .getPrefsService() + .getLocalPreferences() .getValue(PrefKey.NotesHideNotePreview, false) ); const [notes, setNotes] = useState([]); @@ -485,18 +487,18 @@ export const Notes = React.memo( const reloadPreferences = useCallback(async () => { const newSortBy = application - ?.getPrefsService() + ?.getLocalPreferences() .getValue(PrefKey.SortNotesBy, CollectionSort.CreatedAt); let displayOptionsChanged = false; const newSortReverse = application - ?.getPrefsService() + ?.getLocalPreferences() .getValue(PrefKey.SortNotesReverse, false); const newHidePreview = application! - .getPrefsService() + .getLocalPreferences() .getValue(PrefKey.NotesHideNotePreview, false); const newHideDate = application! - .getPrefsService() + .getLocalPreferences() .getValue(PrefKey.NotesHideDate, false); if (sortBy !== newSortBy) { diff --git a/src/screens/Settings/Sections/OptionsSection.tsx b/src/screens/Settings/Sections/OptionsSection.tsx index dcd0245d..a733059f 100644 --- a/src/screens/Settings/Sections/OptionsSection.tsx +++ b/src/screens/Settings/Sections/OptionsSection.tsx @@ -29,7 +29,9 @@ export const OptionsSection = ({ title, encryptionAvailable }: Props) => { // State const [exporting, setExporting] = useState(false); const [lastExportDate, setLastExportDate] = useState(() => - application?.getPrefsService().getValue(PrefKey.LastExportDate, undefined) + application + ?.getLocalPreferences() + .getValue(PrefKey.LastExportDate, undefined) ); const lastExportData = useMemo(() => { @@ -93,7 +95,7 @@ export const OptionsSection = ({ title, encryptionAvailable }: Props) => { const exportDate = new Date(); setLastExportDate(exportDate); application - ?.getPrefsService() + ?.getLocalPreferences() .setUserPrefValue(PrefKey.LastExportDate, exportDate); } setExporting(false); diff --git a/src/screens/Settings/Sections/PreferencesSection.tsx b/src/screens/Settings/Sections/PreferencesSection.tsx index 1bc8713e..dc5e1dab 100644 --- a/src/screens/Settings/Sections/PreferencesSection.tsx +++ b/src/screens/Settings/Sections/PreferencesSection.tsx @@ -13,17 +13,19 @@ export const PreferencesSection = () => { // State const [sortBy, setSortBy] = useState(() => application! - .getPrefsService() + .getLocalPreferences() .getValue(PrefKey.SortNotesBy, CollectionSort.CreatedAt) ); const [sortReverse, setSortReverse] = useState(() => - application!.getPrefsService().getValue(PrefKey.SortNotesReverse, false) + application!.getLocalPreferences().getValue(PrefKey.SortNotesReverse, false) ); const [hideDates, setHideDates] = useState(() => - application!.getPrefsService().getValue(PrefKey.NotesHideDate, false) + application!.getLocalPreferences().getValue(PrefKey.NotesHideDate, false) ); const [hidePreviews, setHidePreviews] = useState(() => - application!.getPrefsService().getValue(PrefKey.NotesHideNotePreview, false) + application! + .getLocalPreferences() + .getValue(PrefKey.NotesHideNotePreview, false) ); const sortOptions = useMemo(() => { @@ -36,24 +38,26 @@ export const PreferencesSection = () => { const toggleReverseSort = () => { application - ?.getPrefsService() + ?.getLocalPreferences() .setUserPrefValue(PrefKey.SortNotesReverse, !sortReverse); setSortReverse(value => !value); }; const changeSortOption = (key: CollectionSort) => { - application?.getPrefsService().setUserPrefValue(PrefKey.SortNotesBy, key); + application + ?.getLocalPreferences() + .setUserPrefValue(PrefKey.SortNotesBy, key); setSortBy(key); }; const toggleNotesPreviewHidden = () => { application - ?.getPrefsService() + ?.getLocalPreferences() .setUserPrefValue(PrefKey.NotesHideNotePreview, !hidePreviews); setHidePreviews(value => !value); }; const toggleNotesDateHidden = () => { application - ?.getPrefsService() + ?.getLocalPreferences() .setUserPrefValue(PrefKey.NotesHideDate, !hideDates); setHideDates(value => !value); }; diff --git a/src/screens/SideMenu/MainSideMenu.tsx b/src/screens/SideMenu/MainSideMenu.tsx index 73561d77..77a3c9df 100644 --- a/src/screens/SideMenu/MainSideMenu.tsx +++ b/src/screens/SideMenu/MainSideMenu.tsx @@ -245,7 +245,7 @@ export const MainSideMenu = React.memo(({ drawerRef }: Props) => { mutator.conflictOf = undefined; }); } - application!.getAppState().setSelectedTag(tag, true); + application?.getAppState().setSelectedTag(tag, true); drawerRef?.closeDrawer(); };