feat: Themes and appeareance settings are now local to your device and not synced (#2847)
This commit is contained in:
@@ -66,7 +66,7 @@ export class Migration2_202_1 extends Migration {
|
||||
const activeThemes = allActiveitems.filter((component) => component.isTheme())
|
||||
const activeComponents = allActiveitems.filter((component) => !component.isTheme())
|
||||
|
||||
await this.services.preferences.setValueDetached(PrefKey.ActiveThemes, Uuids(activeThemes))
|
||||
await this.services.preferences.setValueDetached(PrefKey.DEPRECATED_ActiveThemes, Uuids(activeThemes))
|
||||
await this.services.preferences.setValueDetached(PrefKey.ActiveComponents, Uuids(activeComponents))
|
||||
}
|
||||
}
|
||||
|
||||
55
packages/snjs/lib/Migrations/Versions/2_208_0.ts
Normal file
55
packages/snjs/lib/Migrations/Versions/2_208_0.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { LocalPrefKey, ApplicationStage } from '@standardnotes/services'
|
||||
import { Migration } from '@Lib/Migrations/Migration'
|
||||
import { PrefDefaults, PrefKey } from '@standardnotes/models'
|
||||
|
||||
export class Migration2_208_0 extends Migration {
|
||||
static override version(): string {
|
||||
return '2.208.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.ActiveThemes,
|
||||
this.services.preferences.getValue(
|
||||
PrefKey.DEPRECATED_ActiveThemes,
|
||||
PrefDefaults[PrefKey.DEPRECATED_ActiveThemes],
|
||||
),
|
||||
)
|
||||
this.services.preferences.setLocalValue(
|
||||
LocalPrefKey.UseSystemColorScheme,
|
||||
this.services.preferences.getValue(
|
||||
PrefKey.DEPRECATED_UseSystemColorScheme,
|
||||
PrefDefaults[PrefKey.DEPRECATED_UseSystemColorScheme],
|
||||
),
|
||||
)
|
||||
this.services.preferences.setLocalValue(
|
||||
LocalPrefKey.AutoLightThemeIdentifier,
|
||||
this.services.preferences.getValue(
|
||||
PrefKey.DEPRECATED_AutoLightThemeIdentifier,
|
||||
PrefDefaults[PrefKey.DEPRECATED_AutoLightThemeIdentifier],
|
||||
),
|
||||
)
|
||||
this.services.preferences.setLocalValue(
|
||||
LocalPrefKey.AutoDarkThemeIdentifier,
|
||||
this.services.preferences.getValue(
|
||||
PrefKey.DEPRECATED_AutoDarkThemeIdentifier,
|
||||
PrefDefaults[PrefKey.DEPRECATED_AutoDarkThemeIdentifier],
|
||||
),
|
||||
)
|
||||
this.services.preferences.setLocalValue(
|
||||
LocalPrefKey.UseTranslucentUI,
|
||||
this.services.preferences.getValue(
|
||||
PrefKey.DEPRECATED_UseTranslucentUI,
|
||||
PrefDefaults[PrefKey.DEPRECATED_UseTranslucentUI],
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import { Migration2_42_0 } from './2_42_0'
|
||||
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'
|
||||
|
||||
export const MigrationClasses = [
|
||||
Migration2_0_15,
|
||||
@@ -16,6 +17,7 @@ export const MigrationClasses = [
|
||||
Migration2_167_6,
|
||||
Migration2_168_6,
|
||||
Migration2_202_1,
|
||||
Migration2_208_0,
|
||||
]
|
||||
|
||||
export {
|
||||
@@ -27,4 +29,5 @@ export {
|
||||
Migration2_167_6,
|
||||
Migration2_168_6,
|
||||
Migration2_202_1,
|
||||
Migration2_208_0,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user