From e254a41bbe0c43636dd1322a840aba0495724ba7 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Mon, 19 Apr 2021 16:40:20 -0300 Subject: [PATCH 1/8] fix: changes saved to previous note when switching notes (#406) --- src/screens/Compose/Compose.tsx | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/screens/Compose/Compose.tsx b/src/screens/Compose/Compose.tsx index fa2edbd9..7e1ec663 100644 --- a/src/screens/Compose/Compose.tsx +++ b/src/screens/Compose/Compose.tsx @@ -320,41 +320,43 @@ export class Compose extends React.Component<{}, State> { isUserModified: boolean, dontUpdatePreviews: boolean, closeAfterSync: boolean, - newNoteText: string | undefined = this.note!.text + newNoteText?: string ) => { - if (!this.note) { + const { editor, note } = this; + const { title } = this.state; + + if (!note) { return; } - if (this.note?.deleted) { + if (note?.deleted) { this.context!.alertService!.alert( 'Attempting to save this note has failed. The note has previously been deleted.' ); return; } - - if (this.editor?.isTemplateNote) { - await this.editor?.insertTemplatedNote(); + if (editor?.isTemplateNote) { + await editor?.insertTemplatedNote(); if (this.context?.getAppState().selectedTag?.isSmartTag === false) { await this.context.changeItem( this.context?.getAppState().selectedTag!.uuid, mutator => { - mutator.addItemAsRelationship(this.note!); + mutator.addItemAsRelationship(note!); } ); } } - if (!this.context?.findItem(this.note!.uuid)) { + if (!this.context?.findItem(note!.uuid)) { this.context?.alertService!.alert( 'Attempting to save this note has failed. The note cannot be found.' ); return; } await this.context!.changeItem( - this.note!.uuid, + note!.uuid, mutator => { const noteMutator = mutator as NoteMutator; - noteMutator.title = this.state.title!; - noteMutator.text = newNoteText; + noteMutator.title = title!; + noteMutator.text = newNoteText ?? note.text; if (!dontUpdatePreviews) { const text = newNoteText ?? ''; const truncate = text.length > NOTE_PREVIEW_CHAR_LIMIT; @@ -377,7 +379,7 @@ export class Compose extends React.Component<{}, State> { this.saveTimeout = setTimeout(() => { this.context?.sync(); if (closeAfterSync) { - this.context?.getAppState().closeEditor(this.editor!); + this.context?.getAppState().closeEditor(editor!); } }, syncDebouceMs); }; From b9483dcef12ee6e1cd99e95a52a8a556158ef5d5 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Mon, 19 Apr 2021 17:09:10 -0300 Subject: [PATCH 2/8] chore(version): 3.6.7 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index aa1769f7..41d3ec59 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "StandardNotes", - "version": "3.6.6", - "user-version": "3.6.6", + "version": "3.6.7", + "user-version": "3.6.7", "private": true, "license": "AGPL-3.0-or-later", "scripts": { From 0f7322af38f6d99fb5bc75f9ae57bf230fcaba4c Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Wed, 21 Apr 2021 16:32:51 -0300 Subject: [PATCH 3/8] More accurate saving status, disable editor change on locked notes and SNJS upgrade (#409) * fix: more accurate saving status * fix: disallow changing editor on locked note * chore(version-snjs): 2.0.75 * refactor: support snjs session history refactor --- package.json | 2 +- src/screens/Compose/Compose.tsx | 14 ++++++++++---- src/screens/NoteHistory/SessionHistory.tsx | 6 +++--- src/screens/SideMenu/NoteSideMenu.tsx | 6 ++++++ yarn.lock | 8 ++++---- 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 41d3ec59..51710978 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@react-navigation/native": "^5.9.3", "@react-navigation/stack": "^5.14.3", "@standardnotes/sncrypto-common": "1.2.9", - "@standardnotes/snjs": "2.0.72", + "@standardnotes/snjs": "2.0.75", "js-base64": "^3.5.2", "moment": "^2.29.1", "react": "16.13.1", diff --git a/src/screens/Compose/Compose.tsx b/src/screens/Compose/Compose.tsx index 7e1ec663..6086e3d2 100644 --- a/src/screens/Compose/Compose.tsx +++ b/src/screens/Compose/Compose.tsx @@ -87,7 +87,12 @@ export class Compose extends React.Component<{}, State> { { title: newNote.title, }, - () => this.reloadComponentEditorState() + () => { + this.reloadComponentEditorState(); + if (newNote.dirty) { + this.showSavingStatus(); + } + } ); } ); @@ -103,14 +108,15 @@ export class Compose extends React.Component<{}, State> { this.setState({ title: newNote.title }); } - if (newNote.lastSyncBegan) { + if (newNote.lastSyncBegan || newNote.dirty) { if (newNote.lastSyncEnd) { if ( - newNote.lastSyncBegan?.getTime() > newNote.lastSyncEnd.getTime() + newNote.dirty || + newNote.lastSyncBegan!.getTime() > newNote.lastSyncEnd.getTime() ) { this.showSavingStatus(); } else if ( - newNote.lastSyncEnd.getTime() > newNote.lastSyncBegan.getTime() + newNote.lastSyncEnd.getTime() > newNote.lastSyncBegan!.getTime() ) { this.showAllChangesSavedStatus(); } diff --git a/src/screens/NoteHistory/SessionHistory.tsx b/src/screens/NoteHistory/SessionHistory.tsx index 4a2ac7c6..fa46d2c1 100644 --- a/src/screens/NoteHistory/SessionHistory.tsx +++ b/src/screens/NoteHistory/SessionHistory.tsx @@ -1,5 +1,5 @@ import { ApplicationContext } from '@Root/ApplicationContext'; -import { ItemSessionHistory, SNNote } from '@standardnotes/snjs'; +import { HistoryEntry, SNNote } from '@standardnotes/snjs'; import { NoteHistoryEntry } from '@standardnotes/snjs/dist/@types/services/history/entries/note_history_entry'; import React, { useCallback, useContext, useEffect, useState } from 'react'; import { FlatList, ListRenderItem } from 'react-native'; @@ -16,7 +16,7 @@ export const SessionHistory: React.FC = ({ note, onPress }) => { const insets = useSafeAreaInsets(); // State - const [sessionHistory, setSessionHistory] = useState(); + const [sessionHistory, setSessionHistory] = useState(); useEffect(() => { if (note) { @@ -52,7 +52,7 @@ export const SessionHistory: React.FC = ({ note, onPress }) => { initialNumToRender={10} windowSize={10} keyboardShouldPersistTaps={'never'} - data={sessionHistory?.entries as NoteHistoryEntry[]} + data={sessionHistory as NoteHistoryEntry[]} renderItem={RenderItem} /> ); diff --git a/src/screens/SideMenu/NoteSideMenu.tsx b/src/screens/SideMenu/NoteSideMenu.tsx index c9e12bc9..62465e79 100644 --- a/src/screens/SideMenu/NoteSideMenu.tsx +++ b/src/screens/SideMenu/NoteSideMenu.tsx @@ -235,6 +235,12 @@ export const NoteSideMenu = React.memo((props: Props) => { const onEditorPress = useCallback( async (selectedComponent?: SNComponent) => { + if (note?.locked) { + application?.alertService.alert( + "This note is locked. If you'd like to edit its options, unlock it, and try again." + ); + return; + } if (editor?.isTemplateNote) { await editor?.insertTemplatedNote(); } diff --git a/yarn.lock b/yarn.lock index 611352ab..bb788fce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1390,10 +1390,10 @@ resolved "https://registry.yarnpkg.com/@standardnotes/sncrypto-common/-/sncrypto-common-1.2.9.tgz#5212a959e4ec563584e42480bfd39ef129c3cbdf" integrity sha512-xJ5IUGOZztjSgNP/6XL+Ut5+q9UgSTv6xMtKkcQC5aJxCOkJy9u6RamPLdF00WQgwibxx2tu0e43bKUjTgzMig== -"@standardnotes/snjs@2.0.72": - version "2.0.72" - resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.0.72.tgz#1ff7d691f0d907a1513ec88e6b5d5ae0691f2947" - integrity sha512-OL1jeb0sEz4SZwGHeceoKttVcBmcKAh5y/96TELJxM1ZHL2Ayf6DxAXCz3KZBoD7JZllbJ9QWR37/bp+E4y2TA== +"@standardnotes/snjs@2.0.75": + version "2.0.75" + resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.0.75.tgz#aeb0ead927da63dc85e28f78da2362126bb16602" + integrity sha512-QL5YgDT0aN9t95gxgURqNudXr5dteVsc1ylsKKSw0DpEGiq0bACPxbI+sUFppoWTFmprxmDh3+vc+FFcFg7Lyw== dependencies: "@standardnotes/auth" "^2.0.0" "@standardnotes/sncrypto-common" "^1.2.9" 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 4/8] 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(); }; From e6ddd32f5871c87afaee612727642035fa685e52 Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Fri, 23 Apr 2021 16:03:49 +0200 Subject: [PATCH 5/8] fix: do not display local data message when there are no items to decrypt (#411) * fix: do not display local data message when there are no items to decrypt * fix: use unicode ellipsis * feat: improve status messages for initial loading/syncing --- src/lib/snjs_helper_hooks.ts | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/lib/snjs_helper_hooks.ts b/src/lib/snjs_helper_hooks.ts index 032c379e..a87a591d 100644 --- a/src/lib/snjs_helper_hooks.ts +++ b/src/lib/snjs_helper_hooks.ts @@ -157,10 +157,8 @@ export const useSyncStatus = () => { const [refreshing, setRefreshing] = React.useState(false); const setStatus = useCallback( - (status?: string, color?: string) => { - application - ?.getStatusManager() - .setMessage(SCREEN_NOTES, status ?? '', color); + (status = '', color?: string) => { + application?.getStatusManager().setMessage(SCREEN_NOTES, status, color); }, [application] ); @@ -172,11 +170,16 @@ export const useSyncStatus = () => { application!.isEncryptionAvailable() && application!.getStorageEncryptionPolicy() === StorageEncryptionPolicies.Default; - if (stats.localDataDone) { + + if ( + stats.localDataCurrent === 0 || + stats.localDataTotal === 0 || + stats.localDataDone + ) { setStatus(); return; } - const notesString = `${stats.localDataCurrent}/${stats.localDataTotal} items...`; + const notesString = `${stats.localDataCurrent}/${stats.localDataTotal} items…`; const loadingStatus = encryption ? `Decrypting ${notesString}` : `Loading ${notesString}`; @@ -212,7 +215,9 @@ export const useSyncStatus = () => { setStatus( `Syncing ${stats.uploadCompletionCount}/${stats.uploadTotalCount} items...` ); - } else if (!syncStatus.syncInProgress) { + } else if (syncStatus.syncInProgress) { + setStatus('Syncing…'); + } else { setStatus(); } }, [application, setStatus]); @@ -231,10 +236,6 @@ export const useSyncStatus = () => { setDecrypting(false); setLoading(false); updateLocalDataStatus(); - } else if (eventName === ApplicationEvent.WillSync) { - if (application.hasAccount() && !completedInitialSync) { - setStatus('Syncing...'); - } } else if (eventName === ApplicationEvent.CompletedFullSync) { if ( !completedInitialSync || From 52f3020aabd0e3013bde3f263d6e2b7b7d296d6d Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Fri, 23 Apr 2021 16:19:49 +0200 Subject: [PATCH 6/8] fix: use long commit hash for standard-notes-rn dependency --- ios/Podfile.lock | 4 ++-- package.json | 2 +- yarn.lock | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 9a34a6cc..fb134355 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -301,7 +301,7 @@ PODS: - sn-textview (1.0.0): - React - SNReactNative (1.0.0): - - React + - React-Core - SSZipArchive (2.2.3) - TrustKit (1.6.5) - Yoga (1.14.0) @@ -527,7 +527,7 @@ SPEC CHECKSUMS: RNVectorIcons: bc69e6a278b14842063605de32bec61f0b251a59 RNZipArchive: 3dd2de5b7f590d79e83270508b78870bf5a54f36 sn-textview: f478ee79531da2c7b129c4ea3b20c665e75e1f4b - SNReactNative: c47c4fd6d310eea152cc52e23f4fd306491efee3 + SNReactNative: 3fa6096f78bea7dbd329c897ee854f73666d20db SSZipArchive: 62d4947b08730e4cda640473b0066d209ff033c9 TrustKit: 073855e3adecd317417bda4ac9e9ac54a2e3b9f2 Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6 diff --git a/package.json b/package.json index bbfc08cf..a3b33b42 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "react-native-zip-archive": "^6.0.2", "react-navigation-header-buttons": "^6.0.2", "sn-textview": "standardnotes/sn-textview#3b56f5c2c87c24370f00ee5a0cee0da9a9fc66c3", - "standard-notes-rn": "standardnotes/standard-notes-rn#996b016", + "standard-notes-rn": "standardnotes/standard-notes-rn#996b016f5a63e0e36fb50a86f5ad41c0c072b41e", "styled-components": "^5.2.1" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 8b654203..b19691fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7829,7 +7829,7 @@ stacktrace-parser@^0.1.3: dependencies: type-fest "^0.7.1" -standard-notes-rn@standardnotes/standard-notes-rn#996b016: +standard-notes-rn@standardnotes/standard-notes-rn#996b016f5a63e0e36fb50a86f5ad41c0c072b41e: version "1.0.0" resolved "https://codeload.github.com/standardnotes/standard-notes-rn/tar.gz/996b016f5a63e0e36fb50a86f5ad41c0c072b41e" From b3cc8c724a097a9f594d2373c68c2ec1ba359d81 Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Fri, 23 Apr 2021 16:32:47 +0200 Subject: [PATCH 7/8] chore(deps): update sn-textview & standard-notes-rn --- ios/Podfile.lock | 10 +++++----- package.json | 4 ++-- yarn.lock | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index fb134355..a172bad3 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -298,9 +298,9 @@ PODS: - RNZipArchive/Core (6.0.2): - React-Core - SSZipArchive (= 2.2.3) - - sn-textview (1.0.0): - - React - - SNReactNative (1.0.0): + - sn-textview (1.0.1): + - React-Core + - SNReactNative (1.0.1): - React-Core - SSZipArchive (2.2.3) - TrustKit (1.6.5) @@ -526,8 +526,8 @@ SPEC CHECKSUMS: RNStoreReview: 62d6afd7c37db711a594bbffca6b0ea3a812b7a8 RNVectorIcons: bc69e6a278b14842063605de32bec61f0b251a59 RNZipArchive: 3dd2de5b7f590d79e83270508b78870bf5a54f36 - sn-textview: f478ee79531da2c7b129c4ea3b20c665e75e1f4b - SNReactNative: 3fa6096f78bea7dbd329c897ee854f73666d20db + sn-textview: 0211237b3e0edeeb23aed2a9c47b78af35a81e95 + SNReactNative: b5e9e529c175c13f3a618e27c76cf3071213d5e1 SSZipArchive: 62d4947b08730e4cda640473b0066d209ff033c9 TrustKit: 073855e3adecd317417bda4ac9e9ac54a2e3b9f2 Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6 diff --git a/package.json b/package.json index a3b33b42..90bad54e 100644 --- a/package.json +++ b/package.json @@ -56,8 +56,8 @@ "react-native-webview": "^11.0.3", "react-native-zip-archive": "^6.0.2", "react-navigation-header-buttons": "^6.0.2", - "sn-textview": "standardnotes/sn-textview#3b56f5c2c87c24370f00ee5a0cee0da9a9fc66c3", - "standard-notes-rn": "standardnotes/standard-notes-rn#996b016f5a63e0e36fb50a86f5ad41c0c072b41e", + "sn-textview": "standardnotes/sn-textview#14cd6fded5c746569a9c6c365d2edc41913811bb", + "standard-notes-rn": "standardnotes/standard-notes-rn#d8e5c21b049dd4b97006688617736efbdb7dc4e7", "styled-components": "^5.2.1" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index b19691fe..7d34ba9d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7662,9 +7662,9 @@ slide@^1.1.5: resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" integrity sha1-VusCfWW00tzmyy4tMsTUr8nh1wc= -sn-textview@standardnotes/sn-textview#3b56f5c2c87c24370f00ee5a0cee0da9a9fc66c3: - version "1.0.0" - resolved "https://codeload.github.com/standardnotes/sn-textview/tar.gz/3b56f5c2c87c24370f00ee5a0cee0da9a9fc66c3" +sn-textview@standardnotes/sn-textview#14cd6fded5c746569a9c6c365d2edc41913811bb: + version "1.0.1" + resolved "https://codeload.github.com/standardnotes/sn-textview/tar.gz/14cd6fded5c746569a9c6c365d2edc41913811bb" snapdragon-node@^2.0.1: version "2.1.1" @@ -7829,9 +7829,9 @@ stacktrace-parser@^0.1.3: dependencies: type-fest "^0.7.1" -standard-notes-rn@standardnotes/standard-notes-rn#996b016f5a63e0e36fb50a86f5ad41c0c072b41e: - version "1.0.0" - resolved "https://codeload.github.com/standardnotes/standard-notes-rn/tar.gz/996b016f5a63e0e36fb50a86f5ad41c0c072b41e" +standard-notes-rn@standardnotes/standard-notes-rn#d8e5c21b049dd4b97006688617736efbdb7dc4e7: + version "1.0.1" + resolved "https://codeload.github.com/standardnotes/standard-notes-rn/tar.gz/d8e5c21b049dd4b97006688617736efbdb7dc4e7" static-extend@^0.1.1: version "0.1.2" From 2ec7611b0a2e725f56737fed6478d2a6278ce073 Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Mon, 26 Apr 2021 11:41:31 +0200 Subject: [PATCH 8/8] fix: close editor when unmounting compose component (#412) --- src/screens/Compose/Compose.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/screens/Compose/Compose.tsx b/src/screens/Compose/Compose.tsx index 4138a9fc..60be4f84 100644 --- a/src/screens/Compose/Compose.tsx +++ b/src/screens/Compose/Compose.tsx @@ -222,6 +222,9 @@ export class Compose extends React.Component<{}, State> { this.removeComponentGroupObserver = undefined; this.removeEditorNoteChangeObserver = undefined; this.removeEditorNoteValueChangeObserver = undefined; + if (this.editor) { + this.context?.editorGroup?.closeEditor(this.editor); + } this.context?.getStatusManager()?.setMessage(SCREEN_COMPOSE, ''); if (this.saveTimeout) {