Decouple NodeMapScreen from UIViewModel (#3257)

This commit is contained in:
Phil Oliver 2025-09-30 18:46:31 -04:00 committed by GitHub
parent 51ada3d6ff
commit 9aa0cf9335
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 39 additions and 9 deletions

View file

@ -225,7 +225,7 @@ enum class NodeDetailRoute(
R.string.node_map,
NodeDetailRoutes.NodeMap,
Icons.Default.LocationOn,
{ navController, metricsVM, uiVM -> NodeMapScreen(navController, uiVM, metricsVM) },
{ navController, metricsVM, _ -> NodeMapScreen(navController, metricsVM) },
),
POSITION_LOG(
R.string.position_log,

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2025 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 com.geeksville.mesh.ui.map
import androidx.lifecycle.ViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.StateFlow
import org.meshtastic.core.data.repository.NodeRepository
import org.meshtastic.core.database.model.Node
import javax.inject.Inject
@HiltViewModel
class NodeMapViewModel @Inject constructor(nodeRepository: NodeRepository) : ViewModel() {
val ourNodeInfo: StateFlow<Node?> = nodeRepository.ourNodeInfo
}