* refactor: menuRow directive to MenuRow component * refactor: migrate footer to react * refactor: migrate actions menu to react * refactor: migrate history menu to react * fix: click outside handler use capture to trigger event before re-render occurs which would otherwise cause node.contains to return incorrect result (specifically for the account menu) * refactor: migrate revision preview modal to react * refactor: migrate permissions modal to react * refactor: migrate password wizard to react * refactor: remove unused input modal directive * refactor: remove unused delay hide component * refactor: remove unused filechange directive * refactor: remove unused elemReady directive * refactor: remove unused sn-enter directive * refactor: remove unused lowercase directive * refactor: remove unused autofocus directive * refactor(wip): note view to react * refactor: use mutation observer to deinit textarea listeners * refactor: migrate challenge modal to react * refactor: migrate note group view to react * refactor(wip): migrate remaining classes * fix: navigation parent ref * refactor: fully remove angular assets * fix: account switcher * fix: application view state * refactor: remove unused password wizard type * fix: revision preview and permissions modal * fix: remove angular comment * refactor: react panel resizers for editor * feat: simple panel resizer * fix: use simple panel resizer everywhere * fix: simplify panel resizer state * chore: rename simple panel resizer to panel resizer * refactor: simplify column layout * fix: editor mount safety check * fix: use inline onLoad callback for iframe, as setting onload after it loads will never call it * chore: fix note view test * chore(deps): upgrade snjs
77 lines
2.4 KiB
TypeScript
77 lines
2.4 KiB
TypeScript
import { WebDeviceInterface } from '@/web_device_interface';
|
|
import { WebApplication } from './application';
|
|
import {
|
|
ApplicationDescriptor,
|
|
SNApplicationGroup,
|
|
DeviceInterface,
|
|
Platform,
|
|
} from '@standardnotes/snjs';
|
|
import { AppState } from '@/ui_models/app_state';
|
|
import { Bridge } from '@/services/bridge';
|
|
import { getPlatform, isDesktopApplication } from '@/utils';
|
|
import { ArchiveManager } from '@/services/archiveManager';
|
|
import { DesktopManager } from '@/services/desktopManager';
|
|
import { IOService } from '@/services/ioService';
|
|
import { AutolockService } from '@/services/autolock_service';
|
|
import { StatusManager } from '@/services/statusManager';
|
|
import { ThemeManager } from '@/services/themeManager';
|
|
|
|
export class ApplicationGroup extends SNApplicationGroup {
|
|
constructor(
|
|
private defaultSyncServerHost: string,
|
|
private bridge: Bridge,
|
|
private enableUnfinishedFeatures: boolean,
|
|
private webSocketUrl: string
|
|
) {
|
|
super(new WebDeviceInterface(bridge));
|
|
}
|
|
|
|
async initialize(callback?: any): Promise<void> {
|
|
await super.initialize({
|
|
applicationCreator: this.createApplication,
|
|
});
|
|
|
|
if (isDesktopApplication()) {
|
|
Object.defineProperty(window, 'desktopManager', {
|
|
get: () =>
|
|
(this.primaryApplication as WebApplication).getDesktopService(),
|
|
});
|
|
}
|
|
}
|
|
|
|
private createApplication = (
|
|
descriptor: ApplicationDescriptor,
|
|
deviceInterface: DeviceInterface
|
|
) => {
|
|
const platform = getPlatform();
|
|
const application = new WebApplication(
|
|
deviceInterface as WebDeviceInterface,
|
|
platform,
|
|
descriptor.identifier,
|
|
this.defaultSyncServerHost,
|
|
this.bridge,
|
|
this.enableUnfinishedFeatures,
|
|
this.webSocketUrl
|
|
);
|
|
const appState = new AppState(application, this.bridge);
|
|
const archiveService = new ArchiveManager(application);
|
|
const desktopService = new DesktopManager(application, this.bridge);
|
|
const io = new IOService(
|
|
platform === Platform.MacWeb || platform === Platform.MacDesktop
|
|
);
|
|
const autolockService = new AutolockService(application);
|
|
const statusManager = new StatusManager();
|
|
const themeService = new ThemeManager(application);
|
|
application.setWebServices({
|
|
appState,
|
|
archiveService,
|
|
desktopService,
|
|
io,
|
|
autolockService,
|
|
statusManager,
|
|
themeService,
|
|
});
|
|
return application;
|
|
};
|
|
}
|