Skip to content

Commit

Permalink
refactor: use wrapped storage
Browse files Browse the repository at this point in the history
  • Loading branch information
amanharwara committed Feb 16, 2024
1 parent 0de7258 commit 6be67f2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/snjs/lib/Services/Preferences/PreferencesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
ApplicationStageChangedEventPayload,
StorageServiceInterface,
StorageKey,
StorageValueModes,
} from '@standardnotes/services'
import { ContentType } from '@standardnotes/domain-core'

Expand Down Expand Up @@ -84,7 +83,7 @@ export class PreferencesService
void this.notifyEvent(PreferencesServiceEvent.PreferencesChanged)
}
} else if (stage === ApplicationStage.StorageDecrypted_09) {
this.localPreferences = this.storage.getValue(StorageKey.LocalPreferences, StorageValueModes.Nonwrapped) ?? {}
this.localPreferences = this.storage.getValue(StorageKey.LocalPreferences) ?? {}
void this.notifyEvent(PreferencesServiceEvent.LocalPreferencesChanged)
}
}
Expand All @@ -108,7 +107,7 @@ export class PreferencesService
setLocalValue<K extends LocalPrefKey>(key: K, value: LocalPrefValue[K]): void {
this.localPreferences[key] = value

this.storage.setValue(StorageKey.LocalPreferences, this.localPreferences, StorageValueModes.Nonwrapped)
this.storage.setValue(StorageKey.LocalPreferences, this.localPreferences)

void this.notifyEvent(PreferencesServiceEvent.LocalPreferencesChanged)
}
Expand Down

0 comments on commit 6be67f2

Please sign in to comment.