feat: KMP Debug Panel Migration and Update Documentation (#4859)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2026-03-19 14:07:03 -05:00 committed by GitHub
parent e36176bbf7
commit 00697cc3c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 316 additions and 470 deletions

View file

@ -139,10 +139,10 @@ fun EntryProviderScope<NavKey>.desktopSettingsGraph(backStack: NavBackStack<NavK
CleanNodeDatabaseScreen(viewModel = viewModel)
}
// Debug Panel — Desktop-specific basic log viewer
// Debug Panel — shared commonMain composable
entry<SettingsRoutes.DebugPanel> {
val viewModel: org.meshtastic.feature.settings.debugging.DebugViewModel = koinViewModel()
org.meshtastic.desktop.ui.settings.DesktopDebugScreen(
org.meshtastic.feature.settings.debugging.DebugScreen(
viewModel = viewModel,
onNavigateUp = { backStack.removeLastOrNull() },
)

View file

@ -1,78 +0,0 @@
/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.meshtastic.desktop.ui.settings
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import org.jetbrains.compose.resources.stringResource
import org.meshtastic.core.resources.Res
import org.meshtastic.core.resources.debug_panel
import org.meshtastic.core.ui.component.MainAppBar
import org.meshtastic.feature.settings.debugging.DebugViewModel
/**
* A basic Desktop implementation of the Debug Panel. Allows viewing the raw mesh logs without the Android-specific
* export/sharing intents.
*/
@Composable
fun DesktopDebugScreen(viewModel: DebugViewModel, onNavigateUp: () -> Unit) {
val logs by viewModel.meshLog.collectAsStateWithLifecycle()
Scaffold(
topBar = {
MainAppBar(
title = stringResource(Res.string.debug_panel),
ourNode = null,
showNodeChip = false,
canNavigateUp = true,
onNavigateUp = onNavigateUp,
actions = {},
onClickChip = {},
)
},
) { paddingValues ->
LazyColumn(modifier = Modifier.fillMaxSize().padding(paddingValues)) {
items(logs, key = { it.uuid }) { log ->
Column(modifier = Modifier.padding(16.dp)) {
Text(
text = "${log.formattedReceivedDate} - ${log.messageType}",
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.primary,
)
Text(
text = log.logMessage,
style = MaterialTheme.typography.bodySmall,
modifier = Modifier.padding(top = 4.dp),
)
}
HorizontalDivider()
}
}
}
}