Добавил сохранение флага о необходимости чистки уведомлений

todo - настроить обсервер для самой чистки
This commit is contained in:
Sipachev Igor 2021-03-10 12:58:36 +07:00
parent 9c038a4911
commit 71d4f2c051
12 changed files with 109 additions and 61 deletions

View File

@ -1,3 +1,4 @@
// todo настроить сборщик и для этого файла. Перевести на ts
function insertValueToNode(target, value) {
let nodeList = []
switch (target) {
@ -42,3 +43,10 @@ chrome.runtime.onMessage.addListener(
}
);
chrome.storage.sync.get(['need-clean-notification'], function (result) {
console.log('Value currently is ' + result['need-clean-notification'])
/**
* todo Добавить обсервер на чиски node с уведомлениями, если опция включена
*/
})

View File

@ -1,50 +1,50 @@
{
"name": "SVEAK",
"background": {
"scripts": [ "assets/js/background.js" ]
},
"browser_action": {
"default_icon": {
"16": "icons/16.png",
"32": "icons/32.png"
},
"default_popup": "popup/dist/index.html",
"default_title": "SVEAK"
},
"content_scripts": [ {
"all_frames": true,
"js": [ "assets/js/script.js" ],
"matches": [ "\u003Call_urls>" ]
} ],
"default_locale": "ru",
"description": "Plug-in for SVEAK",
"icons": {
"16": "icons/16.png",
"32": "icons/32.png",
"144": "icons/144.png",
"180": "icons/180.png"
},
"manifest_version": 2,
"permissions": [ "tabs", "contextMenus", "\u003Call_urls>" ],
"short_name": "SVEAK helper",
"version": "1.0.0",
"commands": {
"_execute_browser_action": {
"suggested_key": {
"chromeos": "Alt+A",
"linux": "Alt+A",
"mac": "Alt+A",
"windows": "Alt+A"
}
},
"_execute_page_action": {
"suggested_key": {
"default": "Alt+A",
"mac": "Alt+A",
"windows": "Alt+A"
}
}
},
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApt0rB/UETdl+DvFC54JXH1uPu9C8kGll8EJi8Cfi7BC8CozN/CGnj/wy3EYP7iwO+qbIqK98dlUX/9aEEmsrJEPHhPKPFaN9KmBrVk852eGdYWK9zXQDzFzza3KxvmaAZhlaarEMBow+TPWdvqBGtf+/vYhoDaWBwIE7aawJZK4B8ulVxCLm67/NAPAC2VQ/aJph2egceD4Mfu6n0mCwzIevAa/FuoplAAQ5OC8AztxV3Xv6px2NL3kq+1O988t5SURsGij4oc15QHE5OUF67thrSP/22PWgMTzi+rkNAZO6Ps66zAWFA9MM+rKjT36B4tJnE5yLMGzCdsxP7WydeQIDAQAB",
"update_url": "https://clients2.google.com/service/update2/crx"
}
{
"name": "SVEAK",
"background": {
"scripts": [ "assets/js/background.js" ]
},
"browser_action": {
"default_icon": {
"16": "icons/16.png",
"32": "icons/32.png"
},
"default_popup": "popup/dist/index.html",
"default_title": "SVEAK"
},
"content_scripts": [ {
"all_frames": true,
"js": [ "assets/js/script.js" ],
"matches": [ "\u003Call_urls>" ]
} ],
"default_locale": "ru",
"description": "Plug-in for SVEAK",
"icons": {
"16": "icons/16.png",
"32": "icons/32.png",
"144": "icons/144.png",
"180": "icons/180.png"
},
"manifest_version": 2,
"permissions": [ "tabs", "contextMenus", "\u003Call_urls>", "storage" ],
"short_name": "SVEAK helper",
"version": "1.0.0",
"commands": {
"_execute_browser_action": {
"suggested_key": {
"chromeos": "Alt+A",
"linux": "Alt+A",
"mac": "Alt+A",
"windows": "Alt+A"
}
},
"_execute_page_action": {
"suggested_key": {
"default": "Alt+A",
"mac": "Alt+A",
"windows": "Alt+A"
}
}
},
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApt0rB/UETdl+DvFC54JXH1uPu9C8kGll8EJi8Cfi7BC8CozN/CGnj/wy3EYP7iwO+qbIqK98dlUX/9aEEmsrJEPHhPKPFaN9KmBrVk852eGdYWK9zXQDzFzza3KxvmaAZhlaarEMBow+TPWdvqBGtf+/vYhoDaWBwIE7aawJZK4B8ulVxCLm67/NAPAC2VQ/aJph2egceD4Mfu6n0mCwzIevAa/FuoplAAQ5OC8AztxV3Xv6px2NL3kq+1O988t5SURsGij4oc15QHE5OUF67thrSP/22PWgMTzi+rkNAZO6Ps66zAWFA9MM+rKjT36B4tJnE5yLMGzCdsxP7WydeQIDAQAB",
"update_url": "https://clients2.google.com/service/update2/crx"
}

View File

@ -1 +1 @@
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/popup/dist/favicon.ico"><![endif]--><title>sveak-helper</title><link href="/popup/dist/css/app.95f2e473.css" rel="preload" as="style"><link href="/popup/dist/js/app.c4534a95.js" rel="preload" as="script"><link href="/popup/dist/js/chunk-vendors.49bbd58a.js" rel="preload" as="script"><link href="/popup/dist/css/app.95f2e473.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/popup/dist/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/popup/dist/img/icons/favicon-16x16.png"><link rel="manifest" href="/popup/dist/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="sveak-helper"><link rel="apple-touch-icon" href="/popup/dist/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/popup/dist/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but sveak-helper doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/popup/dist/js/chunk-vendors.49bbd58a.js"></script><script src="/popup/dist/js/app.c4534a95.js"></script></body></html>
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/popup/dist/favicon.ico"><![endif]--><title>sveak-helper</title><link href="/popup/dist/css/app.95f2e473.css" rel="preload" as="style"><link href="/popup/dist/js/app.9bdde6bd.js" rel="preload" as="script"><link href="/popup/dist/js/chunk-vendors.49bbd58a.js" rel="preload" as="script"><link href="/popup/dist/css/app.95f2e473.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/popup/dist/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/popup/dist/img/icons/favicon-16x16.png"><link rel="manifest" href="/popup/dist/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="sveak-helper"><link rel="apple-touch-icon" href="/popup/dist/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/popup/dist/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but sveak-helper doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/popup/dist/js/chunk-vendors.49bbd58a.js"></script><script src="/popup/dist/js/app.9bdde6bd.js"></script></body></html>

2
popup/dist/js/app.9bdde6bd.js vendored Normal file

File diff suppressed because one or more lines are too long

1
popup/dist/js/app.9bdde6bd.js.map vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,15 +1,15 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "7624b45c435247052031",
"revision": "9f7cc03f956475eec94c",
"url": "/css/app.95f2e473.css"
},
{
"revision": "58ffe4608e1a76e678e6af70c4ad0c23",
"revision": "117c3b5969bea3eacecac9b36d7196ef",
"url": "/index.html"
},
{
"revision": "7624b45c435247052031",
"url": "/js/app.c4534a95.js"
"revision": "9f7cc03f956475eec94c",
"url": "/js/app.9bdde6bd.js"
},
{
"revision": "55fa3e18a2c5425a215c",

View File

@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts(
"/precache-manifest.762f04df3566d31749fb46db2b42ae70.js"
"/precache-manifest.ea391085ddd36de2a7ecbc5dff885460.js"
);
workbox.core.setCacheNameDetails({prefix: "sveak-helper"});

View File

@ -1,3 +1,24 @@
class NotificationCleaner {
export class NotificationCleaner {
enable () {
chrome.storage.sync.set({ 'need-clean-notification': true }, function () {
console.log('need-clean-notification: ' + true)
})
}
disable () {
chrome.storage.sync.set({ 'need-clean-notification': false }, function () {
console.log('need-clean-notification: ' + false)
})
}
state (): Promise<boolean> {
return new Promise((resolve, reject) => {
chrome.storage.sync.get(['need-clean-notification'], function (result) {
console.log('Value currently is ' + result['need-clean-notification'])
resolve(result['need-clean-notification'] || false)
})
})
}
}
export default new NotificationCleaner()

View File

@ -9,6 +9,7 @@ import VueClipboard from 'vue-clipboard2'
import { Target } from '@/classes/Enum/Target'
import sender from '@/classes/Service/Browser/Chrome/Sender'
import { Action } from '@/classes/Enum/Action'
import notificationCleaner from '@/classes/Service/NotificationCleaner'
Vue.use(VueClipboard)
@ -16,6 +17,7 @@ Vue.use(VueClipboard)
export default class HelloWorld extends Vue {
tab = 'person'
person = new Person()
isAutoCleaner = false
copyText = ''
get allowedMonths () {
@ -35,6 +37,14 @@ export default class HelloWorld extends Vue {
return result
}
mounted () {
/** todo заполнить первоначальное значение */
notificationCleaner.state().then((isAutoCleaner) => {
this.isAutoCleaner = isAutoCleaner
console.log('this.isAutoCleaner = ' + isAutoCleaner)
})
}
copyPersonalId () {
const personalId = personalIdGenerator.generate(this.person)
this.copy(personalId)
@ -81,4 +91,13 @@ export default class HelloWorld extends Vue {
action: Action.CLEAN_NOTIFICATION
})
}
onChangeAutoCleaner () {
console.log(this.isAutoCleaner)
if (this.isAutoCleaner) {
notificationCleaner.enable()
} else {
notificationCleaner.disable()
}
}
}

View File

@ -74,7 +74,7 @@
<div class="form-row__item">
<label for="autocleaner">
Use notification cleaner
<input type="checkbox" name="autocleaner" id="autocleaner">
<input @change="onChangeAutoCleaner" type="checkbox" v-model="isAutoCleaner">
</label>
</div>
</div>