sparrowcode / PermissionsKit

Universal API for request permission and get its statuses.
https://x.com/sparrowcode_ios
MIT License
5.64k stars 462 forks source link

Precise location support for iOS 14.0+ #269

Closed Strobocop closed 2 years ago

Strobocop commented 2 years ago

Fix for this issue.

Adds support for explicitly requiring precise location in iOS 14.0+.

ivanvorobei commented 2 years ago

Wow, thanks for your work! I think all good, I can confirm it later today and release also today.

ivanvorobei commented 2 years ago

I checked code, I have some propose for clean it.

1) Change names From SPPreciseLocationWhenInUsePermission to SPLocationWhenInUsePrecisePermission example. Also for build flags and other places where it using.

2) Request code is same, so better use inheritance and ovveride state only, example:

class SPLocationWhenInUsePrecisePermission: SPLocationWhenInUsePermission {

    override var status: SPPermissions.PermissionStatus {
        // new logic here
    }
}

If you are ready do it, let me know. If you can't - I can do it in time. Waiting feedback from you.

Strobocop commented 2 years ago

Thanks for the feedback @ivanvorobei.

Ideally I would parameterize the permission enum with an associated value to allow for precision, but that seemed like a larger refactor so I went the path of least resistance. I think your proposed solution minimizes refactor while keeping the code clean. Will update shortly.

ivanvorobei commented 2 years ago

@Strobocop yes, you are right. Thanks and waiting it!

ivanvorobei commented 2 years ago

Thanks, preparing to release 6.8.4 version.