tauri-apps / plugins-workspace

All of the official Tauri plugins in one place!
https://tauri.app
Apache License 2.0
964 stars 273 forks source link

Tauri Plugin Geolocation Lacks Background Watch (iOS) (Guidance Requested on API and Merge) #1833

Open bradleat opened 1 month ago

bradleat commented 1 month ago

Title says it all here. The existing geo location plugin does not update in the background on iOS (I do not know about Android).

I've made an update to the plugin so that background locations work and I have been using it in my own projects. I'd like to contribute the change back to the group, but I'd like feedback on the API and the implementation before I do.

https://github.com/inKibra/tauri-plugins/blob/main/packages/tauri-plugin-geolocation/index.ts

https://github.com/inKibra/tauri-plugins/blob/main/packages/tauri-plugin-geolocation/ios/Sources/GeolocationPlugin.swift

FabianLars commented 1 month ago

The only big issue with your current implementation i see is that imo it'd be better to be have a background option in both the requestPermission and the watchPosition apis so that having permissions for background updates won't force background updates.

Other than that i think there's nothing blocking a PR (things like argument naming are imo small enough to discuss while seeing the diff)

bradleat commented 1 month ago

That makes sense. I'll work on a PR tomorrow.

FabianLars commented 1 month ago

Thanks! Just a warning upfront, i'll be out of office until friday next week so it may take a while for us to work with you towards merging it.

bradleat commented 1 month ago

I'll work on it next Tuesday then.

bradleat commented 1 month ago

@FabianLars I opened a PR with the changes. Not sure if that's the right process here. But just wanted comments.