A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: fix share extension
Ammar Ahmed54a321cb4c17
diff --git a/apps/mobile/app/common/database/storage.js b/apps/mobile/app/common/database/storage.jsindex d039b344e..456225f0c 100644--- a/apps/mobile/app/common/database/storage.js+++ b/apps/mobile/app/common/database/storage.js@@ -91,7 +91,8 @@ export class KV {}async removeMulti(keys) {- return this.storage.removeItems(...keys);+ if (!keys) return true;+ return this.storage.removeItems(keys);}async clear() {diff --git a/apps/mobile/app/services/notifications.ts b/apps/mobile/app/services/notifications.tsindex 0a10b3926..65b72d6ba 100644--- a/apps/mobile/app/services/notifications.ts+++ b/apps/mobile/app/services/notifications.ts@@ -34,7 +34,7 @@ import NetInfo from "@react-native-community/netinfo";import dayjs, { Dayjs } from "dayjs";import { encodeNonAsciiHTML } from "entities";import { Platform } from "react-native";-import { db } from "../common/database";+import { db, setupDatabase } from "../common/database";import { MMKV } from "../common/database/mmkv";import { presentDialog } from "../components/dialog/functions";import { editorState } from "../screens/editor/tiptap/utils";@@ -96,6 +96,7 @@ function encodeLine(line: string) {async function initDatabase() {if (!db.isInitialized) {+ await setupDatabase();await db.init();}}diff --git a/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj b/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxprojindex 3f0783aeb..636507104 100644--- a/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj+++ b/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj@@ -20,9 +20,9 @@6517B7C22B6838EB0079FF37 /* OpenSans-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7BF2B6838EB0079FF37 /* OpenSans-SemiBold.ttf */; };6517B7C32B6838EB0079FF37 /* OpenSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7C02B6838EB0079FF37 /* OpenSans-Bold.ttf */; };6529A13E279BC4C70048D4A8 /* BootSplash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6529A13D279BC4C70048D4A8 /* BootSplash.storyboard */; };- 656DD2AB2B1891DF00A362EA /* BuildFile in Resources */ = {isa = PBXBuildFile; };- 656DD2AC2B1891DF00A362EA /* BuildFile in Resources */ = {isa = PBXBuildFile; };- 656DD2AD2B1891DF00A362EA /* BuildFile in Resources */ = {isa = PBXBuildFile; };+ 656DD2AB2B1891DF00A362EA /* (null) in Resources */ = {isa = PBXBuildFile; };+ 656DD2AC2B1891DF00A362EA /* (null) in Resources */ = {isa = PBXBuildFile; };+ 656DD2AD2B1891DF00A362EA /* (null) in Resources */ = {isa = PBXBuildFile; };6593E4A3281C345400492C50 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6593E4A2281C345400492C50 /* AppDelegate.mm */; };659BE46725E11A5100E05671 /* notesnook-text.png in Resources */ = {isa = PBXBuildFile; fileRef = 659BE46625E11A5100E05671 /* notesnook-text.png */; };65AA857925E6DDEC00772A01 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65AA857825E6DDEC00772A01 /* WidgetKit.framework */; };@@ -582,9 +582,9 @@isa = PBXResourcesBuildPhase;buildActionMask = 2147483647;files = (- 656DD2AB2B1891DF00A362EA /* BuildFile in Resources */,- 656DD2AC2B1891DF00A362EA /* BuildFile in Resources */,- 656DD2AD2B1891DF00A362EA /* BuildFile in Resources */,+ 656DD2AB2B1891DF00A362EA /* (null) in Resources */,+ 656DD2AC2B1891DF00A362EA /* (null) in Resources */,+ 656DD2AD2B1891DF00A362EA /* (null) in Resources */,65C400DF2A80B6B600AA3DF5 /* MaterialCommunityIcons.ttf in Resources */,65C149872A61151B005C40F1 /* extension.bundle in Resources */,65B5014725A672B200E2D264 /* MainInterface.storyboard in Resources */,@@ -1192,6 +1192,7 @@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";@@ -1380,11 +1381,13 @@CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;CODE_SIGN_IDENTITY = "Apple Development";- CODE_SIGN_STYLE = Automatic;+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";+ CODE_SIGN_STYLE = Manual;COPY_PHASE_STRIP = NO;CURRENT_PROJECT_VERSION = 2077;DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";- DEVELOPMENT_TEAM = 53CWBG3QUC;+ DEVELOPMENT_TEAM = "";+ "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;GCC_C_LANGUAGE_STANDARD = gnu11;INFOPLIST_FILE = NotesWidget/Info.plist;@@ -1399,6 +1402,7 @@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";@@ -1525,11 +1529,13 @@CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;CODE_SIGN_ENTITLEMENTS = "Make Note/Make Note.entitlements";CODE_SIGN_IDENTITY = "Apple Development";- CODE_SIGN_STYLE = Automatic;+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";+ CODE_SIGN_STYLE = Manual;COPY_PHASE_STRIP = NO;CURRENT_PROJECT_VERSION = 2077;DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";- DEVELOPMENT_TEAM = 53CWBG3QUC;+ DEVELOPMENT_TEAM = "";+ "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;GCC_C_LANGUAGE_STANDARD = gnu11;HEADER_SEARCH_PATHS = (@@ -1606,6 +1612,7 @@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/Podfile b/apps/mobile/native/ios/Podfileindex e16ca2b6c..e96694f6e 100644--- a/apps/mobile/native/ios/Podfile+++ b/apps/mobile/native/ios/Podfile@@ -98,6 +98,7 @@ target 'Make Note' dopod "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'+ pod "react-native-theme-switch-animation", :path => '../../node_modules/react-native-theme-switch-animation'enddiff --git a/apps/mobile/native/ios/Podfile.lock b/apps/mobile/native/ios/Podfile.lockindex 5101d268b..1fdc4b00f 100644--- a/apps/mobile/native/ios/Podfile.lock+++ b/apps/mobile/native/ios/Podfile.lock@@ -946,6 +946,6 @@ SPEC CHECKSUMS:toolbar-android: 2a73856e98b750d7e71ce4644d3f41cc98211719Yoga: 1d6727ed193122f6adaf435c3de1a768326ff83b-PODFILE CHECKSUM: 9d0d4fe6f32acea3a0267f9f8ff4dd208803b220+PODFILE CHECKSUM: 10c0cc8b6b8b01431d2b42fc7d21667cf36209f0COCOAPODS: 1.14.2diff --git a/apps/mobile/share/index.js b/apps/mobile/share/index.jsindex e8c377687..f2c9a12bc 100644--- a/apps/mobile/share/index.js+++ b/apps/mobile/share/index.js@@ -17,11 +17,12 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/+import { ScopedThemeProvider } from "@notesnook/theme";import React, { Fragment, useEffect, useState } from "react";import { Modal, Platform } from "react-native";import ShareView from "./share";-import { ScopedThemeProvider } from "@notesnook/theme";import "./store";+const Wrapper = Platform.OS === "android" ? Modal : Fragment;const outerProps =Platform.OS === "android"diff --git a/apps/mobile/share/share.js b/apps/mobile/share/share.jsindex dc1941d17..64d5ffe48 100644--- a/apps/mobile/share/share.js+++ b/apps/mobile/share/share.js@@ -44,7 +44,7 @@ import {} from "react-native-safe-area-context";import Icon from "react-native-vector-icons/MaterialCommunityIcons";import isURL from "validator/lib/isURL";-import { db } from "../app/common/database";+import { DatabaseLogger, db } from "../app/common/database";import Storage from "../app/common/database/storage";import { Button } from "../app/components/ui/button";import Heading from "../app/components/ui/typography/heading";@@ -244,10 +244,14 @@ const ShareView = () => {useEffect(() => {(async () => {- await initDatabase();- setLoadingExtension(false);- loadData();- useShareStore.getState().restore();+ try {+ await initDatabase();+ setLoadingExtension(false);+ loadData();+ useShareStore.getState().restore();+ } catch (e) {+ DatabaseLogger.error(e);+ }})();}, [loadData]);diff --git a/apps/mobile/share/store.js b/apps/mobile/share/store.jsindex 1e77350f3..45f02bc76 100644--- a/apps/mobile/share/store.js+++ b/apps/mobile/share/store.js@@ -20,10 +20,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.import { ThemeDark, ThemeLight, useThemeEngineStore } from "@notesnook/theme";import { Appearance } from "react-native";import create from "zustand";-import { db } from "../app/common/database";+import { db, setupDatabase } from "../app/common/database";import { MMKV } from "../app/common/database/mmkv";+export async function initDatabase() {if (!db.isInitialized) {+ await setupDatabase();await db.init();}}