Browse Source

Notify latest version when pinned (#242)

* feat(auto-update): notify user of available updates when version is pinned

* fix(auto-update): update notification message when auto-update is disabled

* fix(auto-update): notify latest update for pinned version before autoUpdate boolean check
Hakim Zulkufli 1 week ago
parent
commit
58da7a9dd2
1 changed files with 13 additions and 6 deletions
  1. 13 6
      src/hooks/auto-update-checker/index.ts

+ 13 - 6
src/hooks/auto-update-checker/index.ts

@@ -95,11 +95,6 @@ async function runBackgroundUpdateCheck(
     return;
     return;
   }
   }
 
 
-  if (pluginInfo.isPinned) {
-    log(`[auto-update-checker] Version is pinned; skipping update check.`);
-    return;
-  }
-
   const channel = extractChannel(pluginInfo.pinnedVersion ?? currentVersion);
   const channel = extractChannel(pluginInfo.pinnedVersion ?? currentVersion);
   const latestVersion = await getLatestVersion(channel);
   const latestVersion = await getLatestVersion(channel);
   if (!latestVersion) {
   if (!latestVersion) {
@@ -122,11 +117,23 @@ async function runBackgroundUpdateCheck(
     `[auto-update-checker] Update available (${channel}): ${currentVersion} → ${latestVersion}`,
     `[auto-update-checker] Update available (${channel}): ${currentVersion} → ${latestVersion}`,
   );
   );
 
 
+  if (pluginInfo.isPinned) {
+    showToast(
+      ctx,
+      `OMO-Slim ${latestVersion}`,
+      `v${latestVersion} available.\nVersion is pinned. Update your plugin config to apply.`,
+      'info',
+      8000,
+    );
+    log(`[auto-update-checker] Version is pinned; skipping auto-update.`);
+    return;
+  }
+
   if (!autoUpdate) {
   if (!autoUpdate) {
     showToast(
     showToast(
       ctx,
       ctx,
       `OMO-Slim ${latestVersion}`,
       `OMO-Slim ${latestVersion}`,
-      `v${latestVersion} available. Restart to apply.`,
+      `v${latestVersion} available. Auto-update is disabled.`,
       'info',
       'info',
       8000,
       8000,
     );
     );