sync completion when signed out
This commit is contained in:
@@ -108,7 +108,7 @@ angular.module('app.frontend')
|
||||
_.merge(request, params);
|
||||
request.post().then(function(response){
|
||||
localStorage.setItem("jwt", response.token);
|
||||
localStorage.setItem("uuid", response.uuid);
|
||||
localStorage.setItem("uuid", response.user.uuid);
|
||||
localStorage.setItem("auth_params", JSON.stringify(authParams));
|
||||
callback(response);
|
||||
})
|
||||
@@ -128,7 +128,7 @@ angular.module('app.frontend')
|
||||
_.merge(request, params);
|
||||
request.post().then(function(response){
|
||||
localStorage.setItem("jwt", response.token);
|
||||
localStorage.setItem("uuid", response.uuid);
|
||||
localStorage.setItem("uuid", response.user.uuid);
|
||||
localStorage.setItem("auth_params", JSON.stringify(_.omit(authParams, ["pw_nonce"])));
|
||||
callback(response);
|
||||
})
|
||||
@@ -247,6 +247,7 @@ angular.module('app.frontend')
|
||||
}
|
||||
}.bind(this))
|
||||
|
||||
this.syncOpInProgress = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -519,7 +520,7 @@ angular.module('app.frontend')
|
||||
|
||||
this.writeItemsToLocalStorage = function(items, callback) {
|
||||
var params = items.map(function(item) {
|
||||
return this.paramsForItem(item, this.isUserSignedIn(), ["created_at", "updated_at", "presentation_url", "dirty"], false)
|
||||
return this.paramsForItem(item, false, ["created_at", "updated_at", "presentation_url", "dirty"], true)
|
||||
}.bind(this));
|
||||
|
||||
dbManager.saveItems(params, callback);
|
||||
@@ -624,12 +625,17 @@ angular.module('app.frontend')
|
||||
}
|
||||
var isString = typeof item.content === 'string' || item.content instanceof String;
|
||||
if(isString) {
|
||||
if(item.content.substring(0, 3) == "001" && item.enc_item_key) {
|
||||
// is encrypted
|
||||
this.decryptSingleItem(item, key);
|
||||
} else {
|
||||
// is base64 encoded
|
||||
item.content = Neeto.crypto.base64Decode(item.content.substring(3, item.content.length))
|
||||
try {
|
||||
if(item.content.substring(0, 3) == "001" && item.enc_item_key) {
|
||||
// is encrypted
|
||||
this.decryptSingleItem(item, key);
|
||||
} else {
|
||||
// is base64 encoded
|
||||
item.content = Neeto.crypto.base64Decode(item.content.substring(3, item.content.length))
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Error decrypting item", item);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class DBManager {
|
||||
}
|
||||
|
||||
saveItem(item) {
|
||||
saveItems([item]);
|
||||
this.saveItems([item]);
|
||||
}
|
||||
|
||||
saveItems(items, callback) {
|
||||
|
||||
Reference in New Issue
Block a user