Skip to content

compose: Restore location sharing in the sample behind a feature flag#6517

Merged
gpunto merged 4 commits into
developfrom
gianmarco/restore-location-attachment
Jun 25, 2026
Merged

compose: Restore location sharing in the sample behind a feature flag#6517
gpunto merged 4 commits into
developfrom
gianmarco/restore-location-attachment

Conversation

@gpunto

@gpunto gpunto commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Goal

While working on the OpenAPI migration, I realized the demo location sharing feature was still unused (we removed it while testing the v7 redesign). I'm readding it behind a flag so it's easier to test location (which is what I needed to do for testing the app with generated DTOs).

Closes AND-1259

Implementation

  • Added an isLocationSharingEnabled flag to CustomSettings (SharedPreferences, defaults to false) and a toggle for it on the login/settings screen.
  • ChannelActivity now passes LocationComponentFactory when the flag is on, and a no-op factory otherwise.

Testing

  • Manual: with the flag off, the attachment picker is unchanged; with it on, a Location option appears and sharing static/live locations works. Required location permissions are already declared in the sample manifest.

Summary by CodeRabbit

  • New Features

    • Added a new location sharing option in the sample app’s login settings.
    • Channel screens now adapt to the location sharing setting and can enable location-related chat components.
    • Theme customization now supports supplying a component factory for chat UI extensions.
  • Bug Fixes

    • Improved toolbar and feature flag text styling to better match the app theme.

@gpunto gpunto added the pr:demo-app Changes specific to demo app label Jun 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.90 MB 5.90 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.15 MB 11.15 MB 0.00 MB 🟢
stream-chat-android-compose 12.61 MB 12.61 MB 0.00 MB 🟢

@gpunto gpunto marked this pull request as ready for review June 24, 2026 12:32
@gpunto gpunto requested a review from a team as a code owner June 24, 2026 12:32
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

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: 05a81951-e572-4088-a99b-00dbf8eb5845

📥 Commits

Reviewing files that changed from the base of the PR and between 2a4b714 and d7bf42e.

📒 Files selected for processing (5)
  • stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/data/CustomSettings.kt
  • stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/SampleChatTheme.kt
  • stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/channel/ChannelActivity.kt
  • stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/login/CustomLoginActivity.kt
  • stream-chat-android-compose-sample/src/main/res/values/strings.xml

Walkthrough

Adds a isLocationSharingEnabled boolean setting to CustomSettings and exposes it as a feature flag toggle in CustomLoginActivity. Extends SampleChatTheme with an optional componentFactory parameter forwarded to ChatTheme. ChannelActivity conditionally injects a LocationComponentFactory based on the flag. Minor theme-consistent color tweaks are applied in the login UI.

Changes

Location Sharing Feature Flag

Layer / File(s) Summary
Settings preference and string resources
...sample/data/CustomSettings.kt, ...res/values/strings.xml
Adds isLocationSharingEnabled boolean preference backed by a new LocationSharing = "location_sharing" key, plus label and description string resources for the UI toggle.
SampleChatTheme componentFactory parameter
...sample/ui/SampleChatTheme.kt
Adds an optional componentFactory: ChatComponentFactory parameter (defaulting to an empty anonymous implementation) and forwards it into the ChatTheme call.
ChannelActivity LocationComponentFactory wiring
...sample/ui/channel/ChannelActivity.kt
In SetupChatTheme, a remember(cid)-keyed factory is created as either LocationComponentFactory (backed by SharedLocationViewModelFactory(cid)) or an empty ChatComponentFactory based on isLocationSharingEnabled, then passed to SampleChatTheme.
Login screen toggle and styling fixes
...sample/ui/login/CustomLoginActivity.kt
Adds a location sharing FeatureFlag entry with local state and a handler persisting to settings.isLocationSharingEnabled; changes the toolbar back-arrow tint to ChatTheme.colors.textPrimary; explicitly sets label/description text colors in FeatureFlagField.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

pr:improvement

Poem

🐰 A bunny hops through settings fine,
Location sharing—now in line!
A flag toggled, a factory wired,
The channel theme with care admired.
Colors themed, no black hardcodes remain,
The warren's map is shared again! 🗺️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes restoring location sharing in the sample behind a feature flag.
Description check ✅ Passed The description covers the goal, implementation, and testing, but omits the template's UI changes, checklist, and GIF sections.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gianmarco/restore-location-attachment

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.

@andremion andremion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good.
I just left a NIT on remember(cid)

@gpunto gpunto enabled auto-merge (squash) June 25, 2026 09:21
@sonarqubecloud

Copy link
Copy Markdown

@gpunto gpunto merged commit ede78d0 into develop Jun 25, 2026
19 checks passed
@gpunto gpunto deleted the gianmarco/restore-location-attachment branch June 25, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:demo-app Changes specific to demo app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants