feat: snjs app groups (#468)
* feat: snjs app groups * fix: update snjs version to point to wip commit * wip: account switcher * feat: rename lock manager to auto lock service * fix: more relevant sign out copy * chore(deps): update snjs * fix: use setTimeout instead of setImmediate * feat: make account switcher expiremental feature * chore(deps): upgrade snjs
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { SNAlertService } from "@node_modules/snjs/dist/@types";
|
||||
import { SNAlertService } from "snjs/dist/@types";
|
||||
export declare class Database {
|
||||
databaseName: string;
|
||||
private alertService;
|
||||
private locked;
|
||||
private alertService?;
|
||||
private db?;
|
||||
constructor(databaseName: string, alertService: SNAlertService);
|
||||
deinit(): void;
|
||||
setAlertService(alertService: SNAlertService): void;
|
||||
/**
|
||||
* Relinquishes the lock and allows db operations to proceed
|
||||
*/
|
||||
|
||||
@@ -18,5 +18,5 @@ export declare class AlertService implements SNAlertService {
|
||||
*/
|
||||
alert(text: string, title?: string, closeButtonText?: string): Promise<void>;
|
||||
confirm(text: string, title?: string, confirmButtonText?: string, confirmButtonType?: ButtonType, cancelButtonText?: string): Promise<boolean>;
|
||||
blockingDialog(text: string): () => void;
|
||||
blockingDialog(text: string, title?: string): () => void;
|
||||
}
|
||||
|
||||
27
dist/@types/app/assets/javascripts/services/autolock_service.d.ts
vendored
Normal file
27
dist/@types/app/assets/javascripts/services/autolock_service.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { WebApplication } from '@/ui_models/application';
|
||||
export declare class AutolockService {
|
||||
private application;
|
||||
private unsubState;
|
||||
private pollFocusInterval;
|
||||
private lastFocusState?;
|
||||
private lockAfterDate?;
|
||||
private lockTimeout?;
|
||||
constructor(application: WebApplication);
|
||||
observeVisibility(): void;
|
||||
deinit(): void;
|
||||
private lockApplication;
|
||||
setAutoLockInterval(interval: number): Promise<void>;
|
||||
getAutoLockInterval(): Promise<any>;
|
||||
/**
|
||||
* Verify document is in focus every so often as visibilitychange event is
|
||||
* not triggered on a typical window blur event but rather on tab changes.
|
||||
*/
|
||||
beginWebFocusPolling(): void;
|
||||
getAutoLockIntervalOptions(): {
|
||||
value: number;
|
||||
label: string;
|
||||
}[];
|
||||
documentVisibilityChanged(visible: boolean): Promise<void>;
|
||||
beginAutoLockTimer(): Promise<void>;
|
||||
cancelAutoLockTimer(): void;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ export { AlertService } from './alertService';
|
||||
export { ArchiveManager } from './archiveManager';
|
||||
export { DesktopManager } from './desktopManager';
|
||||
export { KeyboardManager } from './keyboardManager';
|
||||
export { LockManager } from './lockManager';
|
||||
export { AutolockService } from './autolock_service';
|
||||
export { NativeExtManager } from './nativeExtManager';
|
||||
export { PreferencesManager } from './preferencesManager';
|
||||
export { StatusManager } from './statusManager';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SNPredicate, ApplicationService } from 'snjs';
|
||||
import { PayloadContent } from '@node_modules/snjs/dist/@types/protocol/payloads/generator';
|
||||
import { PayloadContent } from 'snjs/dist/@types/protocol/payloads/generator';
|
||||
/** A class for handling installation of system extensions */
|
||||
export declare class NativeExtManager extends ApplicationService {
|
||||
extManagerId: string;
|
||||
|
||||
@@ -32,9 +32,10 @@ export declare const STRING_GENERATING_LOGIN_KEYS = "Generating Login Keys...";
|
||||
export declare const STRING_GENERATING_REGISTER_KEYS = "Generating Account Keys...";
|
||||
export declare const STRING_INVALID_IMPORT_FILE = "Unable to open file. Ensure it is a proper JSON file and try again.";
|
||||
export declare function StringImportError(errorCount: number): string;
|
||||
export declare const STRING_ENTER_ACCOUNT_PASSCODE = "Enter your application passcode";
|
||||
export declare const STRING_ENTER_ACCOUNT_PASSCODE = "Enter your application passcode to unlock the application";
|
||||
export declare const STRING_ENTER_ACCOUNT_PASSWORD = "Enter your account password";
|
||||
export declare const STRING_ENTER_PASSCODE_FOR_MIGRATION = "Your application passcode is required to perform an upgrade of your local data storage structure.";
|
||||
export declare const STRING_ENTER_PASSCODE_FOR_LOGIN_REGISTER = "Enter your application passcode before signing in or registering";
|
||||
export declare const STRING_STORAGE_UPDATE = "Storage Update";
|
||||
export declare const STRING_AUTHENTICATION_REQUIRED = "Authentication Required";
|
||||
export declare const STRING_UNSUPPORTED_BACKUP_FILE_VERSION = "This backup file was created using an unsupported version of the application and cannot be imported here. Please update your application and try again.";
|
||||
|
||||
@@ -28,6 +28,9 @@ export interface PermissionsModalScope extends Partial<ng.IScope> {
|
||||
permissionsString: string;
|
||||
callback: (approved: boolean) => void;
|
||||
}
|
||||
export interface AccountSwitcherScope extends Partial<ng.IScope> {
|
||||
application: any;
|
||||
}
|
||||
export declare type PanelPuppet = {
|
||||
onReady?: () => void;
|
||||
ready?: boolean;
|
||||
|
||||
@@ -3,13 +3,15 @@ import { ComponentGroup } from './component_group';
|
||||
import { EditorGroup } from '@/ui_models/editor_group';
|
||||
import { PasswordWizardType } from '@/types';
|
||||
import { SNApplication, Challenge, ProtectedAction } from 'snjs';
|
||||
import { DesktopManager, LockManager, ArchiveManager, NativeExtManager, StatusManager, ThemeManager, PreferencesManager, KeyboardManager } from '@/services';
|
||||
import { WebDeviceInterface } from '@/web_device_interface';
|
||||
import { DesktopManager, AutolockService, ArchiveManager, NativeExtManager, StatusManager, ThemeManager, PreferencesManager, KeyboardManager } from '@/services';
|
||||
import { AppState } from '@/ui_models/app_state';
|
||||
import { Bridge } from '@/services/bridge';
|
||||
import { DeinitSource } from 'snjs/dist/@types/types';
|
||||
declare type WebServices = {
|
||||
appState: AppState;
|
||||
desktopService: DesktopManager;
|
||||
lockService: LockManager;
|
||||
autolockService: AutolockService;
|
||||
archiveService: ArchiveManager;
|
||||
nativeExtService: NativeExtManager;
|
||||
statusService: StatusManager;
|
||||
@@ -20,18 +22,17 @@ declare type WebServices = {
|
||||
export declare class WebApplication extends SNApplication {
|
||||
private $compile?;
|
||||
private scope?;
|
||||
private onDeinit?;
|
||||
private webServices;
|
||||
private currentAuthenticationElement?;
|
||||
editorGroup: EditorGroup;
|
||||
componentGroup: ComponentGroup;
|
||||
constructor($compile: ng.ICompileService, $timeout: ng.ITimeoutService, scope: ng.IScope, onDeinit: (app: WebApplication) => void, defaultSyncServerHost: string, bridge: Bridge);
|
||||
constructor(deviceInterface: WebDeviceInterface, identifier: string, $compile: ng.ICompileService, scope: ng.IScope, defaultSyncServerHost: string, bridge: Bridge);
|
||||
/** @override */
|
||||
deinit(): void;
|
||||
deinit(source: DeinitSource): void;
|
||||
setWebServices(services: WebServices): void;
|
||||
getAppState(): AppState;
|
||||
getDesktopService(): DesktopManager;
|
||||
getLockService(): LockManager;
|
||||
getAutolockService(): AutolockService;
|
||||
getArchiveService(): ArchiveManager;
|
||||
getNativeExtService(): NativeExtManager;
|
||||
getStatusService(): StatusManager;
|
||||
@@ -47,5 +48,6 @@ export declare class WebApplication extends SNApplication {
|
||||
authenticationInProgress(): boolean;
|
||||
presentPasswordModal(callback: () => void): void;
|
||||
presentRevisionPreviewModal(uuid: string, content: any): void;
|
||||
openAccountSwitcher(): void;
|
||||
}
|
||||
export {};
|
||||
|
||||
@@ -1,29 +1,13 @@
|
||||
/// <reference types="angular" />
|
||||
import { WebApplication } from './application';
|
||||
import { SNApplicationGroup } from 'snjs';
|
||||
import { Bridge } from '@/services/bridge';
|
||||
declare type AppManagerChangeCallback = () => void;
|
||||
export declare class ApplicationGroup {
|
||||
export declare class ApplicationGroup extends SNApplicationGroup {
|
||||
private defaultSyncServerHost;
|
||||
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, defaultSyncServerHost: string, bridge: Bridge);
|
||||
private createDefaultApplication;
|
||||
/** @callback */
|
||||
onApplicationDeinit(application: WebApplication): void;
|
||||
private createNewApplication;
|
||||
get application(): WebApplication | undefined;
|
||||
getApplications(): WebApplication[];
|
||||
/**
|
||||
* Notifies observer when the active application has changed.
|
||||
* Any application which is no longer active is destroyed, and
|
||||
* must be removed from the interface.
|
||||
*/
|
||||
addApplicationChangeObserver(callback: AppManagerChangeCallback): () => void;
|
||||
private notifyObserversOfAppChange;
|
||||
initialize(callback?: any): Promise<void>;
|
||||
private createApplication;
|
||||
}
|
||||
export {};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { SNComponent, ComponentArea } from 'snjs';
|
||||
import { WebApplication } from './application';
|
||||
import { UuidString } from '@node_modules/snjs/dist/@types/types';
|
||||
import { UuidString } from 'snjs/dist/@types/types';
|
||||
export declare class ComponentGroup {
|
||||
private application;
|
||||
changeObservers: any[];
|
||||
|
||||
4
dist/@types/app/assets/javascripts/views/account_switcher/account_switcher.d.ts
vendored
Normal file
4
dist/@types/app/assets/javascripts/views/account_switcher/account_switcher.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { WebDirective } from '@/types';
|
||||
export declare class AccountSwitcher extends WebDirective {
|
||||
constructor();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SNNote, SNTag } from 'snjs';
|
||||
import { SNNote } from 'snjs';
|
||||
export declare enum NoteSortKey {
|
||||
CreatedAt = "created_at",
|
||||
UserUpdatedAt = "userModifiedDate",
|
||||
@@ -8,4 +8,4 @@ export declare enum NoteSortKey {
|
||||
/** @legacy Use UserUpdatedAt instead */
|
||||
ClientUpdatedAt = "client_updated_at"
|
||||
}
|
||||
export declare function notePassesFilter(note: SNNote, selectedTag: SNTag, showArchived: boolean, hidePinned: boolean, filterText: string): boolean;
|
||||
export declare function notePassesFilter(note: SNNote, showArchived: boolean, hidePinned: boolean, filterText: string): boolean;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { DeviceInterface, SNApplication } from 'snjs';
|
||||
import { DeviceInterface, SNApplication, ApplicationIdentifier } from 'snjs';
|
||||
import { Bridge } from './services/bridge';
|
||||
export declare class WebDeviceInterface extends DeviceInterface {
|
||||
private bridge;
|
||||
private database;
|
||||
private databases;
|
||||
constructor(timeout: any, bridge: Bridge);
|
||||
setApplication(application: SNApplication): void;
|
||||
private databaseForIdentifier;
|
||||
deinit(): void;
|
||||
getRawStorageValue(key: string): Promise<string | null>;
|
||||
getAllRawStorageKeyValues(): Promise<{
|
||||
@@ -14,19 +15,17 @@ export declare class WebDeviceInterface extends DeviceInterface {
|
||||
setRawStorageValue(key: string, value: any): Promise<void>;
|
||||
removeRawStorageValue(key: string): Promise<void>;
|
||||
removeAllRawStorageValues(): Promise<void>;
|
||||
openDatabase(): Promise<{
|
||||
openDatabase(identifier: ApplicationIdentifier): Promise<{
|
||||
isNewDatabase?: boolean | undefined;
|
||||
} | undefined>;
|
||||
private getDatabaseKeyPrefix;
|
||||
private keyForPayloadId;
|
||||
getAllRawDatabasePayloads(): Promise<any[]>;
|
||||
saveRawDatabasePayload(payload: any): Promise<void>;
|
||||
saveRawDatabasePayloads(payloads: any[]): Promise<void>;
|
||||
removeRawDatabasePayloadWithId(id: string): Promise<void>;
|
||||
removeAllRawDatabasePayloads(): Promise<void>;
|
||||
getNamespacedKeychainValue(): Promise<any>;
|
||||
setNamespacedKeychainValue(value: any): Promise<void>;
|
||||
clearNamespacedKeychainValue(): Promise<void>;
|
||||
getAllRawDatabasePayloads(identifier: ApplicationIdentifier): Promise<any[]>;
|
||||
saveRawDatabasePayload(payload: any, identifier: ApplicationIdentifier): Promise<void>;
|
||||
saveRawDatabasePayloads(payloads: any[], identifier: ApplicationIdentifier): Promise<void>;
|
||||
removeRawDatabasePayloadWithId(id: string, identifier: ApplicationIdentifier): Promise<void>;
|
||||
removeAllRawDatabasePayloads(identifier: ApplicationIdentifier): Promise<void>;
|
||||
getNamespacedKeychainValue(identifier: ApplicationIdentifier): Promise<any>;
|
||||
setNamespacedKeychainValue(value: any, identifier: ApplicationIdentifier): Promise<void>;
|
||||
clearNamespacedKeychainValue(identifier: ApplicationIdentifier): Promise<void>;
|
||||
getRawKeychainValue(): Promise<any>;
|
||||
clearRawKeychainValue(): Promise<void>;
|
||||
openUrl(url: string): void;
|
||||
|
||||
Reference in New Issue
Block a user