From b8904672996643dad99892ff125f405ea19439df Mon Sep 17 00:00:00 2001 From: islxyqwe Date: Fri, 28 Jun 2024 18:51:05 +0800 Subject: [PATCH] chore: sync issue --- src/main.ts | 2 +- src/service.ts | 2 +- src/sync.ts | 14 +++++--------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main.ts b/src/main.ts index aa761fd..c116a9a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -61,7 +61,7 @@ export default class PhotesIOPlugin extends Plugin { this.addRibbonIcon( "camera", - "Generate notes from photos", + Platform.isMobile ? "Generate notes from photos" : "Generate notes", async (evt: MouseEvent) => { if (!this.settings.accessToken) { this.openSetting(); diff --git a/src/service.ts b/src/service.ts index 4ed9c22..88795b8 100644 --- a/src/service.ts +++ b/src/service.ts @@ -187,7 +187,7 @@ export const downloadAssets = await app.vault.delete(file); } } - } else if (filename === `!-${ending}.md`) { + } else if (filename === `!-${ending}`) { // should edit exist file, return if not exist return; } diff --git a/src/sync.ts b/src/sync.ts index 1f243f9..f4d3e63 100644 --- a/src/sync.ts +++ b/src/sync.ts @@ -108,8 +108,6 @@ export async function listenSync( const item = payload.new as INotebook; switch (payload.eventType) { case "INSERT": - // Do nothing because notebook is empty. - break; case "UPDATE": { if (item.deleted_at) { removeNotebook( @@ -119,13 +117,11 @@ export async function listenSync( ); break; } - if (item.note_orders) { - updateNotebook({ - notebook_id: item.id, - title: item.title, - updated_at: item.updated_at, - }); - } + updateNotebook({ + notebook_id: item.id, + title: item.title, + updated_at: item.updated_at, + }); break; } }