Made it show the new notice again.

This commit is contained in:
Ajay Ramachandran
2019-09-24 18:16:57 -04:00
parent 04190b27d8
commit 563610cbcd
2 changed files with 24 additions and 3 deletions

View File

@@ -243,5 +243,9 @@
"sourceCode": { "sourceCode": {
"message": "Source Code", "message": "Source Code",
"description": "Used on Firefox Store Page" "description": "Used on Firefox Store Page"
},
"noticeUpdate": {
"message": "The notice has been upgraded! If you still don't like it, hit the never show button.",
"description": "The message displayed after the notice was upgraded."
} }
} }

View File

@@ -80,13 +80,22 @@ chrome.storage.sync.get(["trackViewCount"], function(result) {
//if the notice should not be shown //if the notice should not be shown
//happens when the user click's the "Don't show notice again" button //happens when the user click's the "Don't show notice again" button
//option renamed when new notice was made
var dontShowNotice = false; var dontShowNotice = false;
chrome.storage.sync.get(["dontShowNoticeAgain"], function(result) { chrome.storage.sync.get(["dontShowNotice"], function(result) {
let dontShowNoticeAgain = result.dontShowNoticeAgain; let dontShowNoticeAgain = result.dontShowNoticeAgain;
if (dontShowNoticeAgain != undefined) { if (dontShowNoticeAgain != undefined) {
dontShowNotice = dontShowNoticeAgain; dontShowNotice = dontShowNoticeAgain;
} }
}); });
//load the legacy option to hide the notice
var dontShowNoticeOld = false;
chrome.storage.sync.get(["dontShowNoticeAgain"], function(result) {
let dontShowNoticeAgain = result.dontShowNoticeAgain;
if (dontShowNoticeAgain != undefined) {
dontShowNoticeOld = dontShowNoticeAgain;
}
});
//get messages from the background script and the popup //get messages from the background script and the popup
chrome.runtime.onMessage.addListener(messageListener); chrome.runtime.onMessage.addListener(messageListener);
@@ -591,7 +600,15 @@ function skipToTime(v, index, sponsorTimes, openNotice) {
if (openNotice) { if (openNotice) {
//send out the message saying that a sponsor message was skipped //send out the message saying that a sponsor message was skipped
if (!dontShowNotice) { if (!dontShowNotice) {
new SkipNotice(this, currentUUID); let skipNotice = new SkipNotice(this, currentUUID);
if (dontShowNoticeOld) {
//show why this notice is showing
skipNotice.addNoticeInfoMessage(chrome.i18n.getMessage("noticeUpdate"));
//disable this setting
chrome.storage.sync.set({"dontShowNoticeAgain": false});
}
//auto-upvote this sponsor //auto-upvote this sponsor
if (trackViewCount) { if (trackViewCount) {
@@ -912,7 +929,7 @@ function closeAllSkipNotices(){
} }
function dontShowNoticeAgain() { function dontShowNoticeAgain() {
chrome.storage.sync.set({"dontShowNoticeAgain": true}); chrome.storage.sync.set({"dontShowNotice": true});
dontShowNotice = true; dontShowNotice = true;