feat: desktop compatibility, beta 1
This commit is contained in:
@@ -59,12 +59,22 @@ const startApplication: StartApplication = async function startApplication(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
const renderApp = () => {
|
||||||
render(
|
render(
|
||||||
<ApplicationGroupView mainApplicationGroup={mainApplicationGroup} />,
|
<ApplicationGroupView mainApplicationGroup={mainApplicationGroup} />,
|
||||||
document.body.appendChild(document.createElement('div'))
|
document.body.appendChild(document.createElement('div'))
|
||||||
);
|
);
|
||||||
});
|
};
|
||||||
|
|
||||||
|
const domReady =
|
||||||
|
document.readyState === 'complete' || document.readyState === 'interactive';
|
||||||
|
if (domReady) {
|
||||||
|
renderApp();
|
||||||
|
} else {
|
||||||
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
|
renderApp();
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (IsWebPlatform) {
|
if (IsWebPlatform) {
|
||||||
|
|||||||
@@ -15,12 +15,25 @@ import { WebAppEvent, WebApplication } from '@/ui_models/application';
|
|||||||
import { isDesktopApplication } from '@/utils';
|
import { isDesktopApplication } from '@/utils';
|
||||||
import { Bridge } from './bridge';
|
import { Bridge } from './bridge';
|
||||||
|
|
||||||
|
export interface ElectronDesktopCallbacks {
|
||||||
|
desktop_updateAvailable(): void;
|
||||||
|
desktop_windowGainedFocus(): void;
|
||||||
|
desktop_windowLostFocus(): void;
|
||||||
|
desktop_onComponentInstallationComplete(
|
||||||
|
componentData: any,
|
||||||
|
error: any
|
||||||
|
): Promise<void>;
|
||||||
|
desktop_requestBackupFile(): Promise<string | undefined>;
|
||||||
|
desktop_didBeginBackup(): void;
|
||||||
|
desktop_didFinishBackup(success: boolean): void;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An interface used by the Desktop application to interact with SN
|
* An interface used by the Desktop application to interact with SN
|
||||||
*/
|
*/
|
||||||
export class DesktopManager
|
export class DesktopManager
|
||||||
extends ApplicationService
|
extends ApplicationService
|
||||||
implements DesktopManagerInterface
|
implements DesktopManagerInterface, ElectronDesktopCallbacks
|
||||||
{
|
{
|
||||||
updateObservers: {
|
updateObservers: {
|
||||||
callback: (component: SNComponent) => void;
|
callback: (component: SNComponent) => void;
|
||||||
@@ -115,6 +128,10 @@ export class DesktopManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
desktop_updateAvailable(): void {
|
||||||
|
this.webApplication.notifyWebEvent(WebAppEvent.NewUpdateAvailable);
|
||||||
|
}
|
||||||
|
|
||||||
desktop_windowGainedFocus(): void {
|
desktop_windowGainedFocus(): void {
|
||||||
this.webApplication.notifyWebEvent(WebAppEvent.DesktopWindowGainedFocus);
|
this.webApplication.notifyWebEvent(WebAppEvent.DesktopWindowGainedFocus);
|
||||||
}
|
}
|
||||||
@@ -152,7 +169,7 @@ export class DesktopManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async desktop_requestBackupFile() {
|
async desktop_requestBackupFile(): Promise<string | undefined> {
|
||||||
const data = await this.application.createBackupFile(
|
const data = await this.application.createBackupFile(
|
||||||
this.application.hasProtectionSources()
|
this.application.hasProtectionSources()
|
||||||
? EncryptionIntent.FileEncrypted
|
? EncryptionIntent.FileEncrypted
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export class ApplicationGroup extends SNApplicationGroup {
|
|||||||
super(new WebDeviceInterface(bridge));
|
super(new WebDeviceInterface(bridge));
|
||||||
}
|
}
|
||||||
|
|
||||||
async initialize(callback?: any): Promise<void> {
|
async initialize(): Promise<void> {
|
||||||
await super.initialize({
|
await super.initialize({
|
||||||
applicationCreator: this.createApplication,
|
applicationCreator: this.createApplication,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "standard-notes-web",
|
"name": "standard-notes-web",
|
||||||
"version": "3.9.20",
|
"version": "3.9.30-beta.1",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
Reference in New Issue
Block a user