Skip to content

Commit

Permalink
#509 save the selected device info to the database
Browse files Browse the repository at this point in the history
  • Loading branch information
sds100 committed Nov 16, 2020
1 parent 977bcda commit 2c274f5
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import io.github.sds100.keymapper.util.Event
import io.github.sds100.keymapper.util.KeyEventUtils
import io.github.sds100.keymapper.util.result.CantBeEmpty
import io.github.sds100.keymapper.util.result.InvalidNumber
import kotlinx.coroutines.launch
import splitties.bitflags.hasFlag
import splitties.bitflags.minusFlag
import splitties.bitflags.withFlag
Expand Down Expand Up @@ -89,6 +90,10 @@ class KeyEventActionTypeViewModel(private val mDeviceInfoRepository: DeviceInfoR

fun chooseDevice(index: Int) {
deviceInfoModels.value?.getOrNull(index)?.let {
viewModelScope.launch {
mDeviceInfoRepository.insertDeviceInfo(it)
}

chosenDevice.value = it
}
}
Expand Down

0 comments on commit 2c274f5

Please sign in to comment.