mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 15:23:33 +00:00
poll full sync on interval. broadcast messages from background
This commit is contained in:
@@ -85,7 +85,7 @@ chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
|
|||||||
|
|
||||||
sortSites(sites);
|
sortSites(sites);
|
||||||
for (var i = 0; i < sites.length; i++) {
|
for (var i = 0; i < sites.length; i++) {
|
||||||
if (sites[i].domain && tabDomain == sites[i].domain) {
|
if (sites[i].domain && tabDomain === sites[i].domain) {
|
||||||
count++;
|
count++;
|
||||||
loadContextMenuOptions(sites[i]);
|
loadContextMenuOptions(sites[i]);
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ chrome.contextMenus.onClicked.addListener(function (info, tab) {
|
|||||||
var id = info.menuItemId.split('_')[1];
|
var id = info.menuItemId.split('_')[1];
|
||||||
siteService.getAllDecrypted().then(function (sites) {
|
siteService.getAllDecrypted().then(function (sites) {
|
||||||
for (var i = 0; i < sites.length; i++) {
|
for (var i = 0; i < sites.length; i++) {
|
||||||
if (sites[i].id == id) {
|
if (sites[i].id === id) {
|
||||||
if (info.parentMenuItemId === 'autofill') {
|
if (info.parentMenuItemId === 'autofill') {
|
||||||
autofillPage(sites[i]);
|
autofillPage(sites[i]);
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ function buildContextMenuOptions(url) {
|
|||||||
siteService.getAllDecrypted().then(function (sites) {
|
siteService.getAllDecrypted().then(function (sites) {
|
||||||
sortSites(sites);
|
sortSites(sites);
|
||||||
for (var i = 0; i < sites.length; i++) {
|
for (var i = 0; i < sites.length; i++) {
|
||||||
if (sites[i].domain && tabDomain == sites[i].domain) {
|
if (sites[i].domain && tabDomain === sites[i].domain) {
|
||||||
loadContextMenuOptions(sites[i]);
|
loadContextMenuOptions(sites[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,3 +251,10 @@ function copyToClipboard(text) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fullSync();
|
||||||
|
setInterval(fullSync, 60 * 1000);
|
||||||
|
|
||||||
|
function fullSync() {
|
||||||
|
syncService.fullSync(function() {});
|
||||||
|
}
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ angular
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.$on('syncCompleted', function (event, args) {
|
$scope.$on('syncCompleted', function (event, args) {
|
||||||
setTimeout(loadVault, 500);
|
if ($scope.loaded) {
|
||||||
|
setTimeout(loadVault, 500);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,4 +15,13 @@
|
|||||||
self.animation = '';
|
self.animation = '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
|
||||||
|
if (msg.command === 'syncCompleted') {
|
||||||
|
$scope.$broadcast('syncCompleted');
|
||||||
|
}
|
||||||
|
else if (msg.command === 'syncStarted') {
|
||||||
|
$scope.$broadcast('syncStarted');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -109,7 +109,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.$on('syncCompleted', function (event, args) {
|
$scope.$on('syncCompleted', function (event, args) {
|
||||||
setTimeout(loadVault, 500);
|
if ($scope.loaded) {
|
||||||
|
setTimeout(loadVault, 500);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function getScrollY() {
|
function getScrollY() {
|
||||||
|
|||||||
@@ -169,10 +169,12 @@ function initSyncService() {
|
|||||||
|
|
||||||
function syncStarted() {
|
function syncStarted() {
|
||||||
this.syncInProgress = true;
|
this.syncInProgress = true;
|
||||||
|
chrome.runtime.sendMessage(null, { command: 'syncStarted' });
|
||||||
}
|
}
|
||||||
|
|
||||||
function syncCompleted(successfully) {
|
function syncCompleted(successfully) {
|
||||||
this.syncInProgress = false;
|
this.syncInProgress = false;
|
||||||
|
chrome.runtime.sendMessage(null, { command: 'syncCompleted', successfully: successfully });
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleError() {
|
function handleError() {
|
||||||
|
|||||||
Reference in New Issue
Block a user