fix: remove constructor from DeviceSettingsFragment

This commit is contained in:
andrekir 2023-09-11 21:26:42 -03:00
parent e20e66b7f7
commit b93098cbce
4 changed files with 27 additions and 6 deletions

View file

@ -102,7 +102,7 @@ import com.google.accompanist.themeadapter.appcompat.AppCompatTheme
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
class DeviceSettingsFragment(val node: NodeInfo) : ScreenFragment("Radio Configuration"), Logging {
class DeviceSettingsFragment : ScreenFragment("Radio Configuration"), Logging {
private val model: UIViewModel by activityViewModels()
@ -115,8 +115,13 @@ class DeviceSettingsFragment(val node: NodeInfo) : ScreenFragment("Radio Configu
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setBackgroundColor(ContextCompat.getColor(context, R.color.colorAdvancedBackground))
setContent {
val node by model.destNode.collectAsStateWithLifecycle()
AppCompatTheme {
RadioConfigNavHost(node, model)
RadioConfigNavHost(
node!!,
model,
)
}
}
}
@ -163,7 +168,10 @@ sealed class PacketResponseState {
}
@Composable
fun RadioConfigNavHost(node: NodeInfo, viewModel: UIViewModel = viewModel()) {
fun RadioConfigNavHost(
node: NodeInfo,
viewModel: UIViewModel = viewModel(),
) {
val navController = rememberNavController()
val connectionState by viewModel.connectionState.observeAsState()