style: rename platform to bridge (#452)

* style: rename platform to bridge

* chore: tsc
This commit is contained in:
Baptiste Grob
2020-08-25 16:56:32 +02:00
committed by GitHub
parent b2511455dd
commit da78399567
11 changed files with 45 additions and 31 deletions

View File

@@ -0,0 +1,11 @@
/** Platform-specific (i-e Electron/browser) behavior is handled by a Bridge object. */
export interface Bridge {
getKeychainValue(): Promise<unknown>;
setKeychainValue(value: any): Promise<void>;
clearKeychainValue(): Promise<void>;
}
export declare class BrowserBridge implements Bridge {
getKeychainValue(): Promise<unknown>;
setKeychainValue(value: any): Promise<void>;
clearKeychainValue(): Promise<void>;
}

View File

@@ -5,7 +5,7 @@ import { PasswordWizardType } from '@/types';
import { SNApplication, Challenge, ProtectedAction } from 'snjs';
import { DesktopManager, LockManager, ArchiveManager, NativeExtManager, StatusManager, ThemeManager, PreferencesManager, KeyboardManager } from '@/services';
import { AppState } from '@/ui_models/app_state';
import { Platform } from '@/services/platform';
import { Bridge } from '@/services/bridge';
declare type WebServices = {
appState: AppState;
desktopService: DesktopManager;
@@ -25,7 +25,7 @@ export declare class WebApplication extends SNApplication {
private currentAuthenticationElement?;
editorGroup: EditorGroup;
componentGroup: ComponentGroup;
constructor($compile: ng.ICompileService, $timeout: ng.ITimeoutService, scope: ng.IScope, onDeinit: (app: WebApplication) => void, platform: Platform);
constructor($compile: ng.ICompileService, $timeout: ng.ITimeoutService, scope: ng.IScope, onDeinit: (app: WebApplication) => void, bridge: Bridge);
/** @override */
deinit(): void;
setWebServices(services: WebServices): void;

View File

@@ -1,16 +1,16 @@
/// <reference types="angular" />
import { WebApplication } from './application';
import { Platform } from '@/services/platform';
import { Bridge } from '@/services/bridge';
declare type AppManagerChangeCallback = () => void;
export declare class ApplicationGroup {
private platform;
private bridge;
$compile: ng.ICompileService;
$rootScope: ng.IRootScopeService;
$timeout: ng.ITimeoutService;
applications: WebApplication[];
changeObservers: AppManagerChangeCallback[];
activeApplication?: WebApplication;
constructor($compile: ng.ICompileService, $rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, platform: Platform);
constructor($compile: ng.ICompileService, $rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, bridge: Bridge);
private createDefaultApplication;
/** @callback */
onApplicationDeinit(application: WebApplication): void;

View File

@@ -22,7 +22,8 @@ export declare class PureViewCtrl<P = CtrlProps, S = CtrlState> {
/** @override */
getInitialState(): S;
setState(state: Partial<S>): Promise<unknown>;
updateUI(func: () => void): Promise<void>;
/** @returns a promise that resolves after the UI has been updated. */
flushUI(): import("angular").IPromise<void>;
initProps(props: CtrlProps): void;
addAppStateObserver(): void;
onAppStateEvent(eventName: any, data: any): void;

View File

@@ -1,7 +1,9 @@
import { DeviceInterface, SNApplication } from 'snjs';
import { Bridge } from './services/bridge';
export declare class WebDeviceInterface extends DeviceInterface {
private bridge;
private database;
constructor(namespace: string, timeout: any);
constructor(namespace: string, timeout: any, bridge: Bridge);
setApplication(application: SNApplication): void;
deinit(): void;
getRawStorageValue(key: string): Promise<string | null>;
@@ -22,7 +24,7 @@ export declare class WebDeviceInterface extends DeviceInterface {
saveRawDatabasePayloads(payloads: any[]): Promise<void>;
removeRawDatabasePayloadWithId(id: string): Promise<void>;
removeAllRawDatabasePayloads(): Promise<void>;
getKeychainValue(): Promise<any>;
getKeychainValue(): Promise<unknown>;
setKeychainValue(value: any): Promise<void>;
clearKeychainValue(): Promise<void>;
openUrl(url: string): void;