mv services/state > ui_models/app_state
This commit is contained in:
@@ -7,4 +7,3 @@ export { NativeExtManager } from './nativeExtManager';
|
||||
export { PreferencesManager } from './preferencesManager';
|
||||
export { StatusManager } from './statusManager';
|
||||
export { ThemeManager } from './themeManager';
|
||||
export { AppState } from './state';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { WebApplication } from '@/ui_models/application';
|
||||
import { isDesktopApplication } from '@/utils';
|
||||
import { AppStateEvent } from '@/services/state';
|
||||
import { AppStateEvent } from '@/ui_models/app_state';
|
||||
|
||||
const MILLISECONDS_PER_SECOND = 1000;
|
||||
const FOCUS_POLL_INTERVAL = 1 * MILLISECONDS_PER_SECOND;
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
SNTheme,
|
||||
ComponentArea,
|
||||
} from 'snjs';
|
||||
import { AppStateEvent } from '@/services/state';
|
||||
import { AppStateEvent } from '@/ui_models/app_state';
|
||||
|
||||
const CACHED_THEMES_KEY = 'cachedThemes';
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import { getPlatformString } from '@/utils';
|
||||
import { AlertService } from '@/services/alertService';
|
||||
import { WebDeviceInterface } from '@/interface';
|
||||
import {
|
||||
AppState,
|
||||
DesktopManager,
|
||||
LockManager,
|
||||
ArchiveManager,
|
||||
@@ -26,6 +25,7 @@ import {
|
||||
PreferencesManager,
|
||||
KeyboardManager
|
||||
} from '@/services';
|
||||
import { AppState } from '@/ui_models/app_state';
|
||||
|
||||
type WebServices = {
|
||||
appState: AppState
|
||||
|
||||
@@ -8,9 +8,9 @@ import {
|
||||
NativeExtManager,
|
||||
PreferencesManager,
|
||||
StatusManager,
|
||||
ThemeManager,
|
||||
AppState
|
||||
ThemeManager
|
||||
} from '@/services';
|
||||
import { AppState } from '@/ui_models/app_state';
|
||||
|
||||
type AppManagerChangeCallback = () => void
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ComponentModalScope } from './../../directives/views/componentModal';
|
||||
import { WebDirective, PermissionsModalScope } from '@/types';
|
||||
import { getPlatformString } from '@/utils';
|
||||
import template from './application-view.pug';
|
||||
import { AppStateEvent } from '@/services/state';
|
||||
import { AppStateEvent } from '@/ui_models/app_state';
|
||||
import { ApplicationEvent, SNComponent } from 'snjs';
|
||||
import angular from 'angular';
|
||||
import {
|
||||
|
||||
@@ -22,7 +22,7 @@ import { isDesktopApplication } from '@/utils';
|
||||
import { KeyboardModifier, KeyboardKey } from '@/services/keyboardManager';
|
||||
import template from './editor-view.pug';
|
||||
import { PureViewCtrl } from '@Views/abstract/pure_view_ctrl';
|
||||
import { AppStateEvent, EventSource } from '@/services/state';
|
||||
import { AppStateEvent, EventSource } from '@/ui_models/app_state';
|
||||
import {
|
||||
STRING_DELETED_NOTE,
|
||||
STRING_INVALID_NOTE,
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
ComponentAction
|
||||
} from 'snjs';
|
||||
import template from './footer-view.pug';
|
||||
import { AppStateEvent, EventSource } from '@/services/state';
|
||||
import { AppStateEvent, EventSource } from '@/ui_models/app_state';
|
||||
import {
|
||||
STRING_GENERIC_SYNC_ERROR,
|
||||
STRING_NEW_UPDATE_READY
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
findInArray
|
||||
} from 'snjs';
|
||||
import { PureViewCtrl } from '@Views/abstract/pure_view_ctrl';
|
||||
import { AppStateEvent } from '@/services/state';
|
||||
import { AppStateEvent } from '@/ui_models/app_state';
|
||||
import { KeyboardModifier, KeyboardKey } from '@/services/keyboardManager';
|
||||
import {
|
||||
PANEL_NAME_NOTES
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
WebPrefKey
|
||||
} from 'snjs';
|
||||
import template from './tags-view.pug';
|
||||
import { AppStateEvent } from '@/services/state';
|
||||
import { AppStateEvent } from '@/ui_models/app_state';
|
||||
import { PANEL_NAME_TAGS } from '@/views/constants';
|
||||
import { STRING_DELETE_TAG } from '@/strings';
|
||||
import { PureViewCtrl } from '@Views/abstract/pure_view_ctrl';
|
||||
|
||||
@@ -7,4 +7,3 @@ export { NativeExtManager } from './nativeExtManager';
|
||||
export { PreferencesManager } from './preferencesManager';
|
||||
export { StatusManager } from './statusManager';
|
||||
export { ThemeManager } from './themeManager';
|
||||
export { AppState } from './state';
|
||||
|
||||
@@ -10,5 +10,5 @@ export declare class PreferencesManager extends ApplicationService {
|
||||
preferencesDidChange(): void;
|
||||
syncUserPreferences(): void;
|
||||
getValue(key: WebPrefKey, defaultValue?: any): any;
|
||||
setUserPrefValue(key: WebPrefKey, value: any, sync?: boolean): void;
|
||||
setUserPrefValue(key: WebPrefKey, value: any, sync?: boolean): Promise<void>;
|
||||
}
|
||||
|
||||
72
dist/@types/app/assets/javascripts/ui_models/app_state.d.ts
vendored
Normal file
72
dist/@types/app/assets/javascripts/ui_models/app_state.d.ts
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/// <reference types="angular" />
|
||||
import { SNTag, SNNote, SNUserPrefs } from 'snjs';
|
||||
import { WebApplication } from '@/ui_models/application';
|
||||
import { Editor } from '@/ui_models/editor';
|
||||
export declare enum AppStateEvent {
|
||||
TagChanged = 1,
|
||||
ActiveEditorChanged = 2,
|
||||
PreferencesChanged = 3,
|
||||
PanelResized = 4,
|
||||
EditorFocused = 5,
|
||||
BeganBackupDownload = 6,
|
||||
EndedBackupDownload = 7,
|
||||
DesktopExtsReady = 8,
|
||||
WindowDidFocus = 9,
|
||||
WindowDidBlur = 10
|
||||
}
|
||||
export declare enum EventSource {
|
||||
UserInteraction = 1,
|
||||
Script = 2
|
||||
}
|
||||
declare type ObserverCallback = (event: AppStateEvent, data?: any) => Promise<void>;
|
||||
export declare class AppState {
|
||||
$rootScope: ng.IRootScopeService;
|
||||
$timeout: ng.ITimeoutService;
|
||||
application: WebApplication;
|
||||
observers: ObserverCallback[];
|
||||
locked: boolean;
|
||||
unsubApp: any;
|
||||
rootScopeCleanup1: any;
|
||||
rootScopeCleanup2: any;
|
||||
onVisibilityChange: any;
|
||||
selectedTag?: SNTag;
|
||||
userPreferences?: SNUserPrefs;
|
||||
multiEditorEnabled: boolean;
|
||||
constructor($rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, application: WebApplication);
|
||||
deinit(): void;
|
||||
/**
|
||||
* Creates a new editor if one doesn't exist. If one does, we'll replace the
|
||||
* editor's note with an empty one.
|
||||
*/
|
||||
createEditor(title?: string): void;
|
||||
openEditor(noteUuid: string): Promise<unknown>;
|
||||
getActiveEditor(): Editor;
|
||||
getEditors(): Editor[];
|
||||
closeEditor(editor: Editor): void;
|
||||
closeActiveEditor(): void;
|
||||
closeAllEditors(): void;
|
||||
editorForNote(note: SNNote): Editor | undefined;
|
||||
streamNotesAndTags(): void;
|
||||
addAppEventObserver(): void;
|
||||
isLocked(): boolean;
|
||||
registerVisibilityObservers(): void;
|
||||
/** @returns A function that unregisters this observer */
|
||||
addObserver(callback: ObserverCallback): () => void;
|
||||
notifyEvent(eventName: AppStateEvent, data?: any): Promise<unknown>;
|
||||
setSelectedTag(tag: SNTag): void;
|
||||
/** Returns the tags that are referncing this note */
|
||||
getNoteTags(note: SNNote): SNTag[];
|
||||
/** Returns the notes this tag references */
|
||||
getTagNotes(tag: SNTag): SNNote[];
|
||||
getSelectedTag(): SNTag | undefined;
|
||||
setUserPreferences(preferences: SNUserPrefs): void;
|
||||
panelDidResize(name: string, collapsed: boolean): void;
|
||||
editorDidFocus(eventSource: EventSource): void;
|
||||
beganBackupDownload(): void;
|
||||
endedBackupDownload(success: boolean): void;
|
||||
/**
|
||||
* When the desktop appplication extension server is ready.
|
||||
*/
|
||||
desktopExtensionsReady(): void;
|
||||
}
|
||||
export {};
|
||||
@@ -3,7 +3,8 @@ import { ComponentGroup } from './component_group';
|
||||
import { EditorGroup } from '@/ui_models/editor_group';
|
||||
import { PasswordWizardType } from '@/types';
|
||||
import { SNApplication, Challenge, ChallengeOrchestrator, ProtectedAction } from 'snjs';
|
||||
import { AppState, DesktopManager, LockManager, ArchiveManager, NativeExtManager, StatusManager, ThemeManager, PreferencesManager, KeyboardManager } from '@/services';
|
||||
import { DesktopManager, LockManager, ArchiveManager, NativeExtManager, StatusManager, ThemeManager, PreferencesManager, KeyboardManager } from '@/services';
|
||||
import { AppState } from '@/ui_models/app_state';
|
||||
declare type WebServices = {
|
||||
appState: AppState;
|
||||
desktopService: DesktopManager;
|
||||
|
||||
@@ -16,7 +16,7 @@ export declare class PureViewCtrl {
|
||||
$onInit(): void;
|
||||
deinit(): void;
|
||||
$onDestroy(): void;
|
||||
get appState(): import("../../services").AppState;
|
||||
get appState(): import("../../ui_models/app_state").AppState;
|
||||
/** @private */
|
||||
resetState(): Promise<void>;
|
||||
/** @override */
|
||||
|
||||
1566
dist/javascripts/app.js
vendored
1566
dist/javascripts/app.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/javascripts/app.js.map
vendored
2
dist/javascripts/app.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user