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

Live Location Sharing - User List Bottom Sheet [PSF-890] #6170

Merged
merged 16 commits into from
May 30, 2022

Conversation

onurays
Copy link
Contributor

@onurays onurays commented May 27, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

This PR implements a bottom sheet on maximized live location sharing screen. The bottom sheet contains the user list who currently share their live location. If the current user is sharing a live location the list item also has a button to allow stopping location sharing. Clicking a user should zoom to user's location.

Motivation and context

Closes #6012

Screenshots / GIFs

Screenrecorder-2022-05-27-17-22-57-182.mp4
Screenrecorder-2022-05-27-17-30-05-425.mp4

Tests

  • Select location attachment icon from timeline composer
  • Select "Share live location" in location screen
  • Ideally share live location from another user in the same room too
  • Live location item should be visible in timeline, tap on the item, should navigate to maximized map screen
  • You should see all users' avatars on map and the bottom sheet with the user list
  • You should see a stop sharing button next to your user's item in bottom sheet
  • Selecting stop sharing button should remove your user on map and in bottom sheet list
  • Selecting a user in bottom sheet should zoom to the selected user's location on map
  • Bottom sheet should be extendable and scrollable

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@onurays onurays requested review from a team, yostyle and ariskotsomitopoulos and removed request for a team May 27, 2022 14:56
@github-actions
Copy link

github-actions bot commented May 27, 2022

Unit Test Results

142 files  ±0  142 suites  ±0   2m 14s ⏱️ +5s
229 tests ±0  229 ✔️ ±0  0 💤 ±0  0 ±0 
760 runs  ±0  760 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 353f290. ± Comparison against base commit 828e13f.

♻️ This comment has been updated with latest results.

@ouchadam ouchadam self-requested a review May 30, 2022 09:08
@ouchadam
Copy link
Contributor

to double check, should we be showing the seconds in the updated X ago?

2022-05-30T10:11:57,498269500+01:00

private val avatarRenderer: AvatarRenderer,
private val vectorDateFormatter: VectorDateFormatter,
private val stringProvider: StringProvider,
private val clock: Clock,
Copy link
Contributor

Choose a reason for hiding this comment

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

💯 for injecting the clock!

Copy link
Contributor

@ariskotsomitopoulos ariskotsomitopoulos left a comment

Choose a reason for hiding this comment

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

PR seems fine, just a minor comment

return formatDurationWithUnits(duration, stringProvider::getString)
}

private fun formatDurationWithUnits(duration: Duration, getString: ((Int) -> String)): String {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add a doc/comment for this function to be clear what it does

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice idea, done.

@@ -50,7 +53,8 @@ import javax.inject.Inject
*/
class LocationLiveMapViewFragment @Inject constructor(
private var urlMapProvider: UrlMapProvider,
) : VectorBaseFragment<FragmentSimpleContainerBinding>() {
private var bottomSheetController: LiveLocationBottomSheetController,
) : VectorBaseFragment<FragmentLocationLiveMapViewBinding>() {
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 you can remove the fragment_simple_container.xml.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, removed.

@onurays
Copy link
Contributor Author

onurays commented May 30, 2022

to double check, should we be showing the seconds in the updated X ago?

2022-05-30T10:11:57,498269500+01:00

We shouldn't. I will hide seconds if it has minutes or hours part. I am not sure if we prefer something like "Updated recently".

Base automatically changed from feature/mna/PSF-1019-user-pins to develop May 30, 2022 10:32
android:background="@drawable/bg_live_location_users_bottom_sheet">

<FrameLayout
android:id="@+id/fragmentContainer"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if we should prefix the view ids by for example liveLocationMap to avoid having duplicated ids inside the app?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is better with prefix. Done.

@@ -3037,6 +3037,8 @@
<string name="live_location_sharing_notification_description">Location sharing is in progress</string>
<string name="labs_enable_live_location">Enable Live Location Sharing</string>
<string name="labs_enable_live_location_summary">Temporary implementation: locations persist in room history</string>
<string name="live_location_bottom_sheet_stop_sharing">Stop sharing</string>
Copy link
Contributor

@mnaturel mnaturel May 30, 2022

Choose a reason for hiding this comment

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

Should we have a dedicated string for the bottom sheet or could we reuse the "Stop" string location_share_live_stop used in other views to stop a live location share?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to design we need a new string.

"lastUpdatedAt": "Updated 12min ago"
},
{
"displayName": "You",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the second item used? I only see the first one used in text for preview of the item layout.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is seen in RecyclerView's preview.

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could add android:background="?selectableItemBackground" to have ripple effect when clicking on a user item?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch, done.

android:layout_height="match_parent"
android:background="@drawable/bg_live_location_users_bottom_sheet"
app:behavior_peekHeight="200dp"
app:behavior_hideable="false"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want the bottom sheet always visible? I expected to be able to have the map view in full screen (i.e. just seeing the top of the bottom sheet), I don't know what is expected here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to design we need to. But I also want to discuss this with the team.

@@ -50,7 +53,8 @@ import javax.inject.Inject
*/
class LocationLiveMapViewFragment @Inject constructor(
Copy link
Contributor

Choose a reason for hiding this comment

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

When creating the SymbolManager for the map in setupMap() method, we can add option to allow override of symbols in order to see every users even if they are very near from each other:

symbolManager = SymbolManager(mapFragment.view as MapView, mapboxMap, style).also {
    it.iconAllowOverlap = true
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't know this option, cool! Done.

* develop: (114 commits)
  Docs: Fix various formatting and spelling issues in notifications.md
  Fixing non necessary breaking line
  continuing to the originally supplied url when a rtl override character is detected
  splitting url detection condition into separate branches
  Cleaner code
  Create extension `String?.toActiveSpaceOrOrphanRooms()` to reduce noise.
  Add changelog
  Fix test compilation
  Add some Kdoc
  Add some Kdoc
  Create SpaceFilter.OrphanRooms to improve the API. Not 100% of the side effect. There is probably some (fixed?) bugs here.
  Rename ActiveSpaceFilter to SpaceFilter
  Remove `ActiveSpaceFilter.None` Prefer nullability for API coherency of `RoomSummaryQueryParams`
  Add some Kdoc
  Remove duplicated lines of code (the same code is done a few lines later)
  Remove `RoomCategoryFilter.ALL` Prefer nullability for API coherency of `RoomSummaryQueryParams`
  `displayName` default value is now `QueryStringValue.NoCondition`. It was working fine since in the DB we always have a name using `RoomDisplayNameFallbackProvider`, which in our current implementation always return a non empty String.
  Small rework for nicer code
  Remove duplicated code lines
  Remove `roomId` from `RoomSummaryQueryParams.Builder()`. Create a new API in RoomService to observe a room summary from a roomId.
  ...

# Conflicts:
#	vector/src/main/java/im/vector/app/features/location/live/map/LocationLiveMapViewFragment.kt
pinDrawable = pinDrawable,
locationData = LocationData(
latitude = A_LATITUDE,
longitude = A_LONGITUDE,
uncertainty = A_UNCERTAINTY
),
endOfLiveTimestampMillis = A_END_OF_LIVE_TIMESTAMP
endOfLiveTimestampMillis = A_END_OF_LIVE_TIMESTAMP,
locationTimestampMillis = A_END_OF_LIVE_TIMESTAMP,
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 here we should declare a dedicated location timestamp that should be set in the given locationDataContent variable. So that the mapping is checked.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -79,14 +84,16 @@ class UserLiveLocationViewStateMapperTest {
val viewState = userLiveLocationViewStateMapper.map(summary)

val expectedViewState = UserLiveLocationViewState(
userId = A_USER_ID,
matrixItem = MatrixItem.UserItem(id = A_USER_ID, displayName = "User 2", avatarUrl = ""),
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 we will also need to mock the return of getUser() method for the fakeSession

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely, done. Thanks for the help.

@onurays onurays merged commit 4ccd242 into develop May 30, 2022
@onurays onurays deleted the feature/ons/live_location_bottom_sheet branch May 30, 2022 18:07
@github-actions
Copy link

Matrix SDK

Integration Tests Results:

  • [org.matrix.android.sdk.session]
  • [org.matrix.android.sdk.account]
  • [org.matrix.android.sdk.internal]
  • [org.matrix.android.sdk.ordering]
  • [org.matrix.android.sdk.PermalinkParserTest]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Location sharing] - Maximized view for live location shares
5 participants