Skip to content

Commit

Permalink
Revert "Drop badge counting."
Browse files Browse the repository at this point in the history
This reverts commit e13c455.
  • Loading branch information
jq-rs committed Jan 4, 2023
1 parent 841cee7 commit f15caba
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions js/mlestalk.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ function onPause() {
text: gBgText
});
cordova.plugins.backgroundMode.toBackground();
cordova.plugins.notification.badge.clear();
cordova.plugins.notification.local.clearAll();
}
}
Expand All @@ -315,6 +316,7 @@ function onResume() {
gIsPause = false;
if (isCordova) {
cordova.plugins.notification.local.clearAll();
cordova.plugins.notification.badge.clear();
cordova.plugins.backgroundMode.fromBackground();
}
if(gActiveChannel)
Expand Down Expand Up @@ -374,14 +376,10 @@ function onLoad() {
document.addEventListener("deviceready", function () {
cordova.plugins.notification.local.requestPermission(function (granted) {
gCanNotify = granted;
});
});
cordova.plugins.notification.local.setDummyNotifications();
gCanNotify = true;

// sets a recurring alarm that keeps things rolling
cordova.plugins.backgroundMode.disableWebViewOptimizations();
cordova.plugins.backgroundMode.enable();

cordova.plugins.backgroundMode.setDefaults({
title: gBgTitle,
text: gBgText
Expand All @@ -392,6 +390,10 @@ function onLoad() {
vibrate: true
});

// sets a recurring alarm that keeps things rolling
cordova.plugins.backgroundMode.disableWebViewOptimizations();
cordova.plugins.backgroundMode.enable();

document.addEventListener("pause", onPause, false);
document.addEventListener("resume", onResume, false);
document.addEventListener("backbutton", onBackKeyDown, false);
Expand Down Expand Up @@ -1220,6 +1222,9 @@ function finalize(uid, channel, msgTimestamp, message, isFull, isImage, isAudio)

if(isFull && (gActiveChannel != channel || gIsPause) && uid != gMyName[channel] && gMsgTs[channel] < msgTimestamp) {
gNewMsgsCnt[channel] += 1;
if (isCordova && gIsPause) {
cordova.plugins.notification.badge.increase();
}
}

const notifyTimestamp = parseInt(msgTimestamp / 1000 / 60); //one notify per minute
Expand Down

0 comments on commit f15caba

Please sign in to comment.