refactor: component manager usecases (#2354)
This commit is contained in:
@@ -3,43 +3,39 @@ import {
|
||||
ComponentArea,
|
||||
ComponentFeatureDescription,
|
||||
EditorFeatureDescription,
|
||||
EditorIdentifier,
|
||||
IframeComponentFeatureDescription,
|
||||
ThemeFeatureDescription,
|
||||
} from '@standardnotes/features'
|
||||
import {
|
||||
ActionObserver,
|
||||
ComponentInterface,
|
||||
ComponentOrNativeFeature,
|
||||
PermissionDialog,
|
||||
SNNote,
|
||||
} from '@standardnotes/models'
|
||||
|
||||
import { ActionObserver, ComponentInterface, UIFeature, PermissionDialog, SNNote, SNTag } from '@standardnotes/models'
|
||||
import { DesktopManagerInterface } from '../Device/DesktopManagerInterface'
|
||||
import { ComponentViewerInterface } from './ComponentViewerInterface'
|
||||
|
||||
export interface ComponentManagerInterface {
|
||||
urlForComponent(uiFeature: ComponentOrNativeFeature<ComponentFeatureDescription>): string | undefined
|
||||
urlForFeature(uiFeature: UIFeature<ComponentFeatureDescription>): string | undefined
|
||||
setDesktopManager(desktopManager: DesktopManagerInterface): void
|
||||
thirdPartyComponentsForArea(area: ComponentArea): ComponentInterface[]
|
||||
editorForNote(note: SNNote): ComponentOrNativeFeature<EditorFeatureDescription | IframeComponentFeatureDescription>
|
||||
doesEditorChangeRequireAlert(
|
||||
from: ComponentOrNativeFeature<IframeComponentFeatureDescription | EditorFeatureDescription> | undefined,
|
||||
to: ComponentOrNativeFeature<IframeComponentFeatureDescription | EditorFeatureDescription> | undefined,
|
||||
from: UIFeature<IframeComponentFeatureDescription | EditorFeatureDescription> | undefined,
|
||||
to: UIFeature<IframeComponentFeatureDescription | EditorFeatureDescription> | undefined,
|
||||
): boolean
|
||||
showEditorChangeAlert(): Promise<boolean>
|
||||
destroyComponentViewer(viewer: ComponentViewerInterface): void
|
||||
createComponentViewer(
|
||||
uiFeature: ComponentOrNativeFeature<IframeComponentFeatureDescription>,
|
||||
uiFeature: UIFeature<IframeComponentFeatureDescription>,
|
||||
item: ComponentViewerItem,
|
||||
actionObserver?: ActionObserver,
|
||||
urlOverride?: string,
|
||||
): ComponentViewerInterface
|
||||
presentPermissionsDialog(_dialog: PermissionDialog): void
|
||||
legacyGetDefaultEditor(): ComponentInterface | undefined
|
||||
|
||||
isThemeActive(theme: ComponentOrNativeFeature<ThemeFeatureDescription>): boolean
|
||||
toggleTheme(theme: ComponentOrNativeFeature<ThemeFeatureDescription>): Promise<void>
|
||||
getActiveThemes(): ComponentOrNativeFeature<ThemeFeatureDescription>[]
|
||||
setPermissionDialogUIHandler(handler: (dialog: PermissionDialog) => void): void
|
||||
|
||||
editorForNote(note: SNNote): UIFeature<EditorFeatureDescription | IframeComponentFeatureDescription>
|
||||
getDefaultEditorIdentifier(currentTag?: SNTag): EditorIdentifier
|
||||
|
||||
isThemeActive(theme: UIFeature<ThemeFeatureDescription>): boolean
|
||||
toggleTheme(theme: UIFeature<ThemeFeatureDescription>): Promise<void>
|
||||
getActiveThemes(): UIFeature<ThemeFeatureDescription>[]
|
||||
getActiveThemesIdentifiers(): string[]
|
||||
|
||||
isComponentActive(component: ComponentInterface): boolean
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
ActionObserver,
|
||||
ComponentEventObserver,
|
||||
ComponentMessage,
|
||||
ComponentOrNativeFeature,
|
||||
} from '@standardnotes/models'
|
||||
import { ActionObserver, ComponentEventObserver, ComponentMessage, UIFeature } from '@standardnotes/models'
|
||||
import { FeatureStatus } from '../Feature/FeatureStatus'
|
||||
import { ComponentViewerError } from './ComponentViewerError'
|
||||
import { IframeComponentFeatureDescription } from '@standardnotes/features'
|
||||
@@ -16,7 +11,7 @@ export interface ComponentViewerInterface {
|
||||
get url(): string
|
||||
get componentUniqueIdentifier(): string
|
||||
|
||||
getComponentOrFeatureItem(): ComponentOrNativeFeature<IframeComponentFeatureDescription>
|
||||
getComponentOrFeatureItem(): UIFeature<IframeComponentFeatureDescription>
|
||||
|
||||
destroy(): void
|
||||
setReadonly(readonly: boolean): void
|
||||
|
||||
@@ -15,16 +15,20 @@ export interface MobileDeviceInterface extends DeviceInterface {
|
||||
authenticateWithBiometrics(): Promise<boolean>
|
||||
hideMobileInterfaceFromScreenshots(): void
|
||||
stopHidingMobileInterfaceFromScreenshots(): void
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
consoleLog(...args: any[]): void
|
||||
|
||||
handleThemeSchemeChange(isDark: boolean, bgColor: string): void
|
||||
shareBase64AsFile(base64: string, filename: string): Promise<void>
|
||||
downloadBase64AsFile(base64: string, filename: string, saveInTempLocation?: boolean): Promise<string | undefined>
|
||||
previewFile(base64: string, filename: string): Promise<boolean>
|
||||
exitApp(confirm?: boolean): void
|
||||
addComponentUrl(componentUuid: string, componentUrl: string): void
|
||||
removeComponentUrl(componentUuid: string): void
|
||||
isUrlComponentUrl(url: string): boolean
|
||||
|
||||
registerComponentUrl(componentUuid: string, componentUrl: string): void
|
||||
deregisterComponentUrl(componentUuid: string): void
|
||||
isUrlRegisteredComponentUrl(url: string): boolean
|
||||
|
||||
getAppState(): Promise<'active' | 'background' | 'inactive' | 'unknown' | 'extension'>
|
||||
getColorScheme(): Promise<'light' | 'dark' | null | undefined>
|
||||
purchaseSubscriptionIAP(plan: AppleIAPProductId): Promise<AppleIAPReceipt | undefined>
|
||||
|
||||
Reference in New Issue
Block a user