-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(android.StopDetails): Shimmer loading #634
Conversation
@@ -63,10 +63,10 @@ | |||
<string name="other_link_source_code">Ver código fuente en GitHub</string> | |||
<string name="other_link_tos">Términos de uso</string> | |||
<string name="outbound">Saliente</string> | |||
<string name="recently_viewed">Visto recientemente</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alphabetized in conflict resolution
be3b6b4
to
a45e964
Compare
global: GlobalResponse?, | ||
now: Instant, | ||
filter: StopDetailsFilter?, | ||
pinRoute: (String) -> Unit, | ||
pinnedRoutes: Set<String>, | ||
updateStopFilter: (StopDetailsFilter?) -> Unit | ||
) { | ||
if (filter != null) { | ||
if (departures == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could simplify this code by making the variables we need to change conditional on their own booleans, and having a single non-nested if
statement. E.g.
val colModifier = if (departures == null) { Modifier.loadingShimmer() } else { Modifier }
val populatedPatternsByStop = if (departures == null) { LoadingPlaceholders.patternsByStop() } else { patternsByStop }
if (filter != null) {
Column(colModifier) {
StopDetailsRouteView(populatedPatternsByStop)
}
} else {
StopDetailsFilteredRouteView(populatedPatternsByStop)
}
I find nested if
statements tough to parse, personally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Point taken on readability! of neseted ifs! I opted to break out a distinct LoadingStopDetailsView in dd7e915 for consistency with LoadingRouteCard which also removes the nesting.
* Whether the sheet contents are loading. Used by low-level child views to determine whether they | ||
* should be styled as placeholders by `Modifier.placeholderIfLoading()` | ||
*/ | ||
val IsLoadingSheetContents = compositionLocalOf { false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I'd like to see the one refactor for clarity, but otherwise excellent.
Summary
Ticket: 🤖 | Nearby | Loading states
What is this PR for?
Follow up to #631
iOS
android
withContext(Dispatchers.Default)
where possibleTesting
What testing have you done?
https://github.com/user-attachments/assets/622ce79c-8aa5-427f-adc2-61ec8b71b6dc