diff options
author | 2019-12-11 11:35:39 +0100 | |
---|---|---|
committer | 2019-12-11 11:35:39 +0100 | |
commit | 2491ea3c11de71391cd333cfc375576232d64cba (patch) | |
tree | cfc7b178be929d59ae75ae6ff419b3c11b3474a2 /uncompressed/android-messages | |
parent | Fix update error (diff) | |
download | ferdium-recipes-2491ea3c11de71391cd333cfc375576232d64cba.tar.gz ferdium-recipes-2491ea3c11de71391cd333cfc375576232d64cba.tar.zst ferdium-recipes-2491ea3c11de71391cd333cfc375576232d64cba.zip |
Update packages
Diffstat (limited to 'uncompressed/android-messages')
-rw-r--r-- | uncompressed/android-messages/package.json | 2 | ||||
-rw-r--r-- | uncompressed/android-messages/webview.js | 39 |
2 files changed, 39 insertions, 2 deletions
diff --git a/uncompressed/android-messages/package.json b/uncompressed/android-messages/package.json index 1236e99..9ff5d0a 100644 --- a/uncompressed/android-messages/package.json +++ b/uncompressed/android-messages/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "android-messages", | 2 | "id": "android-messages", |
3 | "name": "Android Messages", | 3 | "name": "Android Messages", |
4 | "version": "1.2.0", | 4 | "version": "1.3.0", |
5 | "description": "Android Messages", | 5 | "description": "Android Messages", |
6 | "main": "index.js", | 6 | "main": "index.js", |
7 | "author": "Daniel Weinberger, Stefan Malzner <stefan@adlk.io>", | 7 | "author": "Daniel Weinberger, Stefan Malzner <stefan@adlk.io>", |
diff --git a/uncompressed/android-messages/webview.js b/uncompressed/android-messages/webview.js index 414a902..7c8e004 100644 --- a/uncompressed/android-messages/webview.js +++ b/uncompressed/android-messages/webview.js | |||
@@ -1,10 +1,47 @@ | |||
1 | "use strict"; | 1 | "use strict"; |
2 | 2 | ||
3 | module.exports = Franz => { | 3 | const { |
4 | remote | ||
5 | } = require('electron'); | ||
6 | |||
7 | const webContents = remote.getCurrentWebContents(); | ||
8 | const { | ||
9 | session | ||
10 | } = webContents; | ||
11 | setTimeout(() => { | ||
12 | const elem = document.querySelector('#af-error-container'); | ||
13 | |||
14 | if (elem && elem.innerText.toLowerCase().includes('the requested url was not found on this server')) { | ||
15 | window.location.reload(); | ||
16 | } | ||
17 | }, 1000); | ||
18 | window.addEventListener('beforeunload', async () => { | ||
19 | try { | ||
20 | session.flushStorageData(); | ||
21 | session.clearStorageData({ | ||
22 | storages: ['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb'] | ||
23 | }); | ||
24 | const registrations = await window.navigator.serviceWorker.getRegistrations(); | ||
25 | registrations.forEach(r => { | ||
26 | r.unregister(); | ||
27 | console.log('ServiceWorker unregistered'); | ||
28 | }); | ||
29 | } catch (err) { | ||
30 | console.err(err); | ||
31 | } | ||
32 | }); | ||
33 | |||
34 | module.exports = (Franz, settings) => { | ||
4 | function getMessages() { | 35 | function getMessages() { |
5 | const messages = document.querySelectorAll('.text-content.unread').length; | 36 | const messages = document.querySelectorAll('.text-content.unread').length; |
6 | Franz.setBadge(messages); | 37 | Franz.setBadge(messages); |
7 | } | 38 | } |
8 | 39 | ||
40 | if (settings.isDarkModeEnabled) { | ||
41 | localStorage.setItem('dark_mode_enabled', 'true'); | ||
42 | } else { | ||
43 | localStorage.setItem('dark_mode_enabled', 'false'); | ||
44 | } | ||
45 | |||
9 | Franz.loop(getMessages); | 46 | Franz.loop(getMessages); |
10 | }; \ No newline at end of file | 47 | }; \ No newline at end of file |