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

@@ -80,13 +80,22 @@ chrome.storage.sync.get(["trackViewCount"], function(result) {
//if the notice should not be shown
//happens when the user click's the "Don't show notice again" button
//option renamed when new notice was made
var dontShowNotice = false;
chrome.storage.sync.get(["dontShowNoticeAgain"], function(result) {
chrome.storage.sync.get(["dontShowNotice"], function(result) {
let dontShowNoticeAgain = result.dontShowNoticeAgain;
if (dontShowNoticeAgain != undefined) {
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
chrome.runtime.onMessage.addListener(messageListener);
@@ -591,7 +600,15 @@ function skipToTime(v, index, sponsorTimes, openNotice) {
if (openNotice) {
//send out the message saying that a sponsor message was skipped
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
if (trackViewCount) {
@@ -912,7 +929,7 @@ function closeAllSkipNotices(){
}
function dontShowNoticeAgain() {
chrome.storage.sync.set({"dontShowNoticeAgain": true});
chrome.storage.sync.set({"dontShowNotice": true});
dontShowNotice = true;