Skip to content

Add Reader subscription settings bottom sheet#22535

Merged
nbradbury merged 20 commits intotrunkfrom
issue/CMM-176-reader-subscribe-options
Jan 28, 2026
Merged

Add Reader subscription settings bottom sheet#22535
nbradbury merged 20 commits intotrunkfrom
issue/CMM-176-reader-subscribe-options

Conversation

@nbradbury
Copy link
Contributor

@nbradbury nbradbury commented Jan 27, 2026

Closes CMM-176

On iOS, users have several Reader subscription options for a site:

iOS subs

This PR adds the same options to Android. Users now see a settings icon in the blog preview header that opens a bottom sheet with three subscription options:

  • Notify me of new posts (push notifications)
  • Email me new posts
  • Email me new comments

The settings icon only appears for followed WordPress.com blogs (not external RSS feeds) when the user is logged in.

New files:

  • ReaderSubscriptionSettingsUiState.kt
  • ReaderBlogSubscriptionUseCase.kt
  • ReaderSubscriptionSettingsViewModel.kt
  • ReaderSubscriptionSettingsBottomSheetFragment.kt
  • reader_subscription_settings_bottom_sheet.xml
subsmovie.mp4

Add iOS-like subscription options when viewing a blog's posts in the
Reader. Users see a settings icon in the blog preview header that opens
a bottom sheet with three subscription options:
- Notify me of new posts (push notifications)
- Email me new posts
- Email me new comments

The settings icon only appears for followed WordPress.com blogs (not
external RSS feeds) when the user is logged in.

New files:
- ReaderSubscriptionSettingsUiState.kt
- ReaderBlogSubscriptionUseCase.kt
- ReaderSubscriptionSettingsViewModel.kt
- ReaderSubscriptionSettingsBottomSheetFragment.kt
- reader_subscription_settings_bottom_sheet.xml

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dangermattic
Copy link
Collaborator

dangermattic commented Jan 27, 2026

2 Warnings
⚠️ 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

nbradbury and others added 2 commits January 27, 2026 09:20
Remove animateLayoutChanges="true" which caused the bottom sheet to
scroll up when toggling options due to layout animations triggered by
loading state and switch enabled state changes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Check network availability before updating subscription settings and
show a snackbar message when offline. Also fix toggle revert logic
to properly restore the previous value on failure.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jan 27, 2026

App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
FlavorJalapeno
Build TypeDebug
Versionpr22535-8a4582f
Commit8a4582f
Direct Downloadjetpack-prototype-build-pr22535-8a4582f.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jan 27, 2026

App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
FlavorJalapeno
Build TypeDebug
Versionpr22535-8a4582f
Commit8a4582f
Direct Downloadwordpress-prototype-build-pr22535-8a4582f.apk
Note: Google Login is not supported on these builds.

nbradbury and others added 4 commits January 27, 2026 14:48
Tests cover:
- start() initialization with and without existing subscription
- onNotifyPostsToggled() success, failure, and no network cases
- onEmailPostsToggled() success, failure, and no network cases
- onEmailCommentsToggled() success, failure, and no network cases
- Snackbar events for errors and no network
- Cleanup calling useCase.cleanup()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nbradbury
Copy link
Contributor Author

@claude

@claude

This comment was marked as outdated.

private val networkUtilsWrapper: NetworkUtilsWrapper,
@Named(BG_THREAD) private val bgDispatcher: CoroutineDispatcher
) {
private var updateContinuation: Continuation<UpdateResult>? = null

This comment was marked as resolved.

}
}

suspend fun updateEmailPostsFrequency(blogId: Long, frequency: SubscriptionFrequency): UpdateResult =

This comment was marked as resolved.

}
}

fun onNotifyPostsToggled(enabled: Boolean) {

This comment was marked as resolved.


private fun setupClickListeners() {
with(binding) {
switchNotifyPosts.setOnClickListener {

This comment was marked as resolved.

}
}

private fun <T> handleUpdateResult(

This comment was marked as resolved.

app:layout_constraintTop_toBottomOf="@+id/divider_3" />

<!-- Loading indicator -->
<ProgressBar

This comment was marked as resolved.

nbradbury and others added 5 commits January 27, 2026 15:17
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Prevent race conditions by checking isLoading state before processing
toggle actions in ReaderSubscriptionSettingsViewModel.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…inuation

- Replace Continuation with Channel for async result handling
- Remove unused updateEmailPostsFrequency method and its imports
- Change switch listeners from setOnClickListener to setOnCheckedChangeListener

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nbradbury
Copy link
Contributor Author

@claude

@claude

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 43.38843% with 137 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.88%. Comparing base (ebfb41e) to head (8b6c265).
⚠️ Report is 1 commits behind head on trunk.

Files with missing lines Patch % Lines
...r/subscription/ReaderSubscriptionSettingsScreen.kt 0.00% 123 Missing ⚠️
...ubscription/ReaderSubscriptionSettingsViewModel.kt 85.91% 3 Missing and 7 partials ⚠️
...ader/subscription/ReaderBlogSubscriptionUseCase.kt 90.24% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #22535      +/-   ##
==========================================
+ Coverage   38.87%   38.88%   +0.01%     
==========================================
  Files        2202     2206       +4     
  Lines      107051   107293     +242     
  Branches    15103    15131      +28     
==========================================
+ Hits        41617    41722     +105     
- Misses      61972    62098     +126     
- Partials     3462     3473      +11     

☔ 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 and others added 5 commits January 27, 2026 17:47
Replace individual switch disabling with a semi-transparent scrim
overlay that blocks interaction while loading. This provides clearer
visual feedback and prevents toggle jitter during loading states.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The _dismiss LiveData was declared but never used in the ViewModel.
Removed it along with its observer in the Fragment.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Removed strings for email frequency options and success message
that were added for future features but are currently unused.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The errorMessage parameter was never shown to users, so
changed Failure from a data class to an object for simplicity.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Track READER_MANAGE_NOTIFICATION_SETTINGS_SHOWN when bottom sheet opens
- Track FOLLOWED_BLOG_NOTIFICATIONS_SETTINGS_ON/OFF for push toggle
- Track FOLLOWED_BLOG_NOTIFICATIONS_SETTINGS_EMAIL_ON/OFF for email toggle
- Track FOLLOWED_BLOG_NOTIFICATIONS_SETTINGS_COMMENTS_ON/OFF for comments toggle

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nbradbury
Copy link
Contributor Author

@claude

@claude

This comment was marked as outdated.

@nbradbury nbradbury marked this pull request as ready for review January 28, 2026 12:32
@nbradbury nbradbury requested a review from adalpari January 28, 2026 12:32
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jan 28, 2026

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
FlavorJalapeno
Build TypeDebug
Versionpr22535-8b6c265
Build Number1483
Application IDorg.wordpress.android.prealpha
Commit8b6c265
Installation URL5ntglkhb77c98
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jan 28, 2026

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
FlavorJalapeno
Build TypeDebug
Versionpr22535-8b6c265
Build Number1483
Application IDcom.jetpack.android.prealpha
Commit8b6c265
Installation URL5kut60o1mp8so
Note: Google Login is not supported on these builds.

@sonarqubecloud
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.

Looks good and works as expected!

@nbradbury nbradbury merged commit c9303de into trunk Jan 28, 2026
24 checks passed
@nbradbury nbradbury deleted the issue/CMM-176-reader-subscribe-options branch January 28, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants