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

fix: location sharing without gms when not moving [WPB-9724] 🍒 🍒 #3145

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jul 1, 2024

BugWPB-9724 [Android] Location sharing on graphene devices sometimes not working

This PR was automatically cherry-picked based on the following PR:

Original PR description:


This PR was automatically cherry-picked based on the following PR:

Original PR description:



PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

Sometimes when we want to share the location on grapehene devices, the app is stuck on loading.

Causes (Optional)

On graphene there is no google services so the app uses the native manager to get the location, by requesting location updates. It works fine when the user is moving, but not when standing in the same place, probably because requestLocationUpdates emits items only when the location changes.

Solutions

On newer Android versions use new way of getting location - getCurrentLocation and on old ones instead of requestLocationUpdates, use requestSingleUpdate because the app needs and uses only a single data anyway, doesn't need to listen for multiple changes.
Also, to make it even faster and more user friendly, first the last known location is checked and if it's not too old (currently if it's not older than 1m) then just use this last location because it looks like the user hasn't moved since then.
If the last location is too old, then just request the current one. There is also a timeout of 10s to get the current location, getCurrentLocation has some timeout anyway, but it's not configurable and it's unclear how big it is, so to make it unified a custom one is created - if the new location doesn't appear within 10s, then user gets the info that the app couldn't get the location.
Added tests for both LocationPickerHelper (to test getting location without google services on both new and old Android versions using robolectric) and LocationPickerHelperFlavor (to test getting location with google services using mockk).

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Open conversation screen and try to share location.


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@github-actions github-actions bot added cherry-pick PR is cherry-picking changes from another banch size/L labels Jul 1, 2024
Copy link
Contributor Author

github-actions bot commented Jul 1, 2024

Built wire-android-staging-release-pr-3145.apk is available for download

Copy link
Contributor Author

github-actions bot commented Jul 1, 2024

Built wire-android-dev-debug-pr-3145.apk is available for download

@saleniuk saleniuk requested review from MohamadJaara, a team, typfel, alexandreferris and mchenani and removed request for a team July 1, 2024 15:43
Copy link
Contributor Author

github-actions bot commented Jul 1, 2024

Built wire-android-staging-compat-pr-3145.apk is available for download

Copy link
Contributor Author

github-actions bot commented Jul 1, 2024

Built wire-android-dev-debug-pr-3145.apk is available for download

Copy link

sonarcloud bot commented Jul 2, 2024

Copy link
Contributor Author

github-actions bot commented Jul 2, 2024

Built wire-android-staging-compat-pr-3145.apk is available for download

Copy link
Contributor Author

github-actions bot commented Jul 2, 2024

Built wire-android-dev-debug-pr-3145.apk is available for download

@saleniuk saleniuk added this pull request to the merge queue Jul 2, 2024
Merged via the queue into develop with commit 29b6de2 Jul 2, 2024
10 checks passed
@saleniuk saleniuk deleted the fix/share-location-without-gms-cherry-pick-cherry-pick branch July 2, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick PR is cherry-picking changes from another banch size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants