diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/autofocus.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/autofocus.d.ts
index 159a60450..ec76fbd03 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/autofocus.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/autofocus.d.ts
@@ -1,7 +1,7 @@
-export function autofocus($timeout: any): {
+export declare function autofocus($timeout: ng.ITimeoutService): {
restrict: string;
scope: {
shouldFocus: string;
};
- link: ($scope: any, $element: any) => void;
+ link: ($scope: import("angular").IScope, $element: JQLite) => void;
};
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/click-outside.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/click-outside.d.ts
index b74259c26..d7df3a234 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/click-outside.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/click-outside.d.ts
@@ -1,5 +1,5 @@
-export function clickOutside($document: any): {
+export declare function clickOutside($document: ng.IDocumentService): {
restrict: string;
replace: boolean;
- link: ($scope: any, $element: any, attrs: any) => void;
+ link: ($scope: import("angular").IScope, $element: JQLite, attrs: any) => void;
};
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/delay-hide.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/delay-hide.d.ts
index 91c9ad5d7..92b3913b6 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/delay-hide.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/delay-hide.d.ts
@@ -1,8 +1,9 @@
-export function delayHide($timeout: any): {
+import angular from 'angular';
+export declare function delayHide($timeout: ng.ITimeoutService): {
restrict: string;
scope: {
show: string;
delay: string;
};
- link: (scope: any, elem: any, attrs: any) => void;
+ link: (scope: angular.IScope, elem: JQLite) => void;
};
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/elemReady.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/elemReady.d.ts
index bda2d4c42..d635cfa78 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/elemReady.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/elemReady.d.ts
@@ -1,4 +1,4 @@
-export function elemReady($parse: any): {
+export declare function elemReady($parse: ng.IParseService): {
restrict: string;
- link: ($scope: any, elem: any, attrs: any) => void;
+ link: ($scope: import("angular").IScope, elem: JQLite, attrs: any) => void;
};
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/file-change.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/file-change.d.ts
index 3a284104b..3ebef593c 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/file-change.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/file-change.d.ts
@@ -1,7 +1,7 @@
-export function fileChange(): {
+export declare function fileChange(): {
restrict: string;
scope: {
handler: string;
};
- link: (scope: any, element: any) => void;
+ link: (scope: import("angular").IScope, element: JQLite) => void;
};
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/index.d.ts
index 3a2852dec..e9f8b7ca5 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/index.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/index.d.ts
@@ -1,9 +1,9 @@
-export { autofocus } from "./autofocus";
-export { clickOutside } from "./click-outside";
-export { delayHide } from "./delay-hide";
-export { elemReady } from "./elemReady";
-export { fileChange } from "./file-change";
-export { infiniteScroll } from "./infiniteScroll";
-export { lowercase } from "./lowercase";
-export { selectOnClick } from "./selectOnClick";
-export { snEnter } from "./snEnter";
+export { autofocus } from './autofocus';
+export { clickOutside } from './click-outside';
+export { delayHide } from './delay-hide';
+export { elemReady } from './elemReady';
+export { fileChange } from './file-change';
+export { infiniteScroll } from './infiniteScroll';
+export { lowercase } from './lowercase';
+export { selectOnClick } from './selectOnClick';
+export { snEnter } from './snEnter';
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/infiniteScroll.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/infiniteScroll.d.ts
index 6f9500126..18300c5df 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/infiniteScroll.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/infiniteScroll.d.ts
@@ -1,3 +1,3 @@
-export function infiniteScroll(): {
- link: (scope: any, elem: any, attrs: any) => void;
+export declare function infiniteScroll(): {
+ link: (scope: import("angular").IScope, elem: JQLite, attrs: any) => void;
};
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/lowercase.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/lowercase.d.ts
index b2df15723..6c375f53f 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/lowercase.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/lowercase.d.ts
@@ -1,4 +1,4 @@
-export function lowercase(): {
+export declare function lowercase(): {
require: string;
- link: (scope: any, element: any, attrs: any, modelCtrl: any) => void;
+ link: (scope: import("angular").IScope, _: JQLite, attrs: any, ctrl: any) => void;
};
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/selectOnClick.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/selectOnClick.d.ts
index ed23ff5b1..1713fab2d 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/selectOnClick.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/selectOnClick.d.ts
@@ -1,4 +1,4 @@
-export function selectOnClick($window: any): {
+export declare function selectOnClick($window: ng.IWindowService): {
restrict: string;
- link: (scope: any, element: any, attrs: any) => void;
+ link: (scope: import("angular").IScope, element: JQLite) => void;
};
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/snEnter.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/snEnter.d.ts
index a4faa7f1d..e80d031bd 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/snEnter.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/snEnter.d.ts
@@ -1 +1 @@
-export function snEnter(): (scope: any, element: any, attrs: any) => void;
+export declare function snEnter(): (scope: import("angular").IScope, element: JQLite, attrs: any) => void;
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/editorMenu.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/editorMenu.d.ts
index f2b01fbb5..5125e0cf5 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/editorMenu.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/editorMenu.d.ts
@@ -1,27 +1,4 @@
-///
-export class EditorMenu {
- restrict: string;
- template: import("pug").compileTemplate;
- controller: typeof EditorMenuCtrl;
- controllerAs: string;
- bindToController: boolean;
- scope: {
- callback: string;
- selectedEditor: string;
- currentItem: string;
- application: string;
- };
+import { WebDirective } from './../../types';
+export declare class EditorMenu extends WebDirective {
+ constructor();
}
-declare class EditorMenuCtrl extends PureCtrl {
- constructor($timeout: any);
- state: {
- isDesktop: any;
- };
- selectComponent(component: any): void;
- toggleDefaultForEditor(editor: any): void;
- offlineAvailableForComponent(component: any): any;
- makeEditorDefault(component: any): void;
- removeEditorDefault(component: any): void;
-}
-import { PureCtrl } from "../../controllers/abstract/pure_ctrl";
-export {};
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/panelResizer.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/panelResizer.d.ts
index a7115eadb..71d312ac5 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/panelResizer.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/panelResizer.d.ts
@@ -1,73 +1,4 @@
-///
-export class PanelResizer {
- restrict: string;
- template: import("pug").compileTemplate;
- controller: typeof PanelResizerCtrl;
- controllerAs: string;
- bindToController: boolean;
- scope: {
- alwaysVisible: string;
- collapsable: string;
- control: string;
- defaultWidth: string;
- hoverable: string;
- index: string;
- minWidth: string;
- onResizeFinish: string;
- panelId: string;
- property: string;
- };
+import { WebDirective } from './../../types';
+export declare class PanelResizer extends WebDirective {
+ constructor();
}
-declare class PanelResizerCtrl {
- constructor($compile: any, $element: any, $timeout: any);
- $compile: any;
- $element: any;
- $timeout: any;
- handleResize(): void;
- onMouseMove(event: any): void;
- onMouseUp(): void;
- onMouseDown(event: any): void;
- $onInit(): void;
- $onDestroy(): void;
- onResizeFinish: any;
- control: any;
- configureControl(): void;
- configureDefaults(): void;
- panel: HTMLElement | null | undefined;
- resizerColumn: any;
- currentMinWidth: any;
- pressed: boolean | undefined;
- startWidth: any;
- lastDownX: any;
- collapsed: boolean | undefined;
- lastWidth: any;
- startLeft: number | undefined;
- lastLeft: any;
- appFrame: DOMRect | null | undefined;
- widthBeforeLastDblClick: any;
- configureRightPanel(): void;
- getParentRect(): any;
- reloadDefaultValues(): void;
- addDoubleClickHandler(): void;
- addMouseDownListener(): void;
- addMouseMoveListener(): void;
- handleWidthEvent(event: any): void;
- handleLeftEvent(event: any): void;
- addMouseUpListener(): void;
- isAtMaxWidth(): any;
- isCollapsed(): boolean;
- setWidth(width: any, finish: any): void;
- setLeft(left: any): void;
- finishSettingWidth(): void;
- /**
- * If an iframe is displayed adjacent to our panel, and the mouse exits over the iframe,
- * document[onmouseup] is not triggered because the document is no longer the same over
- * the iframe. We add an invisible overlay while resizing so that the mouse context
- * remains in our main document.
- */
- addInvisibleOverlay(): void;
- overlay: any;
- removeInvisibleOverlay(): void;
- flash(): void;
-}
-export {};
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/filters/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/filters/index.d.ts
index 28238231f..02443ccd5 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/filters/index.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/filters/index.d.ts
@@ -1 +1 @@
-export { trusted } from "./trusted";
+export { trusted } from './trusted';
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/filters/trusted.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/filters/trusted.d.ts
index 4a1324ee5..29681ff33 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/filters/trusted.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/filters/trusted.d.ts
@@ -1 +1 @@
-export function trusted($sce: any): (url: any) => any;
+export declare function trusted($sce: ng.ISCEService): (url: string) => any;
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/alertService.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/alertService.d.ts
index bd3b618ce..8d3157c6c 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/services/alertService.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/services/alertService.d.ts
@@ -1,6 +1,5 @@
-export class AlertService extends SNAlertService {
- constructor(deviceInterface: import("../../../../../snjs/dist/@types").DeviceInterface);
- alert(title: any, text: any, closeButtonText?: string, onClose: any): Promise;
- confirm(title: any, text: any, confirmButtonText?: string, cancelButtonText?: string, onConfirm: any, onCancel: any, destructive?: boolean): Promise;
+import { SNAlertService } from 'snjs';
+export declare class AlertService extends SNAlertService {
+ alert(title: string, text: string, closeButtonText: string | undefined, onClose: () => void): Promise;
+ confirm(title: string, text: string, confirmButtonText: string | undefined, cancelButtonText: string | undefined, onConfirm: () => void, onCancel: () => void, destructive?: boolean): Promise;
}
-import { SNAlertService } from "../../../../../snjs/dist/@types";
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/archiveManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/archiveManager.d.ts
index 7442f11d5..51b2e8aeb 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/services/archiveManager.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/services/archiveManager.d.ts
@@ -1,21 +1,16 @@
-export class ArchiveManager {
- constructor(application: any);
- application: any;
- /** @public */
- public downloadBackup(encrypted: any): Promise;
- /** @public */
- public downloadBackupOfItems(items: any, encrypted: any): Promise;
- /** @private */
+import { WebApplication } from '@/application';
+import { SNItem } from 'snjs';
+export declare class ArchiveManager {
+ private readonly application;
+ private textFile?;
+ constructor(application: WebApplication);
+ downloadBackup(encrypted: boolean): Promise;
+ downloadBackupOfItems(items: SNItem[], encrypted: boolean): Promise;
private formattedDate;
- /** @private */
private itemsData;
- /** @private */
+ private get zip();
private loadZip;
- /** @private */
private downloadZippedItems;
- /** @private */
private hrefForData;
- textFile: string | undefined;
- /** @private */
private downloadData;
}
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/desktopManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/desktopManager.d.ts
index d45215ef4..51c9aeb56 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/services/desktopManager.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/services/desktopManager.d.ts
@@ -1,49 +1,61 @@
-export class DesktopManager extends ApplicationService {
- constructor($rootScope: any, $timeout: any, application: any);
- $rootScope: any;
- $timeout: any;
- componentActivationObservers: any[];
- updateObservers: any[];
+import { SNComponent, PurePayload } from 'snjs';
+import { WebApplication } from '@/application';
+import { ApplicationService, ApplicationEvent } from 'snjs';
+declare type UpdateObserverCallback = (component: SNComponent) => void;
+declare type ComponentActivationCallback = (payload: PurePayload) => void;
+declare type ComponentActivationObserver = {
+ id: string;
+ callback: ComponentActivationCallback;
+};
+export declare class DesktopManager extends ApplicationService {
+ $rootScope: ng.IRootScopeService;
+ $timeout: ng.ITimeoutService;
+ componentActivationObservers: ComponentActivationObserver[];
+ updateObservers: {
+ callback: UpdateObserverCallback;
+ }[];
isDesktop: any;
- /** @override */
- onAppEvent(eventName: any): void;
- dataLoaded: boolean | undefined;
+ dataLoaded: boolean;
+ dataLoadHandler?: () => void;
+ majorDataChangeHandler?: () => void;
+ extServerHost?: string;
+ installationSyncHandler?: (payloads: PurePayload[]) => void;
+ installComponentHandler?: (payload: PurePayload) => void;
+ lastSearchedText?: string;
+ searchHandler?: (text?: string) => void;
+ constructor($rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, application: WebApplication);
+ get webApplication(): WebApplication;
+ deinit(): void;
+ onAppEvent(eventName: ApplicationEvent): Promise;
saveBackup(): void;
- getExtServerHost(): any;
+ getExtServerHost(): string | undefined;
/**
* Sending a component in its raw state is really slow for the desktop app
* Keys are not passed into ItemParams, so the result is not encrypted
*/
- convertComponentForTransmission(component: any): Promise;
- syncComponentsInstallation(components: any): void;
- installComponent(component: any): Promise;
- registerUpdateObserver(callback: any): () => void;
- searchText(text: any): void;
- lastSearchedText: any;
+ convertComponentForTransmission(component: SNComponent): Promise;
+ syncComponentsInstallation(components: SNComponent[]): void;
+ installComponent(component: SNComponent): Promise;
+ registerUpdateObserver(callback: UpdateObserverCallback): () => void;
+ searchText(text?: string): void;
redoSearch(): void;
- desktop_setSearchHandler(handler: any): void;
- searchHandler: any;
+ desktop_setSearchHandler(handler: (text?: string) => void): void;
desktop_windowGainedFocus(): void;
desktop_windowLostFocus(): void;
desktop_onComponentInstallationComplete(componentData: any, error: any): Promise;
- desktop_registerComponentActivationObserver(callback: any): {
- id: () => number;
- callback: any;
+ desktop_registerComponentActivationObserver(callback: ComponentActivationCallback): {
+ id: string;
+ callback: ComponentActivationCallback;
};
- desktop_deregisterComponentActivationObserver(observer: any): void;
- notifyComponentActivation(component: any): Promise;
- desktop_setExtServerHost(host: any): void;
- extServerHost: any;
- desktop_setComponentInstallationSyncHandler(handler: any): void;
- installationSyncHandler: any;
- desktop_setInstallComponentHandler(handler: any): void;
- installComponentHandler: any;
- desktop_setInitialDataLoadHandler(handler: any): void;
- dataLoadHandler: any;
- desktop_requestBackupFile(callback: any): Promise;
- desktop_setMajorDataChangeHandler(handler: any): void;
- majorDataChangeHandler: any;
+ desktop_deregisterComponentActivationObserver(observer: ComponentActivationObserver): void;
+ notifyComponentActivation(component: SNComponent): Promise;
+ desktop_setExtServerHost(host: string): void;
+ desktop_setComponentInstallationSyncHandler(handler: (payloads: PurePayload[]) => void): void;
+ desktop_setInstallComponentHandler(handler: (payload: PurePayload) => void): void;
+ desktop_setInitialDataLoadHandler(handler: () => void): void;
+ desktop_requestBackupFile(callback: (data: any) => void): Promise;
+ desktop_setMajorDataChangeHandler(handler: () => void): void;
desktop_didBeginBackup(): void;
- desktop_didFinishBackup(success: any): void;
+ desktop_didFinishBackup(success: boolean): void;
}
-import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types";
+export {};
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/index.d.ts
index 7558e5de1..6fb993fcc 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/services/index.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/services/index.d.ts
@@ -1,10 +1,10 @@
-export { AlertService } from "./alertService";
-export { ArchiveManager } from "./archiveManager";
-export { DesktopManager } from "./desktopManager";
-export { KeyboardManager } from "./keyboardManager";
-export { LockManager } from "./lockManager";
-export { NativeExtManager } from "./nativeExtManager";
-export { PreferencesManager } from "./preferencesManager";
-export { StatusManager } from "./statusManager";
-export { ThemeManager } from "./themeManager";
-export { AppState } from "./state";
+export { AlertService } from './alertService';
+export { ArchiveManager } from './archiveManager';
+export { DesktopManager } from './desktopManager';
+export { KeyboardManager } from './keyboardManager';
+export { LockManager } from './lockManager';
+export { NativeExtManager } from './nativeExtManager';
+export { PreferencesManager } from './preferencesManager';
+export { StatusManager } from './statusManager';
+export { ThemeManager } from './themeManager';
+export { AppState } from './state';
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/nativeExtManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/nativeExtManager.d.ts
index df6d08911..c45ccfd94 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/services/nativeExtManager.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/services/nativeExtManager.d.ts
@@ -1,17 +1,18 @@
+import { SNPredicate, ApplicationService } from 'snjs';
+import { PayloadContent } from '@/../../../../snjs/dist/@types/protocol/payloads/generator';
/** A class for handling installation of system extensions */
-export class NativeExtManager extends ApplicationService {
- constructor(application: any);
+export declare class NativeExtManager extends ApplicationService {
extManagerId: string;
batchManagerId: string;
/** @override */
- onAppLaunch(): void;
+ onAppLaunch(): Promise;
get extManagerPred(): SNPredicate;
get batchManagerPred(): SNPredicate;
+ get extMgrUrl(): any;
+ get batchMgrUrl(): any;
reload(): void;
resolveExtensionsManager(): Promise;
- extensionsManagerTemplatePayload(): import("../../../../../snjs/dist/@types/protocol/payloads/pure_payload").PurePayload | undefined;
- batchManagerTemplatePayload(): import("../../../../../snjs/dist/@types/protocol/payloads/pure_payload").PurePayload | undefined;
+ extensionsManagerTemplateContent(): PayloadContent;
resolveBatchManager(): Promise;
+ batchManagerTemplateContent(): PayloadContent;
}
-import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types";
-import { SNPredicate } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types";
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/preferencesManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/preferencesManager.d.ts
index dcc438b81..273105cdb 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/services/preferencesManager.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/services/preferencesManager.d.ts
@@ -1,29 +1,14 @@
-export namespace WebPrefKey {
- export const TagsPanelWidth: string;
- export const NotesPanelWidth: string;
- export const EditorWidth: string;
- export const EditorLeft: string;
- export const EditorMonospaceEnabled: string;
- export const EditorSpellcheck: string;
- export const EditorResizersEnabled: string;
- export const SortNotesBy: string;
- export const SortNotesReverse: string;
- export const NotesShowArchived: string;
- export const NotesHidePinned: string;
- export const NotesHideNotePreview: string;
- export const NotesHideDate: string;
- export const NotesHideTags: string;
-}
-export class PreferencesManager extends ApplicationService {
- constructor(application: import("../../../../../snjs/dist/@types/application").SNApplication);
+import { WebApplication } from '@/application';
+import { ApplicationService, WebPrefKey } from 'snjs';
+export declare class PreferencesManager extends ApplicationService {
+ private userPreferences;
/** @override */
- onAppLaunch(): void;
+ onAppLaunch(): Promise;
+ get webApplication(): WebApplication;
streamPreferences(): void;
loadSingleton(): Promise;
- userPreferences: any;
preferencesDidChange(): void;
syncUserPreferences(): void;
- getValue(key: any, defaultValue: any): any;
- setUserPrefValue(key: any, value: any, sync: any): void;
+ getValue(key: WebPrefKey, defaultValue?: any): any;
+ setUserPrefValue(key: WebPrefKey, value: any, sync?: boolean): void;
}
-import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types";
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/themeManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/themeManager.d.ts
index 4d34eabe1..da62cfd06 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/services/themeManager.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/services/themeManager.d.ts
@@ -1,26 +1,21 @@
-export class ThemeManager extends ApplicationService {
- constructor(application: any);
- activeThemes: any[];
- unsubState: any;
- unregisterDesktop: any;
- unregisterComponent: any;
+import { WebApplication } from '@/application';
+import { ApplicationService } from 'snjs';
+export declare class ThemeManager extends ApplicationService {
+ private activeThemes;
+ private unsubState;
+ private unregisterDesktop;
+ private unregisterComponent;
+ constructor(application: WebApplication);
+ get webApplication(): WebApplication;
+ deinit(): void;
/** @override */
- onAppStart(): void;
- /** @access private */
- activateCachedThemes(): Promise;
- /** @access private */
- registerObservers(): void;
- /** @access public */
+ onAppStart(): Promise;
+ private activateCachedThemes;
+ private registerObservers;
deactivateAllThemes(): void;
- /** @access private */
- activateTheme(theme: any, writeToCache?: boolean): void;
- /** @access private */
- deactivateTheme(theme: any): void;
- /** @access private */
- cacheThemes(): Promise;
- /** @access private */
- decacheThemes(): Promise;
- /** @access private */
- getCachedThemes(): Promise;
+ private activateTheme;
+ private deactivateTheme;
+ private cacheThemes;
+ private decacheThemes;
+ private getCachedThemes;
}
-import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types";
diff --git a/app/assets/javascripts/@types/app/assets/javascripts/utils.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/utils.d.ts
index 36020cc7d..e35b23e08 100644
--- a/app/assets/javascripts/@types/app/assets/javascripts/utils.d.ts
+++ b/app/assets/javascripts/@types/app/assets/javascripts/utils.d.ts
@@ -4,5 +4,5 @@ export declare function dictToArray(dict: any): any[];
export declare function getPlatformString(): string;
export declare function dateToLocalizedString(date: Date): string;
/** Via https://davidwalsh.name/javascript-debounce-function */
-export declare function debounce(this: any, func: any, wait: number, immediate: boolean): () => void;
+export declare function debounce(this: any, func: any, wait: number, immediate?: boolean): () => void;
export declare function isDesktopApplication(): any;
diff --git a/app/assets/javascripts/controllers/editor.ts b/app/assets/javascripts/controllers/editor.ts
index 1de70b90e..3515210cf 100644
--- a/app/assets/javascripts/controllers/editor.ts
+++ b/app/assets/javascripts/controllers/editor.ts
@@ -956,7 +956,7 @@ class EditorCtrl extends PureCtrl {
}
}
- async toggleWebPrefKey(key: string) {
+ async toggleWebPrefKey(key: WebPrefKey) {
(this as any)[key] = !(this as any)[key];
this.application.getPrefsService().setUserPrefValue(
key,
diff --git a/app/assets/javascripts/controllers/notes/notes.ts b/app/assets/javascripts/controllers/notes/notes.ts
index 27603e177..559b97510 100644
--- a/app/assets/javascripts/controllers/notes/notes.ts
+++ b/app/assets/javascripts/controllers/notes/notes.ts
@@ -655,7 +655,7 @@ class NotesCtrl extends PureCtrl {
this.setShowMenuFalse();
}
- toggleWebPrefKey(key: string) {
+ toggleWebPrefKey(key: WebPrefKey) {
this.application!.getPrefsService().setUserPrefValue(key, !this.state[key]);
this.application!.getPrefsService().syncUserPreferences();
}
diff --git a/app/assets/javascripts/directives/functional/lowercase.ts b/app/assets/javascripts/directives/functional/lowercase.ts
index 95b0a27a1..3fc479272 100644
--- a/app/assets/javascripts/directives/functional/lowercase.ts
+++ b/app/assets/javascripts/directives/functional/lowercase.ts
@@ -6,7 +6,7 @@ export function lowercase() {
scope: ng.IScope,
_: JQLite,
attrs: any,
- ctrl: ng.IController
+ ctrl: any
) {
const lowercase = (inputValue: string) => {
if (inputValue === undefined) inputValue = '';
diff --git a/app/assets/javascripts/services/desktopManager.ts b/app/assets/javascripts/services/desktopManager.ts
index ba7f0f7e4..1f8b46621 100644
--- a/app/assets/javascripts/services/desktopManager.ts
+++ b/app/assets/javascripts/services/desktopManager.ts
@@ -31,7 +31,7 @@ export class DesktopManager extends ApplicationService {
installationSyncHandler?: (payloads: PurePayload[]) => void
installComponentHandler?: (payload: PurePayload) => void
lastSearchedText?: string
- searchHandler?: (text: string) => void
+ searchHandler?: (text?: string) => void
constructor(
$rootScope: ng.IRootScopeService,
@@ -118,7 +118,7 @@ export class DesktopManager extends ApplicationService {
};
}
- searchText(text: string) {
+ searchText(text?: string) {
if (!this.isDesktop) {
return;
}
@@ -133,7 +133,7 @@ export class DesktopManager extends ApplicationService {
}
// Pass null to cancel search
- desktop_setSearchHandler(handler: (text: string) => void) {
+ desktop_setSearchHandler(handler: (text?: string) => void) {
this.searchHandler = handler;
}
diff --git a/app/assets/javascripts/services/nativeExtManager.js b/app/assets/javascripts/services/nativeExtManager.js
deleted file mode 100644
index 468f0118e..000000000
--- a/app/assets/javascripts/services/nativeExtManager.js
+++ /dev/null
@@ -1,183 +0,0 @@
-import { isDesktopApplication, dictToArray } from '@/utils';
-import {
- SNPredicate,
- ContentType,
- CreateMaxPayloadFromAnyObject,
- ApplicationService
-} from 'snjs';
-
-const STREAM_ITEMS_PERMISSION = 'stream-items';
-
-/** A class for handling installation of system extensions */
-export class NativeExtManager extends ApplicationService {
- /* @ngInject */
- constructor(application) {
- super(application);
- this.extManagerId = 'org.standardnotes.extensions-manager';
- this.batchManagerId = 'org.standardnotes.batch-manager';
- }
-
- /** @override */
- onAppLaunch() {
- super.onAppLaunch();
- this.reload();
- }
-
- get extManagerPred() {
- const extManagerId = 'org.standardnotes.extensions-manager';
- return SNPredicate.CompoundPredicate([
- new SNPredicate('content_type', '=', ContentType.Component),
- new SNPredicate('package_info.identifier', '=', extManagerId)
- ]);
- }
-
- get batchManagerPred() {
- const batchMgrId = 'org.standardnotes.batch-manager';
- return SNPredicate.CompoundPredicate([
- new SNPredicate('content_type', '=', ContentType.Component),
- new SNPredicate('package_info.identifier', '=', batchMgrId)
- ]);
- }
-
- reload() {
- this.application.singletonManager.registerPredicate(this.extManagerPred);
- this.application.singletonManager.registerPredicate(this.batchManagerPred);
- this.resolveExtensionsManager();
- this.resolveBatchManager();
- }
-
- async resolveExtensionsManager() {
- const extensionsManager = await this.application.singletonManager.findOrCreateSingleton({
- predicate: this.extManagerPred,
- createPayload: this.extensionsManagerTemplatePayload()
- });
- let needsSync = false;
- if (isDesktopApplication()) {
- if (!extensionsManager.local_url) {
- extensionsManager.local_url = window._extensions_manager_location;
- needsSync = true;
- }
- } else {
- if (!extensionsManager.hosted_url) {
- extensionsManager.hosted_url = window._extensions_manager_location;
- needsSync = true;
- }
- }
- // Handle addition of SN|ExtensionRepo permission
- const permission = extensionsManager.content.permissions.find((p) => p.name === STREAM_ITEMS_PERMISSION);
- if (!permission.content_types.includes(ContentType.ExtensionRepo)) {
- permission.content_types.push(ContentType.ExtensionRepo);
- needsSync = true;
- }
- if (needsSync) {
- this.application.saveItem({ item: extensionsManager });
- }
- }
-
- extensionsManagerTemplatePayload() {
- const url = window._extensions_manager_location;
- if (!url) {
- console.error('window._extensions_manager_location must be set.');
- return;
- }
- const packageInfo = {
- name: 'Extensions',
- identifier: this.extManagerId
- };
- const content = {
- name: packageInfo.name,
- area: 'rooms',
- package_info: packageInfo,
- permissions: [
- {
- name: STREAM_ITEMS_PERMISSION,
- content_types: [
- ContentType.Component,
- ContentType.Theme,
- ContentType.ServerExtension,
- ContentType.ActionsExtension,
- ContentType.Mfa,
- ContentType.Editor,
- ContentType.ExtensionRepo
- ]
- }
- ]
- };
- if (isDesktopApplication()) {
- content.local_url = window._extensions_manager_location;
- } else {
- content.hosted_url = window._extensions_manager_location;
- }
- const payload = CreateMaxPayloadFromAnyObject({
- object: {
- content_type: ContentType.Component,
- content: content
- }
- });
- return payload;
- }
-
- batchManagerTemplatePayload() {
- const url = window._batch_manager_location;
- if (!url) {
- console.error('window._batch_manager_location must be set.');
- return;
- }
- const packageInfo = {
- name: 'Batch Manager',
- identifier: this.batchManagerId
- };
- const allContentType = dictToArray(ContentType);
- const content = {
- name: packageInfo.name,
- area: 'modal',
- package_info: packageInfo,
- permissions: [
- {
- name: STREAM_ITEMS_PERMISSION,
- content_types: allContentType
- }
- ]
- };
- if (isDesktopApplication()) {
- content.local_url = window._batch_manager_location;
- } else {
- content.hosted_url = window._batch_manager_location;
- }
- const payload = CreateMaxPayloadFromAnyObject({
- object: {
- content_type: ContentType.Component,
- content: content
- }
- });
- return payload;
- }
-
- async resolveBatchManager() {
- const batchManager = await this.application.singletonManager.findOrCreateSingleton({
- predicate: this.batchManagerPred,
- createPayload: this.batchManagerTemplatePayload()
- });
- let needsSync = false;
- if (isDesktopApplication()) {
- if (!batchManager.local_url) {
- batchManager.local_url = window._batch_manager_location;
- needsSync = true;
- }
- } else {
- if (!batchManager.hosted_url) {
- batchManager.hosted_url = window._batch_manager_location;
- needsSync = true;
- }
- }
- // Handle addition of SN|ExtensionRepo permission
- const permission = batchManager.content.permissions.find((p) => p.name === STREAM_ITEMS_PERMISSION);
- if (!permission.content_types.includes(ContentType.ExtensionRepo)) {
- permission.content_types.push(ContentType.ExtensionRepo);
- needsSync = true;
- }
- if (needsSync) {
- this.application.saveItem({ item: batchManager });
- }
- }
-}
diff --git a/app/assets/javascripts/services/nativeExtManager.ts b/app/assets/javascripts/services/nativeExtManager.ts
new file mode 100644
index 000000000..f5c2d2bb8
--- /dev/null
+++ b/app/assets/javascripts/services/nativeExtManager.ts
@@ -0,0 +1,203 @@
+import { isDesktopApplication, dictToArray } from '@/utils';
+import {
+ SNPredicate,
+ ContentType,
+ SNComponent,
+ ApplicationService,
+ ComponentAction
+} from 'snjs';
+import { PayloadContent } from '@/../../../../snjs/dist/@types/protocol/payloads/generator';
+import { FillItemContent } from '@/../../../../snjs/dist/@types/models/generator';
+import { ComponentMutator } from '@/../../../../snjs/dist/@types/models';
+
+/** A class for handling installation of system extensions */
+export class NativeExtManager extends ApplicationService {
+ extManagerId = 'org.standardnotes.extensions-manager';
+ batchManagerId = 'org.standardnotes.batch-manager';
+
+ /** @override */
+ async onAppLaunch() {
+ super.onAppLaunch();
+ this.reload();
+ }
+
+ get extManagerPred() {
+ const extManagerId = 'org.standardnotes.extensions-manager';
+ return SNPredicate.CompoundPredicate([
+ new SNPredicate('content_type', '=', ContentType.Component),
+ new SNPredicate('package_info.identifier', '=', extManagerId)
+ ]);
+ }
+
+ get batchManagerPred() {
+ const batchMgrId = 'org.standardnotes.batch-manager';
+ return SNPredicate.CompoundPredicate([
+ new SNPredicate('content_type', '=', ContentType.Component),
+ new SNPredicate('package_info.identifier', '=', batchMgrId)
+ ]);
+ }
+
+ get extMgrUrl() {
+ return (window as any)._extensions_manager_location;
+ }
+
+ get batchMgrUrl() {
+ return (window as any)._batch_manager_location;
+ }
+
+ reload() {
+ this.application!.singletonManager!.registerPredicate(this.extManagerPred);
+ this.application!.singletonManager!.registerPredicate(this.batchManagerPred);
+ this.resolveExtensionsManager();
+ this.resolveBatchManager();
+ }
+
+ async resolveExtensionsManager() {
+ const extensionsManager = (await this.application!.singletonManager!.findOrCreateSingleton(
+ this.extManagerPred,
+ ContentType.Component,
+ this.extensionsManagerTemplateContent()
+ )) as SNComponent;
+ let needsSync = false;
+ if (isDesktopApplication()) {
+ if (!extensionsManager.local_url) {
+ await this.application!.changeItem(extensionsManager.uuid, (m) => {
+ const mutator = m as ComponentMutator;
+ mutator.local_url = this.extMgrUrl;
+ });
+ needsSync = true;
+ }
+ } else {
+ if (!extensionsManager.hosted_url) {
+ await this.application!.changeItem(extensionsManager.uuid, (m) => {
+ const mutator = m as ComponentMutator;
+ mutator.hosted_url = this.extMgrUrl;
+ });
+ needsSync = true;
+ }
+ }
+ // Handle addition of SN|ExtensionRepo permission
+ const permissions = extensionsManager!.permissions.slice();
+ const permission = permissions.find((p) => {
+ return p.name === ComponentAction.StreamItems
+ });
+ if (permission && !permission.content_types!.includes(ContentType.ExtensionRepo)) {
+ permission.content_types!.push(ContentType.ExtensionRepo);
+ await this.application!.changeItem(extensionsManager.uuid, (m) => {
+ const mutator = m as ComponentMutator;
+ mutator.permissions = permissions;
+ });
+ needsSync = true;
+ }
+ if (needsSync) {
+ this.application!.saveItem(extensionsManager.uuid);
+ }
+ }
+
+ extensionsManagerTemplateContent() {
+ const url = this.extMgrUrl;
+ if (!url) {
+ throw Error('this.extMgrUrl must be set.');
+ }
+ const packageInfo = {
+ name: 'Extensions',
+ identifier: this.extManagerId
+ };
+ const content = FillItemContent({
+ name: packageInfo.name,
+ area: 'rooms',
+ package_info: packageInfo,
+ permissions: [
+ {
+ name: ComponentAction.StreamItems,
+ content_types: [
+ ContentType.Component,
+ ContentType.Theme,
+ ContentType.ServerExtension,
+ ContentType.ActionsExtension,
+ ContentType.Mfa,
+ ContentType.Editor,
+ ContentType.ExtensionRepo
+ ]
+ }
+ ]
+ }) as PayloadContent;
+ if (isDesktopApplication()) {
+ content.local_url = this.extMgrUrl;
+ } else {
+ content.hosted_url = this.extMgrUrl;
+ }
+ return content;
+ }
+
+ async resolveBatchManager() {
+ const batchManager = (await this.application!.singletonManager!.findOrCreateSingleton(
+ this.batchManagerPred,
+ ContentType.Component,
+ this.batchManagerTemplateContent()
+ )) as SNComponent;
+ let needsSync = false;
+ if (isDesktopApplication()) {
+ if (!batchManager.local_url) {
+ await this.application!.changeItem(batchManager.uuid, (m) => {
+ const mutator = m as ComponentMutator;
+ mutator.local_url = this.batchMgrUrl;
+ });
+ needsSync = true;
+ }
+ } else {
+ if (!batchManager.hosted_url) {
+ await this.application!.changeItem(batchManager.uuid, (m) => {
+ const mutator = m as ComponentMutator;
+ mutator.hosted_url = this.batchMgrUrl;
+ });
+ needsSync = true;
+ }
+ }
+ // Handle addition of SN|ExtensionRepo permission
+ const permissions = batchManager!.permissions.slice();
+ const permission = permissions.find((p) => {
+ return p.name === ComponentAction.StreamItems
+ });
+ if (permission && !permission.content_types!.includes(ContentType.ExtensionRepo)) {
+ permission.content_types!.push(ContentType.ExtensionRepo);
+ await this.application!.changeItem(batchManager.uuid, (m) => {
+ const mutator = m as ComponentMutator;
+ mutator.permissions = permissions;
+ });
+ needsSync = true;
+ }
+ if (needsSync) {
+ this.application!.saveItem(batchManager.uuid);
+ }
+ }
+
+ batchManagerTemplateContent() {
+ const url = this.batchMgrUrl;
+ if (!url) {
+ throw Error('window._batch_manager_location must be set.');
+ }
+ const packageInfo = {
+ name: 'Batch Manager',
+ identifier: this.batchManagerId
+ };
+ const allContentType = dictToArray(ContentType);
+ const content = FillItemContent({
+ name: packageInfo.name,
+ area: 'modal',
+ package_info: packageInfo,
+ permissions: [
+ {
+ name: ComponentAction.StreamItems,
+ content_types: allContentType
+ }
+ ]
+ });
+ if (isDesktopApplication()) {
+ content.local_url = this.batchMgrUrl;
+ } else {
+ content.hosted_url = this.batchMgrUrl;
+ }
+ return content;
+ }
+}
diff --git a/app/assets/javascripts/services/preferencesManager.ts b/app/assets/javascripts/services/preferencesManager.ts
index 65566d590..1362552b8 100644
--- a/app/assets/javascripts/services/preferencesManager.ts
+++ b/app/assets/javascripts/services/preferencesManager.ts
@@ -54,7 +54,7 @@ export class PreferencesManager extends ApplicationService {
}
}
- getValue(key: WebPrefKey, defaultValue: any) {
+ getValue(key: WebPrefKey, defaultValue?: any) {
if (!this.userPreferences) { return defaultValue; }
const value = this.userPreferences.getPref(key);
return (value !== undefined && value !== null) ? value : defaultValue;