react-native-bg-geolocation 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BgGeolocation.podspec +39 -0
- package/LICENSE +20 -0
- package/README.md +366 -0
- package/android/build.gradle +69 -0
- package/android/src/main/AndroidManifest.xml +53 -0
- package/android/src/main/java/com/bggeolocation/BgGeolocationActivityRecognitionReceiver.kt +116 -0
- package/android/src/main/java/com/bggeolocation/BgGeolocationBootReceiver.kt +44 -0
- package/android/src/main/java/com/bggeolocation/BgGeolocationForegroundService.kt +373 -0
- package/android/src/main/java/com/bggeolocation/BgGeolocationGeofenceReceiver.kt +55 -0
- package/android/src/main/java/com/bggeolocation/BgGeolocationHeadlessTask.kt +138 -0
- package/android/src/main/java/com/bggeolocation/BgGeolocationModule.kt +1030 -0
- package/android/src/main/java/com/bggeolocation/BgGeolocationMotionStateMachine.kt +159 -0
- package/android/src/main/java/com/bggeolocation/BgGeolocationPackage.kt +31 -0
- package/android/src/main/res/drawable/bg_geo_notification.xml +9 -0
- package/ios/BgGeolocation.h +14 -0
- package/ios/BgGeolocation.mm +709 -0
- package/ios/engine/AtomicBoolean.swift +48 -0
- package/ios/engine/BGActivityChangeEvent.swift +20 -0
- package/ios/engine/BGActivityConfig.swift +71 -0
- package/ios/engine/BGAppConfig.swift +92 -0
- package/ios/engine/BGAppState.swift +147 -0
- package/ios/engine/BGAuthorization.swift +85 -0
- package/ios/engine/BGAuthorizationAlertPresenter.swift +39 -0
- package/ios/engine/BGAuthorizationConfig.swift +50 -0
- package/ios/engine/BGAuthorizationEvent.swift +40 -0
- package/ios/engine/BGBackgroundTaskManager.swift +143 -0
- package/ios/engine/BGCLRouter.swift +101 -0
- package/ios/engine/BGCallback.swift +19 -0
- package/ios/engine/BGConfig.swift +440 -0
- package/ios/engine/BGConfigModuleBase.swift +180 -0
- package/ios/engine/BGConfigOLD.swift +582 -0
- package/ios/engine/BGConnectivityChangeEvent.swift +15 -0
- package/ios/engine/BGCrashDetector.swift +122 -0
- package/ios/engine/BGCurrentPositionRequest.swift +87 -0
- package/ios/engine/BGDataStore.swift +75 -0
- package/ios/engine/BGDatabase.swift +677 -0
- package/ios/engine/BGDatabasePool.swift +220 -0
- package/ios/engine/BGDatabaseQueue.swift +215 -0
- package/ios/engine/BGDateUtils.swift +26 -0
- package/ios/engine/BGDeviceInfo.swift +54 -0
- package/ios/engine/BGDeviceManager.swift +65 -0
- package/ios/engine/BGEnabledChangeEvent.swift +11 -0
- package/ios/engine/BGEnv.swift +17 -0
- package/ios/engine/BGEventBus.swift +83 -0
- package/ios/engine/BGEventManager.swift +169 -0
- package/ios/engine/BGEventNames.swift +51 -0
- package/ios/engine/BGGeofence.swift +233 -0
- package/ios/engine/BGGeofenceDAO.swift +152 -0
- package/ios/engine/BGGeofenceEvent.swift +42 -0
- package/ios/engine/BGGeofenceLocationRequest.swift +94 -0
- package/ios/engine/BGGeofenceManager.swift +315 -0
- package/ios/engine/BGGeofenceTransition.swift +97 -0
- package/ios/engine/BGGeofencesChangeEvent.swift +26 -0
- package/ios/engine/BGGeolocationConfig.swift +136 -0
- package/ios/engine/BGHeartbeatEvent.swift +31 -0
- package/ios/engine/BGHeartbeatService.swift +51 -0
- package/ios/engine/BGHttpConfig.swift +105 -0
- package/ios/engine/BGHttpErrorCodes.swift +63 -0
- package/ios/engine/BGHttpEvent.swift +34 -0
- package/ios/engine/BGHttpRequest.swift +126 -0
- package/ios/engine/BGHttpResponse.swift +93 -0
- package/ios/engine/BGHttpService.swift +428 -0
- package/ios/engine/BGKalmanFilter.swift +105 -0
- package/ios/engine/BGLMActionNames.swift +55 -0
- package/ios/engine/BGLicenseManager.swift +26 -0
- package/ios/engine/BGLiveActivityManager.swift +327 -0
- package/ios/engine/BGLocation.swift +311 -0
- package/ios/engine/BGLocationAuthorization.swift +427 -0
- package/ios/engine/BGLocationDAO.swift +252 -0
- package/ios/engine/BGLocationErrors.swift +28 -0
- package/ios/engine/BGLocationEvent.swift +43 -0
- package/ios/engine/BGLocationFilter.swift +82 -0
- package/ios/engine/BGLocationFilterConfig.swift +57 -0
- package/ios/engine/BGLocationHelper.swift +54 -0
- package/ios/engine/BGLocationManager.swift +662 -0
- package/ios/engine/BGLocationMetricsEngine.swift +116 -0
- package/ios/engine/BGLocationRequestService.swift +459 -0
- package/ios/engine/BGLocationSatisfier.swift +14 -0
- package/ios/engine/BGLocationStreamEvent.swift +27 -0
- package/ios/engine/BGLog.swift +337 -0
- package/ios/engine/BGLogLevel.swift +26 -0
- package/ios/engine/BGLoggerConfig.swift +60 -0
- package/ios/engine/BGMotionActivity.swift +31 -0
- package/ios/engine/BGMotionActivityClassifier.swift +108 -0
- package/ios/engine/BGMotionActivityManagerAdapter.swift +40 -0
- package/ios/engine/BGMotionActivitySource.swift +46 -0
- package/ios/engine/BGMotionDetector.swift +377 -0
- package/ios/engine/BGMotionPermissionManager.swift +50 -0
- package/ios/engine/BGNativeLogger.swift +48 -0
- package/ios/engine/BGNotificaitons.swift +37 -0
- package/ios/engine/BGOdometer.swift +66 -0
- package/ios/engine/BGPersistenceConfig.swift +29 -0
- package/ios/engine/BGPolygonStreamRequest.swift +48 -0
- package/ios/engine/BGPowerSaveChangeEvent.swift +12 -0
- package/ios/engine/BGPropertySpec.swift +29 -0
- package/ios/engine/BGProviderChangeEvent.swift +31 -0
- package/ios/engine/BGQueue.swift +50 -0
- package/ios/engine/BGRPC.swift +194 -0
- package/ios/engine/BGReachability.swift +58 -0
- package/ios/engine/BGResultSet.swift +157 -0
- package/ios/engine/BGSchedule.swift +228 -0
- package/ios/engine/BGScheduleEvent.swift +13 -0
- package/ios/engine/BGScheduler.swift +116 -0
- package/ios/engine/BGSingleLocationRequest.swift +49 -0
- package/ios/engine/BGStreamLocationRequest.swift +42 -0
- package/ios/engine/BGTemplate.swift +54 -0
- package/ios/engine/BGTimerService.swift +46 -0
- package/ios/engine/BGTrackingAudioManager.swift +286 -0
- package/ios/engine/BGTrackingService.swift +879 -0
- package/ios/engine/BGWatchPositionRequest.swift +63 -0
- package/ios/engine/DatabaseQueue.swift +47 -0
- package/ios/engine/LogQuery.swift +10 -0
- package/ios/engine/SQLQuery.swift +65 -0
- package/ios/engine/TransistorAuthorizationToken.swift +182 -0
- package/ios/liveactivity/BGLiveTrackingAttributes.swift +52 -0
- package/ios/locationpush/BGLocationPushDeliverer.swift +260 -0
- package/ios/locationpush/BGLocationPushService.swift +161 -0
- package/ios/locationpush/BGLocationPushShared.swift +98 -0
- package/ios/locationpush/BGLocationPushSocketClient.swift +198 -0
- package/lib/module/NativeBgGeolocation.js +5 -0
- package/lib/module/NativeBgGeolocation.js.map +1 -0
- package/lib/module/events.js +20 -0
- package/lib/module/events.js.map +1 -0
- package/lib/module/index.js +706 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeBgGeolocation.d.ts +57 -0
- package/lib/typescript/src/NativeBgGeolocation.d.ts.map +1 -0
- package/lib/typescript/src/events.d.ts +18 -0
- package/lib/typescript/src/events.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +238 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +229 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +141 -0
- package/src/NativeBgGeolocation.ts +236 -0
- package/src/events.ts +17 -0
- package/src/index.tsx +935 -0
- package/src/types.ts +254 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
@objc public class BGPropertySpecImpl: NSObject {
|
|
4
|
+
@objc public let name: String
|
|
5
|
+
@objc public let type: String
|
|
6
|
+
@objc public init(name: String, type: String) {
|
|
7
|
+
self.name = name
|
|
8
|
+
self.type = type
|
|
9
|
+
super.init()
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public func BGPropertySpec(name: String, type: String) -> BGPropertySpecImpl {
|
|
14
|
+
return BGPropertySpecImpl(name: name, type: type)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@objc public class BGConfigModuleBase: NSObject {
|
|
18
|
+
|
|
19
|
+
@objc public var trackExplicitKeys: Bool = false
|
|
20
|
+
private var explicitKeys: Set<String> = []
|
|
21
|
+
private var changeObservers: [String: [AnyObject]] = [:]
|
|
22
|
+
|
|
23
|
+
@objc public override class func automaticallyNotifiesObservers(forKey key: String) -> Bool {
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@objc public override init() {
|
|
28
|
+
super.init()
|
|
29
|
+
applyDefaults()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@objc public func applyDefaults() {}
|
|
33
|
+
|
|
34
|
+
@objc public func propertySpecs() -> [BGPropertySpecImpl] { return [] }
|
|
35
|
+
|
|
36
|
+
@objc public func allPropertyNames() -> [String] {
|
|
37
|
+
return propertySpecs().map { $0.name }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@objc public func hasProperty(_ name: String) -> Bool {
|
|
41
|
+
return allPropertyNames().contains(name)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@objc public func canHandleProperty(_ name: String) -> Bool {
|
|
45
|
+
return hasProperty(name)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@objc public func sensitivePropertyNames() -> [String] {
|
|
49
|
+
return []
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@objc public func deprecatedPropertyMappings() -> [String: String] {
|
|
53
|
+
return [:]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@objc public func currentPropertyName(forDeprecated deprecated: String) -> String? {
|
|
57
|
+
return deprecatedPropertyMappings()[deprecated]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@objc public func markExplicitKey(_ key: String) {
|
|
61
|
+
explicitKeys.insert(key)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@objc public func clearExplicitKeys() {
|
|
65
|
+
explicitKeys.removeAll()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@objc public func wasExplicitlySet(_ key: String) -> Bool {
|
|
69
|
+
return explicitKeys.contains(key)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@objc public func userConfigured() -> [String: Any] {
|
|
73
|
+
var result: [String: Any] = [:]
|
|
74
|
+
for key in explicitKeys {
|
|
75
|
+
if let val = value(forKey: key) {
|
|
76
|
+
result[key] = val
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return result
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@objc public func updateWithDictionary(_ dict: [String: Any]) {
|
|
83
|
+
for (key, value) in dict {
|
|
84
|
+
let targetKey = currentPropertyName(forDeprecated: key) ?? key
|
|
85
|
+
if canHandleProperty(targetKey) {
|
|
86
|
+
setValue(value, forProperty: targetKey)
|
|
87
|
+
if trackExplicitKeys { markExplicitKey(targetKey) }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@objc public func setValue(_ value: Any?, forProperty key: String) {
|
|
93
|
+
let coerced = defaultCoerce(value, forKey: key)
|
|
94
|
+
let old = self.value(forKey: key)
|
|
95
|
+
willChangeValue(forKey: key)
|
|
96
|
+
primitiveWriteValue(coerced, forKey: key)
|
|
97
|
+
didChangeValue(forKey: key)
|
|
98
|
+
propertyDidChange(key, oldValue: old, newValue: coerced)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@objc public override func setValue(_ value: Any?, forKey key: String) {
|
|
102
|
+
if canHandleProperty(key) {
|
|
103
|
+
setValue(value, forProperty: key)
|
|
104
|
+
} else {
|
|
105
|
+
super.setValue(value, forKey: key)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@objc public override func setValue(_ value: Any?, forUndefinedKey key: String) {
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@objc public func primitiveWriteValue(_ value: Any?, forKey key: String) {
|
|
113
|
+
super.setValue(value, forKey: key)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@objc public func defaultCoerce(_ value: Any?, forKey key: String) -> Any? {
|
|
117
|
+
return value
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@objc public func valueForProperty(_ key: String) -> Any? {
|
|
121
|
+
return value(forKey: key)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@objc public func validateValue(_ value: Any?, forKey key: String) -> Bool {
|
|
125
|
+
return true
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@objc public func isValue(_ a: Any?, equalTo b: Any?) -> Bool {
|
|
129
|
+
if let a = a as? NSObject, let b = b as? NSObject {
|
|
130
|
+
return a.isEqual(b)
|
|
131
|
+
}
|
|
132
|
+
return a == nil && b == nil
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@objc public func applyAndDiff(_ dict: [String: Any]) -> [String] {
|
|
136
|
+
var changed: [String] = []
|
|
137
|
+
for (key, newValue) in dict {
|
|
138
|
+
let targetKey = currentPropertyName(forDeprecated: key) ?? key
|
|
139
|
+
guard canHandleProperty(targetKey) else { continue }
|
|
140
|
+
let old = value(forKey: targetKey)
|
|
141
|
+
setValue(newValue, forProperty: targetKey)
|
|
142
|
+
if !isValue(old, equalTo: newValue) {
|
|
143
|
+
changed.append(targetKey)
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return changed
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@objc public func resetPropertyToDefault(_ key: String) {
|
|
150
|
+
applyDefaults()
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@objc public func propertyDidChange(_ key: String, oldValue: Any?, newValue: Any?) {}
|
|
154
|
+
|
|
155
|
+
@objc public func contributeDeprecatedProperties(_ dict: NSMutableDictionary, redact: Bool) {}
|
|
156
|
+
|
|
157
|
+
@objc public func redactedValue(forProperty name: String, originalValue: Any?) -> Any? {
|
|
158
|
+
if sensitivePropertyNames().contains(name) { return "**redacted**" }
|
|
159
|
+
return originalValue
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@objc public func toDictionary() -> [String: Any] {
|
|
163
|
+
return toDictionary(false)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@objc public func toDictionary(_ redact: Bool) -> [String: Any] {
|
|
167
|
+
var dict: [String: Any] = [:]
|
|
168
|
+
for spec in propertySpecs() {
|
|
169
|
+
let val = value(forKey: spec.name)
|
|
170
|
+
dict[spec.name] = redact ? redactedValue(forProperty: spec.name, originalValue: val) : val
|
|
171
|
+
}
|
|
172
|
+
return dict
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@objc public func validateConfiguration() -> Bool { return true }
|
|
176
|
+
|
|
177
|
+
@objc public override var description: String {
|
|
178
|
+
return "<\(type(of: self)) \(toDictionary())>"
|
|
179
|
+
}
|
|
180
|
+
}
|