Compare commits

...

1 Commits

Author SHA1 Message Date
Ammar Ahmed
716af57e40 mobile: fix repack not loading async chunks 2024-10-14 14:12:59 +05:00
4 changed files with 43 additions and 6 deletions

View File

@@ -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,

View File

@@ -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)
};
});

View File

@@ -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"
}
}

View File

@@ -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,