Sync on window focus

This commit is contained in:
Mo Bitar
2018-12-21 11:05:02 -06:00
parent 28f5bbaf87
commit 1de0c85e27
2 changed files with 6 additions and 5 deletions

View File

@@ -80,10 +80,6 @@ class DesktopManager {
} }
desktop_windowGainedFocus() { desktop_windowGainedFocus() {
if(!this.passcodeManager.isLocked()) {
this.syncManager.sync();
}
this.$rootScope.$broadcast("window-gained-focus"); this.$rootScope.$broadcast("window-gained-focus");
} }

View File

@@ -2,9 +2,10 @@ const MillisecondsPerSecond = 1000;
class PasscodeManager { class PasscodeManager {
constructor($rootScope, authManager, storageManager) { constructor($rootScope, authManager, storageManager, syncManager) {
this.authManager = authManager; this.authManager = authManager;
this.storageManager = storageManager; this.storageManager = storageManager;
this.syncManager = syncManager;
this.$rootScope = $rootScope; this.$rootScope = $rootScope;
this._hasPasscode = this.storageManager.getItemSync("offlineParams", StorageManager.Fixed) != null; this._hasPasscode = this.storageManager.getItemSync("offlineParams", StorageManager.Fixed) != null;
@@ -203,6 +204,10 @@ class PasscodeManager {
// if that's the case, it needs to be locked immediately. // if that's the case, it needs to be locked immediately.
if(this.lockAfterDate && new Date() > this.lockAfterDate && !this.isLocked()) { if(this.lockAfterDate && new Date() > this.lockAfterDate && !this.isLocked()) {
this.lockApplication(); this.lockApplication();
} else {
if(!this.isLocked()) {
this.syncManager.sync();
}
} }
this.cancelAutoLockTimer(); this.cancelAutoLockTimer();
} else { } else {