expo-location 58.0.11 → 58.0.13
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/CHANGELOG.md +19 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/location/next/LocationModuleNext.kt +2 -2
- package/android/src/main/java/expo/modules/location/next/LocationPermissions.kt +1 -1
- package/android/src/main/java/expo/modules/location/next/LocationRecords.kt +1 -1
- package/android/src/main/java/expo/modules/location/next/WatchPosition.kt +11 -2
- package/build/Location.types.d.ts +4 -1
- package/build/Location.types.js.map +1 -1
- package/build/next/Location.d.ts +1 -0
- package/build/next/Location.js +3 -0
- package/build/next/Location.js.map +1 -0
- package/build/next/index.d.ts +3 -0
- package/build/next/index.js +5 -0
- package/build/next/index.js.map +1 -0
- package/build/next/js/LocationProvider.d.ts +9 -0
- package/build/next/js/LocationProvider.js +20 -0
- package/build/next/js/LocationProvider.js.map +1 -0
- package/build/next/js/LocationUpdatesHandle.d.ts +15 -0
- package/build/next/js/LocationUpdatesHandle.js +39 -0
- package/build/next/js/LocationUpdatesHandle.js.map +1 -0
- package/build/next/js/Permissions.d.ts +7 -0
- package/build/next/js/Permissions.js +24 -0
- package/build/next/js/Permissions.js.map +1 -0
- package/build/next/js/PositionWatchHandle.d.ts +16 -0
- package/build/next/js/PositionWatchHandle.js +50 -0
- package/build/next/js/PositionWatchHandle.js.map +1 -0
- package/build/next/js/getPosition.d.ts +2 -0
- package/build/next/js/getPosition.js +6 -0
- package/build/next/js/getPosition.js.map +1 -0
- package/build/next/js/index.d.ts +6 -0
- package/build/next/js/index.js +8 -0
- package/build/next/js/index.js.map +1 -0
- package/build/next/js/locationServices.d.ts +3 -0
- package/build/next/js/locationServices.js +35 -0
- package/build/next/js/locationServices.js.map +1 -0
- package/build/next/native/NativeLocationModuleNext.d.ts +5 -0
- package/build/next/native/NativeLocationModuleNext.js +7 -0
- package/build/next/native/NativeLocationModuleNext.js.map +1 -0
- package/build/next/native/index.d.ts +5 -0
- package/build/next/native/index.js +3 -0
- package/build/next/native/index.js.map +1 -0
- package/build/next/native/types/NativeLocationModuleNextClass.types.d.ts +21 -0
- package/build/next/native/types/NativeLocationModuleNextClass.types.js +3 -0
- package/build/next/native/types/NativeLocationModuleNextClass.types.js.map +1 -0
- package/build/next/native/types/NativeLocationProviderClass.types.d.ts +8 -0
- package/build/next/native/types/NativeLocationProviderClass.types.js +3 -0
- package/build/next/native/types/NativeLocationProviderClass.types.js.map +1 -0
- package/build/next/native/types/NativeLocationUpdatesHandleClass.types.d.ts +8 -0
- package/build/next/native/types/NativeLocationUpdatesHandleClass.types.js +3 -0
- package/build/next/native/types/NativeLocationUpdatesHandleClass.types.js.map +1 -0
- package/build/next/native/types/NativePositionWatchHandleClass.types.d.ts +12 -0
- package/build/next/native/types/NativePositionWatchHandleClass.types.js +3 -0
- package/build/next/native/types/NativePositionWatchHandleClass.types.js.map +1 -0
- package/build/next/types/LocationProvider.types.d.ts +1 -0
- package/build/next/types/LocationProvider.types.js +3 -0
- package/build/next/types/LocationProvider.types.js.map +1 -0
- package/build/next/types/Permissions.types.d.ts +22 -0
- package/build/next/types/Permissions.types.js +19 -0
- package/build/next/types/Permissions.types.js.map +1 -0
- package/build/next/types/Position.types.d.ts +55 -0
- package/build/next/types/Position.types.js +11 -0
- package/build/next/types/Position.types.js.map +1 -0
- package/build/next/types/index.d.ts +3 -0
- package/build/next/types/index.js +5 -0
- package/build/next/types/index.js.map +1 -0
- package/expo-module.config.json +1 -1
- package/ios/EXLocation.m +1 -0
- package/ios/ExpoLocation.podspec +9 -0
- package/ios/LocationUtils.swift +3 -1
- package/ios/next/LocationModuleNext.swift +110 -0
- package/ios/next/LocationNextExceptions.swift +118 -0
- package/ios/next/LocationUpdatesHandle/LocationUpdatesHandle.swift +52 -0
- package/ios/next/LocationUpdatesHandle/LocationUpdatesTaskConsumer.swift +40 -0
- package/ios/next/LocationUpdatesHandle/LocationUpdatesTaskOptions.swift +19 -0
- package/ios/next/LocationUpdatesHandle/SignificantLocationChangeMonitor.swift +20 -0
- package/ios/next/Permissions/BackgroundPermissionsRequester.swift +34 -0
- package/ios/next/Permissions/CLLocationManager+MainThread.swift +10 -0
- package/ios/next/Permissions/ForegroundPermissionsRequester.swift +38 -0
- package/ios/next/Permissions/LocationAccessGuard.swift +21 -0
- package/ios/next/Permissions/LocationAccuracyAuthorization.swift +9 -0
- package/ios/next/Permissions/LocationAccuracyOption.swift +6 -0
- package/ios/next/Permissions/LocationAuthorizationScope.swift +16 -0
- package/ios/next/Permissions/LocationManagerAlwaysAuthorizationRequest.swift +109 -0
- package/ios/next/Permissions/LocationPermissionKind.swift +26 -0
- package/ios/next/Permissions/LocationPermissionResponse.swift +51 -0
- package/ios/next/Permissions/LocationPermissionsDelegate.swift +85 -0
- package/ios/next/Permissions/LocationPermissionsRequester.swift +96 -0
- package/ios/next/Permissions/LocationPlistKeys.swift +10 -0
- package/ios/next/Permissions/PermissionsRequestOptions.swift +5 -0
- package/ios/next/Permissions/TemporaryFullAccuracyPlistKeys.swift +13 -0
- package/ios/next/Permissions/TemporaryFullAccuracyRequester.swift +28 -0
- package/ios/next/Position/Coordinates.swift +7 -0
- package/ios/next/Position/GetPositionOptions.swift +7 -0
- package/ios/next/Position/LocationUpdateDiagnostics.swift +41 -0
- package/ios/next/Position/Position.swift +43 -0
- package/ios/next/Position/PositionRequester.swift +55 -0
- package/ios/next/Position/PositionUpdatesCompatibilitySource.swift +43 -0
- package/ios/next/Position/PositionUpdatesLiveSource.swift +46 -0
- package/ios/next/Position/PositionUpdatesSource.swift +40 -0
- package/ios/next/Position/PositionUpdatesSubscription.swift +85 -0
- package/ios/next/PositionWatcher/PositionWatchStatus.swift +9 -0
- package/ios/next/PositionWatcher/PositionWatcher.swift +143 -0
- package/ios/next/Profile.swift +60 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/{58.0.11/expo.modules.location-58.0.11-sources.jar → 58.0.13/expo.modules.location-58.0.13-sources.jar} +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13-sources.jar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13-sources.jar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13-sources.jar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13-sources.jar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/{58.0.11/expo.modules.location-58.0.11.module → 58.0.13/expo.modules.location-58.0.13.module} +22 -22
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/{58.0.11/expo.modules.location-58.0.11.pom → 58.0.13/expo.modules.location-58.0.13.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.13/expo.modules.location-58.0.13.pom.sha512 +1 -0
- package/package.json +33 -4
- package/plugin/build/withLocation.d.ts +18 -0
- package/plugin/build/withLocation.js +28 -1
- package/plugin/build/withLocation.js.map +1 -1
- package/plugin/src/withLocation.ts +52 -0
- package/src/Location.types.ts +4 -1
- package/src/next/Location.ts +12 -0
- package/src/next/index.ts +28 -0
- package/src/next/js/LocationProvider.ts +28 -0
- package/src/next/js/LocationUpdatesHandle.ts +60 -0
- package/src/next/js/Permissions.ts +34 -0
- package/src/next/js/PositionWatchHandle.ts +75 -0
- package/src/next/js/getPosition.ts +6 -0
- package/src/next/js/index.ts +21 -0
- package/src/next/js/locationServices.ts +38 -0
- package/src/next/native/NativeLocationModuleNext.ts +9 -0
- package/src/next/native/index.ts +10 -0
- package/src/next/native/types/NativeLocationModuleNextClass.types.ts +34 -0
- package/src/next/native/types/NativeLocationProviderClass.types.ts +12 -0
- package/src/next/native/types/NativeLocationUpdatesHandleClass.types.ts +9 -0
- package/src/next/native/types/NativePositionWatchHandleClass.types.ts +14 -0
- package/src/next/types/LocationProvider.types.ts +1 -0
- package/src/next/types/Permissions.types.ts +27 -0
- package/src/next/types/Position.types.ts +58 -0
- package/src/next/types/index.ts +3 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11-sources.jar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11-sources.jar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11-sources.jar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11-sources.jar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.11/expo.modules.location-58.0.11.pom.sha512 +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import CoreLocation
|
|
2
|
+
|
|
3
|
+
@available(iOS 17.0, *)
|
|
4
|
+
final class PositionUpdatesLiveSource {
|
|
5
|
+
func updates(for profile: Profile, allowsBackgroundUpdates: Bool = false) -> PositionUpdatesSource {
|
|
6
|
+
let (stream, continuation) = AsyncThrowingStream.makeStream(of: CLLocation?.self)
|
|
7
|
+
let backgroundSession = allowsBackgroundUpdates ? CLBackgroundActivitySession() : nil
|
|
8
|
+
let invalidateServiceSession = allowsBackgroundUpdates ? Self.holdAlwaysServiceSession() : {}
|
|
9
|
+
let providerTask = Task {
|
|
10
|
+
do {
|
|
11
|
+
for try await update in CLLocationUpdate.liveUpdates(profile.clLocationUpdateProfile()) {
|
|
12
|
+
guard !Task.isCancelled else {
|
|
13
|
+
break
|
|
14
|
+
}
|
|
15
|
+
if #available(iOS 18.0, *), let failure = LocationUpdateDiagnostics(update).unrecoverableFailure() {
|
|
16
|
+
continuation.finish(throwing: failure)
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
continuation.yield(update.location)
|
|
20
|
+
}
|
|
21
|
+
if Task.isCancelled {
|
|
22
|
+
continuation.finish()
|
|
23
|
+
} else {
|
|
24
|
+
continuation.finish(throwing: LocationUpdatesEndedUnexpectedly())
|
|
25
|
+
}
|
|
26
|
+
} catch {
|
|
27
|
+
continuation.finish(throwing: error)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return PositionUpdatesSource(stream: stream, continuation: continuation) {
|
|
31
|
+
providerTask.cancel()
|
|
32
|
+
backgroundSession?.invalidate()
|
|
33
|
+
invalidateServiceSession()
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private static func holdAlwaysServiceSession() -> () -> Void {
|
|
38
|
+
guard #available(iOS 18.0, *) else {
|
|
39
|
+
return {}
|
|
40
|
+
}
|
|
41
|
+
let session = CLServiceSession(authorization: .always)
|
|
42
|
+
return {
|
|
43
|
+
session.invalidate()
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import CoreLocation
|
|
2
|
+
import Foundation
|
|
3
|
+
|
|
4
|
+
final class PositionUpdatesSource {
|
|
5
|
+
let stream: AsyncThrowingStream<CLLocation?, Error>
|
|
6
|
+
private let continuation: AsyncThrowingStream<CLLocation?, Error>.Continuation
|
|
7
|
+
|
|
8
|
+
init(
|
|
9
|
+
stream: AsyncThrowingStream<CLLocation?, Error>,
|
|
10
|
+
continuation: AsyncThrowingStream<CLLocation?, Error>.Continuation,
|
|
11
|
+
stop: @escaping () -> Void
|
|
12
|
+
) {
|
|
13
|
+
self.stream = stream
|
|
14
|
+
self.continuation = continuation
|
|
15
|
+
continuation.onTermination = { _ in
|
|
16
|
+
stop()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
func stop() {
|
|
21
|
+
continuation.finish()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
extension PositionUpdatesSource {
|
|
26
|
+
static func foreground(for profile: Profile) -> PositionUpdatesSource {
|
|
27
|
+
return updates(for: profile, allowsBackgroundUpdates: false)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static func background(for profile: Profile) -> PositionUpdatesSource {
|
|
31
|
+
return updates(for: profile, allowsBackgroundUpdates: true)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private static func updates(for profile: Profile, allowsBackgroundUpdates: Bool) -> PositionUpdatesSource {
|
|
35
|
+
if profile != .lowPower, #available(iOS 17.0, *) {
|
|
36
|
+
return PositionUpdatesLiveSource().updates(for: profile, allowsBackgroundUpdates: allowsBackgroundUpdates)
|
|
37
|
+
}
|
|
38
|
+
return PositionUpdatesCompatibilitySource().updates(for: profile, allowsBackgroundUpdates: allowsBackgroundUpdates)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import CoreLocation
|
|
2
|
+
import Foundation
|
|
3
|
+
|
|
4
|
+
final class PositionUpdatesSubscription {
|
|
5
|
+
private let source: PositionUpdatesSource
|
|
6
|
+
private let interval: TimeInterval
|
|
7
|
+
private let onLocation: (CLLocation) -> Void
|
|
8
|
+
private let onError: (Error) -> Void
|
|
9
|
+
private let lock = NSRecursiveLock()
|
|
10
|
+
private var lastEmittedAt: Date?
|
|
11
|
+
private var active = true
|
|
12
|
+
|
|
13
|
+
init(
|
|
14
|
+
source: PositionUpdatesSource,
|
|
15
|
+
interval: TimeInterval = 0,
|
|
16
|
+
onLocation: @escaping (CLLocation) -> Void,
|
|
17
|
+
onError: @escaping (Error) -> Void
|
|
18
|
+
) {
|
|
19
|
+
self.source = source
|
|
20
|
+
self.interval = interval
|
|
21
|
+
self.onLocation = onLocation
|
|
22
|
+
self.onError = onError
|
|
23
|
+
Task { @MainActor [weak self] in
|
|
24
|
+
do {
|
|
25
|
+
for try await location in source.stream {
|
|
26
|
+
guard let self, self.deliver(location) else {
|
|
27
|
+
break
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
} catch {
|
|
31
|
+
self?.fail(error)
|
|
32
|
+
}
|
|
33
|
+
self?.finish()
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var isActive: Bool {
|
|
38
|
+
lock.withLock {
|
|
39
|
+
active
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
func stop() {
|
|
44
|
+
lock.withLock {
|
|
45
|
+
active = false
|
|
46
|
+
}
|
|
47
|
+
source.stop()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private func deliver(_ location: CLLocation?) -> Bool {
|
|
51
|
+
lock.withLock {
|
|
52
|
+
guard active else {
|
|
53
|
+
return false
|
|
54
|
+
}
|
|
55
|
+
guard let location else {
|
|
56
|
+
return true
|
|
57
|
+
}
|
|
58
|
+
if let lastEmittedAt, location.timestamp.timeIntervalSince(lastEmittedAt) < interval {
|
|
59
|
+
return true
|
|
60
|
+
}
|
|
61
|
+
lastEmittedAt = location.timestamp
|
|
62
|
+
onLocation(location)
|
|
63
|
+
return true
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private func fail(_ error: Error) {
|
|
68
|
+
lock.withLock {
|
|
69
|
+
guard active else {
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
onError(error)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private func finish() {
|
|
77
|
+
lock.withLock {
|
|
78
|
+
active = false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
deinit {
|
|
83
|
+
stop()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import CoreLocation
|
|
2
|
+
import ExpoModulesCore
|
|
3
|
+
|
|
4
|
+
final class PositionWatcher: SharedObject {
|
|
5
|
+
static let positionChangedEvent = "positionChanged"
|
|
6
|
+
static var isAppInForeground = true
|
|
7
|
+
|
|
8
|
+
var makeSource: (_ profile: Profile) -> PositionUpdatesSource = PositionUpdatesSource.foreground
|
|
9
|
+
|
|
10
|
+
lazy var send: (_ payload: [String: Any]) -> Void = { [weak self] payload in
|
|
11
|
+
self?.emit(event: Self.positionChangedEvent, payload: payload)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
private var activeProfile: Profile
|
|
15
|
+
private var stagedProfile: Profile
|
|
16
|
+
private var activeInterval: TimeInterval = 0
|
|
17
|
+
private var stagedInterval: TimeInterval = 0
|
|
18
|
+
private let lock = NSRecursiveLock()
|
|
19
|
+
private var subscription: PositionUpdatesSubscription?
|
|
20
|
+
private var isStarted = false
|
|
21
|
+
private var isPaused = false
|
|
22
|
+
private var isReleased = false
|
|
23
|
+
|
|
24
|
+
init(profile: Profile) {
|
|
25
|
+
self.activeProfile = profile
|
|
26
|
+
self.stagedProfile = profile
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var isSubscribed: Bool {
|
|
30
|
+
lock.withLock {
|
|
31
|
+
subscription?.isActive == true
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
func start() {
|
|
36
|
+
lock.withLock {
|
|
37
|
+
isStarted = true
|
|
38
|
+
reconcile()
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
func pause() {
|
|
43
|
+
lock.withLock {
|
|
44
|
+
isPaused = true
|
|
45
|
+
reconcile()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
func resume() -> Bool {
|
|
50
|
+
lock.withLock {
|
|
51
|
+
isPaused = false
|
|
52
|
+
reconcile()
|
|
53
|
+
return isSubscribed
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
func withProfile(_ profile: Profile) {
|
|
58
|
+
lock.withLock {
|
|
59
|
+
stagedProfile = profile
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
func withInterval(_ seconds: TimeInterval) throws {
|
|
64
|
+
guard seconds >= 0, seconds.isFinite else {
|
|
65
|
+
throw InvalidWatchIntervalException()
|
|
66
|
+
}
|
|
67
|
+
lock.withLock {
|
|
68
|
+
stagedInterval = seconds
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
func restart() -> Bool {
|
|
73
|
+
lock.withLock {
|
|
74
|
+
if stagedProfile != activeProfile || stagedInterval != activeInterval {
|
|
75
|
+
activeProfile = stagedProfile
|
|
76
|
+
activeInterval = stagedInterval
|
|
77
|
+
stopStreaming()
|
|
78
|
+
}
|
|
79
|
+
reconcile()
|
|
80
|
+
return isSubscribed
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
func status() -> PositionWatchStatus {
|
|
85
|
+
lock.withLock {
|
|
86
|
+
let status = PositionWatchStatus()
|
|
87
|
+
status.isSubscribed = isSubscribed
|
|
88
|
+
status.isHandleAlive = !isReleased
|
|
89
|
+
status.isStarted = isStarted
|
|
90
|
+
status.isPaused = isPaused
|
|
91
|
+
status.isInForeground = Self.isAppInForeground
|
|
92
|
+
return status
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
override func sharedObjectWillRelease() {
|
|
97
|
+
lock.withLock {
|
|
98
|
+
isReleased = true
|
|
99
|
+
reconcile()
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static func positionPayload(_ location: CLLocation) -> [String: Any] {
|
|
104
|
+
return ["data": location.toPosition().toEventPayload()]
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static func errorPayload(_ error: Error) -> [String: Any] {
|
|
108
|
+
let exception = (error as? Exception) ?? UnexpectedException(error)
|
|
109
|
+
return ["error": ["code": exception.code, "message": exception.reason]]
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private func reconcile() {
|
|
113
|
+
let shouldStream = isStarted && !isPaused && !isReleased
|
|
114
|
+
if shouldStream && !isSubscribed {
|
|
115
|
+
startStreaming()
|
|
116
|
+
}
|
|
117
|
+
if !shouldStream {
|
|
118
|
+
stopStreaming()
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private func startStreaming() {
|
|
123
|
+
subscription = PositionUpdatesSubscription(
|
|
124
|
+
source: makeSource(activeProfile),
|
|
125
|
+
interval: activeInterval,
|
|
126
|
+
onLocation: { [weak self] location in
|
|
127
|
+
self?.send(Self.positionPayload(location))
|
|
128
|
+
},
|
|
129
|
+
onError: { [weak self] error in
|
|
130
|
+
self?.send(Self.errorPayload(error))
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
private func stopStreaming() {
|
|
136
|
+
subscription?.stop()
|
|
137
|
+
subscription = nil
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
deinit {
|
|
141
|
+
stopStreaming()
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import ExpoModulesCore
|
|
2
|
+
import CoreLocation
|
|
3
|
+
|
|
4
|
+
enum Profile: String, Enumerable {
|
|
5
|
+
case `default`
|
|
6
|
+
case automotiveNavigation
|
|
7
|
+
case otherNavigation
|
|
8
|
+
case fitness
|
|
9
|
+
case airborne
|
|
10
|
+
case lowPower
|
|
11
|
+
|
|
12
|
+
@available(iOS 17.0, *)
|
|
13
|
+
func clLocationUpdateProfile() -> CLLocationUpdate.LiveConfiguration {
|
|
14
|
+
switch self {
|
|
15
|
+
case .`default`, .lowPower:
|
|
16
|
+
return .default
|
|
17
|
+
case .automotiveNavigation:
|
|
18
|
+
return .automotiveNavigation
|
|
19
|
+
case .otherNavigation:
|
|
20
|
+
return .otherNavigation
|
|
21
|
+
case .fitness:
|
|
22
|
+
return .fitness
|
|
23
|
+
case .airborne:
|
|
24
|
+
return .airborne
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
func clDistanceFilter() -> CLLocationDistance {
|
|
29
|
+
switch self {
|
|
30
|
+
case .lowPower:
|
|
31
|
+
return 3000
|
|
32
|
+
case .`default`, .automotiveNavigation, .otherNavigation, .fitness, .airborne:
|
|
33
|
+
return kCLDistanceFilterNone
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
func clDesiredAccuracy() -> CLLocationAccuracy {
|
|
38
|
+
switch self {
|
|
39
|
+
case .lowPower:
|
|
40
|
+
return kCLLocationAccuracyKilometer
|
|
41
|
+
case .`default`, .automotiveNavigation, .otherNavigation, .fitness, .airborne:
|
|
42
|
+
return kCLLocationAccuracyBest
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
func clActivityType() -> CLActivityType {
|
|
47
|
+
switch self {
|
|
48
|
+
case .`default`, .lowPower:
|
|
49
|
+
return .other
|
|
50
|
+
case .automotiveNavigation:
|
|
51
|
+
return .automotiveNavigation
|
|
52
|
+
case .otherNavigation:
|
|
53
|
+
return .otherNavigation
|
|
54
|
+
case .fitness:
|
|
55
|
+
return .fitness
|
|
56
|
+
case .airborne:
|
|
57
|
+
return .airborne
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b6131ece5f5a18998ce0571f54242774
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2376a0dbedbda141dd71a8de6daa7d6c7cbbe4ab
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
36352dc221d755d69fb9a847a78836e1e359ad0443743aaa7f5f2648ddf76f87
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a0bb6a2c55e0c88b6c92553b3a5b05b5b24c604ade8388a46fd758221a2a8b4fb5f2ffb2ad7f3977794932f541aff21f9a5be896510654a963137bbd00ca11e4
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fd583896233d35b7c90515551e9751c6
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
9784711dc85345dfb3100c08a4061f4121806394
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
30515d0f37957d667880e577c9bc247dfd4e84c9058574413e850893e83c3406
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1d52e7849fe29a33c686fca271fd5b2696ebbb050617ee2d081e3aeae4c4c4a0826fb6b4b8eef4c790ad72aa5d49701cc96c92caacec3e484a3a4930dc45a5c8
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.location",
|
|
6
|
-
"version": "58.0.
|
|
6
|
+
"version": "58.0.13",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
],
|
|
34
34
|
"files": [
|
|
35
35
|
{
|
|
36
|
-
"name": "expo.modules.location-58.0.
|
|
37
|
-
"url": "expo.modules.location-58.0.
|
|
38
|
-
"size":
|
|
39
|
-
"sha512": "
|
|
40
|
-
"sha256": "
|
|
41
|
-
"sha1": "
|
|
42
|
-
"md5": "
|
|
36
|
+
"name": "expo.modules.location-58.0.13.aar",
|
|
37
|
+
"url": "expo.modules.location-58.0.13.aar",
|
|
38
|
+
"size": 450277,
|
|
39
|
+
"sha512": "1d52e7849fe29a33c686fca271fd5b2696ebbb050617ee2d081e3aeae4c4c4a0826fb6b4b8eef4c790ad72aa5d49701cc96c92caacec3e484a3a4930dc45a5c8",
|
|
40
|
+
"sha256": "30515d0f37957d667880e577c9bc247dfd4e84c9058574413e850893e83c3406",
|
|
41
|
+
"sha1": "9784711dc85345dfb3100c08a4061f4121806394",
|
|
42
|
+
"md5": "fd583896233d35b7c90515551e9751c6"
|
|
43
43
|
}
|
|
44
44
|
]
|
|
45
45
|
},
|
|
@@ -90,13 +90,13 @@
|
|
|
90
90
|
],
|
|
91
91
|
"files": [
|
|
92
92
|
{
|
|
93
|
-
"name": "expo.modules.location-58.0.
|
|
94
|
-
"url": "expo.modules.location-58.0.
|
|
95
|
-
"size":
|
|
96
|
-
"sha512": "
|
|
97
|
-
"sha256": "
|
|
98
|
-
"sha1": "
|
|
99
|
-
"md5": "
|
|
93
|
+
"name": "expo.modules.location-58.0.13.aar",
|
|
94
|
+
"url": "expo.modules.location-58.0.13.aar",
|
|
95
|
+
"size": 450277,
|
|
96
|
+
"sha512": "1d52e7849fe29a33c686fca271fd5b2696ebbb050617ee2d081e3aeae4c4c4a0826fb6b4b8eef4c790ad72aa5d49701cc96c92caacec3e484a3a4930dc45a5c8",
|
|
97
|
+
"sha256": "30515d0f37957d667880e577c9bc247dfd4e84c9058574413e850893e83c3406",
|
|
98
|
+
"sha1": "9784711dc85345dfb3100c08a4061f4121806394",
|
|
99
|
+
"md5": "fd583896233d35b7c90515551e9751c6"
|
|
100
100
|
}
|
|
101
101
|
]
|
|
102
102
|
},
|
|
@@ -110,13 +110,13 @@
|
|
|
110
110
|
},
|
|
111
111
|
"files": [
|
|
112
112
|
{
|
|
113
|
-
"name": "expo.modules.location-58.0.
|
|
114
|
-
"url": "expo.modules.location-58.0.
|
|
115
|
-
"size":
|
|
116
|
-
"sha512": "
|
|
117
|
-
"sha256": "
|
|
118
|
-
"sha1": "
|
|
119
|
-
"md5": "
|
|
113
|
+
"name": "expo.modules.location-58.0.13-sources.jar",
|
|
114
|
+
"url": "expo.modules.location-58.0.13-sources.jar",
|
|
115
|
+
"size": 39982,
|
|
116
|
+
"sha512": "a0bb6a2c55e0c88b6c92553b3a5b05b5b24c604ade8388a46fd758221a2a8b4fb5f2ffb2ad7f3977794932f541aff21f9a5be896510654a963137bbd00ca11e4",
|
|
117
|
+
"sha256": "36352dc221d755d69fb9a847a78836e1e359ad0443743aaa7f5f2648ddf76f87",
|
|
118
|
+
"sha1": "2376a0dbedbda141dd71a8de6daa7d6c7cbbe4ab",
|
|
119
|
+
"md5": "b6131ece5f5a18998ce0571f54242774"
|
|
120
120
|
}
|
|
121
121
|
]
|
|
122
122
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
585f591b8edc00660c56ea8256a9664f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
593547bde190365701ba329c2e4b8a10205da018
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
79b0154c9db5c0d476f7225b33ac7c40a0c7661f356cd16870f4a216ff2a693f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f7fb35c26e35b5c187829d84abc71228ec8bbefa08ece125cd4feb7a4961edbeca6e8789df4848c74751303a46b33ba8b11e034ca1a5880d5bad7f35e712dde5
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>host.exp.exponent</groupId>
|
|
11
11
|
<artifactId>expo.modules.location</artifactId>
|
|
12
|
-
<version>58.0.
|
|
12
|
+
<version>58.0.13</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.location</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
35cc85505e7dfd6d984fca92c612b609
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b170440ec0fba727b6ebe34501aa3aa5d8bba924
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
9c7add2e11db5f0b33aca67f7f623c58d7863272f8ad5595a42bd2fef831917e
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
353c6484d0224b8655cd47f7b0be7d9efd3e1ff9d8873532d7a2a5f8d565e2cf532e446d3a77836a213455b509448a1f6bfde10fa852a1e2fbcbe684d4f7e170
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-location",
|
|
3
|
-
"version": "58.0.
|
|
3
|
+
"version": "58.0.13",
|
|
4
4
|
"description": "Allows reading geolocation information from the device. Your app can poll for the current location or subscribe to location update events.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compass",
|
|
@@ -26,21 +26,50 @@
|
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"main": "build/index.js",
|
|
28
28
|
"types": "build/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
"./app.plugin": "./app.plugin.js",
|
|
31
|
+
"./app.plugin.js": "./app.plugin.js",
|
|
32
|
+
"./package.json": "./package.json",
|
|
33
|
+
"./plugin": "./plugin/build/index.js",
|
|
34
|
+
".": {
|
|
35
|
+
"types": {
|
|
36
|
+
"expo-source": "./src/index.ts",
|
|
37
|
+
"default": "./build/index.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"expo-source": "./src/index.ts",
|
|
40
|
+
"default": "./build/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./next": {
|
|
43
|
+
"types": {
|
|
44
|
+
"expo-source": "./src/next/index.ts",
|
|
45
|
+
"default": "./build/next/index.d.ts"
|
|
46
|
+
},
|
|
47
|
+
"expo-source": "./src/next/index.ts",
|
|
48
|
+
"default": "./build/next/index.js"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
29
51
|
"dependencies": {
|
|
30
|
-
"@expo/image-utils": "^0.12.
|
|
52
|
+
"@expo/image-utils": "^0.12.4"
|
|
31
53
|
},
|
|
32
54
|
"devDependencies": {
|
|
55
|
+
"@expo/internal-scripts": "58.0.1",
|
|
33
56
|
"@types/jest": "^30.0.0",
|
|
34
57
|
"@types/node": "^22.14.0",
|
|
35
58
|
"@types/react": "~19.3.0",
|
|
36
|
-
"expo": "58.0.
|
|
37
|
-
"expo-
|
|
59
|
+
"expo": "58.0.7",
|
|
60
|
+
"expo-task-manager": "~58.0.11"
|
|
38
61
|
},
|
|
39
62
|
"peerDependencies": {
|
|
40
63
|
"expo": "*",
|
|
64
|
+
"expo-task-manager": "*",
|
|
41
65
|
"react": "*",
|
|
42
66
|
"react-native": "*"
|
|
43
67
|
},
|
|
68
|
+
"peerDependenciesMeta": {
|
|
69
|
+
"expo-task-manager": {
|
|
70
|
+
"optional": true
|
|
71
|
+
}
|
|
72
|
+
},
|
|
44
73
|
"scripts": {
|
|
45
74
|
"precompile-ios": "et prebuild-package-for-publish",
|
|
46
75
|
"precompile-android": "et prebuild-android-package-for-publish",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConfigPlugin } from 'expo/config-plugins';
|
|
2
|
+
export declare const FULL_ACCURACY_PURPOSE_KEY = "ExpoLocationFullAccuracy";
|
|
2
3
|
type DPIString = 'mdpi' | 'hdpi' | 'xhdpi' | 'xxhdpi' | 'xxxhdpi';
|
|
3
4
|
type dpiMap = Record<DPIString, {
|
|
4
5
|
folderName: string;
|
|
@@ -45,6 +46,23 @@ export type Props = {
|
|
|
45
46
|
* @platform ios
|
|
46
47
|
*/
|
|
47
48
|
motionUsagePermission?: string | false;
|
|
49
|
+
/**
|
|
50
|
+
* A string to set the message the system shows when a permission request from
|
|
51
|
+
* `expo-location/next` asks to raise a reduced accuracy authorization to full accuracy. It is written under the
|
|
52
|
+
* `ExpoLocationFullAccuracy` key of `NSLocationTemporaryUsageDescriptionDictionary`.
|
|
53
|
+
* Pass `false` to omit the key, which skips the raise.
|
|
54
|
+
* @default "Allow $(PRODUCT_NAME) to access your precise location"
|
|
55
|
+
* @platform ios
|
|
56
|
+
*/
|
|
57
|
+
locationFullAccuracyPermission?: string | false;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the permission prompt offers reduced accuracy by default, by setting
|
|
60
|
+
* `NSLocationDefaultAccuracyReduced` in `Info.plist`. The app can still ask for full accuracy
|
|
61
|
+
* for a session with `accuracy: 'full'` in a permission request from `expo-location/next`.
|
|
62
|
+
* @default false
|
|
63
|
+
* @platform ios
|
|
64
|
+
*/
|
|
65
|
+
isIosReducedAccuracyByDefault?: boolean;
|
|
48
66
|
/**
|
|
49
67
|
* Whether to enable location in `UIBackgroundModes`.
|
|
50
68
|
* @default false
|