Skip to content

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

mobile: validate password field before publishing note

kashaf-ansari-dev07defdfa7885
diff --git a/apps/mobile/app/components/sheets/publish-note/index.tsx b/apps/mobile/app/components/sheets/publish-note/index.tsx
index 16e8c7b81..ae4a23fe8 100644
--- a/apps/mobile/app/components/sheets/publish-note/index.tsx
+++ b/apps/mobile/app/components/sheets/publish-note/index.tsx
@@ -108,16 +108,24 @@ const PublishNoteSheet = ({
try {
if (note?.id) {
- if (isLocked && !passwordValue.current) return;
+ if (isLocked && !passwordValue.current?.trim()) {
+ ToastManager.show({
+ heading: strings.passwordRequired(),
+ message: strings.enterPassword(),
+ type: "error",
+ context: "local"
+ });
+ return;
+ }
+
await db.monographs.publish(note.id, customTitle.current, {
- selfDestruct: selfDestruct,
+ selfDestruct,
password: isLocked ? passwordValue.current : undefined
});
await monographData.execute();
Navigation.queueRoutesForUpdate();
eSendEvent(eMenuItemUpdate);
- setPublishLoading(false);
}
requestInAppReview();
} catch (e) {
@@ -127,9 +135,9 @@ const PublishNoteSheet = ({
type: "error",
context: "local"
});
+ } finally {
+ setPublishLoading(false);
}
-
- setPublishLoading(false);
};
const setPublishLoading = (value: boolean) => {
setPublishing(value);