From 7d742a7ea682efe690f2dfe71b566127d1195cda Mon Sep 17 00:00:00 2001 From: Anton Bershanskiy <8knots@protonmail.com> Date: Wed, 20 Apr 2022 23:06:06 +0300 Subject: [PATCH 1/2] Fix: do not open changelog if not needed --- Extensions/combined/ryd.background.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Extensions/combined/ryd.background.js b/Extensions/combined/ryd.background.js index 18eb0fa..d89f39d 100644 --- a/Extensions/combined/ryd.background.js +++ b/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) => { From bdc46fae6f5df20cf337ab65adf7e6c86ce1335f Mon Sep 17 00:00:00 2001 From: Anton Bershanskiy <8knots@protonmail.com> Date: Wed, 20 Apr 2022 23:25:49 +0300 Subject: [PATCH 2/2] Smaller diff --- Extensions/combined/ryd.background.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Extensions/combined/ryd.background.js b/Extensions/combined/ryd.background.js index d89f39d..a26f082 100644 --- a/Extensions/combined/ryd.background.js +++ b/Extensions/combined/ryd.background.js @@ -83,10 +83,8 @@ api.runtime.onInstalled.addListener((details) => { details.previousVersion === chrome.runtime.getManifest().version) ) return; - api.tabs.create({ - url: api.runtime.getURL("/changelog/3/changelog_3.0.html"), - }); -}); + 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) => {