Skip to content

Subscriber detail navigation, take two #21969

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

Merged
merged 12 commits into from
Jun 25, 2025

Conversation

nbradbury
Copy link
Contributor

This PR uses Jetpack Compose Navigation to navigate between the subscriber list and subscriber detail.

My original hope was to make navigation part of the generic DataViewScreen so it could be re-used rather than re-implemented in future data view screens, but that turned out to be wishful thinking. It's better for each data view screen to handle its own navigation.

I've only used Jetpack navigation once before so the concept is fairly new to me. I'm open to any suggestions to improve it!

Note: The detail screen is not the final design. The goal of this PR isn't the detail screen but instead the navigation between the list and detail.

To test

  • Enable the experimental subscriber feature
  • My Site > Subscribers
  • Verify that tapping a subscriber in the list opens the detail
  • Verify that tapping the back button on the detail navigates back to the list
  • Verify that tapping the back button on the list navigates back to the main activity
subs.mp4

@nbradbury nbradbury added the Subscribers View and manage newsletter subscribers label Jun 23, 2025
@dangermattic
Copy link
Collaborator

dangermattic commented Jun 23, 2025

3 Warnings
⚠️ strings.xml files should only be updated on release branches, when the translations are downloaded by our automation.
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jun 23, 2025

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr21969-062ee8d
Commit062ee8d
Direct Downloadwordpress-prototype-build-pr21969-062ee8d.apk
Note: Google Login is not supported on these builds.

@nbradbury nbradbury requested a review from Copilot June 23, 2025 19:56
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jun 23, 2025

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr21969-062ee8d
Commit062ee8d
Direct Downloadjetpack-prototype-build-pr21969-062ee8d.apk
Note: Google Login is not supported on these builds.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements navigation between the subscriber list and a detailed subscriber view using Jetpack Compose Navigation. Key changes include:

  • Adding new string resources for subscriber details.
  • Updating SubscribersViewModel to expose a helper method and refactoring the API request handling.
  • Implementing Compose-based UI screens for subscriber details, including navigation and pull-to-refresh for the data view.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
strings.xml Added new subscriber-related string resources.
SubscribersViewModel.kt Refactored API request handling and added an extension method.
SubscribersActivity.kt Implemented Compose navigation for list-detail screens with back navigation.
SubscriberDetailScreen.kt Created a new detail screen UI using Compose.
RemoteImage.kt Introduced a Compose component to load remote images with fallback.
DataViewScreen.kt Updated pull-to-refresh implementation and removed the back click handler.
DataViewItemCard.kt Updated usage of RemoteImage with adjustments for UI styling.
Comments suppressed due to low confidence (1)

WordPress/src/main/java/org/wordpress/android/ui/subscribers/SubscriberDetailScreen.kt:215

  • Consider formatting the subscription date to a user-friendly, locale-aware format rather than using toString().
                value = subscriber.dateSubscribed.toString()

Copy link

codecov bot commented Jun 23, 2025

Codecov Report

Attention: Patch coverage is 0% with 32 lines in your changes missing coverage. Please review.

Project coverage is 39.10%. Comparing base (8e83e61) to head (062ee8d).
Report is 1 commits behind head on trunk.

Files with missing lines Patch % Lines
...rg/wordpress/android/ui/dataview/DataViewScreen.kt 0.00% 28 Missing ⚠️
.../wordpress/android/ui/dataview/DataViewItemCard.kt 0.00% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #21969   +/-   ##
=======================================
  Coverage   39.10%   39.10%           
=======================================
  Files        2150     2150           
  Lines      101026   101026           
  Branches    15521    15521           
=======================================
  Hits        39504    39504           
  Misses      58034    58034           
  Partials     3488     3488           

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nbradbury nbradbury marked this pull request as ready for review June 24, 2025 11:43
@nbradbury nbradbury requested a review from adalpari June 24, 2025 11:43
@@ -61,6 +57,11 @@ fun DataViewItemCard(
RemoteImage(
imageUrl = image.imageUrl,
fallbackImageRes = image.fallbackImageRes,
modifier = modifier
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 the modifier from the DataViewItemCard arguments should only be passed to the first composable item. So, in this case, we may need to create new one

Suggested change
modifier = modifier
modifier = Modifier

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching that! It was a typo on my part. Resolved in c91a8bf.

Copy link
Contributor

@adalpari adalpari left a comment

Choose a reason for hiding this comment

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

Overall looks good to me. I left some comments about the Modifier object since I would like just to be consistent about its usage across the UI elements

@nbradbury nbradbury requested a review from adalpari June 24, 2025 16:57
@nbradbury nbradbury enabled auto-merge (squash) June 24, 2025 18:27
Copy link

Copy link
Contributor

@adalpari adalpari left a comment

Choose a reason for hiding this comment

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

Pretty clean code and UX flow :)
LGTM!!

@nbradbury nbradbury merged commit 1ea4458 into trunk Jun 25, 2025
26 checks passed
@nbradbury nbradbury deleted the feature/subscriber-detail-navigation-take2 branch June 25, 2025 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Subscribers View and manage newsletter subscribers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants