feat: delete local backups when signing out

This commit is contained in:
Baptiste Grob
2021-04-14 15:05:33 +02:00
parent d3ff9f2f21
commit 6a52721ea7
12 changed files with 168 additions and 17 deletions

View File

@@ -2,12 +2,16 @@ import { action, makeObservable, observable } from "mobx";
export class AccountMenuState {
show = false;
signingOut = false;
constructor() {
makeObservable(this, {
show: observable,
signingOut: observable,
setShow: action,
toggleShow: action,
setSigningOut: action,
});
}
@@ -15,6 +19,10 @@ export class AccountMenuState {
this.show = show;
}
setSigningOut = (signingOut: boolean): void => {
this.signingOut = signingOut;
}
toggleShow = (): void => {
this.show = !this.show;
}

View File

@@ -53,7 +53,7 @@ export class WebApplication extends SNApplication {
private $compile: angular.ICompileService,
scope: angular.IScope,
defaultSyncServerHost: string,
private bridge: Bridge,
public bridge: Bridge,
) {
super(
bridge.environment,
@@ -169,6 +169,11 @@ export class WebApplication extends SNApplication {
return angular.element(document.getElementById(this.identifier)!);
}
async signOutAndDeleteLocalBackups(): Promise<void> {
await this.bridge.deleteLocalBackups();
return this.signOut();
}
presentPasswordModal(callback: () => void) {
const scope = this.scope!.$new(true) as InputModalScope;
scope.type = "password";