mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix(auto): clean up imports and simplify CarAppService
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Android/sessions/571f7a66-0c36-43f2-890e-c8ed87ec7164 Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
This commit is contained in:
parent
c018ca6066
commit
e2700b26aa
3 changed files with 9 additions and 23 deletions
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
package org.meshtastic.app.auto
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.pm.ApplicationInfo
|
||||
import androidx.car.app.CarAppService
|
||||
import androidx.car.app.Session
|
||||
import androidx.car.app.SessionInfo
|
||||
|
|
@ -31,24 +29,13 @@ import androidx.car.app.validation.HostValidator
|
|||
*/
|
||||
class MeshtasticCarAppService : CarAppService() {
|
||||
|
||||
override fun createHostValidator(): HostValidator {
|
||||
return if (applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0) {
|
||||
HostValidator.ALLOW_ALL_HOSTS_VALIDATOR
|
||||
} else {
|
||||
HostValidator.ALLOW_ALL_HOSTS_VALIDATOR
|
||||
}
|
||||
}
|
||||
override fun createHostValidator(): HostValidator =
|
||||
HostValidator.ALLOW_ALL_HOSTS_VALIDATOR
|
||||
|
||||
override fun onCreateSession(sessionInfo: SessionInfo): Session {
|
||||
return MeshtasticCarSession()
|
||||
}
|
||||
override fun onCreateSession(sessionInfo: SessionInfo): Session =
|
||||
MeshtasticCarSession()
|
||||
|
||||
@Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
|
||||
override fun onCreateSession(): Session {
|
||||
return MeshtasticCarSession()
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
}
|
||||
override fun onCreateSession(): Session =
|
||||
MeshtasticCarSession()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package org.meshtastic.app.auto
|
|||
import androidx.car.app.CarContext
|
||||
import androidx.car.app.Screen
|
||||
import androidx.car.app.model.Action
|
||||
import androidx.car.app.model.CarIcon
|
||||
import androidx.car.app.model.ItemList
|
||||
import androidx.car.app.model.ListTemplate
|
||||
import androidx.car.app.model.Row
|
||||
|
|
@ -172,7 +171,7 @@ class MeshtasticCarScreen(carContext: CarContext) :
|
|||
}
|
||||
|
||||
private fun buildStatusSection(): ItemList {
|
||||
val statusText = when (val state = connectionState) {
|
||||
val statusText = when (connectionState) {
|
||||
is ConnectionState.Connected -> "Connected"
|
||||
is ConnectionState.Disconnected -> "Disconnected"
|
||||
is ConnectionState.DeviceSleep -> "Device Sleeping"
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ import kotlinx.coroutines.CoroutineScope
|
|||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.launch
|
||||
import org.koin.core.annotation.Single
|
||||
import org.meshtastic.core.di.CoroutineDispatchers
|
||||
import org.meshtastic.core.model.DataPacket
|
||||
import org.meshtastic.core.model.Node
|
||||
import org.meshtastic.core.navigation.DEEP_LINK_BASE_URI
|
||||
import org.meshtastic.core.repository.NodeRepository
|
||||
|
|
@ -125,7 +125,7 @@ class ConversationShortcutManager(
|
|||
|
||||
// Channel shortcuts (broadcast conversations)
|
||||
for ((index, channelSettings) in channels.withIndex()) {
|
||||
val contactKey = "${index}${org.meshtastic.core.model.DataPacket.ID_BROADCAST}"
|
||||
val contactKey = "${index}${DataPacket.ID_BROADCAST}"
|
||||
val channelName = channelSettings.name.ifEmpty { "Primary Channel" }
|
||||
val person = Person.Builder()
|
||||
.setName(channelName)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue