Updates
This commit is contained in:
@@ -86,6 +86,10 @@ angular.module('app')
|
|||||||
|
|
||||||
syncManager.addEventHandler((syncEvent, data) => {
|
syncManager.addEventHandler((syncEvent, data) => {
|
||||||
$rootScope.$broadcast(syncEvent, data || {});
|
$rootScope.$broadcast(syncEvent, data || {});
|
||||||
|
|
||||||
|
if(syncEvent == "sync-session-invalid") {
|
||||||
|
alert("Your session has expired. New changes will not be pulled in. Please sign out and sign back in to refresh your session.");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
syncManager.loadLocalItems().then(() => {
|
syncManager.loadLocalItems().then(() => {
|
||||||
@@ -103,7 +107,7 @@ angular.module('app')
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadAllTag() {
|
function loadAllTag() {
|
||||||
var allTag = new Tag({content: {title: "All"}});
|
var allTag = new SNTag({content: {title: "All"}});
|
||||||
allTag.all = true;
|
allTag.all = true;
|
||||||
allTag.needsLoad = true;
|
allTag.needsLoad = true;
|
||||||
$scope.allTag = allTag;
|
$scope.allTag = allTag;
|
||||||
@@ -112,7 +116,7 @@ angular.module('app')
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadArchivedTag() {
|
function loadArchivedTag() {
|
||||||
var archiveTag = new SmartTag({content: {title: "Archived", predicate: ["archived", "=", true]}});
|
var archiveTag = new SNSmartTag({content: {title: "Archived", predicate: ["archived", "=", true]}});
|
||||||
Object.defineProperty(archiveTag, "notes", {
|
Object.defineProperty(archiveTag, "notes", {
|
||||||
get: () => {
|
get: () => {
|
||||||
return modelManager.notesMatchingPredicate(archiveTag.content.predicate);
|
return modelManager.notesMatchingPredicate(archiveTag.content.predicate);
|
||||||
@@ -282,10 +286,9 @@ angular.module('app')
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// sign out
|
// sign out
|
||||||
authManager.signOut();
|
authManager.signout().then(() => {
|
||||||
storageManager.clearAllData().then(() => {
|
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
authManager.login(server, email, pw, false, false, {}).then((response) => {
|
authManager.login(server, email, pw, false, false, {}).then((response) => {
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ class LockScreen {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
authManager.signOut();
|
authManager.signout().then(() => {
|
||||||
storageManager.clearAllData().then(() => {
|
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ angular.module('app')
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.noteCount = function(tag) {
|
this.noteCount = function(tag) {
|
||||||
var validNotes = Note.filterDummyNotes(tag.notes).filter(function(note){
|
var validNotes = SNNote.filterDummyNotes(tag.notes).filter(function(note){
|
||||||
return !note.archived;
|
return !note.archived;
|
||||||
});
|
});
|
||||||
return validNotes.length;
|
return validNotes.length;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class AccountMenu {
|
|||||||
$scope.clearDatabaseAndRewriteAllItems(true, block);
|
$scope.clearDatabaseAndRewriteAllItems(true, block);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
modelManager.resetLocalMemory();
|
modelManager.handleSignout();
|
||||||
storageManager.clearAllModels().then(() => {
|
storageManager.clearAllModels().then(() => {
|
||||||
block();
|
block();
|
||||||
})
|
})
|
||||||
@@ -183,8 +183,7 @@ class AccountMenu {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
authManager.signOut();
|
authManager.signout().then(() => {
|
||||||
storageManager.clearAllData().then(() => {
|
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ class AuthManager extends SFAuthManager {
|
|||||||
async handleAuthResponse(response, email, url, authParams, keys) {
|
async handleAuthResponse(response, email, url, authParams, keys) {
|
||||||
try {
|
try {
|
||||||
await super.handleAuthResponse(response, email, url, authParams, keys);
|
await super.handleAuthResponse(response, email, url, authParams, keys);
|
||||||
this._authParams = authParams;
|
|
||||||
this.user = response.user;
|
this.user = response.user;
|
||||||
this.storageManager.setItem("user", JSON.stringify(response.user));
|
this.storageManager.setItem("user", JSON.stringify(response.user));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -131,7 +130,7 @@ class AuthManager extends SFAuthManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
signOut() {
|
signOut() {
|
||||||
this._keys = null;
|
super.signout();
|
||||||
this.user = null;
|
this.user = null;
|
||||||
this._authParams = null;
|
this._authParams = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ class HttpManager extends SFHttpManager {
|
|||||||
|
|
||||||
constructor(storageManager, $timeout) {
|
constructor(storageManager, $timeout) {
|
||||||
// calling callbacks in a $timeout allows UI to update
|
// calling callbacks in a $timeout allows UI to update
|
||||||
super(storageManager, $timeout);
|
super($timeout);
|
||||||
|
|
||||||
|
this.setJWTRequestHandler(async () => {
|
||||||
|
return storageManager.getItem("jwt");;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
SFModelManager.ContentTypeClassMapping = {
|
SFModelManager.ContentTypeClassMapping = {
|
||||||
"Note" : Note,
|
"Note" : SNNote,
|
||||||
"Tag" : Tag,
|
"Tag" : SNTag,
|
||||||
"SN|SmartTag" : SmartTag,
|
"SN|SmartTag" : SNSmartTag,
|
||||||
"Extension" : Extension,
|
"Extension" : SNExtension,
|
||||||
"SN|Editor" : Editor,
|
"SN|Editor" : SNEditor,
|
||||||
"SN|Theme" : Theme,
|
"SN|Theme" : SNTheme,
|
||||||
"SN|Component" : Component,
|
"SN|Component" : SNComponent,
|
||||||
"SF|Extension" : ServerExtension,
|
"SF|Extension" : SNServerExtension,
|
||||||
"SF|MFA" : Mfa
|
"SF|MFA" : SNMfa
|
||||||
};
|
};
|
||||||
|
|
||||||
SFItem.AppDomain = "org.standardnotes.sn";
|
SFItem.AppDomain = "org.standardnotes.sn";
|
||||||
@@ -23,8 +23,8 @@ class ModelManager extends SFModelManager {
|
|||||||
this.storageManager = storageManager;
|
this.storageManager = storageManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
resetLocalMemory() {
|
handleSignout() {
|
||||||
super.resetLocalMemory();
|
super.handleSignout();
|
||||||
this.notes.length = 0;
|
this.notes.length = 0;
|
||||||
this.tags.length = 0;
|
this.tags.length = 0;
|
||||||
this.components.length = 0;
|
this.components.length = 0;
|
||||||
@@ -75,10 +75,6 @@ class ModelManager extends SFModelManager {
|
|||||||
}), 0, tag);
|
}), 0, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
get filteredNotes() {
|
|
||||||
return Note.filterDummyNotes(this.notes);
|
|
||||||
}
|
|
||||||
|
|
||||||
setItemToBeDeleted(item) {
|
setItemToBeDeleted(item) {
|
||||||
super.setItemToBeDeleted(item);
|
super.setItemToBeDeleted(item);
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class StorageManager extends SFStorageManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeEncryptedStorageToDisk() {
|
writeEncryptedStorageToDisk() {
|
||||||
var encryptedStorage = new EncryptedStorage();
|
var encryptedStorage = new SNEncryptedStorage();
|
||||||
// Copy over totality of current storage
|
// Copy over totality of current storage
|
||||||
encryptedStorage.content.storage = this.storageAsHash();
|
encryptedStorage.content.storage = this.storageAsHash();
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ class StorageManager extends SFStorageManager {
|
|||||||
async decryptStorage() {
|
async decryptStorage() {
|
||||||
var stored = JSON.parse(this.getItemSync("encryptedStorage", StorageManager.Fixed));
|
var stored = JSON.parse(this.getItemSync("encryptedStorage", StorageManager.Fixed));
|
||||||
await SFJS.itemTransformer.decryptItem(stored, this.encryptedStorageKeys);
|
await SFJS.itemTransformer.decryptItem(stored, this.encryptedStorageKeys);
|
||||||
var encryptedStorage = new EncryptedStorage(stored);
|
var encryptedStorage = new SNEncryptedStorage(stored);
|
||||||
|
|
||||||
for(var key of Object.keys(encryptedStorage.content.storage)) {
|
for(var key of Object.keys(encryptedStorage.content.storage)) {
|
||||||
this.setItem(key, encryptedStorage.storage[key]);
|
this.setItem(key, encryptedStorage.storage[key]);
|
||||||
|
|||||||
Reference in New Issue
Block a user