mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
remove old sync code
This commit is contained in:
parent
3a5190780b
commit
02dc3609b4
@ -107,74 +107,6 @@ function initSyncService() {
|
||||
return deferred.promise
|
||||
}
|
||||
|
||||
function syncFolders(serverFolders, callback) {
|
||||
var self = this;
|
||||
|
||||
self.userService.isAuthenticated(function (isAuthenticated) {
|
||||
if (!isAuthenticated) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
self.userService.getUserId(function (userId) {
|
||||
self.folderService.getAll(function (folders) {
|
||||
var localFolders = {};
|
||||
for (var i = 0; i < folders.length; i++) {
|
||||
localFolders[folders[i].id] = folders[i];
|
||||
}
|
||||
|
||||
var data = [];
|
||||
for (var j = 0; j < serverFolders.length; j++) {
|
||||
var serverFolder = serverFolders[j];
|
||||
var existingLocalFolder = localFolders[serverFolder.id];
|
||||
|
||||
if (!existingLocalFolder || existingLocalFolder.RevisionDate !== serverFolder.RevisionDate) {
|
||||
data.push(new FolderData(serverFolder, userId));
|
||||
}
|
||||
}
|
||||
|
||||
self.folderService.upsert(data, function () {
|
||||
callback();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function syncLogins(serverLogins, callback) {
|
||||
var self = this;
|
||||
|
||||
self.userService.isAuthenticated(function (isAuthenticated) {
|
||||
if (!isAuthenticated) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
self.userService.getUserId(function (userId) {
|
||||
self.loginService.getAll(function (logins) {
|
||||
var localLogins = {};
|
||||
for (var i = 0; i < logins.length; i++) {
|
||||
localLogins[logins[i].id] = logins[i];
|
||||
}
|
||||
|
||||
var data = [];
|
||||
for (var j = 0; j < serverLogins.length; j++) {
|
||||
var serverLogin = serverLogins[j];
|
||||
var existingLocalLogin = localLogins[serverLogin.id];
|
||||
|
||||
if (!existingLocalLogin || existingLocalLogin.RevisionDate !== serverLogin.RevisionDate) {
|
||||
data.push(new LoginData(serverLogin, userId));
|
||||
}
|
||||
}
|
||||
|
||||
self.loginService.upsert(data, function () {
|
||||
callback();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function syncSettings(userId) {
|
||||
var deferred = Q.defer();
|
||||
var self = this;
|
||||
|
Loading…
Reference in New Issue
Block a user