Skip to content

more functional Geolocator.RequestAccessAsync() - #2024

Closed
pkar70 wants to merge 15 commits into
unoplatform:masterfrom
pkar70:geolocatorStatus
Closed

pkar70 wants to merge 15 commits into
unoplatform:masterfrom
pkar70:geolocatorStatus

Conversation

@pkar70

@pkar70 pkar70 commented Nov 5, 2019 •

Copy link
Copy Markdown
Contributor

GitHub Issue (If applicable): #1967

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

RequestAccessAsync() => GeolocationAccessStatus.Allowed;

What is the new behavior?

Above is correct only on API <23.
Now, it RequestAccessAsync() returns real GeolocationAccessStatus.

PR Checklist

  • Tested code with current supported SDKs
  • Docs have been added/updated which fit documentation template (for bug fixes / features)
  • Unit Tests and/or UI Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Wasm UI Tests are not showing unexpected any differences. Validate PR Screenshots Compare Test Run results.
  • Contains NO breaking changes
  • Updated the Release Notes
  • Associated with an issue (GitHub or internal)

Other information

Recreated PR#1998 to have one commit.

This should be only first step in rewriting RequestAccessAsync() - it should behave as on Windows, i.e. it should display system dialog asking for permission. But this is beyond my Android knowledge.

I don't know how to make test for this PR... Not from programmers point of view, but no idea how to test this change.

Internal Issue (If applicable):

@carldebilly carldebilly left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems good.

@gitpod-io

gitpod-io Bot commented Nov 18, 2019 •

Copy link
Copy Markdown

@davidjohnoliver

davidjohnoliver commented Nov 29, 2019 •

Copy link
Copy Markdown
Contributor

Re: testing

  • what happens when you call this method on the Android emulator? You may be able to test this in Uno.UI.RuntimeTests

  • if it turns out you really can`t make an automated test for it, then describing what happens when you tested manually in the PR description is the next best thing. Otherwise what do we have to go on?

@pkar70

pkar70 commented Nov 29, 2019

Copy link
Copy Markdown
Contributor Author

Test - but what can be tested? That function returns anything at all?

@pkar70

pkar70 commented Nov 29, 2019

Copy link
Copy Markdown
Contributor Author

These changes can be treated as step in right direction, but not as satisfactionary.
Dialog asking user for permission is not displayed.
Seems like GetPositionAsync() works only on some devices.

@pkar70

pkar70 commented Dec 14, 2019

Copy link
Copy Markdown
Contributor Author

At last, I got Geolocator working. With full RequestAccessAsync implementation.
To tests, I wrote MyGeolocator, and inside this class, I used Uno.UI.BaseActivity.Current (required for Android system dialog asking for permission).
When I tried to copy this code to uno\src\Uno.UWP\Devices\Geolocation\Geolocator.Android.cs , it failed: Error CS0234 The type or namespace name 'BaseActivity' does not exist in the namespace 'Uno.UI' (are you missing an assembly reference?) .

Second big change is inside GetGeopositionAsync, but I think I should wait for some solution for CS0234 problem mentioned above, to change PR.

@jeromelaban

Copy link
Copy Markdown
Member

Indeed you cannot use BaseActivity in Uno.UWP, you need to use the ContextHelper.Current property.

working outside Uno (in app).
lines 271-309 should be splitted in layers (but I don't know how to do it).
@jeromelaban jeromelaban added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Dec 23, 2019
@pkar70

pkar70 commented Dec 28, 2019

Copy link
Copy Markdown
Contributor Author

Help is needed for splitting RequestAccessAsync into levels... (BaseActivity to ContextHelper.Current etc.). Current version works inside app, not inside Uno.

@carldebilly

This comment has been minimized.

@pkar70

pkar70 commented Jan 25, 2020 •

Copy link
Copy Markdown
Contributor Author

All code that doesn't need help (== not related to dialog asking user for permission) is now in PR #2536, as suggested.

@CLAassistant

CLAassistant commented Jun 10, 2020 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@pkar70
pkar70 requested a review from a team August 7, 2020 22:11
@pkar70

pkar70 commented Sep 3, 2020

Copy link
Copy Markdown
Contributor Author

See #2536 (updated with #3064 (RequestAccessAsync) and with #3891 (Geopoint)).

@pkar70 pkar70 closed this Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants