aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Drew Green <agreenbhm@gmail.com>2023-09-13 01:41:49 -0400
committerLibravatar GitHub <noreply@github.com>2023-09-13 07:41:49 +0200
commit56659e878969b72d8fd3afa292a8d5d8fc9d9d8d (patch)
treea0d36fae74082a463b216ef5621f4a130479455a /src
parent6.5.0-nightly.10 [skip ci] (diff)
downloadferdium-app-56659e878969b72d8fd3afa292a8d5d8fc9d9d8d.tar.gz
ferdium-app-56659e878969b72d8fd3afa292a8d5d8fc9d9d8d.tar.zst
ferdium-app-56659e878969b72d8fd3afa292a8d5d8fc9d9d8d.zip
workaround: notifications not displaying for WhatsApp (#1357)
Added error-handling for notification failure due to object cloning error
Diffstat (limited to 'src')
-rw-r--r--src/webview/notifications.ts22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/webview/notifications.ts b/src/webview/notifications.ts
index 7f6ce01fd..aa88f13a2 100644
--- a/src/webview/notifications.ts
+++ b/src/webview/notifications.ts
@@ -37,12 +37,22 @@ export const notificationsClassDefinition = `(() => {
37 constructor(title = '', options = {}) { 37 constructor(title = '', options = {}) {
38 this.title = title; 38 this.title = title;
39 this.options = options; 39 this.options = options;
40 window.ferdium.displayNotification(title, options) 40 try{
41 .then(() => { 41 window.ferdium.displayNotification(title, options)
42 if (typeof (this.onClick) === 'function') { 42 .then(() => {
43 this.onClick(); 43 if (typeof (this.onClick) === 'function') {
44 } 44 this.onClick();
45 }); 45 }
46 });
47 } catch(error) {
48 this.options.onClick = null;
49 window.ferdium.displayNotification(title, options)
50 .then(() => {
51 if (typeof (this.onClick) === 'function') {
52 this.onClick();
53 }
54 });
55 }
46 } 56 }
47 57
48 static requestPermission(cb = null) { 58 static requestPermission(cb = null) {