mirror of
https://github.com/standardnotes/mobile.git
synced 2026-05-24 06:24:31 -04:00
Updates after PR review
This commit is contained in:
@@ -212,7 +212,7 @@ export default class KeysManager {
|
||||
this.accountKeys = null;
|
||||
this.accountAuthParams = null;
|
||||
this.user = null;
|
||||
Storage.get().clearKeys(this.accountRelatedStorageKeys);
|
||||
await Storage.get().clearKeys(this.accountRelatedStorageKeys);
|
||||
return this.persistKeysToKeychain();
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ export default class KeysManager {
|
||||
|
||||
// Local Security
|
||||
|
||||
clearOfflineKeysAndData() {
|
||||
async clearOfflineKeysAndData() {
|
||||
// make sure user is authenticated before performing this step
|
||||
if(!this.offlineKeys.mk) {
|
||||
alert("Unable to remove passcode. Make sure you are properly authenticated and try again.");
|
||||
@@ -282,7 +282,7 @@ export default class KeysManager {
|
||||
}
|
||||
this.offlineKeys = null;
|
||||
this.offlineAuthParams = null;
|
||||
Storage.get().removeItem(OfflineParamsKey);
|
||||
await Storage.get().removeItem(OfflineParamsKey);
|
||||
return this.persistKeysToKeychain();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,10 +42,12 @@ export default class Auth extends SFAuthManager {
|
||||
}
|
||||
|
||||
async handleAuthResponse(response, email, url, authParams, keys) {
|
||||
super.handleAuthResponse(response, email, url, authParams, keys);
|
||||
// We don't want to call super, as the super implementation is meant for web credentials
|
||||
// super will save keys to storage, which we don't want.
|
||||
// await super.handleAuthResponse(response, email, url, authParams, keys);
|
||||
try {
|
||||
this._keys = keys;
|
||||
return await Promise.all([
|
||||
return Promise.all([
|
||||
KeysManager.get().persistAccountKeys(_.merge(keys, {jwt: response.token})),
|
||||
KeysManager.get().setAccountAuthParams(authParams),
|
||||
KeysManager.get().saveUser({server: url, email: email})
|
||||
|
||||
@@ -76,7 +76,7 @@ export default class ModelManager extends SFModelManager {
|
||||
}
|
||||
|
||||
async removeItemLocally(item) {
|
||||
super.removeItemLocally(item);
|
||||
await super.removeItemLocally(item);
|
||||
|
||||
if(item.content_type == "Tag") {
|
||||
_.remove(this.tags, {uuid: item.uuid});
|
||||
|
||||
@@ -53,7 +53,7 @@ export default class Storage extends SFStorageManager {
|
||||
}
|
||||
|
||||
async removeItem(key) {
|
||||
return await AsyncStorage.removeItem(key);
|
||||
return AsyncStorage.removeItem(key);
|
||||
}
|
||||
|
||||
async clearKeys(keys) {
|
||||
|
||||
@@ -23,15 +23,7 @@ SFItem.prototype.dateToLocalizedString = function(date) {
|
||||
|
||||
// Define these new methods
|
||||
|
||||
SFItem.prototype.initUUID = async function(date) {
|
||||
if(!this.uuid) {
|
||||
return SFJS.crypto.generateUUID().then((uuid) => {
|
||||
this.uuid = uuid;
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
SFItem.prototype.initUUID = async function(date) {
|
||||
SFItem.prototype.initUUID = async function() {
|
||||
if(!this.uuid) {
|
||||
return SFJS.crypto.generateUUID().then((uuid) => {
|
||||
this.uuid = uuid;
|
||||
@@ -42,7 +34,7 @@ SFItem.prototype.initUUID = async function(date) {
|
||||
// Define these getters
|
||||
|
||||
Object.defineProperty(SFItem.prototype, "key", {
|
||||
get: function key() {
|
||||
return this.uuid;
|
||||
}
|
||||
get: function key() {
|
||||
return this.uuid;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -388,8 +388,8 @@ export default class Account extends Abstract {
|
||||
title: "Disable Passcode",
|
||||
text: message,
|
||||
confirmButtonText: "Disable Passcode",
|
||||
onConfirm: () => {
|
||||
var result = KeysManager.get().clearOfflineKeysAndData();
|
||||
onConfirm: async () => {
|
||||
var result = await KeysManager.get().clearOfflineKeysAndData();
|
||||
if(encryptionSource == "offline") {
|
||||
// remove encryption from all items
|
||||
this.resaveOfflineData(null, true);
|
||||
|
||||
@@ -64,7 +64,6 @@ export default class Webview extends Abstract {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
Reference in New Issue
Block a user