Skip to content

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

feat: duplicate/localOnly note

ammarahm-ed28d7c8008372
diff --git a/apps/mobile/src/components/properties/index.js b/apps/mobile/src/components/properties/index.js
index 74c53c1b2..0ce307d1b 100644
--- a/apps/mobile/src/components/properties/index.js
+++ b/apps/mobile/src/components/properties/index.js
@@ -144,6 +144,8 @@ Properties.present = (item, buttons = []) => {
'RemoveTopic',
'History',
'ReadOnly',
+ 'Local only',
+ 'Duplicate',
...android,
...buttons
]);
@@ -161,6 +163,7 @@ Properties.present = (item, buttons = []) => {
props.push(['Add Shortcut', 'Delete', 'Rename Tag']);
break;
}
+ if (!props[0]) return;
presentSheet({
component: (ref, close) => (
<Properties
diff --git a/apps/mobile/src/utils/hooks/useActions.js b/apps/mobile/src/utils/hooks/useActions.js
index 73c96c259..1438a3eb6 100644
--- a/apps/mobile/src/utils/hooks/useActions.js
+++ b/apps/mobile/src/utils/hooks/useActions.js
@@ -453,6 +453,16 @@ export const useActions = ({ close = () => {}, item }) => {
eSendEvent(eOpenExportDialog, [item]);
}
+ async function toggleLocalOnly() {
+ db.notes.note(item.id).localOnly();
+ Navigation.setRoutesToUpdate([
+ Navigation.routeNames.NotesPage,
+ Navigation.routeNames.Favorites,
+ Navigation.routeNames.Notes
+ ]);
+ close();
+ }
+
const toggleReadyOnlyMode = async () => {
await db.notes.note(item.id).readonly();
let current = db.notes.note(item.id).data.readonly;
@@ -468,6 +478,16 @@ export const useActions = ({ close = () => {}, item }) => {
close();
};
+ const duplicateNote = async () => {
+ await db.notes.note(item.id).duplicate();
+ Navigation.setRoutesToUpdate([
+ Navigation.routeNames.NotesPage,
+ Navigation.routeNames.Favorites,
+ Navigation.routeNames.Notes
+ ]);
+ close();
+ };
+
const actions = [
{
name: 'Add to notebook',
@@ -631,12 +651,26 @@ export const useActions = ({ close = () => {}, item }) => {
func: toggleReadyOnlyMode,
on: item.readonly
},
+ {
+ name: 'Local only',
+ title: 'Local only',
+ icon: 'sync-off',
+ func: toggleLocalOnly,
+ on: item.localOnly
+ },
+
{
name: 'History',
title: 'History',
icon: 'history',
func: openHistory
},
+ {
+ name: 'Duplicate',
+ title: 'Duplicate',
+ icon: 'content-duplicate',
+ func: duplicateNote
+ },
{
name: 'Dark Mode',
title: 'Dark mode',