mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-05-24 14:50:26 -04:00
fix(settings): remote admin always showed local node config (#5560)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -20,7 +20,6 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.lifecycle.compose.dropUnlessResumed
|
||||
import androidx.navigation3.runtime.EntryProviderScope
|
||||
@@ -80,7 +79,7 @@ fun getRadioConfigViewModel(backStack: NavBackStack<NavKey>, destNumOverride: In
|
||||
backStack.lastOrNull { it is SettingsRoute.Settings }?.let { (it as SettingsRoute.Settings).destNum }
|
||||
}
|
||||
return koinViewModel<RadioConfigViewModel>(key = destNum?.toString()) {
|
||||
parametersOf(SavedStateHandle(mapOf("destNum" to destNum)))
|
||||
parametersOf(destNum)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package org.meshtastic.feature.settings.radio
|
||||
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import co.touchlab.kermit.Logger
|
||||
@@ -115,7 +114,7 @@ data class RadioConfigState(
|
||||
@KoinViewModel
|
||||
@Suppress("LongParameterList")
|
||||
open class RadioConfigViewModel(
|
||||
@InjectedParam savedStateHandle: SavedStateHandle,
|
||||
@InjectedParam private val destNum: Int?,
|
||||
private val radioConfigRepository: RadioConfigRepository,
|
||||
private val packetRepository: PacketRepository,
|
||||
private val serviceRepository: ServiceRepository,
|
||||
@@ -184,8 +183,6 @@ open class RadioConfigViewModel(
|
||||
_mqttProbeStatus.value = null
|
||||
}
|
||||
|
||||
private val destNum: Int? = savedStateHandle.get<Int>("destNum")
|
||||
|
||||
private val _destNode = MutableStateFlow<Node?>(null)
|
||||
val destNode: StateFlow<Node?>
|
||||
get() = _destNode
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package org.meshtastic.feature.settings.radio
|
||||
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import dev.mokkery.MockMode
|
||||
import dev.mokkery.answering.returns
|
||||
import dev.mokkery.every
|
||||
@@ -117,7 +116,7 @@ class ProfileRoundTripTest {
|
||||
|
||||
viewModel =
|
||||
RadioConfigViewModel(
|
||||
savedStateHandle = SavedStateHandle(),
|
||||
destNum = null,
|
||||
radioConfigRepository = radioConfigRepository,
|
||||
packetRepository = packetRepository,
|
||||
serviceRepository = serviceRepository,
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package org.meshtastic.feature.settings.radio
|
||||
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import app.cash.turbine.test
|
||||
import dev.mokkery.MockMode
|
||||
import dev.mokkery.answering.calls
|
||||
@@ -140,7 +139,7 @@ class RadioConfigViewModelTest {
|
||||
}
|
||||
|
||||
private fun createViewModel() = RadioConfigViewModel(
|
||||
savedStateHandle = SavedStateHandle(),
|
||||
destNum = null,
|
||||
radioConfigRepository = radioConfigRepository,
|
||||
packetRepository = packetRepository,
|
||||
serviceRepository = serviceRepository,
|
||||
@@ -407,7 +406,7 @@ class RadioConfigViewModelTest {
|
||||
nodeRepository.setNodes(listOf(node))
|
||||
viewModel =
|
||||
RadioConfigViewModel(
|
||||
savedStateHandle = SavedStateHandle(mapOf("destNum" to 456)),
|
||||
destNum = 456,
|
||||
radioConfigRepository = radioConfigRepository,
|
||||
packetRepository = packetRepository,
|
||||
serviceRepository = serviceRepository,
|
||||
|
||||
Reference in New Issue
Block a user