-
Notifications
You must be signed in to change notification settings - Fork 743
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
[Location sharing] - Navigation to Map view from live location message (PSF-888) #6092
Conversation
@@ -75,7 +75,8 @@ class LiveLocationShareMessageItemFactory @Inject constructor( | |||
val height = dimensionConverter.dpToPx(MessageItemFactory.MESSAGE_LOCATION_ITEM_HEIGHT_IN_DP) | |||
|
|||
return MessageLiveLocationInactiveItem_() | |||
.attributes(attributes) | |||
// disable the click on this state item | |||
.attributes(attributes.copy(itemClickListener = null)) |
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 can avoid to add the clickListener before or add a new boolean to disable instead?
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 am not sure I can do better and more simple for that. Deciding whether the item should be clickable depends on the status of the live which is computed inside this factory using some fields of the summary data. Unless you have a solution in mind?
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 agree it's a bit strange to do like this. Also I am pretty sure that in the future, if we want the item to be clickable, we may hardly understand why the item is not clickable because of this.
Not a blocker anyway.
/** | ||
* Screen showing a map with all the current users sharing their live location in room. | ||
*/ | ||
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.
Maybe start using @androidentrypoint for fragment with field injection?
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, I will try to make the change.
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.
See c46aaa2
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.
Some small remarks, otherwise LGTM
/*@Binds | ||
@IntoMap | ||
@FragmentKey(LocationLiveMapViewFragment::class) | ||
fun bindLocationLiveMapViewFragment(fragment: LocationLiveMapViewFragment): Fragment*/ |
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.
Please remove commented out code, or will it be uncommented in a future PR?
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.
Oups not intended, sorry.
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 am wondering if we could have this type of auto verification (no commented code) in Danger?
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.
Sonar is checking that
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.
Removed in 721d7cb
@@ -75,7 +75,8 @@ class LiveLocationShareMessageItemFactory @Inject constructor( | |||
val height = dimensionConverter.dpToPx(MessageItemFactory.MESSAGE_LOCATION_ITEM_HEIGHT_IN_DP) | |||
|
|||
return MessageLiveLocationInactiveItem_() | |||
.attributes(attributes) | |||
// disable the click on this state item | |||
.attributes(attributes.copy(itemClickListener = null)) |
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 agree it's a bit strange to do like this. Also I am pretty sure that in the future, if we want the item to be clickable, we may hardly understand why the item is not clickable because of this.
Not a blocker anyway.
|
||
/** | ||
* Screen showing a map with all the current users sharing their live location in room. | ||
*/ |
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.
Thanks for the comment!
val fragment = SupportMapFragment.newInstance(options) | ||
addFragment(R.id.liveLocationMapContainer, fragment, tag = MAP_FRAGMENT_TAG) | ||
fragment | ||
} |
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 reduce to
?: run {
val options = MapboxMapOptions.createFromAttributes(requireContext(), null)
SupportMapFragment.newInstance(options)
.also { addFragment(R.id.liveLocationMapContainer, it, tag = MAP_FRAGMENT_TAG) }
}
Also maybe extract to a private fun getOrCreateSupportMapFragment()
for code clarity.
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.
Thanks for the suggestion. Done in b331521
|
||
private fun setupMap() { | ||
val mapFragment: SupportMapFragment = | ||
parentFragmentManager.findFragmentByTag(MAP_FRAGMENT_TAG) as? SupportMapFragment |
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 should use the childFramentManager
here
?: run { | ||
val options = MapboxMapOptions.createFromAttributes(requireContext(), null) | ||
val fragment = SupportMapFragment.newInstance(options) | ||
addFragment(R.id.liveLocationMapContainer, fragment, tag = MAP_FRAGMENT_TAG) |
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 should use addChildFragment
here.
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
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 rename the file to something more generic and reusable like fragment_simple_container.xml
. I have check and a similar fragment layout does not exist yet.
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 in 7bb73ff
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.
Thanks for the update!
As discussed, OK for the click listener management.
Matrix SDKIntegration Tests Results:
|
Type of change
Content
Add possibility to navigate to a map screen from a running live location share message.
User pins on map and other UI will be implemented in another pull request.
Motivation and context
Part of #6012
Screenshots / GIFs
Tests
Tested devices
Checklist