From 93316bf4635bead982624e694467c9e7d1b51cdb Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sun, 7 Jun 2020 11:27:35 -0400 Subject: [PATCH] Added option to disable notification --- public/_locales/en/messages.json | 6 ++++++ src/background.ts | 14 ++++++++------ src/config.ts | 2 ++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index 935eabed..43999660 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -623,5 +623,11 @@ }, "categoryUpdate2": { "message": "Open the options to skip intros, outros, merch, etc." + }, + "unsubmittedWarning": { + "message": "Unsubmitted Segments Notification" + }, + "unsubmittedWarningDescription": { + "message": "Send a notification when you leave a video with segments that are not uploaded" } } diff --git a/src/background.ts b/src/background.ts index 0c11ab06..28a1051e 100644 --- a/src/background.ts +++ b/src/background.ts @@ -62,12 +62,14 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) { //this allows the callback to be called later return true; case "alertPrevious": - chrome.notifications.create("stillThere" + Math.random(), { - type: "basic", - title: chrome.i18n.getMessage("wantToSubmit") + " " + request.previousVideoID + "?", - message: chrome.i18n.getMessage("leftTimes"), - iconUrl: "./icons/LogoSponsorBlocker256px.png" - }); + if (Config.config.unsubmittedWarning) { + chrome.notifications.create("stillThere" + Math.random(), { + type: "basic", + title: chrome.i18n.getMessage("wantToSubmit") + " " + request.previousVideoID + "?", + message: chrome.i18n.getMessage("leftTimes"), + iconUrl: "./icons/LogoSponsorBlocker256px.png" + }); + } case "registerContentScript": registerFirefoxContentScript(request); return false; diff --git a/src/config.ts b/src/config.ts index d60cdf0d..634947a9 100644 --- a/src/config.ts +++ b/src/config.ts @@ -15,6 +15,7 @@ interface SBConfig { skipCount: number, sponsorTimesContributed: number, submissionCountSinceCategories: number, // New count used to show the "Read The Guidelines!!" message + unsubmittedWarning: boolean, disableSkipping: boolean, trackViewCount: boolean, dontShowNotice: boolean, @@ -132,6 +133,7 @@ var Config: SBObject = { skipCount: 0, sponsorTimesContributed: 0, submissionCountSinceCategories: 0, + unsubmittedWarning: true, disableSkipping: false, trackViewCount: true, dontShowNotice: false,