소스 검색

Fix: do not open changelog if not needed

Anton Bershanskiy 3 년 전
부모
커밋
7d742a7ea6
1개의 변경된 파일13개의 추가작업 그리고 3개의 파일을 삭제
  1. 13 3
      Extensions/combined/ryd.background.js

+ 13 - 3
Extensions/combined/ryd.background.js

@@ -74,9 +74,19 @@ api.runtime.onMessage.addListener((request, sender, sendResponse) => {
   }
 });
 
-api.runtime.onInstalled.addListener(() => {
-  api.tabs.create({url: api.runtime.getURL("/changelog/3/changelog_3.0.html")});
-})
+api.runtime.onInstalled.addListener((details) => {
+  if (
+    // No need to show changelog if its was a browser update (and not extension update)
+    details.reason === "browser_update" ||
+    // No need to show changelog if developer just reloaded the extension
+    (details.reason === "update" &&
+      details.previousVersion === chrome.runtime.getManifest().version)
+  )
+    return;
+  api.tabs.create({
+    url: api.runtime.getURL("/changelog/3/changelog_3.0.html"),
+  });
+});
 
 async function sendVote(videoId, vote) {
   api.storage.sync.get(null, async (storageResult) => {