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

#5417: Pinned location sharing #5479

Merged
merged 19 commits into from
Mar 15, 2022
Merged

Conversation

mnaturel
Copy link
Contributor

@mnaturel mnaturel commented Mar 9, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Implementation of the pinned location sharing. User can now select a location on the map different from its current location. User can also zoom to its current location using a dedicated button placed above the compass icon.

Motivation and context

Closes #5417

Screenshots / GIFs

User location sharing

Pinned location sharing

Tests

User location case

  • Ensure location sharing option is enabled in "Settings" -> "Preferences"
  • Go to a room or a direct message
  • Click on the "add" icon
  • Select the location icon
  • Check you see the map with your current location
  • Check you see the confirmation view with your avatar and color
  • Click on the confirmation view
  • Check the location is correctly shared in the timeline of the room/message

Pinned location case

  • Ensure location sharing option is enabled in "Settings" -> "Preferences"
  • Go to a room or a direct message
  • Click on the "add" icon
  • Select the location icon
  • Check you see the map with your current location
  • Move the map on another location
  • Check the confirmation view has changed and corresponds to pin location option
  • Check the pin on the map is now a generic pin instead of the avatar
  • Click on the confirmation view
  • Check the location is correctly shared in the timeline of the room/message

Compatibility with previous versions

  • Share user location or a pinned location in a room
  • Go to the room using a previous version of the app
  • Check the events are represented as user location (Generic pin would not be displayed for pinned location due to the current enum model for asset type and the change of the naming for the asset field)
  • Share user location with a previous version in a room
  • Go to the room using the new app version
  • Check we correctly see the shared user location

Tested devices

  • Physical
  • Emulator
  • OS version(s): Android 11

Checklist

@mnaturel mnaturel force-pushed the feature/mna/PSF-735-pinned-location branch from 2cc7751 to fce6c66 Compare March 9, 2022 16:05
@github-actions
Copy link

github-actions bot commented Mar 9, 2022

Unit Test Results

102 files  +4  102 suites  +4   1m 9s ⏱️ +4s
182 tests +2  182 ✔️ +2  0 💤 ±0  0 ±0 
598 runs  +8  598 ✔️ +8  0 💤 ±0  0 ±0 

Results for commit b72c87d. ± Comparison against base commit db0cfd4.

♻️ This comment has been updated with latest results.

@mnaturel
Copy link
Contributor Author

mnaturel commented Mar 9, 2022

Hello @gaelledel, this PR is ready for design review. Can you check everything is okay?

Copy link

@gaelledel gaelledel left a comment

Choose a reason for hiding this comment

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

Awesome work :D

object CurrentUserLocationSharingAction : LocationSharingAction()
data class PinnedLocationSharingAction(val locationData: LocationData?) : LocationSharingAction()
data class LocationTargetChangeAction(val locationData: LocationData) : LocationSharingAction()
object ZoomToUserLocationAction : LocationSharingAction()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove Action suffix like ZoomToUserLocation to continue the naming convention of other actions?

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 in fact it is not necessary.

@@ -130,21 +143,52 @@ class LocationSharingFragment @Inject constructor(
.show()
}

private fun initLocateBtn() {
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 prefer renaming to initLocateButton()

@mnaturel mnaturel marked this pull request as ready for review March 14, 2022 15:31
pinDrawable = it
)
private fun updatePin(isUserPin: Boolean? = true) {
if (isUserPin == true) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We generally prefer if (isUserPin.orFalse()).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I was not aware of this extension.

pinId = DEFAULT_PIN_ID,
pinDrawable = pinDrawable
pinDrawable = null,
showPin = areTargetAndUserLocationEqual == false
Copy link
Contributor

Choose a reason for hiding this comment

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

.orFalse can be used here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I replaced it by areTargetAndUserLocationEqual.orTrue().not() to be equivalent to areTargetAndUserLocationEqual == false.

private var mapRefs: MapRefs? = null
private var initZoomDone = false
private var showLocationBtn = false
Copy link
Contributor

@onurays onurays Mar 15, 2022

Choose a reason for hiding this comment

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

Could you please rename locateBtn, createLocateBtn, showLocationBtn, initLocateBtn and adjustCompassBtn?

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 no problem, done.

Copy link
Contributor

@onurays onurays left a comment

Choose a reason for hiding this comment

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

Nice work! Tested on my device. I just have small remarks.

@mnaturel mnaturel force-pushed the feature/mna/PSF-735-pinned-location branch from 70a6d2b to 19e7ec2 Compare March 15, 2022 14:39
@mnaturel
Copy link
Contributor Author

Nice work! Tested on my device. I just have small remarks.

Thanks! I fixed all comments and rebased the branch on develop. Can you have a look again?

@mnaturel
Copy link
Contributor Author

When testing again with previous version, I now have a "Malformed event" message for pinned location events sent with a version built from this branch. This is due to the enum type LocationAssetType which is not flexible. I do not have any solution for this...

@onurays onurays self-requested a review March 15, 2022 15:28
@mnaturel mnaturel enabled auto-merge March 15, 2022 15:33
@mnaturel mnaturel force-pushed the feature/mna/PSF-735-pinned-location branch from 19e7ec2 to b72c87d Compare March 15, 2022 16:09
@mnaturel mnaturel merged commit 9ef235f into develop Mar 15, 2022
@mnaturel mnaturel deleted the feature/mna/PSF-735-pinned-location branch March 15, 2022 16:40
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] - Pinned location
3 participants