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 repack not loading async chunks
Ammar Ahmed4f9d06737fc1
diff --git a/apps/mobile/app/services/exporter.ts b/apps/mobile/app/services/exporter.tsindex 96a51c0d8..5938a485d 100644--- a/apps/mobile/app/services/exporter.ts+++ b/apps/mobile/app/services/exporter.ts@@ -33,7 +33,7 @@ import {} from "@notesnook/common";import { Note } from "@notesnook/core";import { FilteredSelector } from "@notesnook/core";-import { basename, dirname, join } from "pathe";+import { basename, dirname, join, extname } from "pathe";import downloadAttachment from "../common/filesystem/download-attachment";import { cacheDir } from "../common/filesystem/utils";import { unlockVault } from "../utils/unlock-vault";@@ -326,10 +326,18 @@ async function createFile(await copyFileAsync("file://" + exportedFile, file.uri);filePath = file.uri;} else {- filePath = join(path, basename(noteItem.path));+ const originalPath = join(path, basename(noteItem.path));+ filePath = originalPath;+ const ext = extname(originalPath);+ let id = 1;+ while (await RNFetchBlob.fs.exists(filePath)) {+ filePath = originalPath.replace(`${ext}`, "") + "_" + id + ext;+ id++;+ }+ console.log("path", filePath);await RNFetchBlob.fs.mv(exportedFile, filePath);}-+ console.log("file moved...");return {filePath: filePath,fileDir: path,diff --git a/apps/mobile/native/globals.js b/apps/mobile/native/globals.jsindex ad9cdcb32..35748abb4 100644--- a/apps/mobile/native/globals.js+++ b/apps/mobile/native/globals.js@@ -15,6 +15,7 @@ import { DOMParser } from './worker.js';global.DOMParser = DOMParser;import {setI18nGlobal } from "@notesnook/intl";import { i18n } from "@lingui/core";+import { ScriptManager, Script } from '@callstack/repack/client';import {messages as $en} from "@notesnook/intl/locales/$en.json";@@ -25,3 +26,20 @@ i18n.load({setI18nGlobal(i18n);i18n.activate("en");setI18nGlobal(i18n);+++ScriptManager.shared.addResolver(async (scriptId) => {+ // `scriptId` will be either 'student' or 'teacher'++ // In dev mode, resolve script location to dev server.+ if (__DEV__) {+ return {+ url: Script.getDevServerURL(scriptId),+ cache: false,+ };+ }++ return {+ url: Script.getFileSystemURL(scriptId)+ };+});diff --git a/apps/mobile/native/package.json b/apps/mobile/native/package.jsonindex f98e5bbda..550d586ab 100644--- a/apps/mobile/native/package.json+++ b/apps/mobile/native/package.json@@ -121,6 +121,7 @@"ts-jest": "^29.1.1","webpack-cli": "^5.1.4","webpack": "^5.88.2",- "metro-react-native-babel-preset": "0.77.0"+ "metro-react-native-babel-preset": "0.77.0",+ "acorn-import-attributes": "1.9.5"}}diff --git a/apps/mobile/package-lock.json b/apps/mobile/package-lock.jsonindex ae8d6bfd7..8cc069a6e 100644--- a/apps/mobile/package-lock.json+++ b/apps/mobile/package-lock.json@@ -26,8 +26,7 @@"react": "18.2.0","react-native": "0.74.5","react-native-actions-sheet": "^0.9.7",- "react-native-mmkv-storage": "^0.10.2",- "react-native-privacy-snapshot": "github:standardnotes/react-native-privacy-snapshot"+ "react-native-mmkv-storage": "^0.10.2"},"devDependencies": {"fonteditor-core": "^2.1.11",@@ -29521,6 +29520,7 @@"react-native-notification-sounds": "0.5.5","react-native-orientation": "https://github.com/yamill/react-native-orientation.git","react-native-pdf": "6.6.2",+ "react-native-privacy-snapshot": "github:standardnotes/react-native-privacy-snapshot","react-native-quick-sqlite": "^8.0.6","react-native-reanimated": "3.14.0","react-native-safe-area-context": "^4.10.8",@@ -29558,6 +29558,7 @@"@types/react-test-renderer": "^18.0.0","@typescript-eslint/eslint-plugin": "^5.14.0","@typescript-eslint/parser": "^5.14.0",+ "acorn-import-attributes": "1.9.5","babel-jest": "^29.6.3","babel-loader": "^8.2.5","babel-plugin-module-resolver": "^4.1.0",@@ -35397,6 +35398,15 @@"node": ">=0.4.0"}},+ "node_modules/acorn-import-attributes": {+ "version": "1.9.5",+ "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz",+ "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==",+ "dev": true,+ "peerDependencies": {+ "acorn": "^8"+ }+ },"node_modules/acorn-jsx": {"version": "5.3.2","dev": true,