Skip to content

GT-2676 Offline Warning Dialog for Downloadable Languages#4341

Open
tjohnson009 wants to merge 12 commits intodevelopfrom
GT-2676-offline-warning-dialog
Open

GT-2676 Offline Warning Dialog for Downloadable Languages#4341
tjohnson009 wants to merge 12 commits intodevelopfrom
GT-2676-offline-warning-dialog

Conversation

@tjohnson009
Copy link
Contributor

  • 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

@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 30.76923% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.76%. Comparing base (ff7b6db) to head (a6a3eb4).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
.../ui/languages/downloadable/OfflineDialogOverlay.kt 0.00% 13 Missing ⚠️
...guages/downloadable/DownloadableLanguagesLayout.kt 44.44% 4 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +61 to +65
val connected = isConnected.collectAsState()

return UiState(
query = query,
isConnected = connected,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just inline this since you are only using it in 1 place

Suggested change
val connected = isConnected.collectAsState()
return UiState(
query = query,
isConnected = connected,
return UiState(
query = query,
isConnected = isConnected.collectAsState(),

Comment on lines -122 to +123
LanguageListItem(it, state.eventSink, Modifier.animateItem())
LanguageListItem(it, state.eventSink, state.isConnected.value, Modifier.animateItem())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
            }
        }
    )
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.isConnected

that way you can just refer to it as isConnected when calling LanguageListItem

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's lots of ways to do the same thing ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants