diff --git a/app/src/main/java/com/geeksville/mesh/ui/DeviceSettingsItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/DeviceSettingsItemList.kt index a5a32cde3..2cec67923 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/DeviceSettingsItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/DeviceSettingsItemList.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType +import androidx.lifecycle.viewmodel.compose.viewModel import com.geeksville.mesh.ConfigProtos import com.geeksville.mesh.ConfigProtos.Config.NetworkConfig import com.geeksville.mesh.R @@ -34,7 +35,7 @@ import com.geeksville.mesh.ui.components.RegularPreference import com.geeksville.mesh.ui.components.SwitchPreference @Composable -fun DeviceSettingsItemList(viewModel: UIViewModel) { +fun DeviceSettingsItemList(viewModel: UIViewModel = viewModel()) { val focusManager = LocalFocusManager.current val hasWifi = viewModel.hasWifi() diff --git a/app/src/main/java/com/geeksville/mesh/ui/ModuleSettingsItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/ModuleSettingsItemList.kt index 0b4511570..9a7c363cb 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/ModuleSettingsItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/ModuleSettingsItemList.kt @@ -16,6 +16,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType +import androidx.lifecycle.viewmodel.compose.viewModel import com.geeksville.mesh.ModuleConfigProtos.ModuleConfig import com.geeksville.mesh.copy import com.geeksville.mesh.model.UIViewModel @@ -27,7 +28,7 @@ import com.geeksville.mesh.ui.components.PreferenceFooter import com.geeksville.mesh.ui.components.SwitchPreference @Composable -fun ModuleSettingsItemList(viewModel: UIViewModel) { +fun ModuleSettingsItemList(viewModel: UIViewModel = viewModel()) { val focusManager = LocalFocusManager.current val connectionState by viewModel.connectionState.observeAsState()