-
Notifications
You must be signed in to change notification settings - Fork 731
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
Conversation
private val avatarRenderer: AvatarRenderer, | ||
private val vectorDateFormatter: VectorDateFormatter, | ||
private val stringProvider: StringProvider, | ||
private val clock: Clock, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 for injecting the clock!
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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>() { |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, removed.
android:background="@drawable/bg_live_location_users_bottom_sheet"> | ||
|
||
<FrameLayout | ||
android:id="@+id/fragmentContainer" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
}
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 = ""), |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly.
There was a problem hiding this comment.
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.
Matrix SDKIntegration Tests Results:
|
Type of change
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
Tested devices
Checklist