Skip to content

Expose ChannelsScreen.isBackPressEnabled config flag to disable the default back handler#6228

Open
VelikovPetar wants to merge 1 commit intodevelopfrom
feature/AND-1108_channels_screen_back_press_flag
Open

Expose ChannelsScreen.isBackPressEnabled config flag to disable the default back handler#6228
VelikovPetar wants to merge 1 commit intodevelopfrom
feature/AND-1108_channels_screen_back_press_flag

Conversation

@VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Mar 9, 2026

Goal

Provides a way for customers to disable the default BackHandler registered in the ChannelsScreen. Useful if the integration depends on propagating the back-events and handling them higher in the hierarchy, where they don't have direct access to the onBackPressed callback.

Implementation

  • Add new ChannelsScreen.isBackPressEnabled flag.

🎨 UI Changes

NA

Testing

  1. Set ChannelsScreen.isBackPressEnabled
  2. The ChannelsScreen.onBackPressed should no longer be invoked (the back press event should be intercepted by a handler higher in the hierarchy (BackHandler or Activity.onBackPressed))

Summary by CodeRabbit

  • New Features
    • The Channels Screen now provides control over back button behavior through a new optional parameter. You can enable or disable back navigation, with the back button enabled by default to maintain existing behavior.

@VelikovPetar VelikovPetar added the pr:new-feature New feature label Mar 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.26 MB 5.26 MB 0.00 MB 🟢
stream-chat-android-offline 5.48 MB 5.48 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.63 MB 10.63 MB 0.00 MB 🟢
stream-chat-android-compose 12.85 MB 12.85 MB 0.00 MB 🟢

@VelikovPetar VelikovPetar marked this pull request as ready for review March 9, 2026 15:47
@VelikovPetar VelikovPetar requested a review from a team as a code owner March 9, 2026 15:47
@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0864bd66-04f3-47e6-a107-5a9073316f58

📥 Commits

Reviewing files that changed from the base of the PR and between 56a1073 and 7a5c7ed.

📒 Files selected for processing (2)
  • stream-chat-android-compose/api/stream-chat-android-compose.api
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/ChannelsScreen.kt

Walkthrough

A new isBackPressEnabled boolean parameter (defaulting to true) is added to the ChannelsScreen composable function, enabling dynamic control over back press handling behavior instead of a hardcoded state.

Changes

Cohort / File(s) Summary
ChannelsScreen Back Press Control
stream-chat-android-compose/api/stream-chat-android-compose.api, stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/ChannelsScreen.kt
Added isBackPressEnabled: Boolean = true parameter to ChannelsScreen. Updated BackHandler invocation to use the parameter instead of hardcoded enabled state, replacing BackHandler(enabled = true) with BackHandler(enabled = isBackPressEnabled).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Hoppy updates to back press control,
A rabbit's gift to make UI whole,
Enable, disable with a boolean's soul,
The back handler now bends to our role! 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description covers the essential sections (Goal and Implementation) but lacks required sections like UI Changes details, Testing instructions, and Contributor/Reviewer checklists. Complete the missing template sections: add detailed testing steps with expected behavior, mark UI Changes as complete, and fill out the Contributor and Reviewer checklists as applicable.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: exposing a new configuration flag to control back handler behavior in ChannelsScreen.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/AND-1108_channels_screen_back_press_flag

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

pr:new-feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant