Add reconnect handler and make reboot state better reflected in the notfications

This commit is contained in:
Johannes Zellner
2020-03-06 02:38:17 -08:00
parent 1555b143a9
commit 19e2919d5b
4 changed files with 39 additions and 23 deletions

View File

@@ -41,12 +41,12 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
});
};
function refreshNotifications() {
Client.getNotifications(false, 1, 20, function (error, results) {
function refreshNotifications(poll) {
Client.getNotifications(false, 1, 100, function (error, results) {
if (error) console.error(error);
else $scope.notifications = results;
$timeout(refreshNotifications, 60 * 1000);
if (poll) $timeout(refreshNotifications, 60 * 1000);
});
}
@@ -112,7 +112,7 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
$scope.initialized = true;
refreshNotifications();
refreshNotifications(true);
$scope.updateSubscriptionStatus();
});
@@ -127,6 +127,10 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
}
});
Client.onReconnect(function () {
refreshNotifications(false);
});
init();
// setup all the dialog focus handling