chore: add server switcher (#2717)
* wip * wip2 * refactor: use radio button group * chore: add persisting host per workspace * chore: header style * chore: update server picker title style * chore: margin * chore: label * chore: remove separator * rename migration to latest snjs version --------- Co-authored-by: Aman Harwara <amanharwara@protonmail.com>
This commit is contained in:
27
packages/snjs/lib/Migrations/Versions/2_204_8.ts
Normal file
27
packages/snjs/lib/Migrations/Versions/2_204_8.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { ApplicationStage, StorageKey } from '@standardnotes/services'
|
||||
import { Migration } from '@Lib/Migrations/Migration'
|
||||
|
||||
export class Migration2_204_8 extends Migration {
|
||||
static override version(): string {
|
||||
return '2.204.8'
|
||||
}
|
||||
|
||||
protected registerStageHandlers(): void {
|
||||
this.registerStageHandler(ApplicationStage.Launched_10, async () => {
|
||||
await this.migrateHostKeyStoredToWorkspaceIdentified()
|
||||
|
||||
this.markDone()
|
||||
})
|
||||
}
|
||||
|
||||
private async migrateHostKeyStoredToWorkspaceIdentified(): Promise<void> {
|
||||
const existingHostKeyValue = this.services.storageService.getValue<string | undefined>(StorageKey.ServerHost)
|
||||
if (existingHostKeyValue === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
this.services.storageService.setValue(`${StorageKey.ServerHost}:${this.services.identifier}`, existingHostKeyValue)
|
||||
|
||||
await this.services.storageService.removeValue(StorageKey.ServerHost)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user