Baseflow / flutter-geolocator

Android and iOS Geolocation plugin for Flutter
https://baseflow.com/
MIT License
1.24k stars 647 forks source link

[Feature Request]: linux: switch to xdg-desktop-portal #1374

Open emersion opened 10 months ago

emersion commented 10 months ago

Is there already an issue requesting this feature?

Please select affected platform(s)

Use case

Right now the Linux plugin uses either the GNOME-specific API, either Geoclue directly. However these interfaces shouldn't be used inside of a sandbox like Flatpak.

Instead, org.freedesktop.portal.Location should be used. It works both outside and inside sandboxes.

Proposal

Use org.freedesktop.portal.Location instead of other APIs.

Specific requirements or considerations

No response

Additional information or context

No response

TimHoogstrate commented 10 months ago

Dear @emersion,

Thanks for filing the feature request. Can you elaborate a bit on the subject? Why shouldn't these interfaces be used inside a sandbox? And what would be the advantages of using the free desktop.portal.Location for the user/developer? Can you point us to some relevant documentation?

Kind regards,

emersion commented 10 months ago

Why shouldn't these interfaces be used inside a sandbox?

The sandbox prevents the app from querying regular D-Bus services. Only a few standard D-Bus interfaces are available. See https://docs.flatpak.org/en/latest/basic-concepts.html.

what would be the advantages of using the free desktop.portal.Location for the user/developer?

For the user, increased control and security: the portal will display an authorization UI that the user will need to accept, just like on Android/iOS. The user can revoke the permission if they want to.

For the developer, being able to correctly work in a sandbox like Flatpak.

TimHoogstrate commented 10 months ago

Dear @emersion,

Thanks for your input. It looks like something interesting to investigate. Unfortunately, currently the team lacks the relevant knowledge to the subject. We are not sure what impact it has on existing linux package. You could help us a lot us a lot if you could propose or file a PR containing the changes in a new package next to the "old" package.

Kind regards,

emersion commented 10 months ago

Got it. I don't know when I'll have time to work on this, but will keep it in my TODO list.

bilelmoussaoui commented 3 months ago

https://pub.dev/packages/xdg_desktop_portal can be used btw