-
-
Notifications
You must be signed in to change notification settings - Fork 391
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Themes and appeareance settings are now local to your device an…
…d not synced (#2847)
- Loading branch information
1 parent
3d1a038
commit bfbf9ab
Showing
18 changed files
with
250 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export enum LocalPrefKey { | ||
ActiveThemes = 'activeThemes', | ||
UseSystemColorScheme = 'useSystemColorScheme', | ||
UseTranslucentUI = 'useTranslucentUI', | ||
AutoLightThemeIdentifier = 'autoLightThemeIdentifier', | ||
AutoDarkThemeIdentifier = 'autoDarkThemeIdentifier', | ||
} | ||
|
||
export type LocalPrefValue = { | ||
[LocalPrefKey.ActiveThemes]: string[] | ||
[LocalPrefKey.UseSystemColorScheme]: boolean | ||
[LocalPrefKey.UseTranslucentUI]: boolean | ||
[LocalPrefKey.AutoLightThemeIdentifier]: string | ||
[LocalPrefKey.AutoDarkThemeIdentifier]: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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], | ||
), | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.