1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

load vault on $viewContentLoaded. apply scope on current tab when no sites to load. switch to $timeout to go through angular lifecycle.

This commit is contained in:
Kyle Spearrin
2016-12-27 00:01:01 -05:00
parent 6af283b947
commit 304183aad8
2 changed files with 18 additions and 11 deletions

View File

@@ -2,7 +2,7 @@
.module('bit.vault')
.controller('vaultController', function ($scope, $rootScope, siteService, folderService, $q, $state, $stateParams, toastr,
syncService, utilsService, $analytics, i18nService, stateService) {
syncService, utilsService, $analytics, i18nService, stateService, $timeout) {
var stateKey = 'vault',
state = stateService.getState(stateKey) || {};
@@ -11,9 +11,11 @@
var syncOnLoad = $stateParams.syncOnLoad;
if (syncOnLoad) {
setTimeout(function () {
syncService.fullSync(function () { });
}, utilsService.isFirefox() ? 500 : 0);
$scope.$on('$viewContentLoaded', function () {
$timeout(function () {
syncService.fullSync(function () { })
}, 0);
});
}
var delayLoad = true;
@@ -29,8 +31,8 @@
}
if (delayLoad) {
setTimeout(setScrollY, 100);
setTimeout(loadVault, 1000);
$timeout(setScrollY, 100);
$timeout(loadVault, 1000);
}
else if (!syncOnLoad) {
loadVault();
@@ -136,7 +138,7 @@
};
$scope.$on('syncCompleted', function (event, successfully) {
setTimeout(loadVault, 500);
$timeout(loadVault, 500);
});
function storeState() {