feat: Switched editor appearance preferences to be local instead of synced (#2870)
This commit is contained in:
45
packages/snjs/lib/Migrations/Versions/2_209_0.ts
Normal file
45
packages/snjs/lib/Migrations/Versions/2_209_0.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { LocalPrefKey, ApplicationStage } from '@standardnotes/services'
|
||||
import { Migration } from '@Lib/Migrations/Migration'
|
||||
import { PrefDefaults, PrefKey } from '@standardnotes/models'
|
||||
|
||||
export class Migration2_209_0 extends Migration {
|
||||
static override version(): string {
|
||||
return '2.209.0'
|
||||
}
|
||||
|
||||
protected registerStageHandlers(): void {
|
||||
this.registerStageHandler(ApplicationStage.FullSyncCompleted_13, async () => {
|
||||
await this.migrateSyncedPreferencesToLocal()
|
||||
|
||||
this.markDone()
|
||||
})
|
||||
}
|
||||
|
||||
private async migrateSyncedPreferencesToLocal(): Promise<void> {
|
||||
this.services.preferences.setLocalValue(
|
||||
LocalPrefKey.EditorMonospaceEnabled,
|
||||
this.services.preferences.getValue(
|
||||
PrefKey.DEPRECATED_EditorMonospaceEnabled,
|
||||
PrefDefaults[LocalPrefKey.EditorMonospaceEnabled],
|
||||
),
|
||||
)
|
||||
this.services.preferences.setLocalValue(
|
||||
LocalPrefKey.EditorFontSize,
|
||||
this.services.preferences.getValue(PrefKey.DEPRECATED_EditorFontSize, PrefDefaults[LocalPrefKey.EditorFontSize]),
|
||||
)
|
||||
this.services.preferences.setLocalValue(
|
||||
LocalPrefKey.EditorLineWidth,
|
||||
this.services.preferences.getValue(
|
||||
PrefKey.DEPRECATED_EditorLineWidth,
|
||||
PrefDefaults[LocalPrefKey.EditorLineWidth],
|
||||
),
|
||||
)
|
||||
this.services.preferences.setLocalValue(
|
||||
LocalPrefKey.EditorLineHeight,
|
||||
this.services.preferences.getValue(
|
||||
PrefKey.DEPRECATED_EditorLineHeight,
|
||||
PrefDefaults[LocalPrefKey.EditorLineHeight],
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import { Migration2_167_6 } from './2_167_6'
|
||||
import { Migration2_168_6 } from './2_168_6'
|
||||
import { Migration2_202_1 } from './2_202_1'
|
||||
import { Migration2_208_0 } from './2_208_0'
|
||||
import { Migration2_209_0 } from './2_209_0'
|
||||
|
||||
export const MigrationClasses = [
|
||||
Migration2_0_15,
|
||||
@@ -18,6 +19,7 @@ export const MigrationClasses = [
|
||||
Migration2_168_6,
|
||||
Migration2_202_1,
|
||||
Migration2_208_0,
|
||||
Migration2_209_0,
|
||||
]
|
||||
|
||||
export {
|
||||
@@ -30,4 +32,5 @@ export {
|
||||
Migration2_168_6,
|
||||
Migration2_202_1,
|
||||
Migration2_208_0,
|
||||
Migration2_209_0,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user