GT-2676 Offline Warning Dialog for Downloadable Languages#4341
GT-2676 Offline Warning Dialog for Downloadable Languages#4341tjohnson009 wants to merge 12 commits intodevelopfrom
Conversation
tjohnson009
commented
Mar 2, 2026
- add offline dialog state and ui event to screen
- render offline warning dialog in downloadable languages layout
- stop language pin and show offline dialog when not connected
app/src/main/kotlin/org/cru/godtools/ui/languages/downloadable/DownloadableLanguagesLayout.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/org/cru/godtools/ui/languages/downloadable/DownloadableLanguagesPresenter.kt
Outdated
Show resolved
Hide resolved
app/src/main/kotlin/org/cru/godtools/ui/languages/downloadable/DownloadableLanguagesScreen.kt
Outdated
Show resolved
Hide resolved
app/src/main/kotlin/org/cru/godtools/ui/languages/downloadable/DownloadableLanguagesLayout.kt
Outdated
Show resolved
Hide resolved
app/src/main/kotlin/org/cru/godtools/ui/languages/downloadable/DownloadableLanguagesLayout.kt
Outdated
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #4341 +/- ##
===========================================
- Coverage 49.80% 49.76% -0.04%
===========================================
Files 439 440 +1
Lines 11857 11880 +23
Branches 2067 2069 +2
===========================================
+ Hits 5905 5912 +7
- Misses 5339 5355 +16
Partials 613 613 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| val connected = isConnected.collectAsState() | ||
|
|
||
| return UiState( | ||
| query = query, | ||
| isConnected = connected, |
There was a problem hiding this comment.
you can just inline this since you are only using it in 1 place
| val connected = isConnected.collectAsState() | |
| return UiState( | |
| query = query, | |
| isConnected = connected, | |
| return UiState( | |
| query = query, | |
| isConnected = isConnected.collectAsState(), |
| LanguageListItem(it, state.eventSink, Modifier.animateItem()) | ||
| LanguageListItem(it, state.eventSink, state.isConnected.value, Modifier.animateItem()) |
There was a problem hiding this comment.
so we can actually defer the read of the isConnected State value better by using a closure for reading it.
LanguageListItem(isConnected = { state.isConnected.value })
private fun LanguageListItem(isConnected: () -> Boolean) {
UiElement(
modifier = Modifier.clickable {
if (!isConnected()) {
// show overlay
}
}
)
}There was a problem hiding this comment.
that way the state value is only read when the user clicks on a list item and not every time the list item is composed
There was a problem hiding this comment.
The other thing you can do the clean up the code more is at the top of the Layout use this:
val isConnected by state.isConnectedthat way you can just refer to it as isConnected when calling LanguageListItem
There was a problem hiding this comment.
there's lots of ways to do the same thing ;)