auto update alert in footer

This commit is contained in:
Mo Bitar
2017-05-20 09:10:12 -05:00
parent 79afc843fb
commit ea632445de
9 changed files with 37 additions and 14 deletions

View File

@@ -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);
}
}
}

View File

@@ -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.")
}
});

View File

@@ -18,8 +18,8 @@ h2 {
width: 100%;
padding: 5px;
background-color: #d8d7d9;
height: $header-height;
max-height: $header-height;
height: $footer-height;
max-height: $footer-height;
z-index: 100;
font-size: 10px;
color: $dark-gray;

View File

@@ -84,13 +84,13 @@ p {
background-color: $bg-color;
}
$header-height: 25px;
$footer-height: 25px;
$section-header-height: 70px;
.app {
// height: 100%;
height: calc(100% - #{$header-height});
height: calc(100% - #{$footer-height});
width: 100%;
display: flex;
vertical-align: top;
@@ -115,7 +115,7 @@ $section-header-height: 70px;
.section {
padding-bottom: 0px;
height: 100%;
max-height: calc(100vh - #{$header-height});
max-height: calc(100vh - #{$footer-height});
font-size: 17px;
.scrollable {

View File

@@ -52,7 +52,7 @@
}
.scrollable {
height: calc(100vh - (#{$notes-title-bar-height} + #{$header-height}));
height: calc(100vh - (#{$notes-title-bar-height} + #{$footer-height}));
}
.infinite-scroll {

View File

@@ -29,7 +29,7 @@
}
.scrollable {
height: calc(100vh - (#{$tags-title-bar-height} + #{$header-height}));
height: calc(100vh - (#{$tags-title-bar-height} + #{$footer-height}));
}
.tag {

View File

@@ -3,7 +3,7 @@ $dark-gray: #2e2e2e;
@import "app/standard";
@import "app/main";
@import "app/ui";
@import "app/header";
@import "app/footer";
@import "app/tags";
@import "app/notes";
@import "app/editor";

View File

@@ -14,6 +14,9 @@
.pull-right
.footer-bar-link{"ng-if" => "ctrl.newUpdateAvailable", "ng-click" => "ctrl.clickedNewUpdateAnnouncement()"}
%span.blue.normal New update downloaded. Installs on app restart.
.footer-bar-link{"style" => "margin-right: 5px;"}
%div{"ng-if" => "ctrl.lastSyncDate", "style" => "float: left; font-weight: normal; margin-right: 8px;"}
%span{"ng-if" => "!ctrl.isRefreshing"}

View File

@@ -7,4 +7,4 @@
%editor-section{"note" => "selectedNote", "remove" => "deleteNote", "save" => "saveNote", "update-tags" => "updateTagsForNote"}
%header
%footer