You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by se...@apache.org on 2021/10/05 20:22:45 UTC
[openmeetings] 01/01: OPENMEETINGS-2678 Update and ignore if
Notificaiton API is not available.
This is an automated email from the ASF dual-hosted git repository.
sebawagner pushed a commit to branch feature/OPENMEETINGS-2678-ios-notification-api
in repository https://gitbox.apache.org/repos/asf/openmeetings.git
commit 80cdb0dffeb02c5c958d613907e2dcfa3579d759
Author: Sebastian Wagner <se...@gmail.com>
AuthorDate: Wed Oct 6 09:22:27 2021 +1300
OPENMEETINGS-2678 Update and ignore if Notificaiton API is not available.
---
openmeetings-web/src/main/front/main/src/omutils.js | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/openmeetings-web/src/main/front/main/src/omutils.js b/openmeetings-web/src/main/front/main/src/omutils.js
index b8270e6..58b5917 100644
--- a/openmeetings-web/src/main/front/main/src/omutils.js
+++ b/openmeetings-web/src/main/front/main/src/omutils.js
@@ -52,7 +52,9 @@ function _sendMessage(_m, _base) {
Wicket.WebSocket.send(msg);
}
function _requestNotifyPermission(callback, elseCallback) {
- if (Notification.permission !== 'granted' && Notification.permission !== 'denied') {
+ if (typeof Notification !== "undefined"
+ && Notification.permission !== 'granted'
+ && Notification.permission !== 'denied') {
function onRequest(permission) {
if (permission === 'granted') {
callback();
@@ -63,12 +65,16 @@ function _requestNotifyPermission(callback, elseCallback) {
} else {
Notification.requestPermission().then(onRequest);
}
- } else if (typeof(elseCallback) === 'function') {
- elseCallback();
+ } else {
+ _info("No notification API for this browser");
+ if (typeof(elseCallback) === 'function') {
+ elseCallback();
+ }
}
}
function _notify(msg, tag, elseCallback) {
- if (window === window.parent) {
+ if (typeof Notification !== "undefined"
+ && window === window.parent) {
function _newMessage() {
const opts = {
tag: tag
@@ -84,8 +90,11 @@ function _notify(msg, tag, elseCallback) {
} else {
_requestNotifyPermission(() => _newMessage());
}
- } else if (typeof(elseCallback) === 'function') {
- elseCallback();
+ } else {
+ _info("No notification API for this browser");
+ if (typeof(elseCallback) === 'function') {
+ elseCallback();
+ }
}
}
function _isSafari() {