feat: Themes and appeareance settings are now local to your device and not synced (#2847)
This commit is contained in:
@@ -49,6 +49,7 @@ export enum ApplicationEvent {
|
||||
/** When StorageService is ready (but NOT yet decrypted) to start servicing read/write requests */
|
||||
StorageReady = 'Application:StorageReady',
|
||||
PreferencesChanged = 'Application:PreferencesChanged',
|
||||
LocalPreferencesChanged = 'Application:LocalPreferencesChanged',
|
||||
UnprotectedSessionBegan = 'Application:UnprotectedSessionBegan',
|
||||
UserRolesChanged = 'Application:UserRolesChanged',
|
||||
FeaturesAvailabilityChanged = 'Application:FeaturesAvailabilityChanged',
|
||||
|
||||
15
packages/services/src/Domain/Preferences/LocalPrefKey.ts
Normal file
15
packages/services/src/Domain/Preferences/LocalPrefKey.ts
Normal file
@@ -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
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
import { PrefKey, PrefValue } from '@standardnotes/models'
|
||||
import { AbstractService } from '../Service/AbstractService'
|
||||
import { LocalPrefKey, LocalPrefValue } from './LocalPrefKey'
|
||||
|
||||
export enum PreferencesServiceEvent {
|
||||
LocalPreferencesChanged = 'LocalPreferencesChanged',
|
||||
PreferencesChanged = 'PreferencesChanged',
|
||||
}
|
||||
|
||||
@@ -10,7 +12,15 @@ export interface PreferenceServiceInterface extends AbstractService<PreferencesS
|
||||
getValue<K extends PrefKey>(key: K, defaultValue?: PrefValue[K]): PrefValue[K] | undefined
|
||||
getValue<K extends PrefKey>(key: K, defaultValue: PrefValue[K] | undefined): PrefValue[K] | undefined
|
||||
|
||||
getLocalValue<K extends LocalPrefKey>(key: K, defaultValue: LocalPrefValue[K]): LocalPrefValue[K]
|
||||
getLocalValue<K extends LocalPrefKey>(key: K, defaultValue?: LocalPrefValue[K]): LocalPrefValue[K] | undefined
|
||||
getLocalValue<K extends LocalPrefKey>(
|
||||
key: K,
|
||||
defaultValue: LocalPrefValue[K] | undefined,
|
||||
): LocalPrefValue[K] | undefined
|
||||
|
||||
setValue<K extends PrefKey>(key: K, value: PrefValue[K]): Promise<void>
|
||||
/** Set value without triggering sync or event notifications */
|
||||
setValueDetached<K extends PrefKey>(key: K, value: PrefValue[K]): Promise<void>
|
||||
setLocalValue<K extends LocalPrefKey>(key: K, value: LocalPrefValue[K]): void
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ export enum StorageKey {
|
||||
FileBackupsLocation = 'file_backups_location',
|
||||
VaultSelectionOptions = 'vault_selection_options',
|
||||
Subscription = 'subscription',
|
||||
LocalPreferences = 'local_preferences',
|
||||
}
|
||||
|
||||
export enum NonwrappedStorageKey {
|
||||
|
||||
@@ -134,6 +134,7 @@ export * from './KeySystem/KeySystemKeyManager'
|
||||
export * from './Mfa/MfaServiceInterface'
|
||||
export * from './Mutator/MutatorClientInterface'
|
||||
export * from './Payloads/PayloadManagerInterface'
|
||||
export * from './Preferences/LocalPrefKey'
|
||||
export * from './Preferences/PreferenceId'
|
||||
export * from './Preferences/PreferenceServiceInterface'
|
||||
export * from './Protection/MobileUnlockTiming'
|
||||
|
||||
Reference in New Issue
Block a user