File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,9 @@ public final class AsyncLocationManager {
3535 proxyDelegate. cancel ( for: authorizationPerformer. uniqueIdentifier)
3636 } operation: {
3737 await withCheckedContinuation { continuation in
38- if #available( iOS 14 , * ) , locationManager. authorizationStatus != . notDetermined {
39- continuation. resume ( with: . success( locationManager. authorizationStatus) )
38+ let authorizationStatus = checkingPermissions ( )
39+ if authorizationStatus != . notDetermined {
40+ continuation. resume ( with: . success( authorizationStatus) )
4041 } else {
4142 authorizationPerformer. linkContinuation ( continuation)
4243 proxyDelegate. addPerformer ( authorizationPerformer)
@@ -167,3 +168,14 @@ public final class AsyncLocationManager {
167168 }
168169
169170}
171+
172+ extension AsyncLocationManager {
173+ /// Check if user already allowed location permission
174+ private func checkingPermissions( ) -> CLAuthorizationStatus {
175+ if #available( iOS 14 , * ) {
176+ return locationManager. authorizationStatus
177+ } else {
178+ return CLLocationManager . authorizationStatus ( )
179+ }
180+ }
181+ }
You can’t perform that action at this time.
0 commit comments