-
Notifications
You must be signed in to change notification settings - Fork 754
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
Fix location crash #5084
Fix location crash #5084
Conversation
`LocationListener` does not have default implementation for some methods for Android versions below R
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.
Surprised, approved, thanks a lot for testing.
Matrix SDKIntegration Tests Results:
|
errorDrawable ?: return | ||
val pinDrawable = createPinDrawable(errorDrawable) | ||
cache[userId] = pinDrawable | ||
callback(pinDrawable) |
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.
Fixes the issue when the user does not have an avatar
@@ -18,15 +18,9 @@ package im.vector.app.features.location | |||
|
|||
import android.graphics.drawable.Drawable | |||
|
|||
interface VectorMapView { |
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.
This interface was implemented but not really used as a type
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 tried to be flexible in case of changing the map library but has problems with epoxy.
style | ||
) | ||
pendingState?.let { render(it) } | ||
pendingState = 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.
Trying to fix race condition here
return map?.cameraPosition?.zoom | ||
} | ||
|
||
override fun onClick(callback: () -> Unit) { |
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.
this was not used
android:layout_marginEnd="@dimen/layout_horizontal_margin" | ||
app:layout_constraintBottom_toBottomOf="@id/shareLocationContainer" | ||
app:layout_constraintEnd_toEndOf="@id/shareLocationContainer" | ||
app:layout_constraintTop_toTopOf="@id/shareLocationContainer" /> |
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.
callback?.onLocationUpdate(lastKnownLocation.toLocationData()) | ||
} | ||
|
||
locationManager.requestLocationUpdates( |
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 it OK to call this multiple times this fun
and call only once locationManager?.removeUpdates(this)
in onStop
? Maybe yes but I want to be sure.
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, you can see the location icon on Status Bar is disappearing when fragment is destroyed.
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.
Ah didn't notice that. It does not disappear on my side
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 have to put the entire app into bg to make it disappear to be more precise.
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.
working well in my local test
for me the Marker is there but no Map Render in Timeline but the rest to seems work now :) |
…uild the URLs in the controllers
Thanks for your feedback! Loading images in the timeline can take a few seconds but is working here. |
append(keyParam) | ||
if (!resources.getBoolean(R.bool.is_rtl)) { | ||
// On LTR languages we want the legal mentions to be displayed on the bottom left of the image | ||
append("&attribution=bottomleft") |
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.
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.
Thank you for the great collaboration!
OS: Oxygen OS 11 based on Android 11
|
} | ||
|
||
@Test | ||
fun invalidCases() { |
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.
Perfect, thanks for the test cases!
…location. So do not ignore them. Not sure how if this is a universal rule...
val locationUrl = state.timelineEvent()?.root?.getClearContent() | ||
?.toModel<MessageLocationContent>(catchError = true) | ||
?.toLocationData() | ||
?.let { urlMapProvider.buildStaticMapUrl(it, INITIAL_MAP_ZOOM_IN_TIMELINE, 1200, 800) } |
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.
nit: is it worth extracting these to width/height constants or using named params?
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, and I think the values are not correct (since not related to the actual ImageView size). Anyway, could be improved later, this is not a big issue, Glide will crop the image anyway (I think)
Thanks for the review!
When the user want to share their location and then disable the location on their device, there was a crash on Android < R.
Now the user get a dialog and can safely close the screen.
Update
I use the same PR to fix more implementation issue:
There is still some problems: