Skip to content

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

fix: init database before loading a note from notification

ammarahm-edec5619fdf65e
diff --git a/apps/mobile/src/services/Notifications.ts b/apps/mobile/src/services/Notifications.ts
index ff44d30f7..a6614261e 100644
--- a/apps/mobile/src/services/Notifications.ts
+++ b/apps/mobile/src/services/Notifications.ts
@@ -34,11 +34,15 @@ function loadNote(id: string, jump: boolean) {
function init() {
if (Platform.OS === 'ios') return;
PushNotification.configure({
- onNotification: function (notification) {
+ onNotification: async function (notification) {
editing.movedAway = false;
MMKV.removeItem('appState');
if (useNoteStore?.getState()?.loading === false) {
//@ts-ignore
+ await db.init();
+ //@ts-ignore
+ await db.notes.init();
+ //@ts-ignore
loadNote(notification.tag, false);
return;
}
@@ -64,6 +68,14 @@ function init() {
break
case "ReplyInput":
console.log("texto", notification);
+ await db.init();
+ await db.notes.add({
+ content:{
+ type:'tiny',
+ //@ts-ignore
+ data:`<p>${notification.reply_text} </p>`
+ }
+ })
//@ts-ignore/////
pinQuickNote(notification.id);
break