diff --git a/apps/mobile/android/app/build.gradle b/apps/mobile/android/app/build.gradle index 8d629d0aa..7cc709a78 100644 --- a/apps/mobile/android/app/build.gradle +++ b/apps/mobile/android/app/build.gradle @@ -140,7 +140,7 @@ android { if (project.hasProperty("prBuildNumber")) { versionCode Integer.parseInt(prBuildNumber()) } else { - versionCode 3112 + versionCode 3113 } versionName getNpmVersion() testBuildType System.getProperty('testBuildType', 'debug') diff --git a/apps/mobile/android/releasenotes/whatsnew-en-US b/apps/mobile/android/releasenotes/whatsnew-en-US index 7109ee11e..0454f523e 100644 --- a/apps/mobile/android/releasenotes/whatsnew-en-US +++ b/apps/mobile/android/releasenotes/whatsnew-en-US @@ -1,3 +1,4 @@ +- Add option to clear note version history - Minor bug fixes and improvements Thank you for using Notesnook! diff --git a/apps/mobile/app/components/note-history/index.tsx b/apps/mobile/app/components/note-history/index.tsx index 92a3c7c55..c7a9bedf1 100644 --- a/apps/mobile/app/components/note-history/index.tsx +++ b/apps/mobile/app/components/note-history/index.tsx @@ -45,11 +45,13 @@ import { Dialog } from "../dialog"; const HistoryItem = ({ index, items, - note + note, + refresh }: { index: number; items?: VirtualizedGrouping; note: Note; + refresh: () => void; }) => { const [item] = useDBItem(index, "noteHistory", items); const { colors } = useThemeColors(); @@ -60,8 +62,9 @@ const HistoryItem = ({ const _start_time = getFormattedDate(start, "time"); const _end_time = getFormattedDate(end + 60000, "time"); - return `${_start_date} ${_start_time} - ${_end_date === _start_date ? " " : _end_date + " " - }${_end_time}`; + return `${_start_date} ${_start_time} - ${ + _end_date === _start_date ? " " : _end_date + " " + }${_end_time}`; }; const preview = useCallback( @@ -76,12 +79,13 @@ const HistoryItem = ({ }} content={content} note={note} + update={refresh} /> ), context: "note_history" }); }, - [note] + [note, refresh] ); return ( @@ -123,7 +127,7 @@ export default function NoteHistory({ const [_loading, setLoading] = useState(true); const { colors } = useThemeColors(); - useEffect(() => { + const refresh = useCallback(() => { db.noteHistory .get(note.id) .sorted({ @@ -139,11 +143,20 @@ export default function NoteHistory({ }); }, [note.id]); + useEffect(() => { + refresh(); + }, [refresh]); + const renderItem = useCallback( ({ index }: { index: number }) => ( - + ), - [history, note] + [history, note, refresh] ); return ( @@ -156,27 +169,27 @@ export default function NoteHistory({ button={ history?.placeholders.length ? { - title: strings.clearHistory(), - type: "secondary", - onPress: () => { - presentDialog({ - title: strings.clearHistory(), - paragraph: strings.clearHistoryConfirmation(), - positiveText: strings.clear(), - negativeText: strings.cancel(), - positiveType: "errorShade", - context: "local", - positivePress: async () => { - await db.noteHistory.clearSessions(note.id); - fwdRef.current?.hide(); - ToastManager.show({ - heading: strings.historyCleared(), - type: "success" - }); - } - }); + title: strings.clearHistory(), + type: "secondary", + onPress: () => { + presentDialog({ + title: strings.clearHistory(), + paragraph: strings.clearHistoryConfirmation(), + positiveText: strings.clear(), + negativeText: strings.cancel(), + positiveType: "errorShade", + context: "local", + positivePress: async () => { + await db.noteHistory.clearSessions(note.id); + fwdRef.current?.hide(); + ToastManager.show({ + heading: strings.historyCleared(), + type: "success" + }); + } + }); + } } - } : undefined } /> diff --git a/apps/mobile/app/components/note-history/preview.tsx b/apps/mobile/app/components/note-history/preview.tsx index 59f70a029..a92afc887 100644 --- a/apps/mobile/app/components/note-history/preview.tsx +++ b/apps/mobile/app/components/note-history/preview.tsx @@ -53,7 +53,8 @@ import { export default function NotePreview({ session, content, - note + note, + update }: { session?: HistorySession & { session: string }; content: @@ -64,6 +65,7 @@ export default function NotePreview({ > | undefined; note: TrashOrItem; + update?: () => void; }) { const { colors } = useThemeColors(); const [locked, setLocked] = useState(false); @@ -120,19 +122,22 @@ export default function NotePreview({ positivePress: async () => { if (isSession) { await db.noteHistory.remove(session.id); + update?.(); eSendEvent(eCloseSheet, "note_history"); Navigation.queueRoutesForUpdate(); } else if (note.type === "trash") { await db.trash.delete(note.id); useTrashStore.getState().refresh(); useSelectionStore.getState().setSelectionMode(); + eSendEvent(eCloseSheet); } ToastManager.show({ heading: isSession ? strings.versionDeleted() : strings.noteDeleted(), - type: "success" + type: "success", + context: isSession ? "local" : "global" }); - eSendEvent(eCloseSheet); + return true; }, positiveType: "error" }); diff --git a/apps/mobile/ios/build-configs/ios-build.active.xcconfig b/apps/mobile/ios/build-configs/ios-build.active.xcconfig index 5942b744b..4d0ea7252 100644 --- a/apps/mobile/ios/build-configs/ios-build.active.xcconfig +++ b/apps/mobile/ios/build-configs/ios-build.active.xcconfig @@ -1,6 +1,6 @@ // Production iOS build identifiers -IOS_CURRENT_PROJECT_VERSION = 2190 -IOS_MARKETING_VERSION = 3.4.6 +IOS_CURRENT_PROJECT_VERSION = 2191 +IOS_MARKETING_VERSION = 3.4.7 IOS_MAIN_BUNDLE_ID = org.streetwriters.notesnook IOS_WIDGET_BUNDLE_ID = org.streetwriters.notesnook.notewidget IOS_SHARE_BUNDLE_ID = org.streetwriters.notesnook.share diff --git a/apps/mobile/ios/build-configs/ios-build.production.xcconfig b/apps/mobile/ios/build-configs/ios-build.production.xcconfig index 5942b744b..4d0ea7252 100644 --- a/apps/mobile/ios/build-configs/ios-build.production.xcconfig +++ b/apps/mobile/ios/build-configs/ios-build.production.xcconfig @@ -1,6 +1,6 @@ // Production iOS build identifiers -IOS_CURRENT_PROJECT_VERSION = 2190 -IOS_MARKETING_VERSION = 3.4.6 +IOS_CURRENT_PROJECT_VERSION = 2191 +IOS_MARKETING_VERSION = 3.4.7 IOS_MAIN_BUNDLE_ID = org.streetwriters.notesnook IOS_WIDGET_BUNDLE_ID = org.streetwriters.notesnook.notewidget IOS_SHARE_BUNDLE_ID = org.streetwriters.notesnook.share diff --git a/apps/mobile/ios/build-configs/ios-build.staging.xcconfig b/apps/mobile/ios/build-configs/ios-build.staging.xcconfig index 16a0c1aef..2404c2515 100644 --- a/apps/mobile/ios/build-configs/ios-build.staging.xcconfig +++ b/apps/mobile/ios/build-configs/ios-build.staging.xcconfig @@ -1,6 +1,6 @@ // Staging iOS build identifiers -IOS_CURRENT_PROJECT_VERSION = 2190 -IOS_MARKETING_VERSION = 3.4.6 +IOS_CURRENT_PROJECT_VERSION = 2191 +IOS_MARKETING_VERSION = 3.4.7 IOS_MAIN_BUNDLE_ID = org.streetwriters.notesnook IOS_WIDGET_BUNDLE_ID = org.streetwriters.notesnook.notewidget IOS_SHARE_BUNDLE_ID = org.streetwriters.notesnook.share diff --git a/apps/mobile/package.json b/apps/mobile/package.json index b66a62ad3..50b7339e0 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -1,6 +1,6 @@ { "name": "@notesnook/mobile", - "version": "3.4.6", + "version": "3.4.7", "private": true, "license": "GPL-3.0-or-later", "scripts": { diff --git a/fastlane/metadata/android/en-US/changelogs/15569.txt b/fastlane/metadata/android/en-US/changelogs/15569.txt new file mode 100644 index 000000000..0454f523e --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/15569.txt @@ -0,0 +1,4 @@ +- Add option to clear note version history +- Minor bug fixes and improvements + +Thank you for using Notesnook!