fix: workspace names now default to account email after signing in. It can later be changed from the workspace switcher menu.

This commit is contained in:
Mo
2023-05-04 05:52:42 -05:00
parent d9c480b67b
commit 8385b4e89f
184 changed files with 215 additions and 205 deletions

View File

@@ -0,0 +1,53 @@
import { WebApplication } from './WebApplication'
import { ApplicationDescriptor, SNApplicationGroup } from '@standardnotes/snjs'
import { getPlatform, isDesktopApplication } from '@/Utils'
import { WebOrDesktopDevice } from '@/Application/Device/WebOrDesktopDevice'
const createApplication = (
descriptor: ApplicationDescriptor,
deviceInterface: WebOrDesktopDevice,
defaultSyncServerHost: string,
device: WebOrDesktopDevice,
webSocketUrl: string,
) => {
const platform = getPlatform(device)
const application = new WebApplication(
deviceInterface,
platform,
descriptor.identifier,
defaultSyncServerHost,
webSocketUrl,
)
return application
}
export class WebApplicationGroup extends SNApplicationGroup<WebOrDesktopDevice> {
constructor(private defaultSyncServerHost: string, device: WebOrDesktopDevice, private webSocketUrl: string) {
super(device)
}
override async initialize(): Promise<void> {
const defaultSyncServerHost = this.defaultSyncServerHost
const webSocketUrl = this.webSocketUrl
await super.initialize({
applicationCreator: async (descriptor, device) => {
return createApplication(descriptor, device, defaultSyncServerHost, device, webSocketUrl)
},
})
if (isDesktopApplication()) {
window.webClient = (this.primaryApplication as WebApplication).getDesktopService()
}
}
override deinit() {
super.deinit()
if (isDesktopApplication()) {
delete window.webClient
}
}
}