Merge branch 'hotfix/notify_android_lost_subscription' into develop
This commit is contained in:
@@ -362,6 +362,7 @@ function pushesSubscribe() {
|
|||||||
log('[app] Subscription:', subscription);
|
log('[app] Subscription:', subscription);
|
||||||
if (await pushesUpdateServerSubscription(subscription, true)) {
|
if (await pushesUpdateServerSubscription(subscription, true)) {
|
||||||
log('[app] Subscription: Sent to server, updating UI');
|
log('[app] Subscription: Sent to server, updating UI');
|
||||||
|
dbSettingsSet('notify_endpoint_' + BOATCLASS, subscription.endpoint);
|
||||||
updatePushSwitches();
|
updatePushSwitches();
|
||||||
updatePushBadge();
|
updatePushBadge();
|
||||||
} else {
|
} else {
|
||||||
@@ -395,6 +396,7 @@ function pushesUnSubscribe(silent = false) {
|
|||||||
subscription.unsubscribe();
|
subscription.unsubscribe();
|
||||||
log('[app] Subscription: Updating UI');
|
log('[app] Subscription: Updating UI');
|
||||||
$('#menu-pushes').hideMenu();
|
$('#menu-pushes').hideMenu();
|
||||||
|
dbSettingsSet('notify_endpoint_' + BOATCLASS, false);
|
||||||
updatePushBadge();
|
updatePushBadge();
|
||||||
hideLoader();
|
hideLoader();
|
||||||
if (!silent) toastOk('Du erhältst ab sofort keine Benachrichtigungen mehr von uns.');
|
if (!silent) toastOk('Du erhältst ab sofort keine Benachrichtigungen mehr von uns.');
|
||||||
@@ -510,12 +512,29 @@ function updatePushBadge() {
|
|||||||
$('#badge-pushes').removeClass('bg-green2-dark').addClass('bg-red2-dark').text('BLOCKED');
|
$('#badge-pushes').removeClass('bg-green2-dark').addClass('bg-red2-dark').text('BLOCKED');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
swRegistration.pushManager.getSubscription().then(function(subscription) {
|
swRegistration.pushManager.getSubscription().then(async function(subscription) {
|
||||||
|
var dbSub = await dbSettingsGet('notify_endpoint_' + BOATCLASS);
|
||||||
var isSub = (subscription !== null);
|
var isSub = (subscription !== null);
|
||||||
|
log('[app] DB Subscription:', dbSub);
|
||||||
|
log('[app] Real Subscription:', subscription);
|
||||||
if (isSub) {
|
if (isSub) {
|
||||||
$('#badge-pushes').removeClass('bg-red2-dark').addClass('bg-green2-dark').text('AN');
|
$('#badge-pushes').removeClass('bg-red2-dark').addClass('bg-green2-dark').text('AN');
|
||||||
|
if (dbSub === null) dbSettingsSet('notify_endpoint_' + BOATCLASS, subscription.endpoint);
|
||||||
|
else if (dbSub !== subscription.endpoint) {
|
||||||
|
if (navigator.onLine) {
|
||||||
|
log('[app] Updating subscription');
|
||||||
|
pushesSubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#badge-pushes').removeClass('bg-green2-dark').addClass('bg-red2-dark').text('AUS');
|
$('#badge-pushes').removeClass('bg-green2-dark').addClass('bg-red2-dark').text('AUS');
|
||||||
|
if (dbSub === null) dbSettingsSet('notify_endpoint_' + BOATCLASS, false);
|
||||||
|
else if (dbSub !== false) {
|
||||||
|
if (navigator.onLine) {
|
||||||
|
log('[app] Re subscribe');
|
||||||
|
pushesSubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PWA_VERSION', '1.11.4');
|
define('PWA_VERSION', '1.11.4h1');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user