feat: add onSignOut bridge hook

This commit is contained in:
Baptiste Grob
2021-03-23 18:52:11 +01:00
parent 52e8e8220b
commit 257c0f6cab
3 changed files with 6 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ export interface Bridge {
syncComponents(payloads: unknown[]): void;
onMajorDataChange(): void;
onInitialDataLoad(): void;
onSignOut(): void;
onSearch(text?: string): void;
downloadBackup(): void | Promise<void>;
}

View File

@@ -30,4 +30,5 @@ export class BrowserBridge implements Bridge {
onInitialDataLoad(): void {}
onSearch(): void {}
downloadBackup(): void {}
onSignOut(): void {}
}

View File

@@ -6,13 +6,12 @@ import { InputModalScope } from '@/directives/views/inputModal';
import { PasswordWizardType, PasswordWizardScope } from '@/types';
import {
SNApplication,
platformFromString,
SNComponent,
PermissionDialog,
DeinitSource,
} from '@standardnotes/snjs';
import angular from 'angular';
import { getPlatform, getPlatformString } from '@/utils';
import { getPlatform } from '@/utils';
import { AlertService } from '@/services/alertService';
import { WebDeviceInterface } from '@/web_device_interface';
import {
@@ -92,6 +91,9 @@ export class WebApplication extends SNApplication {
this.scope = undefined;
(this.openModalComponent as any) = undefined;
(this.presentPermissionsDialog as any) = undefined;
if (source === DeinitSource.SignOut) {
this.bridge.onSignOut();
}
/** Allow our Angular directives to be destroyed and any pending digest cycles
* to complete before destroying the global application instance and all its services */
setTimeout(() => {