Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: show migration progress

Ammar Ahmed8f2113b15572
diff --git a/apps/mobile/app/components/dialogs/progress/index.tsx b/apps/mobile/app/components/dialogs/progress/index.tsx
index 1afa063b0..985a9d4ac 100644
--- a/apps/mobile/app/components/dialogs/progress/index.tsx
+++ b/apps/mobile/app/components/dialogs/progress/index.tsx
@@ -164,7 +164,7 @@ export default function Progress() {
/>
</View>
- {data?.canHideProgress ? null : (
+ {!data?.canHideProgress ? null : (
<Button
title={cancelCallback.current ? "Cancel" : "Hide"}
type="secondaryAccented"
diff --git a/apps/mobile/app/hooks/use-app-events.tsx b/apps/mobile/app/hooks/use-app-events.tsx
index 46391b632..545207fe9 100644
--- a/apps/mobile/app/hooks/use-app-events.tsx
+++ b/apps/mobile/app/hooks/use-app-events.tsx
@@ -93,6 +93,7 @@ import { sleep } from "../utils/time";
import { NotesnookModule } from "../utils/notesnook-module";
import { changeSystemBarColors } from "../stores/use-theme-store";
import { strings } from "@notesnook/intl";
+import { endProgress, startProgress } from "../components/dialogs/progress";
const onCheckSyncStatus = async (type: SyncStatusEvent) => {
const { disableSync, disableAutoSync } = SettingsService.get();
@@ -577,6 +578,17 @@ export const useAppEvents = () => {
EV.subscribe(EVENTS.uploadCanceled, (data) => {
useAttachmentStore.getState().setUploading(data);
}),
+ EV.subscribe(EVENTS.migrationStarted, () => {
+ startProgress({
+ title: "Migrating Data",
+ paragraph: "Please wait while we migrate your data",
+ canHideProgress: false,
+ fillBackground: true
+ });
+ }),
+ EV.subscribe(EVENTS.migrationFinished, () => {
+ endProgress();
+ }),
EV.subscribe(EVENTS.vaultLocked, async () => {
// Lock all notes in all tabs...
for (const tab of useTabStore.getState().tabs) {
diff --git a/apps/mobile/package-lock.json b/apps/mobile/package-lock.json
index 264dd015a..d9ca94cc9 100644
--- a/apps/mobile/package-lock.json
+++ b/apps/mobile/package-lock.json
@@ -1063,7 +1063,8 @@
"prismjs": "^1.29.0",
"qclone": "^1.2.0",
"rfdc": "^1.3.0",
- "spark-md5": "^3.0.2"
+ "spark-md5": "^3.0.2",
+ "sqlite-better-trigram": "^0.0.1"
},
"devDependencies": {
"@notesnook/crypto": "file:../crypto",
diff --git a/packages/editor-mobile/patches/react-scripts+5.0.1.patch b/packages/editor-mobile/patches/react-scripts+5.0.1.patch
index 243afa735..d3b84f2eb 100644
--- a/packages/editor-mobile/patches/react-scripts+5.0.1.patch
+++ b/packages/editor-mobile/patches/react-scripts+5.0.1.patch
@@ -1,5 +1,5 @@
diff --git a/node_modules/react-scripts/config/webpack.config.js b/node_modules/react-scripts/config/webpack.config.js
-index e465d8e..5e3771c 100644
+index e465d8e..19a2c01 100644
--- a/node_modules/react-scripts/config/webpack.config.js
+++ b/node_modules/react-scripts/config/webpack.config.js
@@ -106,6 +106,9 @@ module.exports = function (webpackEnv) {
@@ -21,7 +21,7 @@ index e465d8e..5e3771c 100644
minimizer: [
// This is only used in production mode
new TerserPlugin({
-@@ -304,6 +307,13 @@ module.exports = function (webpackEnv) {
+@@ -304,6 +307,14 @@ module.exports = function (webpackEnv) {
},
resolve: {
// This allows you to set a fallback for where webpack should look for modules.
@@ -31,11 +31,12 @@ index e465d8e..5e3771c 100644
+ dgram: false,
+ path: false,
+ url: false,
++ fs: false
+ },
// We placed these paths second because we want `node_modules` to "win"
// if there are any conflicts. This matches Node resolution mechanism.
// https://github.com/facebook/create-react-app/issues/253
-@@ -320,13 +330,19 @@ module.exports = function (webpackEnv) {
+@@ -320,13 +331,19 @@ module.exports = function (webpackEnv) {
.map(ext => `.${ext}`)
.filter(ext => useTypeScript || !ext.includes('ts')),
alias: {
@@ -56,7 +57,7 @@ index e465d8e..5e3771c 100644
}),
...(modules.webpackAliases || {}),
},
-@@ -336,14 +352,14 @@ module.exports = function (webpackEnv) {
+@@ -336,14 +353,14 @@ module.exports = function (webpackEnv) {
// To fix this, we prevent you from importing files out of src/ -- if you'd like to,
// please link the files into your node_modules/ and let module-resolution kick in.
// Make sure your source files are compiled, as they will not be processed in any way.
@@ -79,7 +80,7 @@ index e465d8e..5e3771c 100644
],
},
module: {
-@@ -353,7 +369,7 @@ module.exports = function (webpackEnv) {
+@@ -353,7 +370,7 @@ module.exports = function (webpackEnv) {
shouldUseSourceMap && {
enforce: 'pre',
exclude: /@babel(?:\/|\\{1,2})runtime/,
@@ -88,7 +89,7 @@ index e465d8e..5e3771c 100644
loader: require.resolve('source-map-loader'),
},
{
-@@ -408,13 +424,13 @@ module.exports = function (webpackEnv) {
+@@ -408,13 +425,13 @@ module.exports = function (webpackEnv) {
},
],
issuer: {
@@ -104,7 +105,7 @@ index e465d8e..5e3771c 100644
include: paths.appSrc,
loader: require.resolve('babel-loader'),
options: {
-@@ -452,7 +468,7 @@ module.exports = function (webpackEnv) {
+@@ -452,7 +469,7 @@ module.exports = function (webpackEnv) {
plugins: [
isEnvDevelopment &&
shouldUseReactRefresh &&
@@ -113,7 +114,7 @@ index e465d8e..5e3771c 100644
].filter(Boolean),
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
-@@ -460,13 +476,13 @@ module.exports = function (webpackEnv) {
+@@ -460,13 +477,13 @@ module.exports = function (webpackEnv) {
cacheDirectory: true,
// See #6846 for context on why cacheCompression is disabled
cacheCompression: false,
@@ -129,7 +130,7 @@ index e465d8e..5e3771c 100644
exclude: /@babel(?:\/|\\{1,2})runtime/,
loader: require.resolve('babel-loader'),
options: {
-@@ -594,7 +610,7 @@ module.exports = function (webpackEnv) {
+@@ -594,7 +611,7 @@ module.exports = function (webpackEnv) {
// its runtime that would otherwise be processed through "file" loader.
// Also exclude `html` and `json` extensions so they get processed
// by webpacks internal loaders.