[Quality Q1] WearOS - Show offline indicator next to time text#5036
[Quality Q1] WearOS - Show offline indicator next to time text#5036
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an offline indicator icon next to the time text on WearOS screens when the device is disconnected from WiFi or cellular networks. The indicator is conditionally hidden when users navigate to certain screens (Now Playing and Up Next pages in the pager).
Changes:
- Introduces a new
TimeTextWithConnectivitycomposable that displays a cloud-off icon when offline - Implements global time text management through CompositionLocal to control visibility across screens
- Updates ConnectivityStateManager to optimistically assume connection on startup
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| TimeTextWithConnectivity.kt | New composable that shows offline indicator icon next to system time when disconnected |
| MainActivity.kt | Implements global time text management using CompositionLocalProvider and controls visibility based on navigation |
| NowPlayingPager.kt | Adds LocalSetTimeTextVisible composition local and hides time text on pages 1-2 using lifecycle-aware flow collection |
| ConnectivityStateManager.kt | Changes initial connection state from false to true to prevent false offline indicator flash on startup |
| EffectsScreen.kt, NotificationScreen.kt, ConnectivityNotificationOverlay.kt, LoginWithPhoneScreen.kt | Consistently hide default TimeText using timeText = {} pattern |
| ic_cloud_off.xml | Adds vector drawable icon for offline indicator |
...src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/component/TimeTextWithConnectivity.kt
Outdated
Show resolved
Hide resolved
wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/MainActivity.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/component/TimeTextWithConnectivity.kt
Outdated
Show resolved
Hide resolved
| scope = coroutineScope, | ||
| started = SharingStarted.Eagerly, | ||
| initialValue = false, | ||
| initialValue = true, |
There was a problem hiding this comment.
initialValue = true makes isConnected emit true immediately even when the current networkStatus indicates no Wi‑Fi/Cell, which can momentarily show an incorrect “online” state and will break the existing ConnectivityStateManagerTest expectations (they currently assert the first emission is false when no networks are available). Consider keeping initialValue = false or deriving the initial value from the current network status so the first emission is accurate.
| initialValue = true, | |
| initialValue = false, |
| painter = painterResource(IR.drawable.ic_cloud_off), | ||
| contentDescription = stringResource(LR.string.offline_icon_content_description), |
There was a problem hiding this comment.
For accessibility, the content description string "Offline icon" describes the UI element rather than the state it conveys. Consider changing it to something that communicates meaning to screen readers (e.g., "Offline" / "No internet connection").
Description
This is a breakup task of the monstrous PR #4969
We now display an offline icon next to the time on most of the watch screens when the device is offline.
We dismiss this view when the user scrolls (horizontally) to the Now playing or Up next screens.
Fixes PCDROID-468
Testing Instructions
Screenshots or Screencast
Checklist
./gradlew spotlessApplyto automatically apply formatting/linting)modules/services/localization/src/main/res/values/strings.xml