1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-22 11:45:59 +01:00

show loading while syncing on vault list

This commit is contained in:
Kyle Spearrin 2016-09-22 19:26:20 -04:00
parent 3f95c3a7ea
commit c3d1d4101e
4 changed files with 16 additions and 12 deletions

View File

@ -86,7 +86,7 @@ angular
}
};
$scope.$on('syncCompleted', function (event, args) {
$scope.$on('syncCompleted', function (event, successfully) {
if ($scope.loaded) {
setTimeout(loadVault, 500);
}

View File

@ -1,4 +1,4 @@
angular
angular
.module('bit.global')
.controller('mainController', function ($scope, $state, loginService, toastr) {
@ -18,7 +18,7 @@
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
if (msg.command === 'syncCompleted') {
$scope.$broadcast('syncCompleted');
$scope.$broadcast('syncCompleted', msg.successfully);
}
else if (msg.command === 'syncStarted') {
$scope.$broadcast('syncStarted');

View File

@ -1,7 +1,8 @@
angular
.module('bit.vault')
.controller('vaultController', function ($scope, $rootScope, siteService, folderService, $q, $state, $stateParams, toastr) {
.controller('vaultController', function ($scope, $rootScope, siteService, folderService, $q, $state, $stateParams, toastr,
syncService) {
$('#search').focus();
var delayLoad = true;
@ -42,9 +43,11 @@
promises.push(sitePromise);
$q.all(promises).then(function () {
$scope.loaded = true;
$rootScope.vaultFolders = decFolders;
$rootScope.vaultSites = decSites;
if (decSites.length || !syncService.syncInProgress) {
$scope.loaded = true;
$rootScope.vaultFolders = decFolders;
$rootScope.vaultSites = decSites;
}
if (!delayLoad) {
setScrollY();
}
@ -108,10 +111,8 @@
toastr.info(type + ' copied!');
};
$scope.$on('syncCompleted', function (event, args) {
if ($scope.loaded) {
setTimeout(loadVault, 500);
}
$scope.$on('syncCompleted', function (event, successfully) {
setTimeout(loadVault, 500);
});
function getScrollY() {

View File

@ -14,15 +14,17 @@ function initSyncService() {
throw 'callback function required';
}
syncStarted();
var self = this;
self.userService.isAuthenticated(function (isAuthenticated) {
if (!isAuthenticated) {
syncCompleted(false);
callback(false);
return;
}
self.userService.getUserId(function (userId) {
syncStarted();
var now = new Date();
var ciphers = self.apiService.getCiphers(function (response) {
var sites = {};
@ -178,6 +180,7 @@ function initSyncService() {
}
function handleError() {
syncCompleted(false);
// TODO: check for unauth or forbidden and logout
}
};