Sync integrity checking
This commit is contained in:
@@ -86,12 +86,21 @@ angular.module('app')
|
|||||||
}
|
}
|
||||||
this.updateOfflineStatus();
|
this.updateOfflineStatus();
|
||||||
|
|
||||||
$rootScope.$on("initial-data-loaded", () => {
|
|
||||||
// If the user has no notes and is offline, show Account menu
|
syncManager.addEventHandler((syncEvent, data) => {
|
||||||
if(this.offline && modelManager.noteCount() == 0) {
|
$timeout(() => {
|
||||||
this.showAccountMenu = true;
|
if(syncEvent == "local-data-loaded") {
|
||||||
}
|
// If the user has no notes and is offline, show Account menu
|
||||||
})
|
if(this.offline && modelManager.noteCount() == 0) {
|
||||||
|
this.showAccountMenu = true;
|
||||||
|
}
|
||||||
|
} else if(syncEvent == "enter-out-of-sync") {
|
||||||
|
this.outOfSync = true;
|
||||||
|
} else if(syncEvent == "exit-out-of-sync") {
|
||||||
|
this.outOfSync = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
this.findErrors = function() {
|
this.findErrors = function() {
|
||||||
this.error = syncManager.syncStatus.error;
|
this.error = syncManager.syncStatus.error;
|
||||||
@@ -121,7 +130,8 @@ angular.module('app')
|
|||||||
|
|
||||||
this.refreshData = function() {
|
this.refreshData = function() {
|
||||||
this.isRefreshing = true;
|
this.isRefreshing = true;
|
||||||
syncManager.sync({force: true}).then((response) => {
|
// Enable integrity checking for this force request
|
||||||
|
syncManager.sync({force: true, performIntegrityCheck: true}).then((response) => {
|
||||||
$timeout(function(){
|
$timeout(function(){
|
||||||
this.isRefreshing = false;
|
this.isRefreshing = false;
|
||||||
}.bind(this), 200)
|
}.bind(this), 200)
|
||||||
|
|||||||
@@ -91,7 +91,8 @@ angular.module('app')
|
|||||||
syncManager.loadLocalItems().then(() => {
|
syncManager.loadLocalItems().then(() => {
|
||||||
$timeout(() => {
|
$timeout(() => {
|
||||||
$rootScope.$broadcast("initial-data-loaded"); // This needs to be processed first before sync is called so that singletonManager observers function properly.
|
$rootScope.$broadcast("initial-data-loaded"); // This needs to be processed first before sync is called so that singletonManager observers function properly.
|
||||||
syncManager.sync();
|
// Perform integrity check on first sync
|
||||||
|
syncManager.sync({performIntegrityCheck: true});
|
||||||
// refresh every 30s
|
// refresh every 30s
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
syncManager.sync();
|
syncManager.sync();
|
||||||
|
|||||||
@@ -37,6 +37,10 @@
|
|||||||
.sk-app-bar-item.no-pointer{"ng-if" => "ctrl.lastSyncDate && !ctrl.isRefreshing"}
|
.sk-app-bar-item.no-pointer{"ng-if" => "ctrl.lastSyncDate && !ctrl.isRefreshing"}
|
||||||
.sk-label.subtle
|
.sk-label.subtle
|
||||||
Last refreshed {{ctrl.lastSyncDate | appDateTime}}
|
Last refreshed {{ctrl.lastSyncDate | appDateTime}}
|
||||||
|
|
||||||
|
.sk-app-bar-item{"ng-if" => "ctrl.outOfSync && !ctrl.isRefreshing"}
|
||||||
|
.sk-label.warning Potentially Out of Sync
|
||||||
|
|
||||||
.sk-app-bar-item{"ng-if" => "ctrl.lastSyncDate && ctrl.isRefreshing"}
|
.sk-app-bar-item{"ng-if" => "ctrl.lastSyncDate && ctrl.isRefreshing"}
|
||||||
.sk-spinner.small
|
.sk-spinner.small
|
||||||
|
|
||||||
|
|||||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -4830,9 +4830,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"standard-file-js": {
|
"standard-file-js": {
|
||||||
"version": "0.3.42",
|
"version": "0.3.43",
|
||||||
"resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.42.tgz",
|
"resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.43.tgz",
|
||||||
"integrity": "sha512-FCBOnW7iJ8GjIcIba5etBAmSNiPZ8PGhrsF86QgqdutKZ0lyALpSgOoWSUHmFwZNXhEB47znyqybqZ8ReV6LZg==",
|
"integrity": "sha512-Adwy9ims9YnX++mhX5fhY4+X0slCPgeUF54IFmH4MOZHcJkwSHKBLA426QxzKFWs3F3IKD2fsiKnYf2uXEuepw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"statuses": {
|
"statuses": {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
"serve-static": "^1.13.2",
|
"serve-static": "^1.13.2",
|
||||||
"sn-models": "0.1.13",
|
"sn-models": "0.1.13",
|
||||||
"sn-stylekit": "2.0.13",
|
"sn-stylekit": "2.0.13",
|
||||||
"standard-file-js": "0.3.42",
|
"standard-file-js": "0.3.43",
|
||||||
"grunt-shell": "^2.1.0"
|
"grunt-shell": "^2.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user