From 356142bb2215719b2dc9129350707dddfdb176d7 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Mon, 4 Dec 2023 12:32:35 +0500 Subject: [PATCH] mobile: fix share extension in release --- apps/mobile/app/hooks/use-app-events.tsx | 8 +++--- .../mobile/app/navigation/navigation-stack.js | 14 +--------- apps/mobile/app/stores/index.ts | 22 +++++++-------- apps/mobile/app/utils/tooltip.ts | 8 +++--- apps/mobile/native/index.js | 5 +--- apps/mobile/native/ios/Make Note/Info.plist | 2 ++ .../ios/Notesnook.xcodeproj/project.pbxproj | 27 +++++++++---------- .../xcshareddata/xcschemes/Make Note.xcscheme | 5 ++++ apps/mobile/native/ios/Notesnook/Info.plist | 2 ++ apps/mobile/native/ios/Podfile | 3 +++ apps/mobile/native/ios/Podfile.lock | 10 ++++++- .../patches/recyclerlistview+4.2.0.patch | 13 +++++++++ apps/mobile/share/share.js | 2 -- 13 files changed, 68 insertions(+), 53 deletions(-) create mode 100644 apps/mobile/patches/recyclerlistview+4.2.0.patch diff --git a/apps/mobile/app/hooks/use-app-events.tsx b/apps/mobile/app/hooks/use-app-events.tsx index ff3aae253..2d366e036 100644 --- a/apps/mobile/app/hooks/use-app-events.tsx +++ b/apps/mobile/app/hooks/use-app-events.tsx @@ -628,7 +628,7 @@ export const useAppEvents = () => { if (!db.isInitialized) { await db.init(); } - initialize(); + await initialize(); useNoteStore.getState().setLoading(false); }, disableClosing: true @@ -656,8 +656,10 @@ export const useAppEvents = () => { } } if (IsDatabaseMigrationRequired()) return; - initialize(); - useNoteStore.getState().setLoading(false); + await initialize(); + setImmediate(() => { + useNoteStore.getState().setLoading(false); + }); Walkthrough.init(); }, [IsDatabaseMigrationRequired]); diff --git a/apps/mobile/app/navigation/navigation-stack.js b/apps/mobile/app/navigation/navigation-stack.js index 40bc89fa1..741a72c5b 100644 --- a/apps/mobile/app/navigation/navigation-stack.js +++ b/apps/mobile/app/navigation/navigation-stack.js @@ -81,7 +81,6 @@ const _Tabs = () => { (state) => state.settings.introCompleted ); const height = useSettingStore((state) => state.dimensions.height); - const loading = useNoteStore((state) => state.loading); const insets = useGlobalSafeAreaInsets(); const screenHeight = height - (50 + insets.top + insets.bottom); React.useEffect(() => { @@ -90,18 +89,7 @@ const _Tabs = () => { }, 1000); }, [homepage]); - return loading && introCompleted ? ( - <> - - - - - ) : ( + return ( null} initialRouteName={!introCompleted ? "Welcome" : homepage} diff --git a/apps/mobile/app/stores/index.ts b/apps/mobile/app/stores/index.ts index 6f7b31342..31102bce5 100644 --- a/apps/mobile/app/stores/index.ts +++ b/apps/mobile/app/stores/index.ts @@ -38,19 +38,17 @@ export function initAfterSync() { useRelationStore.getState().update(); } -export function initialize() { +export async function initialize() { if (!db) return; - setImmediate(() => { - useMenuStore.getState().setColorNotes(); - useMenuStore.getState().setMenuPins(); - useNotebookStore.getState().setNotebooks(); - useTrashStore.getState().setTrash(); - useTagStore.getState().setTags(); - useFavoriteStore.getState().setFavorites(); - useNoteStore.getState().setNotes(); - useReminderStore.getState().setReminders(); - Notifications.setupReminders(); - }); + useMenuStore.getState().setColorNotes(); + useMenuStore.getState().setMenuPins(); + useNotebookStore.getState().setNotebooks(); + useTrashStore.getState().setTrash(); + useTagStore.getState().setTags(); + useFavoriteStore.getState().setFavorites(); + await useNoteStore.getState().setNotes(); + useReminderStore.getState().setReminders(); + Notifications.setupReminders(); } export function clearAllStores() { diff --git a/apps/mobile/app/utils/tooltip.ts b/apps/mobile/app/utils/tooltip.ts index 586d304d5..86d122043 100644 --- a/apps/mobile/app/utils/tooltip.ts +++ b/apps/mobile/app/utils/tooltip.ts @@ -16,8 +16,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import RNTooltips from "react-native-tooltips"; -import { tabBarRef } from "./global-refs"; import { Platform } from "react-native"; export const POSITIONS = { @@ -26,9 +24,13 @@ export const POSITIONS = { TOP: 3, BOTTOM: 4 }; - +let RNTooltips: any; let prevTarget: any = null; function show(event: any, text: string, position = 2) { + const tabBarRef = require("./global-refs").tabBarRef; + if (!RNTooltips) { + RNTooltips = require("react-native-tooltips").default; + } if (!event._targetInst?.ref?.current) return; prevTarget && RNTooltips.Dismiss(prevTarget); prevTarget = null; diff --git a/apps/mobile/native/index.js b/apps/mobile/native/index.js index f4c376a82..c3cfdb995 100644 --- a/apps/mobile/native/index.js +++ b/apps/mobile/native/index.js @@ -31,9 +31,6 @@ if (__DEV__) { console.warn = () => null; LogBox.ignoreAllLogs(); } -let NotesnookShare; - -let QuickNoteIOS; const AppProvider = () => { const App = require('../app/app').default; @@ -43,7 +40,7 @@ const AppProvider = () => { AppRegistry.registerComponent(appName, () => AppProvider); const ShareProvider = () => { - NotesnookShare = require('../share/index').default; + let NotesnookShare = require('../share/index').default; return Platform.OS === 'ios' ? ( diff --git a/apps/mobile/native/ios/Make Note/Info.plist b/apps/mobile/native/ios/Make Note/Info.plist index c0bbbd442..082dc7055 100644 --- a/apps/mobile/native/ios/Make Note/Info.plist +++ b/apps/mobile/native/ios/Make Note/Info.plist @@ -52,6 +52,8 @@ NSExtensionPointIdentifier com.apple.share-services + ReactNativeQuickSQLite_AppGroup + group.org.streetwriters.notesnook UIAppFonts OpenSans-Bold.ttf diff --git a/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj b/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj index ef00418db..b44f36153 100644 --- a/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj +++ b/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj @@ -19,6 +19,9 @@ 6510E6D72877215700DACAA9 /* build.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 6510E6D62877215700DACAA9 /* build.bundle */; }; 6515C42F2580AA3000E83E39 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6515C42E2580AA2F00E83E39 /* StoreKit.framework */; }; 6529A13E279BC4C70048D4A8 /* BootSplash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6529A13D279BC4C70048D4A8 /* BootSplash.storyboard */; }; + 656DD2AB2B1891DF00A362EA /* OpenSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6552012F27019F7700A43C51 /* OpenSans-Regular.ttf */; }; + 656DD2AC2B1891DF00A362EA /* OpenSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 659670B12A2754FD00C5D2AF /* OpenSans-Bold.ttf */; }; + 656DD2AD2B1891DF00A362EA /* OpenSans-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6552012E27019F6E00A43C51 /* OpenSans-SemiBold.ttf */; }; 6593E4A3281C345400492C50 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6593E4A2281C345400492C50 /* AppDelegate.mm */; }; 659670B22A2754FD00C5D2AF /* OpenSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 659670B12A2754FD00C5D2AF /* OpenSans-Bold.ttf */; }; 659BE46725E11A5100E05671 /* notesnook-text.png in Resources */ = {isa = PBXBuildFile; fileRef = 659BE46625E11A5100E05671 /* notesnook-text.png */; }; @@ -579,6 +582,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 656DD2AB2B1891DF00A362EA /* OpenSans-Regular.ttf in Resources */, + 656DD2AC2B1891DF00A362EA /* OpenSans-Bold.ttf in Resources */, + 656DD2AD2B1891DF00A362EA /* OpenSans-SemiBold.ttf in Resources */, 65C400DF2A80B6B600AA3DF5 /* MaterialCommunityIcons.ttf in Resources */, 65C149872A61151B005C40F1 /* extension.bundle in Resources */, 65B5014725A672B200E2D264 /* MainInterface.storyboard in Resources */, @@ -1100,11 +1106,9 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Notesnook/Notesnook.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 2063; - DEVELOPMENT_TEAM = ""; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC; + DEVELOPMENT_TEAM = 53CWBG3QUC; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; HEADER_SEARCH_PATHS = ( @@ -1186,7 +1190,6 @@ PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook; PRODUCT_NAME = Notesnook; PROVISIONING_PROFILE_SPECIFIER = ""; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Notesnook App Distribution 2024"; SWIFT_OBJC_BRIDGING_HEADER = "Notesnook-Bridging-Header.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -1375,13 +1378,11 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 2063; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = ""; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC; + DEVELOPMENT_TEAM = 53CWBG3QUC; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = NotesWidget/Info.plist; @@ -1396,7 +1397,6 @@ PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.notewidget; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Notesnook Widget Distribution 2024"; SKIP_INSTALL = YES; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; @@ -1523,13 +1523,11 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_ENTITLEMENTS = "Make Note/Make Note.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 2063; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = ""; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC; + DEVELOPMENT_TEAM = 53CWBG3QUC; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; GCC_C_LANGUAGE_STANDARD = gnu11; HEADER_SEARCH_PATHS = ( @@ -1606,7 +1604,6 @@ PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.share; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Notesnook Share Distribution 2024"; SKIP_INSTALL = YES; SWIFT_OBJC_BRIDGING_HEADER = "Make Note/Make Note-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/apps/mobile/native/ios/Notesnook.xcodeproj/xcshareddata/xcschemes/Make Note.xcscheme b/apps/mobile/native/ios/Notesnook.xcodeproj/xcshareddata/xcschemes/Make Note.xcscheme index 146f25b2f..5b133e10c 100644 --- a/apps/mobile/native/ios/Notesnook.xcodeproj/xcshareddata/xcschemes/Make Note.xcscheme +++ b/apps/mobile/native/ios/Notesnook.xcodeproj/xcshareddata/xcschemes/Make Note.xcscheme @@ -71,6 +71,11 @@ debugServiceExtension = "internal" allowLocationSimulation = "YES" launchAutomaticallySubstyle = "2"> + + Only required by library- not requested in application NSPhotoLibraryUsageDescription Add photos from gallery to your note. + ReactNativeQuickSQLite_AppGroup + group.org.streetwriters.notesnook UIAppFonts OpenSans-SemiBold.ttf diff --git a/apps/mobile/native/ios/Podfile b/apps/mobile/native/ios/Podfile index 635872259..55d2b6b88 100644 --- a/apps/mobile/native/ios/Podfile +++ b/apps/mobile/native/ios/Podfile @@ -95,6 +95,9 @@ target 'Make Note' do pod 'callstack-repack', :path => '../../node_modules/@callstack/repack' pod 'RNSecureRandom', :path => '../../node_modules/react-native-securerandom' pod "RNCClipboard", :path => '../../node_modules/@react-native-clipboard/clipboard' + pod "react-native-quick-sqlite", :path => '../../node_modules/react-native-quick-sqlite' + pod "RNDeviceInfo", :path => '../../node_modules/react-native-device-info' + pod "RNPrivacySnapshot", :path => '../../node_modules/react-native-privacy-snapshot' end diff --git a/apps/mobile/native/ios/Podfile.lock b/apps/mobile/native/ios/Podfile.lock index c74140aea..a9b1efcb2 100644 --- a/apps/mobile/native/ios/Podfile.lock +++ b/apps/mobile/native/ios/Podfile.lock @@ -339,6 +339,10 @@ PODS: - React - react-native-pdf (6.6.2): - React-Core + - react-native-quick-sqlite (8.0.6): + - React + - React-callinvoker + - React-Core - react-native-safe-area-context (4.6.3): - RCT-Folly - RCTRequired @@ -591,6 +595,7 @@ DEPENDENCIES: - react-native-notification-sounds (from `../../node_modules/react-native-notification-sounds`) - react-native-orientation (from `../../node_modules/react-native-orientation`) - react-native-pdf (from `../../node_modules/react-native-pdf`) + - react-native-quick-sqlite (from `../../node_modules/react-native-quick-sqlite`) - react-native-safe-area-context (from `../../node_modules/react-native-safe-area-context`) - "react-native-share-extension (from `../../node_modules/@ammarahmed/react-native-share-extension`)" - "react-native-sodium (from `../../node_modules/@ammarahmed/react-native-sodium`)" @@ -734,6 +739,8 @@ EXTERNAL SOURCES: :path: "../../node_modules/react-native-orientation" react-native-pdf: :path: "../../node_modules/react-native-pdf" + react-native-quick-sqlite: + :path: "../../node_modules/react-native-quick-sqlite" react-native-safe-area-context: :path: "../../node_modules/react-native-safe-area-context" react-native-share-extension: @@ -880,6 +887,7 @@ SPEC CHECKSUMS: react-native-notification-sounds: da78c828fe1bcbb92d8b505d5261890ed315ff39 react-native-orientation: f1caf84d65f1a4fd4511a18f2b924e634ad7a628 react-native-pdf: 33c622cbdf776a649929e8b9d1ce2d313347c4fa + react-native-quick-sqlite: e0e23b749382a85e4b57146f753de737a6c3a9e1 react-native-safe-area-context: 36cc67648134e89465663b8172336a19eeda493d react-native-share-extension: df66a2ee48a62277d79898375e2142bde0782063 react-native-sodium: 955bb0dc3ea05f8ea06d5e96cb89d1be7b5d7681 @@ -929,6 +937,6 @@ SPEC CHECKSUMS: toolbar-android: 2a73856e98b750d7e71ce4644d3f41cc98211719 Yoga: 1d6727ed193122f6adaf435c3de1a768326ff83b -PODFILE CHECKSUM: b0cadd188aa428b98d1eaa0b84b3b6208e714119 +PODFILE CHECKSUM: 21553b7e17c48c3fa8e56d4cc26e0c4bd4a74260 COCOAPODS: 1.12.1 diff --git a/apps/mobile/patches/recyclerlistview+4.2.0.patch b/apps/mobile/patches/recyclerlistview+4.2.0.patch new file mode 100644 index 000000000..d134e89d5 --- /dev/null +++ b/apps/mobile/patches/recyclerlistview+4.2.0.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/recyclerlistview/dist/reactnative/core/layoutmanager/LayoutManager.js b/node_modules/recyclerlistview/dist/reactnative/core/layoutmanager/LayoutManager.js +index 9cd3c57..970421a 100644 +--- a/node_modules/recyclerlistview/dist/reactnative/core/layoutmanager/LayoutManager.js ++++ b/node_modules/recyclerlistview/dist/reactnative/core/layoutmanager/LayoutManager.js +@@ -111,7 +111,7 @@ var WrapGridLayoutManager = /** @class */ (function (_super) { + var itemDim = { height: 0, width: 0 }; + var itemRect = null; + var oldLayout = null; +- for (var i = startIndex; i < itemCount; i++) { ++ for (var i = startIndex; i < Math.min(startIndex + 5000, itemCount); i++) { + oldLayout = this._layouts[i]; + var layoutType = this._layoutProvider.getLayoutTypeForIndex(i); + if (oldLayout && oldLayout.isOverridden && oldLayout.type === layoutType) { diff --git a/apps/mobile/share/share.js b/apps/mobile/share/share.js index 14e5f71e6..021ae5aee 100644 --- a/apps/mobile/share/share.js +++ b/apps/mobile/share/share.js @@ -33,7 +33,6 @@ import { SafeAreaView, ScrollView, StatusBar, - Text, TouchableOpacity, View, useWindowDimensions @@ -53,7 +52,6 @@ import Paragraph from "../app/components/ui/typography/paragraph"; import { useDBItem } from "../app/hooks/use-db-item"; import { eSendEvent } from "../app/services/event-manager"; import { FILE_SIZE_LIMIT, IMAGE_SIZE_LIMIT } from "../app/utils/constants"; -import { getElevationStyle } from "../app/utils/elevation"; import { eOnLoadNote } from "../app/utils/events"; import { NoteBundle } from "../app/utils/note-bundle"; import { SIZE } from "../app/utils/size";