Refactoring: remove last uses of 'GetLongPreference'
This commit is contained in:
parent
22c8a45012
commit
2bb38e0a61
2 changed files with 3 additions and 8 deletions
|
@ -172,11 +172,6 @@ export class OsmConnection {
|
||||||
): UIEventSource<T | undefined> {
|
): UIEventSource<T | undefined> {
|
||||||
return <UIEventSource<T>>this.preferencesHandler.getPreference(key, defaultValue, prefix)
|
return <UIEventSource<T>>this.preferencesHandler.getPreference(key, defaultValue, prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetLongPreference(key: string, prefix: string = "mapcomplete-"): UIEventSource<string> {
|
|
||||||
return this.preferencesHandler.getPreference(key, prefix)
|
|
||||||
}
|
|
||||||
|
|
||||||
public OnLoggedIn(action: (userDetails: UserDetails) => void) {
|
public OnLoggedIn(action: (userDetails: UserDetails) => void) {
|
||||||
this._onLoggedIn.push(action)
|
this._onLoggedIn.push(action)
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ export class OptionallySyncedHistory<T> {
|
||||||
"preference-" + key + "-history",
|
"preference-" + key + "-history",
|
||||||
"sync",
|
"sync",
|
||||||
)
|
)
|
||||||
const synced = this.synced = UIEventSource.asObject<T[]>(osmconnection.GetLongPreference(key + "-history"), [])
|
const synced = this.synced = UIEventSource.asObject<T[]>(osmconnection.getPreference(key + "-history"), [])
|
||||||
const local = this.local = LocalStorageSource.GetParsed<T[]>(key + "-history", [])
|
const local = this.local = LocalStorageSource.GetParsed<T[]>(key + "-history", [])
|
||||||
const thisSession = this.thisSession = new UIEventSource<T[]>([], "optionally-synced:"+key+"(session only)")
|
const thisSession = this.thisSession = new UIEventSource<T[]>([], "optionally-synced:"+key+"(session only)")
|
||||||
this.syncPreference.addCallback(syncmode => {
|
this.syncPreference.addCallback(syncmode => {
|
||||||
|
@ -273,7 +273,7 @@ export default class UserRelatedState {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getUnofficialTheme(id: string): (MinimalLayoutInformation & { definition }) | undefined {
|
public getUnofficialTheme(id: string): (MinimalLayoutInformation & { definition }) | undefined {
|
||||||
const pref = this.osmConnection.GetLongPreference("unofficial-theme-" + id)
|
const pref = this.osmConnection.getPreference("unofficial-theme-" + id)
|
||||||
const str = pref.data
|
const str = pref.data
|
||||||
|
|
||||||
if (str === undefined || str === "undefined" || str === "") {
|
if (str === undefined || str === "undefined" || str === "") {
|
||||||
|
@ -311,7 +311,7 @@ export default class UserRelatedState {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (!layout.official) {
|
if (!layout.official) {
|
||||||
this.osmConnection.GetLongPreference("unofficial-theme-" + layout.id).setData(
|
this.osmConnection.getPreference("unofficial-theme-" + layout.id).setData(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
id: layout.id,
|
id: layout.id,
|
||||||
icon: layout.icon,
|
icon: layout.icon,
|
||||||
|
|
Loading…
Reference in a new issue