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

#5395: Location sharing options view #5411

Merged
merged 25 commits into from
Mar 9, 2022

Conversation

mnaturel
Copy link
Contributor

@mnaturel mnaturel commented Mar 3, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Adding a new custom view named LocationSharingOptionPickerView to be able to show different options of location sharing.
The only visible changes we can see now in the app is the icon and text displayed to confirm sharing and the avatar display in timeline and map (see captures below).
In fact, we only have user current location option available for now. Icon is now the user avatar with background color corresponding to the user color both in the pins of the map and in the confirmation view. Ripple effect has also been added when the confirmation view is pressed.

Motivation and context

Closes #5395.

Screenshots / GIFs

Current visible changes in the app

Changes not currently visible in the app

For UI validation, only the option picker view is relevant, the map view has not been updated for now)

Tests

  • 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
  • Check the avatar background color is yours and consistent both in the map and in the confirmation view
  • Click on the confirmation view
  • Check the location is correctly shared in the timeline of the room/message
  • Check the avatar background color is yours and consistent in the timeline

To test the other options, go to LocationSharingFragment at initOptionsPicker() method and set the options as you want. For example, views.shareLocationOptionsPicker.render(LocationSharingOption.USER_CURRENT, LocationSharingOption.USER_LIVE) or views.shareLocationOptionsPicker.render(LocationSharingOption.PINNED)

Tested devices

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

Checklist

@github-actions
Copy link

github-actions bot commented Mar 3, 2022

Unit Test Results

  96 files  ±0    96 suites  ±0   1m 7s ⏱️ -1s
172 tests ±0  172 ✔️ ±0  0 💤 ±0  0 ±0 
564 runs  ±0  564 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 2bdafde. ± Comparison against base commit 2048b85.

♻️ This comment has been updated with latest results.

@mnaturel
Copy link
Contributor Author

mnaturel commented Mar 3, 2022

Hi @gaelledel , can you please review the design? I have added some relevant screenshots of the added modifications.

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.

Ace! Looking forward to see future developments

@mnaturel mnaturel marked this pull request as ready for review March 3, 2022 10:58
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.

Good Job with the custom views, it seems fine to me

Comment on lines 141 to 144
// TODO
}
views.shareLocationOptionsPicker.optionUserLive.debouncedClicks {
// TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

What do we plan to do 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.

For the live location sharing, the app will send location of the user periodically during a certain amount of time until the user stops sharing its location. And in timeline we will also be able to see locations of different several users currently live sharing their location.

Copy link
Member

@bmarty bmarty 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!
A few (small) remarks

@@ -142,6 +142,9 @@
<item name="vctr_keyword_style">@style/Widget.Vector.Keyword</item>

<item name="vctr_toast_background">@color/vctr_toast_background_light</item>

<!-- Location sharing -->
<item name="vctr_live_location">@color/vctr_live_location_dark</item>
Copy link
Member

Choose a reason for hiding this comment

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

I think you mean vctr_live_location_light (even if the actual value is the same)

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 exactly, thanks! I missed that, I will fix this.

enum class LocationSharingOption {
USER_CURRENT, // current user's location
USER_LIVE, // user's location during a certain amount of time
PINNED // static location pinned by the user
Copy link
Member

Choose a reason for hiding this comment

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

On the form I prefer to have comment above the value, using KDoc for better integration with IDE. So like

/**
 * static location pinned by the user
 */
PINNED

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay I will update it.

applyBackground()
}

fun setOptions(vararg options: LocationSharingOption) {
Copy link
Member

Choose a reason for hiding this comment

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

Generally those methods are called render in the codebase.
Also maybe passing a List as parameter could be better than vararg, but I do not have a strong opinion on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay for the naming. I was wondering about a Set instead of vararg but I have chosen vararg because it easier to use and read (no extra setOf()).

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay I see. We declare one file per view. I will do the update.

@@ -2924,9 +2924,17 @@
<!-- Location -->
<string name="location_activity_title_static_sharing">Share location</string>
<string name="location_activity_title_preview">Location</string>
<!-- TODO delete -->
Copy link
Member

Choose a reason for hiding this comment

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

Thanks. Related lint issue about unused resourced could be ignore. Maybe add a lint ignore in the tag to please lint and not break develop once merged. I will update the recipe to delete strings if it works (or you can do it if you want to!).

@mnaturel
Copy link
Contributor Author

mnaturel commented Mar 4, 2022

Nice work! A few (small) remarks

Thanks for the review! I have fixed all discussions, can you check again? I will need this work to move on #5417.

@onurays
Copy link
Contributor

onurays commented Mar 8, 2022

We may have a quick win here to share the location as a pin by extending LocationAssetType like:

@JsonClass(generateAdapter = false)
enum class LocationAssetType {
    /**
     *
     **/
    @Json(name = "m.self")
    SELF,

    /**
     *
     **/
    @Json(name = "m.pin")
    PIN
}

Timeline already handles the asset type and renders as a pin if it is different than m.self.

@mnaturel
Copy link
Contributor Author

mnaturel commented Mar 9, 2022

We may have a quick win here to share the location as a pin by extending LocationAssetType like:

@JsonClass(generateAdapter = false)
enum class LocationAssetType {
    /**
     *
     **/
    @Json(name = "m.self")
    SELF,

    /**
     *
     **/
    @Json(name = "m.pin")
    PIN
}

Timeline already handles the asset type and renders as a pin if it is different than m.self.

Thanks for the info! I will try to use it on my next PR to handle static pinned location sharing.

@mnaturel mnaturel force-pushed the feature/mna/PSF-735-sharing-options-view branch from 4718c00 to 2bdafde Compare March 9, 2022 09:16
<attr name="locShareIconBackgroundTint" format="color" />
<attr name="locShareIconPadding" format="dimension" />
<attr name="locShareIconDescription" format="string" />
<attr name="locShareTitle" format="string" />
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for using a prefix, it's far better when attributes are used in the XML!

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

Thanks for the update!
(static review only)

@mnaturel mnaturel merged commit f12afe0 into develop Mar 9, 2022
@mnaturel mnaturel deleted the feature/mna/PSF-735-sharing-options-view branch March 9, 2022 15:10
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] - Sharing options view
5 participants