Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add Location implementation to Toga GTK #2999
Add Location implementation to Toga GTK #2999
Changes from 29 commits
7057a1c
0e0ec80
d6c7634
8bcefbb
53ea54d
2fdeda1
33b5267
58a7466
6ab8db2
ac8853b
6548dc5
da2a257
3ffd287
19e75c3
be5ae2d
8d3dd1a
282da75
4547f39
059e2af
4e7517a
e64ac5e
82f1bed
146793c
f85cf57
153d964
6cee226
62d32df
64957c0
da8a17b
e019c5d
c7d34ec
9e3b1d6
1ba7515
47bbd88
951f323
9c1a51b
d6c104b
dea7ac6
280065a
99376e0
0de43b9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
What happens if permission is revoked after being initially allowed? Is that even a possibility? If it is, it looks like the listener handle is removed once an "initialised" state is received.
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.
If you run an example in Flatpak and use Flatseal, you can deny permissions while the app is running and already has location permission... but the XDG Location Portal doesn't send any signal to that fact, and location updates still propagate. If the app restarts, then permission does go away. I haven't found any way to revoke permissions while the app is running and after it's already requested permissions.
In a non-sandboxed environment, the state can end up in
FAILED
if the system service closes, which is handled by the listener attached to the client:https://github.com/sarayourfriend/toga/blob/add/gtk-geoclue-geolocation/gtk/src/toga_gtk/hardware/location.py#L136-L154
A "client" is only available in non-sandboxed environments, as mentioned in the Geoclue documentation for the method linked to in the section I've linked above.
In that case, tracking will cease, and calls to
current_location
andstart_tracking
will fail with aRuntimeError
.This isn't a permissions issue, though. It could be the Geoclue agent crashing, for example, and you can reproduce it by running the app outside a sandbox and running
systemctl stop geoclue
. That is why the code I linked above sets the state toFAILED
rather thanDENIED
, and doesn't reset the permission result.