Skip to content

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

mobile: bulk export all notes

ammarahm-ed25bffe205382
diff --git a/apps/mobile/app/components/sheets/export-notes/index.js b/apps/mobile/app/components/sheets/export-notes/index.js
index 6d97ec010..eb9abeb57 100644
--- a/apps/mobile/app/components/sheets/export-notes/index.js
+++ b/apps/mobile/app/components/sheets/export-notes/index.js
@@ -18,19 +18,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Fragment, useState } from "react";
-import { Platform, StyleSheet, View } from "react-native";
+import { Platform, StyleSheet, View, ActivityIndicator } from "react-native";
import FileViewer from "react-native-file-viewer";
import Share from "react-native-share";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { notesnook } from "../../../../e2e/test.ids";
+import { db } from "../../../common/database";
import { presentSheet, ToastEvent } from "../../../services/event-manager";
import Exporter from "../../../services/exporter";
+import PremiumService from "../../../services/premium";
import { useThemeStore } from "../../../stores/use-theme-store";
import { getElevation } from "../../../utils";
import { ph, pv, SIZE } from "../../../utils/size";
import { sleep } from "../../../utils/time";
import DialogHeader from "../../dialog/dialog-header";
import { Button } from "../../ui/button";
+import { IconButton } from "../../ui/icon-button";
import { PressableButton } from "../../ui/pressable";
import Seperator from "../../ui/seperator";
import Heading from "../../ui/typography/heading";
@@ -41,22 +44,23 @@ const ExportNotesSheet = ({ notes }) => {
const [exporting, setExporting] = useState(false);
const [complete, setComplete] = useState(false);
const [result, setResult] = useState({});
+ const [status, setStatus] = useState(null);
- const save = async (func) => {
+ const save = async (type) => {
if (exporting) return;
+ if (!PremiumService.get() && type !== "txt") return;
setExporting(true);
setComplete(false);
- let res;
- for (var i = 0; i < notes.length; i++) {
- let note = notes[i];
- res = await func(note);
- if (!res) {
- setExporting(false);
- return;
- }
+ let result;
+ if (notes.length > 1) {
+ result = await Exporter.bulkExport(notes, type, setStatus);
+ } else {
+ result = await Exporter.exportNote(notes[0], type);
+ await sleep(1000);
}
+ if (!result) return setExporting(false);
- setResult(res);
+ setResult(result);
setComplete(true);
setExporting(false);
};
@@ -65,7 +69,7 @@ const ExportNotesSheet = ({ notes }) => {
{
title: "PDF",
func: async () => {
- await save(Exporter.saveToPDF, "PDF");
+ await save("pdf");
},
icon: "file-pdf-box",
desc: "Can be opened in a pdf reader like Adobe or Foxit Reader",
@@ -74,7 +78,7 @@ const ExportNotesSheet = ({ notes }) => {
{
title: "Markdown",
func: async () => {
- await save(Exporter.saveToMarkdown, "Markdown");
+ await save("md");
},
icon: "language-markdown",
desc: "Can be opened in any text or markdown editor",
@@ -83,7 +87,7 @@ const ExportNotesSheet = ({ notes }) => {
{
title: "Plain Text",
func: async () => {
- await save(Exporter.saveToText, "Text");
+ await save("txt");
},
icon: "card-text",
desc: "Can be opened in any text editor",
@@ -92,7 +96,7 @@ const ExportNotesSheet = ({ notes }) => {
{
title: "HTML",
func: async () => {
- await save(Exporter.saveToHTML, "Html");
+ await save("html");
},
icon: "language-html5",
desc: "Can be opened in any web browser",
@@ -102,151 +106,209 @@ const ExportNotesSheet = ({ notes }) => {
return (
<View>
- <View
- style={{
- paddingHorizontal: 12
- }}
- >
- <DialogHeader
- icon="export"
- title="Export Note"
- paragraph={
- "All exports are saved in Notesnook/exported folder in phone storage"
- }
- />
- </View>
+ {!complete && !exporting ? (
+ <>
+ <View
+ style={{
+ paddingHorizontal: 12
+ }}
+ >
+ <DialogHeader
+ icon="export"
+ title={notes.length > 1 ? "Export Notes" : "Export Note"}
+ paragraph={`All exports are saved in ${
+ Platform.OS === "android"
+ ? "the selected"
+ : "Notesnook/exported"
+ } folder in phone storage`}
+ />
+ </View>
+
+ <Seperator half />
+ </>
+ ) : null}
- <Seperator half />
<View style={styles.buttonContainer}>
- {actions.map((item) => (
- <Fragment key={item.title}>
- <Seperator half />
- <PressableButton
- onPress={item.func}
- customStyle={{
- width: "100%",
- alignItems: "center",
- flexDirection: "row",
- paddingRight: 12,
- paddingVertical: 10,
- justifyContent: "flex-start",
- borderRadius: 0,
- paddingHorizontal: 12
- }}
- >
- <View
- style={{
- backgroundColor: colors.shade,
- borderRadius: 5,
- height: 60,
- width: 60,
- justifyContent: "center",
- alignItems: "center"
+ {!exporting && !complete ? (
+ actions.map((item) => (
+ <Fragment key={item.title}>
+ <Seperator half />
+ <PressableButton
+ onPress={item.func}
+ customStyle={{
+ width: "100%",
+ alignItems: "center",
+ flexDirection: "row",
+ paddingRight: 12,
+ paddingVertical: 10,
+ justifyContent: "flex-start",
+ borderRadius: 0,
+ paddingHorizontal: 12
}}
>
- <Icon
- name={item.icon}
- color={colors.accent}
- size={SIZE.xxxl + 10}
+ <View
+ style={{
+ backgroundColor: colors.shade,
+ borderRadius: 5,
+ height: 60,
+ width: 60,
+ justifyContent: "center",
+ alignItems: "center"
+ }}
+ >
+ <Icon
+ name={item.icon}
+ color={colors.accent}
+ size={SIZE.xxxl + 10}
+ />
+ </View>
+ <View
+ style={{
+ flexShrink: 1
+ }}
+ >
+ <Heading style={{ marginLeft: 10 }} size={SIZE.md}>
+ {item.title}
+ </Heading>
+ <Paragraph
+ style={{ marginLeft: 10 }}
+ size={SIZE.sm}
+ color={colors.icon}
+ >
+ {item.desc}
+ </Paragraph>
+ </View>
+ </PressableButton>
+ </Fragment>
+ ))
+ ) : (
+ <View
+ style={{
+ minHeight: 150,
+ justifyContent: "center",
+ alignItems: "center",
+ width: "100%",
+ paddingHorizontal: 12,
+ paddingVertical: 20
+ }}
+ >
+ {!complete ? (
+ <>
+ <ActivityIndicator />
+ <Paragraph>
+ {notes.length === 1
+ ? "Exporting note... Please wait"
+ : `Exporting notes${
+ status ? ` (${status})` : ``
+ }... Please wait`}
+ </Paragraph>
+ </>
+ ) : (
+ <>
+ <IconButton
+ name="export"
+ color={colors.icon}
+ size={50}
+ customStyle={{
+ width: 70,
+ height: 70
+ }}
/>
- </View>
- <View
- style={{
- flexShrink: 1
- }}
- >
- <Heading style={{ marginLeft: 10 }} size={SIZE.md}>
- {item.title}
+ <Heading
+ style={{
+ textAlign: "center",
+ marginTop: 10
+ }}
+ color={colors.icon}
+ >
+ {notes.length > 1 ? "Notes exported" : "Note exported"}
</Heading>
<Paragraph
- style={{ marginLeft: 10 }}
- size={SIZE.sm}
- color={colors.icon}
+ style={{
+ textAlign: "center"
+ }}
>
- {item.desc}
+ Your {notes.length > 1 ? "notes are" : "note is"} exported
+ successfully as {result.fileName}
</Paragraph>
- </View>
- </PressableButton>
- </Fragment>
- ))}
-
- <View
- style={{
- width: "100%",
- paddingHorizontal: 12,
- marginTop: 10
- }}
- >
- {complete && (
- <>
- <Button
- title="Open"
- type="accent"
- width="100%"
- fontSize={SIZE.md}
- onPress={async () => {
- close();
- await sleep(500);
- FileViewer.open(result.filePath, {
- showOpenWithDialog: true,
- showAppsSuggestions: true
- }).catch(() => {
- ToastEvent.show({
- heading: "Cannot open",
- message: `No application found to open ${result.name} file.`,
- type: "success",
- context: "local"
- });
- });
- }}
- height={50}
- />
- <Button
- title="Share"
- type="shade"
- width="100%"
- fontSize={SIZE.md}
- style={{
- marginTop: 10
- }}
- onPress={async () => {
- if (Platform.OS === "ios") {
- Share.open({
- url: result.filePath
- }).catch(console.log);
- } else {
+ <Button
+ title="Open"
+ type="accent"
+ width={250}
+ fontSize={SIZE.md}
+ style={{
+ marginTop: 10,
+ borderRadius: 100
+ }}
+ onPress={async () => {
+ close();
+ await sleep(500);
FileViewer.open(result.filePath, {
showOpenWithDialog: true,
- showAppsSuggestions: true,
- shareFile: true
- }).catch(console.log);
- }
- }}
- height={50}
- />
- </>
- )}
- {complete && (
- <Paragraph
- style={{
- textAlign: "center",
- marginTop: 5
- }}
- color={colors.icon}
- size={SIZE.xs}
- >
- {"Note exported as " + result.fileName}
- </Paragraph>
- )}
- </View>
+ showAppsSuggestions: true
+ }).catch(() => {
+ ToastEvent.show({
+ heading: "Cannot open",
+ message: `No application found to open ${result.name} file.`,
+ type: "success",
+ context: "local"
+ });
+ });
+ }}
+ height={50}
+ />
+ <Button
+ title="Share"
+ type="grayAccent"
+ width={250}
+ fontSize={SIZE.md}
+ style={{
+ marginTop: 10,
+ borderRadius: 100
+ }}
+ onPress={async () => {
+ if (Platform.OS === "ios") {
+ Share.open({
+ url: result.filePath
+ }).catch(console.log);
+ } else {
+ FileViewer.open(result.filePath, {
+ showOpenWithDialog: true,
+ showAppsSuggestions: true,
+ shareFile: true
+ }).catch(console.log);
+ }
+ }}
+ height={50}
+ />
+ <Button
+ title="Export in another format"
+ type="grayAccent"
+ width={250}
+ fontSize={SIZE.md}
+ style={{
+ marginTop: 10,
+ borderRadius: 100
+ }}
+ onPress={async () => {
+ setComplete(false);
+ setResult(null);
+ setExporting(false);
+ }}
+ height={50}
+ />
+ </>
+ )}
+ </View>
+ )}
</View>
</View>
);
};
-ExportNotesSheet.present = (note) => {
+ExportNotesSheet.present = (note, allNotes) => {
presentSheet({
- component: <ExportNotesSheet notes={[note]} />
+ component: <ExportNotesSheet notes={allNotes ? db.notes.all : [note]} />
});
};
diff --git a/apps/mobile/app/package.json b/apps/mobile/app/package.json
index 74a021d8f..39e0eb890 100644
--- a/apps/mobile/app/package.json
+++ b/apps/mobile/app/package.json
@@ -25,7 +25,8 @@
"toggle-switch-react-native": "3.2.0",
"url": "^0.11.0",
"validator": "^13.5.2",
- "zustand": "^3.6.0"
+ "zustand": "^3.6.0",
+ "fflate": "^0.7.3"
},
"sideEffects": false
}
diff --git a/apps/mobile/app/screens/settings/settings-data.tsx b/apps/mobile/app/screens/settings/settings-data.tsx
index 0c8fc5b16..e90f5de24 100644
--- a/apps/mobile/app/screens/settings/settings-data.tsx
+++ b/apps/mobile/app/screens/settings/settings-data.tsx
@@ -20,12 +20,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import dayjs from "dayjs";
import React from "react";
import { Linking, Platform } from "react-native";
+import { getVersion } from "react-native-device-info";
import * as RNIap from "react-native-iap";
import { enabled } from "react-native-privacy-snapshot";
import { db } from "../../common/database";
import { MMKV } from "../../common/database/mmkv";
import { ChangePassword } from "../../components/auth/change-password";
import { presentDialog } from "../../components/dialog/functions";
+import ExportNotesSheet from "../../components/sheets/export-notes";
import { Issue } from "../../components/sheets/github/issue";
import { Progress } from "../../components/sheets/progress";
import { Update } from "../../components/sheets/update";
@@ -65,7 +67,6 @@ import { useDragState } from "./editor/state";
import { verifyUser } from "./functions";
import { SettingSection } from "./types";
import { getTimeLeft } from "./user-section";
-import { getVersion } from "react-native-device-info";
export const settingsGroups: SettingSection[] = [
{
@@ -748,6 +749,16 @@ export const settingsGroups: SettingSection[] = [
}
eSendEvent(eOpenRestoreDialog);
}
+ },
+ {
+ id: "export-notes",
+ name: "Export all notes",
+ icon: "export",
+ description:
+ "Export all notes as pdf, markdown, html or text in a single zip file",
+ modifer: () => {
+ ExportNotesSheet.present(undefined, true);
+ }
}
]
},
diff --git a/apps/mobile/app/services/exporter.js b/apps/mobile/app/services/exporter.js
index 85baef73e..4cf0ad267 100644
--- a/apps/mobile/app/services/exporter.js
+++ b/apps/mobile/app/services/exporter.js
@@ -18,15 +18,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { decode, EntityLevel } from "entities";
+import { zip } from "fflate";
import { Platform } from "react-native";
import RNHTMLtoPDF from "react-native-html-to-pdf-lite";
import * as ScopedStorage from "react-native-scoped-storage";
import RNFetchBlob from "rn-fetch-blob";
+import { db } from "../common/database/index";
+import Storage from "../common/database/storage";
import { toTXT } from "../utils";
import { sanitizeFilename } from "../utils/sanitizer";
-import Storage from "../common/database/storage";
-import {db} from "../common/database/index";
-
+import { sleep } from "../utils/time";
const defaultStyle = `<style>
.img_size_one {
width:100%;
@@ -331,6 +332,20 @@ hr {
</style>`;
+const MIMETypes = {
+ txt: "text/plain",
+ pdf: "application/pdf",
+ md: "text/markdown",
+ html: "text/html"
+};
+
+const FolderNames = {
+ txt: "Text",
+ pdf: "PDF",
+ md: "Markdown",
+ html: "Html"
+};
+
async function releasePermissions(path) {
if (Platform.OS === "ios") return;
const uris = await ScopedStorage.getPersistedUriPermissions();
@@ -341,197 +356,218 @@ async function releasePermissions(path) {
}
}
-async function saveToPDF(note) {
- let androidSavePath = "/Notesnook/exported/PDF";
- if (Platform.OS === "android") {
- let file = await ScopedStorage.openDocumentTree(true);
- if (!file) return;
- androidSavePath = file.uri;
- }
-
- Platform.OS === "ios" && (await Storage.checkAndCreateDir("/exported/PDF/"));
- let html = await db.notes.note(note.id).export("html");
- html = decode(html, {
- level: EntityLevel.HTML
- });
- let fileName = sanitizeFilename(note.title + Date.now(), {
- replacement: "_"
- });
- let html3 = html;
- if (html.indexOf("<head>") > -1) {
- let html1 = html.substring(0, html.indexOf("<head>") + 6);
- let html2 = html.substring(html.indexOf("<head>") + 6);
- html3 = html1 + defaultStyle + html2;
- }
-
- let options = {
- html: html3,
- fileName: Platform.OS === "ios" ? "/exported/PDF/" + fileName : fileName,
- width: 595,
- height: 852,
- bgColor: "#FFFFFF",
- padding: 30,
- base64: Platform.OS === "android"
- };
- if (Platform.OS === "ios") {
- options.directory = "Documents";
- }
- let res = await RNHTMLtoPDF.convert(options);
-
- let fileUri;
- if (Platform.OS === "android") {
- fileUri = await ScopedStorage.writeFile(
- androidSavePath,
- res.base64,
- fileName,
- "application/pdf",
- "base64",
- false
- );
-
- if (res.filePath) {
- await RNFetchBlob.fs.unlink(res.filePath);
- }
- }
-
- await releasePermissions(androidSavePath);
-
- return {
- filePath: fileUri || res.filePath,
- type: "application/pdf",
- name: "PDF",
- fileName: fileName
- };
-}
-
-async function saveToMarkdown(note) {
+/**
+ *
+ * @param {"Text" | "PDF" | "Markdown" | "Html" } type
+ * @returns
+ */
+async function getPath(type) {
let path =
Platform.OS === "ios" &&
- (await Storage.checkAndCreateDir("/exported/Markdown/"));
+ (await Storage.checkAndCreateDir(`/exported/${type}/`));
+
if (Platform.OS === "android") {
let file = await ScopedStorage.openDocumentTree(true);
if (!file) return;
path = file.uri;
}
-
- let markdown = await db.notes.note(note.id).export("md");
- let fileName = sanitizeFilename(note.title + Date.now(), {
- replacement: "_"
- });
-
- let fileUri;
+ return path;
+}
+
+/**
+ *
+ * @param {string} path
+ * @param {string} data
+ * @param {string} title
+ * @param {"txt" | "pdf" | "md" | "html"} extension
+ * @returns
+ */
+async function save(path, data, fileName, extension) {
+ let uri;
if (Platform.OS === "android") {
- fileUri = await ScopedStorage.writeFile(
+ uri = await ScopedStorage.writeFile(
path,
- markdown,
- fileName + ".md",
- "text/markdown",
+ data,
+ fileName + `.${extension}`,
+ MIMETypes[extension],
"utf8",
false
);
await releasePermissions(path);
} else {
- path = path + fileName + ".md";
- await RNFetchBlob.fs.writeFile(path, markdown, "utf8");
+ path = path + fileName + `.${extension}`;
+ await RNFetchBlob.fs.writeFile(path, data, "utf8");
}
-
- return {
- filePath: fileUri || path,
- type: "text/markdown",
- name: "Markdown",
- fileName: fileName
- };
+ return uri || path;
}
-async function saveToText(note) {
- let path =
- Platform.OS === "ios" &&
- (await Storage.checkAndCreateDir("/exported/Text/"));
- if (Platform.OS === "android") {
- let file = await ScopedStorage.openDocumentTree(true);
- if (!file) return;
- path = file.uri;
+async function makeHtml(note) {
+ let html = await db.notes.note(note.id).export("html");
+ html = decode(html, {
+ level: EntityLevel.HTML
+ });
+ if (html.indexOf("<head>") > -1) {
+ let chunk1 = html.substring(0, html.indexOf("<head>") + 6);
+ let chunk2 = html.substring(html.indexOf("<head>") + 6);
+ html = chunk1 + defaultStyle + chunk2;
}
+ return html;
+}
+
+/**
+ *
+ * @param {"txt" | "pdf" | "md" | "html"} type
+ */
+async function exportAs(type, note, bulk) {
+ console.log(type, "type");
+ let data;
+ switch (type) {
+ case "html":
+ {
+ data = await makeHtml(note);
+ console.log("html created", data);
+ }
+ break;
+ case "md":
+ data = await db.notes.note(note.id).export("md");
+ break;
+ case "pdf":
+ {
+ let html = await makeHtml(note);
+ let fileName = sanitizeFilename(note.title + Date.now(), {
+ replacement: "_"
+ });
+
+ let options = {
+ html: html,
+ fileName:
+ Platform.OS === "ios" ? "/exported/PDF/" + fileName : fileName,
+ width: 595,
+ height: 852,
+ bgColor: "#FFFFFF",
+ padding: 30,
+ base64: bulk || Platform.OS === "android"
+ };
+ if (Platform.OS === "ios") {
+ options.directory = "Documents";
+ }
+ let res = await RNHTMLtoPDF.convert(options);
+ data = !bulk && Platform.OS === "ios" ? res.filePath : res.base64;
+ if (bulk && res.filePath) {
+ RNFetchBlob.fs.unlink(res.filePath);
+ }
+ }
+ break;
+ case "txt":
+ data = await toTXT(note);
+ break;
+ }
+
+ return data;
+}
+
+/**
+ *
+ * @param {"txt" | "pdf" | "md" | "html"} type
+ */
+async function exportNote(note, type) {
+ let path = await getPath(FolderNames[type]);
+ if (!path) return;
+ let result = await exportAs(type, note);
- let text = await toTXT(note);
let fileName = sanitizeFilename(note.title + Date.now(), {
replacement: "_"
});
- let fileUri;
- if (Platform.OS === "android") {
- fileUri = await ScopedStorage.writeFile(
- path,
- text,
- fileName + ".txt",
- "text/plain",
- "utf8",
- false
- );
- await releasePermissions(path);
+ if (type === "pdf" && Platform.OS === "ios") {
+ path = result;
} else {
- path = path + fileName + ".txt";
- await RNFetchBlob.fs.writeFile(path, text, "utf8");
+ path = await save(path, result, fileName, type);
}
return {
- filePath: fileUri || path,
+ filePath: path,
type: "text/plain",
name: "Text",
- fileName: fileName
+ fileName: fileName + `.${type}`
};
}
-async function saveToHTML(note) {
- let path =
- Platform.OS === "ios" &&
- (await Storage.checkAndCreateDir("/exported/Html/"));
- if (Platform.OS === "android") {
- let file = await ScopedStorage.openDocumentTree(true);
- if (!file) return;
- path = file.uri;
- }
+function copyFileAsync(source, dest) {
+ return new Promise((resolve) => {
+ ScopedStorage.copyFile(source, dest, () => {
+ resolve();
+ });
+ });
+}
- let html = await db.notes.note(note.id).export("html");
- let fileName = sanitizeFilename(note.title + Date.now(), {
- replacement: "_"
+function zipAsync(results) {
+ return new Promise((resolve) => {
+ zip(results, (err, data) => {
+ resolve(Buffer.from(data.buffer).toString("base64"));
+ });
});
- let html3 = html;
- if (html.indexOf("<head>") > -1) {
- let html1 = html.substring(0, html.indexOf("<head>") + 6);
- let html2 = html.substring(html.indexOf("<head>") + 6);
- html3 = html1 + defaultStyle + html2;
- }
+}
- let fileUri;
- if (Platform.OS === "android") {
- fileUri = await ScopedStorage.writeFile(
- path,
- html3,
- fileName + ".html",
- "text/html",
- "utf8",
- false
+/**
+ *
+ * @param {"txt" | "pdf" | "md" | "html"} type
+ */
+async function bulkExport(notes, type, callback) {
+ let path = await getPath(FolderNames[type]);
+ if (!path) return;
+
+ const results = {};
+ for (var i = 0; i < notes.length; i++) {
+ await sleep(1);
+ let note = notes[i];
+ let result = await exportAs(type, note);
+ let fileName = sanitizeFilename(note.title + Date.now(), {
+ replacement: "_"
+ });
+ results[fileName + `.${type}`] = Buffer.from(
+ result,
+ type === "pdf" ? "base64" : "utf-8"
);
- await releasePermissions(path);
- } else {
- path = path + fileName + ".html";
- await RNFetchBlob.fs.writeFile(path, html3, "utf8");
+ callback(`${i + 1}/${notes.length}`);
+ }
+ callback("zipping");
+ await sleep(1);
+ const zipped = await zipAsync(results);
+ const fileName = `nn-export-all-${type}-${Date.now()}.zip`;
+ callback("saving to disk");
+ await sleep(1);
+ try {
+ if (Platform.OS === "ios") {
+ RNFetchBlob.fs.writeFile(path + `/${fileName}`, zipped, "base64");
+ } else {
+ const templFile = RNFetchBlob.fs.dirs.CacheDir + `/${fileName}`;
+ await RNFetchBlob.fs.writeFile(templFile, zipped, "base64");
+ const file = await ScopedStorage.createFile(
+ path,
+ fileName,
+ "application/zip"
+ );
+ path = file.uri;
+ await copyFileAsync("file://" + templFile, path);
+ await RNFetchBlob.fs.unlink(templFile);
+ callback();
+ }
+ } catch (e) {
+ console.log(e, "error");
}
return {
- filePath: fileUri || path,
- type: "text/html",
- name: "Html",
+ filePath: path,
+ type: "application/zip",
+ name: "zip",
fileName: fileName
};
}
const Exporter = {
- saveToHTML,
- saveToText,
- saveToMarkdown,
- saveToPDF
+ exportNote,
+ bulkExport
};
export default Exporter;
diff --git a/apps/mobile/app/services/premium.js b/apps/mobile/app/services/premium.js
index bc30575ad..bdedcb685 100644
--- a/apps/mobile/app/services/premium.js
+++ b/apps/mobile/app/services/premium.js
@@ -95,7 +95,7 @@ async function getProducts() {
}
function get() {
- //if (__DEV__ || Config.isTesting) return true;
+ if (__DEV__ || Config.isTesting) return true;
return SUBSCRIPTION_STATUS.BASIC !== premiumStatus;
}
diff --git a/apps/mobile/native/package.json b/apps/mobile/native/package.json
index 1b993c030..34aad1fb0 100644
--- a/apps/mobile/native/package.json
+++ b/apps/mobile/native/package.json
@@ -53,7 +53,8 @@
"react-native-vector-icons": "^9.0.0",
"react-native-webview": "^11.14.1",
"rn-extensions-share": "^2.4.0",
- "rn-fetch-blob": "^0.12.0"
+ "rn-fetch-blob": "^0.12.0",
+ "react-native-zip-archive": "6.0.8"
},
"devDependencies": {
"@babel/core": "^7.12.9",
diff --git a/apps/mobile/package-lock.json b/apps/mobile/package-lock.json
index 3229342ce..8ebdc024c 100644
--- a/apps/mobile/package-lock.json
+++ b/apps/mobile/package-lock.json
@@ -13,6 +13,7 @@
"app/"
],
"dependencies": {
+ "fflate": "^0.7.3",
"react-native-actions-shortcuts": "^1.0.1",
"react-native-fingerprint-scanner": "https://github.com/ammarahm-ed/react-native-fingerprint-scanner.git"
},
@@ -32,6 +33,7 @@
"buffer": "^6.0.3",
"dayjs": "^1.10.4",
"entities": "^3.0.1",
+ "fflate": "^0.7.3",
"html-to-text": "8.1.0",
"phone": "^3.1.14",
"qclone": "^1.1.0",
@@ -102,6 +104,7 @@
"react-native-tooltips": "^1.0.3",
"react-native-vector-icons": "^9.0.0",
"react-native-webview": "^11.14.1",
+ "react-native-zip-archive": "6.0.8",
"rn-extensions-share": "^2.4.0",
"rn-fetch-blob": "^0.12.0"
},
@@ -10132,6 +10135,11 @@
"bser": "2.1.1"
}
},
+ "node_modules/fflate": {
+ "version": "0.7.4",
+ "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.7.4.tgz",
+ "integrity": "sha512-5u2V/CDW15QM1XbbgS+0DfPxVB+jUKhWEKuuFuHncbk3tEEqzmoXL+2KyOFuKGqOnmdIy0/davWF1CkuwtibCw=="
+ },
"node_modules/file-entry-cache": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
@@ -18484,6 +18492,15 @@
"node": ">=8"
}
},
+ "node_modules/react-native-zip-archive": {
+ "version": "6.0.8",
+ "resolved": "https://registry.npmjs.org/react-native-zip-archive/-/react-native-zip-archive-6.0.8.tgz",
+ "integrity": "sha512-Rpy9VlvR7cOQWipMA/UXD8LDV0Q7V80DCKF2ItU5jd2IRishFWrgwHGx7M7OVhbdAwquRMEh9I+UCXdl3QKPxw==",
+ "peerDependencies": {
+ "react": ">=16.8.6",
+ "react-native": ">=0.60.0"
+ }
+ },
"node_modules/react-native/node_modules/react-refresh": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.4.3.tgz",
@@ -24138,6 +24155,7 @@
"buffer": "^6.0.3",
"dayjs": "^1.10.4",
"entities": "^3.0.1",
+ "fflate": "^0.7.3",
"html-to-text": "8.1.0",
"phone": "^3.1.14",
"qclone": "^1.1.0",
@@ -24240,6 +24258,7 @@
"react-native-tooltips": "^1.0.3",
"react-native-vector-icons": "^9.0.0",
"react-native-webview": "^11.14.1",
+ "react-native-zip-archive": "6.0.8",
"react-test-renderer": "18.0.0",
"rn-extensions-share": "^2.4.0",
"rn-fetch-blob": "^0.12.0",
@@ -28824,6 +28843,11 @@
"bser": "2.1.1"
}
},
+ "fflate": {
+ "version": "0.7.4",
+ "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.7.4.tgz",
+ "integrity": "sha512-5u2V/CDW15QM1XbbgS+0DfPxVB+jUKhWEKuuFuHncbk3tEEqzmoXL+2KyOFuKGqOnmdIy0/davWF1CkuwtibCw=="
+ },
"file-entry-cache": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
@@ -35057,6 +35081,11 @@
}
}
},
+ "react-native-zip-archive": {
+ "version": "6.0.8",
+ "resolved": "https://registry.npmjs.org/react-native-zip-archive/-/react-native-zip-archive-6.0.8.tgz",
+ "integrity": "sha512-Rpy9VlvR7cOQWipMA/UXD8LDV0Q7V80DCKF2ItU5jd2IRishFWrgwHGx7M7OVhbdAwquRMEh9I+UCXdl3QKPxw=="
+ },
"react-refresh": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.0.tgz",
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index a9306ba7e..328c48b56 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -31,6 +31,7 @@
"@notesnook/editor": "*",
"@notesnook/editor-mobile": "*",
"react-native-actions-shortcuts": "^1.0.1",
- "react-native-fingerprint-scanner": "https://github.com/ammarahm-ed/react-native-fingerprint-scanner.git"
+ "react-native-fingerprint-scanner": "https://github.com/ammarahm-ed/react-native-fingerprint-scanner.git",
+ "fflate": "^0.7.3"
}
}
\ No newline at end of file