Skip to content

Commit

Permalink
Adding support for checking paused notifications
Browse files Browse the repository at this point in the history
Will revert this check in the next commit since it is not very relevant right now
e-mission/e-mission-docs#680 (comment)
  • Loading branch information
shankari committed Oct 29, 2021
1 parent e9cd270 commit 2b0cf26
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion www/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
"not-paused-name": "Not Paused",
"description": {
"android-enable": "On the app settings page, ensure that all notifications and channels are enabled.",
"android-unpause": "On the app settings page, ensure that all notifications are enabled. If this doesn't fix the problem, ask for help from your admin",
"android-unpause": "App is suspended or marked as 'distracting'. Please report to your admin.",
"ios": "Please allow."
}
}
Expand Down
18 changes: 17 additions & 1 deletion www/js/appstatus/permissioncheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,29 @@ controller("PermissionCheckControl", function($scope, $element, $attrs,
return checkOrFix(appAndChannelNotificationsCheck, $window.cordova.plugins.BEMDataCollection.isValidShowNotifications,
$scope.recomputeNotificationStatus, showError=false);
};
let fixPaused = function() {
console.log("refresh notification pause status");
return checkOrFix(appUnpausedCheck, $window.cordova.plugins.BEMDataCollection.isNotificationsUnpaused,
$scope.recomputeNotificationStatus, showError=true);
};
let checkPaused = function() {
console.log("refresh notification pause status");
return checkOrFix(appUnpausedCheck, $window.cordova.plugins.BEMDataCollection.isNotificationsUnpaused,
$scope.recomputeNotificationStatus, showError=false);
};
let appAndChannelNotificationsCheck = {
name: $translate.instant("intro.appstatus.notificationperms.app-enabled-name"),
desc: $translate.instant("intro.appstatus.notificationperms.description.android-enable"),
fix: fixPerms,
refresh: checkPerms
}
$scope.notificationChecks = [appAndChannelNotificationsCheck];
let appUnpausedCheck = {
name: $translate.instant("intro.appstatus.notificationperms.not-paused-name"),
desc: $translate.instant("intro.appstatus.notificationperms.description.android-unpause"),
fix: fixPaused,
refresh: checkPaused
}
$scope.notificationChecks = [appAndChannelNotificationsCheck, appUnpausedCheck];
let notificationCheckPromises = $scope.notificationChecks.map((fc) => fc.refresh());
console.log("About to initialize notification status");
console.log(notificationCheckPromises);
Expand Down

0 comments on commit 2b0cf26

Please sign in to comment.