auto update alert in footer
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
class BaseCtrl {
|
||||
constructor(syncManager, dbManager, analyticsManager) {
|
||||
constructor($rootScope, $scope, syncManager, dbManager, analyticsManager) {
|
||||
dbManager.openDatabase(null, function(){
|
||||
// new database, delete syncToken so that items can be refetched entirely from server
|
||||
syncManager.clearSyncToken();
|
||||
syncManager.sync();
|
||||
})
|
||||
|
||||
$scope.onUpdateAvailable = function(version) {
|
||||
$rootScope.$broadcast('new-update-available', version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
angular.module('app.frontend')
|
||||
.directive("header", function(authManager){
|
||||
.directive("footer", function(authManager){
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {},
|
||||
templateUrl: 'frontend/header.html',
|
||||
templateUrl: 'frontend/footer.html',
|
||||
replace: true,
|
||||
controller: 'HeaderCtrl',
|
||||
controller: 'FooterCtrl',
|
||||
controllerAs: 'ctrl',
|
||||
bindToController: true,
|
||||
|
||||
@@ -22,7 +22,7 @@ angular.module('app.frontend')
|
||||
}
|
||||
}
|
||||
})
|
||||
.controller('HeaderCtrl', function (authManager, modelManager, $timeout, dbManager, syncManager) {
|
||||
.controller('FooterCtrl', function ($rootScope, authManager, modelManager, $timeout, dbManager, syncManager) {
|
||||
|
||||
this.user = authManager.user;
|
||||
|
||||
@@ -78,4 +78,20 @@ angular.module('app.frontend')
|
||||
this.syncUpdated = function() {
|
||||
this.lastSyncDate = new Date();
|
||||
}
|
||||
|
||||
$rootScope.$on("new-update-available", function(version){
|
||||
$timeout(function(){
|
||||
// timeout calls apply() which is needed
|
||||
this.onNewUpdateAvailable();
|
||||
}.bind(this))
|
||||
}.bind(this))
|
||||
|
||||
this.onNewUpdateAvailable = function() {
|
||||
this.newUpdateAvailable = true;
|
||||
}
|
||||
|
||||
this.clickedNewUpdateAnnouncement = function() {
|
||||
this.newUpdateAvailable = false;
|
||||
alert("A new update is ready to install. Updates address performance and security issues, as well as bug fixes and feature enhancements. Simply quit Standard Notes and re-open it for the update to be applied.")
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user