Fix "no gps" / "no weather data" is not displayed in data fields anymore (#67)
This commit is contained in:
parent
3a4515268e
commit
107c7a575d
@ -89,9 +89,6 @@ class KarooHeadwindExtension : KarooExtension("karoo-headwind", BuildConfig.VERS
|
||||
)
|
||||
}
|
||||
|
||||
data class StreamData(val settings: HeadwindSettings, val gps: GpsCoordinates?,
|
||||
val profile: UserProfile? = null, val upcomingRoute: UpcomingRoute? = null)
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
@ -202,7 +202,7 @@ abstract class ForecastDataType(private val karooSystem: KarooSystemService, typ
|
||||
dataFlow.collect { (allData, settingsAndProfile, widgetSettings, userProfile, headingResponse, upcomingRoute) ->
|
||||
Log.d(KarooHeadwindExtension.TAG, "Updating weather forecast view")
|
||||
|
||||
if (allData == null){
|
||||
if (allData.isNullOrEmpty()){
|
||||
emitter.updateView(
|
||||
getErrorWidget(
|
||||
glance,
|
||||
|
||||
@ -28,6 +28,7 @@ import kotlinx.coroutines.awaitCancellation
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.emitAll
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.math.roundToInt
|
||||
@ -127,7 +128,10 @@ class HeadwindDirectionDataType(
|
||||
previewFlow()
|
||||
} else {
|
||||
val directionFlow = streamValues()
|
||||
val speedFlow = UserWindSpeedDataType.streamValues(context, karooSystem)
|
||||
val speedFlow = flow {
|
||||
emit(0.0)
|
||||
emitAll(UserWindSpeedDataType.streamValues(context, karooSystem))
|
||||
}
|
||||
|
||||
combine(directionFlow, speedFlow) { direction, speed ->
|
||||
DirectionAndSpeed(direction, speed)
|
||||
|
||||
@ -19,7 +19,6 @@ import androidx.compose.material3.Tab
|
||||
import androidx.compose.material3.TabRow
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
|
||||
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
@ -55,7 +54,6 @@ fun MainScreen(close: () -> Unit) {
|
||||
var tabIndex by remember { mutableIntStateOf(0) }
|
||||
|
||||
var isRefreshing by remember { mutableStateOf(false) }
|
||||
val swipeRefreshState = rememberPullToRefreshState()
|
||||
|
||||
val tabs = listOf("Weather", "Settings")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user