mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Migrate (mostly) maps prefs to repo (#2776)
This commit is contained in:
parent
4be0cd7f81
commit
6cb0196a6e
5 changed files with 23 additions and 43 deletions
|
|
@ -17,8 +17,7 @@
|
|||
|
||||
package com.geeksville.mesh.ui.map
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import androidx.core.content.edit
|
||||
import com.geeksville.mesh.android.prefs.UiPrefs
|
||||
import com.geeksville.mesh.database.NodeRepository
|
||||
import com.geeksville.mesh.database.PacketRepository
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
|
|
@ -28,12 +27,14 @@ import javax.inject.Inject
|
|||
class MapViewModel
|
||||
@Inject
|
||||
constructor(
|
||||
preferences: SharedPreferences,
|
||||
uiPrefs: UiPrefs,
|
||||
packetRepository: PacketRepository,
|
||||
nodeRepository: NodeRepository,
|
||||
) : BaseMapViewModel(preferences, nodeRepository, packetRepository) {
|
||||
) : BaseMapViewModel(uiPrefs, nodeRepository, packetRepository) {
|
||||
|
||||
var mapStyleId: Int
|
||||
get() = preferences.getInt(MAP_STYLE_ID, 0)
|
||||
set(value) = preferences.edit { putInt(MAP_STYLE_ID, value) }
|
||||
get() = uiPrefs.mapStyle
|
||||
set(value) {
|
||||
uiPrefs.mapStyle = value
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue