kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
refactor: clean up unused code
rodzic
60b13fd020
commit
cdea292169
|
@ -47,9 +47,6 @@ import kotlinx.coroutines.flow.mapLatest
|
|||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.osmdroid.bonuspack.kml.KmlDocument
|
||||
import org.osmdroid.views.MapView
|
||||
import org.osmdroid.views.overlay.FolderOverlay
|
||||
import java.io.BufferedWriter
|
||||
import java.io.FileNotFoundException
|
||||
import java.io.FileOutputStream
|
||||
|
@ -234,7 +231,6 @@ class UIViewModel @Inject constructor(
|
|||
destNum: Int,
|
||||
requestAction: suspend (IMeshService, Int, Int) -> Unit,
|
||||
errorMessage: String,
|
||||
configType: Int = 0
|
||||
) = viewModelScope.launch {
|
||||
meshService?.let { service ->
|
||||
val packetId = service.packetId
|
||||
|
@ -263,14 +259,12 @@ class UIViewModel @Inject constructor(
|
|||
destNum,
|
||||
{ service, packetId, dest -> service.getRemoteConfig(packetId, dest, configType) },
|
||||
"Request getConfig error",
|
||||
configType
|
||||
)
|
||||
|
||||
fun getModuleConfig(destNum: Int, configType: Int) = request(
|
||||
destNum,
|
||||
{ service, packetId, dest -> service.getModuleConfig(packetId, dest, configType) },
|
||||
"Request getModuleConfig error",
|
||||
configType
|
||||
)
|
||||
|
||||
fun setRingtone(destNum: Int, ringtone: String) {
|
||||
|
@ -726,30 +720,6 @@ class UIViewModel @Inject constructor(
|
|||
// meshService?.commitEditSettings()
|
||||
}
|
||||
|
||||
fun parseUrl(url: String, map: MapView) {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
parseIt(url, map)
|
||||
}
|
||||
}
|
||||
|
||||
// For Future Use
|
||||
// model.parseUrl(
|
||||
// "https://www.google.com/maps/d/kml?forcekml=1&mid=1FmqWhZG3PG3dY92x9yf2RlREcK7kMZs&lid=-ivSjBCePsM",
|
||||
// map
|
||||
// )
|
||||
private fun parseIt(url: String, map: MapView) {
|
||||
val kmlDoc = KmlDocument()
|
||||
try {
|
||||
kmlDoc.parseKMLUrl(url)
|
||||
val kmlOverlay = kmlDoc.mKmlRoot.buildOverlay(map, null, null, kmlDoc) as FolderOverlay
|
||||
kmlDoc.mKmlRoot.mItems
|
||||
kmlDoc.mKmlRoot.mName
|
||||
map.overlayManager.overlays().add(kmlOverlay)
|
||||
} catch (ex: Exception) {
|
||||
debug("Failed to download .kml $ex")
|
||||
}
|
||||
}
|
||||
|
||||
fun addQuickChatAction(name: String, value: String, mode: QuickChatAction.Mode) {
|
||||
viewModelScope.launch(Dispatchers.Main) {
|
||||
val action = QuickChatAction(0, name, value, mode, _quickChatActions.value.size)
|
||||
|
|
Ładowanie…
Reference in New Issue