wip
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package xyz.magicalbits.smsremote.device
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import xyz.magicalbits.smsremote.data.a14Device
|
||||
import xyz.magicalbits.smsremote.data.iPhoneDevice
|
||||
|
||||
class DeviceViewModel : ViewModel() {
|
||||
private var deviceId: String = ""
|
||||
private val _deviceData = MutableLiveData<DeviceScreenState>()
|
||||
val deviceData: LiveData<DeviceScreenState> = _deviceData
|
||||
|
||||
fun setDeviceId(newDeviceId: String?) {
|
||||
if (newDeviceId != null) {
|
||||
deviceId = newDeviceId
|
||||
}
|
||||
|
||||
// placeholder since there's no API reading logic yet
|
||||
_deviceData.value =
|
||||
if (deviceId == "Samsung A14") {
|
||||
a14Device
|
||||
} else {
|
||||
iPhoneDevice
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Immutable
|
||||
data class DeviceScreenState(
|
||||
val deviceId: String,
|
||||
val name: String,
|
||||
val phoneNumbers: List<String>
|
||||
)
|
||||
Reference in New Issue
Block a user