Skip to content

Commit 04fe4b9

Browse files
Merge pull request #5 from rn-bridge/release-0.9.0
update libs & pods
2 parents c188d59 + 7128655 commit 04fe4b9

22 files changed

+423
-14
lines changed

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,3 @@ example/.yarn/*
8080

8181
# Turborepo
8282
.turbo/
83-
84-
# generated by bob
85-
lib/

example/ios/Podfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ PODS:
12371237
- ReactCommon/turbomodule/bridging
12381238
- ReactCommon/turbomodule/core
12391239
- Yoga
1240-
- react-native-geofencing (0.6.0):
1240+
- react-native-geofencing (0.9.0):
12411241
- DoubleConversion
12421242
- glog
12431243
- hermes-engine
@@ -1757,7 +1757,7 @@ SPEC CHECKSUMS:
17571757
React-logger: 0a81d1a40650bbdafb255fe4616edb83feed0ee9
17581758
React-Mapbuffer: b758bec0d9994c10a2841dfd5ec70673665fd3e2
17591759
React-microtasksnativemodule: f25dba9c8c3f8be0b3368d52b99abd6e381dee1d
1760-
react-native-geofencing: 8ae5d2d171423a4f6f6d91735440d6b42465debd
1760+
react-native-geofencing: 7b7538824a9e107120f60e85c7ba3933552f920d
17611761
React-nativeconfig: 7af2ccce165f86b233a9f9d63295f6207e62640e
17621762
React-NativeModulesApple: db1c1ee9dda26c9e58d824b4100fed83add82ae9
17631763
React-perflogger: 7c4e97b47d8bc58c03fad1a6b97d96181b59aa41

ios/Geofencing.swift

+18-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class Geofencing: RCTEventEmitter, CLLocationManagerDelegate {
8888
authorizationSuccessCallback = successCallback
8989

9090
if allowAlways && CLLocationManager.authorizationStatus() == .authorizedWhenInUse {
91-
locationManager.requestAlwaysAuthorization()
91+
requestAlwaysAuthorization()
9292
} else {
9393
locationManager.requestWhenInUseAuthorization()
9494
}
@@ -203,7 +203,7 @@ class Geofencing: RCTEventEmitter, CLLocationManagerDelegate {
203203
authorizationSuccessCallback?([["success": true, "location": getLocationAuthorizationStatus()]])
204204
} else if status == .authorizedWhenInUse {
205205
if self.allowAlways {
206-
locationManager.requestAlwaysAuthorization()
206+
requestAlwaysAuthorization()
207207
} else {
208208
authorizationSuccessCallback?([["success": true, "location": getLocationAuthorizationStatus()]])
209209
}
@@ -240,5 +240,21 @@ class Geofencing: RCTEventEmitter, CLLocationManagerDelegate {
240240
return message
241241
}
242242

243+
private func requestAlwaysAuthorization() {
244+
if isBackgroundLocationUpdatesEnabled() {
245+
locationManager.requestAlwaysAuthorization()
246+
} else {
247+
authorizationSuccessCallback?([["success": false, "location": getLocationAuthorizationStatus(), "reason": "Location updates background mode is not enabled"]])
248+
authorizationSuccessCallback = nil
249+
}
250+
}
251+
252+
private func isBackgroundLocationUpdatesEnabled() -> Bool {
253+
if let backgroundModes = Bundle.main.object(forInfoDictionaryKey: "UIBackgroundModes") as? [String] {
254+
return backgroundModes.contains("location")
255+
}
256+
return false
257+
}
258+
243259
}
244260

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Even if this is empty, this is needed for autolinking with your project

lib/commonjs/index.js

+148
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/commonjs/index.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/commonjs/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"type":"commonjs"}

lib/module/index.js

+144
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)