mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Issue #369 - Use repository pattern for bluetooth state
(cherry picked from commit b3878a4240)
This commit is contained in:
parent
1294eee8e3
commit
c0fe9213f1
11 changed files with 224 additions and 109 deletions
|
|
@ -0,0 +1,19 @@
|
|||
package com.geeksville.mesh.model
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.asLiveData
|
||||
import com.geeksville.mesh.repository.bluetooth.BluetoothRepository
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
* Thin view model which adapts the view layer to the `BluetoothRepository`.
|
||||
*/
|
||||
@HiltViewModel
|
||||
class BluetoothViewModel @Inject constructor(
|
||||
private val bluetoothRepository: BluetoothRepository,
|
||||
) : ViewModel() {
|
||||
fun refreshState() = bluetoothRepository.refreshState()
|
||||
|
||||
val enabled = bluetoothRepository.enabled.asLiveData()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue