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; syncComponents(payloads: unknown[]): void;
onMajorDataChange(): void; onMajorDataChange(): void;
onInitialDataLoad(): void; onInitialDataLoad(): void;
onSignOut(): void;
onSearch(text?: string): void; onSearch(text?: string): void;
downloadBackup(): void | Promise<void>; downloadBackup(): void | Promise<void>;
} }

View File

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

View File

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