feat: introduce Desktop target and expand Kotlin Multiplatform (KMP) architecture (#4761)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2026-03-12 16:14:49 -05:00 committed by GitHub
parent f4364cff9a
commit ac6bb5479b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
386 changed files with 17089 additions and 4590 deletions

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2025-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.core.navigation
import androidx.navigation3.runtime.NavKey
import org.jetbrains.compose.resources.StringResource
import org.meshtastic.core.resources.Res
import org.meshtastic.core.resources.bottom_nav_settings
import org.meshtastic.core.resources.connections
import org.meshtastic.core.resources.conversations
import org.meshtastic.core.resources.map
import org.meshtastic.core.resources.nodes
/**
* Shared top-level destinations for the application shell.
*
* Defines the canonical set of destinations and their corresponding labels and routes, ensuring parity between Android
* and Desktop navigation shells.
*/
enum class TopLevelDestination(val label: StringResource, val route: Route) {
Conversations(Res.string.conversations, ContactsRoutes.ContactsGraph),
Nodes(Res.string.nodes, NodesRoutes.NodesGraph),
Map(Res.string.map, MapRoutes.Map()),
Settings(Res.string.bottom_nav_settings, SettingsRoutes.SettingsGraph()),
Connections(Res.string.connections, ConnectionsRoutes.ConnectionsGraph),
;
companion object {
fun fromNavKey(key: NavKey?): TopLevelDestination? =
entries.find { dest -> key?.let { it::class == dest.route::class } == true }
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2025-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.core.navigation
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
class NavigationParityTest {
@Test
fun `all top level destinations are defined`() {
assertEquals(5, TopLevelDestination.entries.size)
}
@Test
fun `fromNavKey matches all top level routes`() {
TopLevelDestination.entries.forEach { destination ->
val result = TopLevelDestination.fromNavKey(destination.route)
assertNotNull(result, "Should match destination for route ${destination.route}")
assertEquals(destination, result)
}
}
}