Skip to content
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

Merged
merged 6 commits into from
Jan 10, 2025
Merged

Conversation

KaylaBrady
Copy link
Collaborator

Summary

Ticket: 🤖 | Nearby | Loading states

What is this PR for?
Follow up to #631

  • Shimmer loading in stop details
  • Extract reusable LoadingShimmer modifier
  • iOS cleanup: shimmer loading iOS accessibility label
    iOS
  • If you added any user-facing strings on iOS, are they included in Localizable.xcstrings?
    • Add temporary machine translations, marked "Needs Review"

android

  • All user-facing strings added to strings resource
  • Expensive calculations are run in withContext(Dispatchers.Default) where possible

Testing

What testing have you done?

@KaylaBrady KaylaBrady requested a review from a team as a code owner January 9, 2025 16:02
@KaylaBrady KaylaBrady requested review from JackVCurtis and removed request for a team January 9, 2025 16:02
@@ -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>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

alphabetized in conflict resolution

Base automatically changed from kb-shimmer-load to main January 9, 2025 19:25
global: GlobalResponse?,
now: Instant,
filter: StopDetailsFilter?,
pinRoute: (String) -> Unit,
pinnedRoutes: Set<String>,
updateStopFilter: (StopDetailsFilter?) -> Unit
) {
if (filter != null) {
if (departures == null) {
Copy link
Contributor

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.

Copy link
Collaborator Author

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 }
Copy link
Contributor

Choose a reason for hiding this comment

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

Cool!

Copy link
Contributor

@JackVCurtis JackVCurtis left a 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.

@KaylaBrady KaylaBrady merged commit 4863f21 into main Jan 10, 2025
7 checks passed
@KaylaBrady KaylaBrady deleted the kb-shimmer-load-2 branch January 10, 2025 15:41
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