Sync resolution menu

This commit is contained in:
Mo Bitar
2019-02-09 20:34:43 -06:00
parent 3e39ba5239
commit 8565f377c7
8 changed files with 113 additions and 10 deletions

View File

@@ -116,6 +116,10 @@ angular.module('app')
this.closeAllRooms();
}
this.toggleSyncResolutionMenu = function() {
this.showSyncResolution = !this.showSyncResolution;
}.bind(this);
this.closeAccountMenu = () => {
this.showAccountMenu = false;
}

View File

@@ -292,8 +292,8 @@ class AccountMenu {
}
$scope.importJSONData = function(data, password, callback) {
var onDataReady = (errorCount) => {
var items = modelManager.importItems(data.items);
var onDataReady = async (errorCount) => {
var items = await modelManager.importItems(data.items);
for(var item of items) {
// We don't want to activate any components during import process in case of exceptions
// breaking up the import proccess

View File

@@ -0,0 +1,46 @@
class SyncResolutionMenu {
constructor() {
this.restrict = "E";
this.templateUrl = "directives/sync-resolution-menu.html";
this.scope = {
"closeFunction" : "&"
};
}
controller($scope, modelManager, syncManager, archiveManager, $timeout) {
'ngInject';
$scope.status = {};
$scope.close = function() {
$timeout(() => {
$scope.closeFunction()();
})
}
$scope.downloadBackup = function(encrypted) {
archiveManager.downloadBackup(encrypted);
$scope.status.backupFinished = true;
}
$scope.skipBackup = function() {
$scope.status.backupFinished = true;
}
$scope.performSyncResolution = function() {
$scope.status.resolving = true;
syncManager.resolveOutOfSync().then(() => {
$scope.status.resolving = false;
$scope.status.attemptedResolution = true;
if(syncManager.isOutOfSync()) {
$scope.status.fail = true;
} else {
$scope.status.success = true;
}
})
}
}
}
angular.module('app').directive('syncResolutionMenu', () => new SyncResolutionMenu);