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

Hide join call button when the user is already in the call #3815

Merged
merged 6 commits into from
Nov 7, 2024

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Nov 6, 2024

Content

When the user is in the call due to the Pip mode, the "Join" call button is displayed. This PR hides it if the user is currently (and locally) in the call.

This PR also improve the RoomCallState regarding permission. We now have a disabled button if the user is not allowed to join the call.

Motivation and context

Closes element-hq/element-meta#2608

Screenshots / GIFs

See the recorded ones.

Tests

  • In a room, start a call
  • Enter Pip mode
  • Observe that the button to join the call in the room (top end of the screen) is not displayed, and it is also not displayed anymore in the timeline item of the call.

Note that if there is a call in another room, joining the other call will do nothing. This is another issue, not related to this PR.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 23
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off
  • You've made a self review of your PR

bmarty and others added 4 commits November 6, 2024 09:14
This is at the account level so if the user has joined the call on another device, the join button will be hidden.

Extract room call state presenter to its own module and update RoomCallState model.
Let RoomDetailsPresenter use the new RoomCallStatePresenter
@bmarty bmarty requested a review from a team as a code owner November 6, 2024 09:36
@bmarty bmarty requested review from ganfra and removed request for a team November 6, 2024 09:36
@bmarty bmarty added the PR-Change For updates to an existing feature label Nov 6, 2024
Copy link
Contributor

github-actions bot commented Nov 6, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/qDCsxG

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 92.64706% with 10 lines in your changes missing coverage. Please review.

Project coverage is 82.93%. Comparing base (98bf685) to head (db4b4d3).
Report is 40 commits behind head on develop.

Files with missing lines Patch % Lines
.../messages/impl/timeline/components/CallMenuItem.kt 91.42% 2 Missing and 1 partial ⚠️
...o/element/android/features/call/api/CurrentCall.kt 60.00% 2 Missing ⚠️
...ent/android/features/roomcall/api/RoomCallState.kt 77.77% 1 Missing and 1 partial ⚠️
...roid/features/call/impl/utils/ActiveCallManager.kt 92.30% 0 Missing and 1 partial ⚠️
...ssages/impl/timeline/components/TimelineItemRow.kt 0.00% 1 Missing ⚠️
...d/features/roomcall/impl/RoomCallStatePresenter.kt 95.23% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3815      +/-   ##
===========================================
+ Coverage    82.91%   82.93%   +0.02%     
===========================================
  Files         1772     1778       +6     
  Lines        44534    44620      +86     
  Branches      5227     5233       +6     
===========================================
+ Hits         36924    37005      +81     
- Misses        5780     5784       +4     
- Partials      1830     1831       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

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

Small remarks otherwise LGTM


import kotlinx.coroutines.flow.StateFlow

interface CurrentCallObserver {
Copy link
Member

Choose a reason for hiding this comment

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

The name is a bit weird, the observer is the one who subscribe to the flow usually, not the one providing.
I'd call this CurrentCallService or CurrentCallDataSource for exemple

Copy link
Member Author

@bmarty bmarty Nov 6, 2024

Choose a reason for hiding this comment

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

class FakeCurrentCallObserver(
initialValue: CurrentCall = CurrentCall.None,
) : CurrentCallObserver {
override val currentCall = MutableStateFlow(initialValue)
Copy link
Member

Choose a reason for hiding this comment

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

Usually when we have StateFlow we provide them in the constructor of the fake

Copy link
Member Author

Choose a reason for hiding this comment

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

@bmarty bmarty enabled auto-merge November 6, 2024 16:29
Copy link

sonarcloud bot commented Nov 6, 2024

@bmarty bmarty disabled auto-merge November 7, 2024 07:59
@bmarty bmarty merged commit 9ea0a11 into develop Nov 7, 2024
26 checks passed
@bmarty bmarty deleted the feature/bma/hideJoinCallButton branch November 7, 2024 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Change For updates to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Story] Element X: Hide the "Join" button after the call has started (Android only)
3 participants