expo-location 58.0.20 → 58.0.22
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 +15 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/location/next/LocationModuleNext.kt +29 -0
- package/android/src/main/java/expo/modules/location/next/LocationRecords.kt +6 -2
- package/android/src/main/java/expo/modules/location/next/geocoding/Geocoding.kt +117 -0
- package/android/src/main/java/expo/modules/location/next/geocoding/GeocodingExceptions.kt +27 -0
- package/android/src/main/java/expo/modules/location/next/geocoding/GeocodingRecords.kt +24 -0
- package/android/src/main/java/expo/modules/location/taskConsumers/LocationTaskConsumer.kt +3 -3
- package/build/next/Location.d.ts +1 -1
- package/build/next/Location.js +1 -1
- package/build/next/Location.js.map +1 -1
- package/build/next/index.d.ts +1 -1
- package/build/next/index.js.map +1 -1
- package/build/next/js/geocoding.d.ts +38 -0
- package/build/next/js/geocoding.js +49 -0
- package/build/next/js/geocoding.js.map +1 -0
- package/build/next/js/index.d.ts +1 -0
- package/build/next/js/index.js +1 -0
- package/build/next/js/index.js.map +1 -1
- package/build/next/native/types/NativeLocationModuleNextClass.types.d.ts +3 -1
- package/build/next/types/Geocoding.types.d.ts +74 -0
- package/build/next/types/Geocoding.types.js +7 -0
- package/build/next/types/Geocoding.types.js.map +1 -0
- package/build/next/types/index.d.ts +1 -0
- package/build/next/types/index.js +1 -0
- package/build/next/types/index.js.map +1 -1
- package/ios/next/Geocoding/Address.swift +11 -0
- package/ios/next/Geocoding/AddressNormalization.swift +8 -0
- package/ios/next/Geocoding/CompatibilityGeocoder.swift +73 -0
- package/ios/next/Geocoding/GeocodeOptions.swift +6 -0
- package/ios/next/Geocoding/GeocoderNext.swift +4 -0
- package/ios/next/Geocoding/MapKitGeocoder.swift +70 -0
- package/ios/next/Geocoding/ReverseGeocodeOptions.swift +6 -0
- package/ios/next/Geocoding/String+toLocale.swift +12 -0
- package/ios/next/LocationModuleNext.swift +15 -0
- package/ios/next/LocationNextExceptions.swift +19 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/{58.0.20/expo.modules.location-58.0.20-sources.jar → 58.0.22/expo.modules.location-58.0.22-sources.jar} +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22-sources.jar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22-sources.jar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22-sources.jar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22-sources.jar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/{58.0.20/expo.modules.location-58.0.20.module → 58.0.22/expo.modules.location-58.0.22.module} +22 -22
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/{58.0.20/expo.modules.location-58.0.20.pom → 58.0.22/expo.modules.location-58.0.22.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.22/expo.modules.location-58.0.22.pom.sha512 +1 -0
- package/package.json +5 -5
- package/src/next/Location.ts +2 -0
- package/src/next/index.ts +3 -0
- package/src/next/js/geocoding.ts +56 -0
- package/src/next/js/index.ts +1 -0
- package/src/next/native/types/NativeLocationModuleNextClass.types.ts +6 -0
- package/src/next/types/Geocoding.types.ts +77 -0
- package/src/next/types/index.ts +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20-sources.jar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20-sources.jar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20-sources.jar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20-sources.jar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.location/58.0.20/expo.modules.location-58.0.20.pom.sha512 +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 58.0.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [Android] Add `geocode` and `reverseGeocode` to the `expo-location/next` API. ([#52444](https://github.com/expo/expo/pull/52444) by [@HubertBer](https://github.com/HubertBer))
|
|
8
|
+
- [next] Add `geocode` and `reverseGeocode` with a `locale` option. ([#52024](https://github.com/expo/expo/pull/52024) by [@Wenszel](https://github.com/Wenszel))
|
|
9
|
+
|
|
10
|
+
## 58.0.21
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [Android] Fixed the foreground location service not coming back when the app returns to the foreground after the system stopped its process. ([#52634](https://github.com/expo/expo/pull/52634) by [@HubertBer](https://github.com/HubertBer))
|
|
15
|
+
- Updated dependencies. ([#52932](https://github.com/expo/expo/pull/52932))
|
|
16
|
+
- @expo/image-utils@0.12.7
|
|
17
|
+
|
|
3
18
|
## 58.0.20
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/android/build.gradle
CHANGED
|
@@ -4,13 +4,13 @@ plugins {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
group = 'host.exp.exponent'
|
|
7
|
-
version = '58.0.
|
|
7
|
+
version = '58.0.22'
|
|
8
8
|
|
|
9
9
|
android {
|
|
10
10
|
namespace "expo.modules.location"
|
|
11
11
|
defaultConfig {
|
|
12
12
|
versionCode 29
|
|
13
|
-
versionName "58.0.
|
|
13
|
+
versionName "58.0.22"
|
|
14
14
|
consumerProguardFiles("proguard-rules.pro")
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -15,6 +15,11 @@ import expo.modules.kotlin.modules.Module
|
|
|
15
15
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
16
16
|
import expo.modules.kotlin.functions.Coroutine
|
|
17
17
|
import expo.modules.kotlin.sharedobjects.SharedRef
|
|
18
|
+
import expo.modules.location.next.geocoding.GeocodeOptions
|
|
19
|
+
import expo.modules.location.next.geocoding.GeocodingQuery
|
|
20
|
+
import expo.modules.location.next.geocoding.InvalidCoordinatesException
|
|
21
|
+
import expo.modules.location.next.geocoding.geocode
|
|
22
|
+
import expo.modules.location.next.geocoding.ReverseGeocodeOptions
|
|
18
23
|
import expo.modules.location.next.locationForegroundService.BackgroundSessionOptions
|
|
19
24
|
import expo.modules.location.next.locationForegroundService.BackgroundSessionState
|
|
20
25
|
import expo.modules.location.next.locationForegroundService.LocationForegroundService
|
|
@@ -132,6 +137,30 @@ class LocationModuleNext : Module() {
|
|
|
132
137
|
return@Coroutine permissionsManager.getLocationPermissions(background = true)
|
|
133
138
|
}
|
|
134
139
|
|
|
140
|
+
AsyncFunction("geocode") Coroutine { address: String, options: GeocodeOptions? ->
|
|
141
|
+
if (address.isBlank()) {
|
|
142
|
+
return@Coroutine emptyList()
|
|
143
|
+
}
|
|
144
|
+
return@Coroutine geocode(
|
|
145
|
+
context,
|
|
146
|
+
appContext.jsLogger,
|
|
147
|
+
GeocodingQuery.ByAddress(address),
|
|
148
|
+
options?.locale
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
AsyncFunction("reverseGeocode") Coroutine { coordinates: Coordinates, options: ReverseGeocodeOptions? ->
|
|
153
|
+
if (!coordinates.areValid()) {
|
|
154
|
+
throw InvalidCoordinatesException()
|
|
155
|
+
}
|
|
156
|
+
return@Coroutine geocode(
|
|
157
|
+
context,
|
|
158
|
+
appContext.jsLogger,
|
|
159
|
+
GeocodingQuery.ByCoordinates(coordinates),
|
|
160
|
+
options?.locale
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
|
|
135
164
|
AsyncFunction("requestNotificationPermissions") Coroutine { ->
|
|
136
165
|
permissionsManager.requestNotificationPermissions()
|
|
137
166
|
return@Coroutine permissionsManager.getNotificationPermissions(context)
|
|
@@ -7,6 +7,7 @@ import android.os.Bundle
|
|
|
7
7
|
import android.os.PersistableBundle
|
|
8
8
|
import expo.modules.kotlin.records.Field
|
|
9
9
|
import expo.modules.kotlin.records.Record
|
|
10
|
+
import expo.modules.kotlin.records.Required
|
|
10
11
|
import expo.modules.kotlin.types.Enumerable
|
|
11
12
|
import expo.modules.kotlin.types.OptimizedRecord
|
|
12
13
|
import expo.modules.location.next.locationProviders.BackgroundUpdatesParameters
|
|
@@ -126,8 +127,8 @@ class GetPositionOptions(
|
|
|
126
127
|
|
|
127
128
|
@OptimizedRecord
|
|
128
129
|
class Coordinates(
|
|
129
|
-
@Field val latitude: Double,
|
|
130
|
-
@Field val longitude: Double
|
|
130
|
+
@Field @Required val latitude: Double,
|
|
131
|
+
@Field @Required val longitude: Double
|
|
131
132
|
) : Record {
|
|
132
133
|
private fun BaseBundle.putCoordinateFields() {
|
|
133
134
|
putDouble("latitude", latitude)
|
|
@@ -139,6 +140,9 @@ class Coordinates(
|
|
|
139
140
|
fun toBundle() = Bundle().apply { putCoordinateFields() }
|
|
140
141
|
}
|
|
141
142
|
|
|
143
|
+
fun Coordinates.areValid(): Boolean =
|
|
144
|
+
latitude in -90.0..90.0 && longitude in -180.0..180.0
|
|
145
|
+
|
|
142
146
|
fun PersistableBundle.toCoordinates(): Coordinates = Coordinates(
|
|
143
147
|
getDouble("latitude"),
|
|
144
148
|
getDouble("longitude")
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
package expo.modules.location.next.geocoding
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.location.Address as AndroidAddress
|
|
5
|
+
import android.location.Geocoder
|
|
6
|
+
import android.os.Build
|
|
7
|
+
import androidx.annotation.DeprecatedSinceApi
|
|
8
|
+
import androidx.annotation.RequiresApi
|
|
9
|
+
import expo.modules.core.logging.Logger
|
|
10
|
+
import expo.modules.location.next.Coordinates
|
|
11
|
+
import java.io.IOException
|
|
12
|
+
import java.util.Locale
|
|
13
|
+
import kotlin.coroutines.resume
|
|
14
|
+
import kotlin.coroutines.resumeWithException
|
|
15
|
+
import kotlinx.coroutines.CancellationException
|
|
16
|
+
import kotlinx.coroutines.Dispatchers
|
|
17
|
+
import kotlinx.coroutines.suspendCancellableCoroutine
|
|
18
|
+
import kotlinx.coroutines.withContext
|
|
19
|
+
|
|
20
|
+
private const val MAX_GEOCODING_RESULTS = 4
|
|
21
|
+
|
|
22
|
+
sealed interface GeocodingQuery {
|
|
23
|
+
data class ByAddress(val address: String) : GeocodingQuery
|
|
24
|
+
data class ByCoordinates(val coordinates: Coordinates) : GeocodingQuery
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private suspend fun Geocoder.findAddresses(query: GeocodingQuery): List<AndroidAddress> {
|
|
28
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
29
|
+
return findAddressesModern(query)
|
|
30
|
+
}
|
|
31
|
+
return findAddressesLegacy(query)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
|
35
|
+
private suspend fun Geocoder.findAddressesModern(query: GeocodingQuery): List<AndroidAddress> =
|
|
36
|
+
suspendCancellableCoroutine { continuation ->
|
|
37
|
+
val listener = object : Geocoder.GeocodeListener {
|
|
38
|
+
override fun onGeocode(addresses: MutableList<AndroidAddress>) {
|
|
39
|
+
continuation.resume(addresses)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
override fun onError(errorMessage: String?) {
|
|
43
|
+
continuation.resumeWithException(IOException(errorMessage))
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
when (query) {
|
|
47
|
+
is GeocodingQuery.ByAddress ->
|
|
48
|
+
getFromLocationName(query.address, MAX_GEOCODING_RESULTS, listener)
|
|
49
|
+
is GeocodingQuery.ByCoordinates ->
|
|
50
|
+
getFromLocation(query.coordinates.latitude, query.coordinates.longitude, MAX_GEOCODING_RESULTS, listener)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@DeprecatedSinceApi(Build.VERSION_CODES.TIRAMISU)
|
|
55
|
+
private suspend fun Geocoder.findAddressesLegacy(query: GeocodingQuery): List<AndroidAddress> =
|
|
56
|
+
withContext(Dispatchers.IO) {
|
|
57
|
+
when (query) {
|
|
58
|
+
is GeocodingQuery.ByAddress ->
|
|
59
|
+
getFromLocationName(query.address, MAX_GEOCODING_RESULTS)
|
|
60
|
+
is GeocodingQuery.ByCoordinates ->
|
|
61
|
+
getFromLocation(query.coordinates.latitude, query.coordinates.longitude, MAX_GEOCODING_RESULTS)
|
|
62
|
+
}.orEmpty()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private fun AndroidAddress.toAddress(): Address? {
|
|
66
|
+
if (!hasLatitude() || !hasLongitude()) {
|
|
67
|
+
return null
|
|
68
|
+
}
|
|
69
|
+
return Address(
|
|
70
|
+
coordinates = Coordinates(latitude, longitude),
|
|
71
|
+
name = featureName?.takeIf { it.isNotBlank() },
|
|
72
|
+
formattedAddress = formattedAddressOrNull(),
|
|
73
|
+
city = locality?.takeIf { it.isNotBlank() },
|
|
74
|
+
country = countryName?.takeIf { it.isNotBlank() },
|
|
75
|
+
isoCountryCode = countryCode?.takeIf { it.isNotBlank() }
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private fun AndroidAddress.formattedAddressOrNull(): String? {
|
|
80
|
+
return (0..maxAddressLineIndex)
|
|
81
|
+
.mapNotNull { getAddressLine(it) }
|
|
82
|
+
.filter { it.isNotBlank() }
|
|
83
|
+
.joinToString(", ")
|
|
84
|
+
.takeIf { it.isNotBlank() }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private fun resolveLocale(locale: String?, logger: Logger?): Locale {
|
|
88
|
+
val requestedLocale = locale ?: return Locale.getDefault()
|
|
89
|
+
val parsedLocale = Locale.forLanguageTag(requestedLocale)
|
|
90
|
+
if (parsedLocale.language.isEmpty()) {
|
|
91
|
+
logger?.warn("[expo-location] Unrecognized locale '$requestedLocale', the device locale will be used instead.")
|
|
92
|
+
return Locale.getDefault()
|
|
93
|
+
}
|
|
94
|
+
return parsedLocale
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
suspend fun geocode(
|
|
98
|
+
context: Context,
|
|
99
|
+
logger: Logger?,
|
|
100
|
+
query: GeocodingQuery,
|
|
101
|
+
locale: String?
|
|
102
|
+
): List<Address> {
|
|
103
|
+
if (!Geocoder.isPresent()) {
|
|
104
|
+
throw NoGeocodingBackendException()
|
|
105
|
+
}
|
|
106
|
+
val resolvedLocale = resolveLocale(locale, logger)
|
|
107
|
+
val results = try {
|
|
108
|
+
Geocoder(context, resolvedLocale).findAddresses(query)
|
|
109
|
+
} catch (exception: CancellationException) {
|
|
110
|
+
throw exception
|
|
111
|
+
} catch (exception: IOException) {
|
|
112
|
+
throw GeocodingUnavailableException(exception)
|
|
113
|
+
} catch (exception: RuntimeException) {
|
|
114
|
+
throw GeocodingFailedException(exception)
|
|
115
|
+
}
|
|
116
|
+
return results.mapNotNull { it.toAddress() }
|
|
117
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
package expo.modules.location.next.geocoding
|
|
2
|
+
|
|
3
|
+
import expo.modules.kotlin.exception.CodedException
|
|
4
|
+
|
|
5
|
+
class NoGeocodingBackendException :
|
|
6
|
+
CodedException(
|
|
7
|
+
"This device has no geocoding backend. `android.location.Geocoder` is served by a backend " +
|
|
8
|
+
"that is not part of the core Android framework, and devices without it - including many " +
|
|
9
|
+
"without Google Play services - cannot geocode at all. Reconnecting to the network does " +
|
|
10
|
+
"not help."
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
class InvalidCoordinatesException :
|
|
14
|
+
CodedException(
|
|
15
|
+
"The coordinates are outside the valid range. Latitude must be between -90 and 90, " +
|
|
16
|
+
"longitude between -180 and 180."
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
class GeocodingUnavailableException(cause: Throwable? = null) :
|
|
20
|
+
CodedException(
|
|
21
|
+
"The geocoding service could not be reached. This is usually a network failure or a timeout, " +
|
|
22
|
+
"and retrying later may succeed.",
|
|
23
|
+
cause
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
class GeocodingFailedException(cause: Throwable) :
|
|
27
|
+
CodedException("Geocoding failed.", cause)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
package expo.modules.location.next.geocoding
|
|
2
|
+
|
|
3
|
+
import expo.modules.kotlin.records.Field
|
|
4
|
+
import expo.modules.kotlin.records.Record
|
|
5
|
+
import expo.modules.kotlin.types.OptimizedRecord
|
|
6
|
+
import expo.modules.location.next.Coordinates
|
|
7
|
+
|
|
8
|
+
@OptimizedRecord
|
|
9
|
+
class Address(
|
|
10
|
+
@Field val coordinates: Coordinates,
|
|
11
|
+
@Field val name: String?,
|
|
12
|
+
@Field val formattedAddress: String?,
|
|
13
|
+
@Field val city: String?,
|
|
14
|
+
@Field val country: String?,
|
|
15
|
+
@Field val isoCountryCode: String?
|
|
16
|
+
) : Record
|
|
17
|
+
|
|
18
|
+
class GeocodeOptions(
|
|
19
|
+
@Field val locale: String? = null
|
|
20
|
+
) : Record
|
|
21
|
+
|
|
22
|
+
class ReverseGeocodeOptions(
|
|
23
|
+
@Field val locale: String? = null
|
|
24
|
+
) : Record
|
|
@@ -183,12 +183,12 @@ class LocationTaskConsumer(context: Context, taskManagerUtils: TaskManagerUtilsI
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
private fun maybeStartForegroundService() {
|
|
186
|
+
private fun maybeStartForegroundService(isForegrounded: Boolean = AppForegroundedSingleton.isForegrounded) {
|
|
187
187
|
// Foreground service is available as of Android Oreo.
|
|
188
188
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
|
189
189
|
return
|
|
190
190
|
}
|
|
191
|
-
if (!
|
|
191
|
+
if (!isForegrounded) {
|
|
192
192
|
Log.w(TAG, "Foreground location task cannot be started while the app is in the background!")
|
|
193
193
|
return
|
|
194
194
|
}
|
|
@@ -391,7 +391,7 @@ class LocationTaskConsumer(context: Context, taskManagerUtils: TaskManagerUtilsI
|
|
|
391
391
|
override fun onHostResume() {
|
|
392
392
|
mIsHostPaused = false
|
|
393
393
|
if (mTask != null && mService?.isPromoted != true) {
|
|
394
|
-
maybeStartForegroundService()
|
|
394
|
+
maybeStartForegroundService(isForegrounded = true)
|
|
395
395
|
}
|
|
396
396
|
maybeReportDeferredLocations()
|
|
397
397
|
}
|
package/build/next/Location.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getPosition, watchPosition, hasLocationServicesEnabled, enableLocationServices, getForegroundPermissions, requestForegroundPermissions, getBackgroundPermissions, requestBackgroundPermissions, getNotificationPermissions, requestNotificationPermissions, setLocationProvider, getSelectedLocationProviderName, ensureBackgroundSessionStarted, stopBackgroundSession, getBackgroundSessionStatus, } from './js';
|
|
1
|
+
export { getPosition, watchPosition, hasLocationServicesEnabled, enableLocationServices, getForegroundPermissions, requestForegroundPermissions, getBackgroundPermissions, requestBackgroundPermissions, getNotificationPermissions, requestNotificationPermissions, setLocationProvider, getSelectedLocationProviderName, ensureBackgroundSessionStarted, stopBackgroundSession, getBackgroundSessionStatus, geocode, reverseGeocode, } from './js';
|
package/build/next/Location.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { getPosition, watchPosition, hasLocationServicesEnabled, enableLocationServices, getForegroundPermissions, requestForegroundPermissions, getBackgroundPermissions, requestBackgroundPermissions, getNotificationPermissions, requestNotificationPermissions, setLocationProvider, getSelectedLocationProviderName, ensureBackgroundSessionStarted, stopBackgroundSession, getBackgroundSessionStatus } from './js';
|
|
1
|
+
export { getPosition, watchPosition, hasLocationServicesEnabled, enableLocationServices, getForegroundPermissions, requestForegroundPermissions, getBackgroundPermissions, requestBackgroundPermissions, getNotificationPermissions, requestNotificationPermissions, setLocationProvider, getSelectedLocationProviderName, ensureBackgroundSessionStarted, stopBackgroundSession, getBackgroundSessionStatus, geocode, reverseGeocode } from './js';
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=Location.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["next/Location.ts"],"sourcesContent":[null],"names":["getPosition","watchPosition","hasLocationServicesEnabled","enableLocationServices","getForegroundPermissions","requestForegroundPermissions","getBackgroundPermissions","requestBackgroundPermissions","getNotificationPermissions","requestNotificationPermissions","setLocationProvider","getSelectedLocationProviderName","ensureBackgroundSessionStarted","stopBackgroundSession","getBackgroundSessionStatus"],"mappings":"AAAA,SACEA,WAAW,EACXC,aAAa,EACbC,0BAA0B,EAC1BC,sBAAsB,EACtBC,wBAAwB,EACxBC,4BAA4B,EAC5BC,wBAAwB,EACxBC,4BAA4B,EAC5BC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,mBAAmB,EACnBC,+BAA+B,EAC/BC,8BAA8B,EAC9BC,qBAAqB,EACrBC,0BAA0B,
|
|
1
|
+
{"version":3,"sources":["next/Location.ts"],"sourcesContent":[null],"names":["getPosition","watchPosition","hasLocationServicesEnabled","enableLocationServices","getForegroundPermissions","requestForegroundPermissions","getBackgroundPermissions","requestBackgroundPermissions","getNotificationPermissions","requestNotificationPermissions","setLocationProvider","getSelectedLocationProviderName","ensureBackgroundSessionStarted","stopBackgroundSession","getBackgroundSessionStatus","geocode","reverseGeocode"],"mappings":"AAAA,SACEA,WAAW,EACXC,aAAa,EACbC,0BAA0B,EAC1BC,sBAAsB,EACtBC,wBAAwB,EACxBC,4BAA4B,EAC5BC,wBAAwB,EACxBC,4BAA4B,EAC5BC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,mBAAmB,EACnBC,+BAA+B,EAC/BC,8BAA8B,EAC9BC,qBAAqB,EACrBC,0BAA0B,EAC1BC,OAAO,EACPC,cAAc,QACT,OAAO"}
|
package/build/next/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * as Location from './Location';
|
|
2
2
|
export { useForegroundLocationPermissions, useBackgroundLocationPermissions, useNotificationPermissions, useLocationServices, PositionWatchHandle, LocationProvider, LocationUpdatesHandle, defineLocationTask, } from './js';
|
|
3
|
-
export { LocationProfile, LocationAccuracy, LocationScope, RequestPermissionsAccuracyOption, type Coordinates, type Position, type PositionUpdate, type PositionWatchError, type PositionWatchStatus, type WatchPositionParams, type GetPositionOptions, type LocationTaskOptions, type LocationPermissionResponse, type RequestPermissionsOptions, type LocationProviderRefType, BackgroundSessionState, type BackgroundSessionOptions, type BackgroundSessionStatus, type BackgroundTaskStatus, } from './types';
|
|
3
|
+
export { LocationProfile, LocationAccuracy, LocationScope, RequestPermissionsAccuracyOption, type Coordinates, type Position, type PositionUpdate, type PositionWatchError, type PositionWatchStatus, type WatchPositionParams, type GetPositionOptions, type LocationTaskOptions, type LocationPermissionResponse, type RequestPermissionsOptions, type LocationProviderRefType, BackgroundSessionState, type BackgroundSessionOptions, type BackgroundSessionStatus, type BackgroundTaskStatus, type Address, type GeocodeOptions, type ReverseGeocodeOptions, } from './types';
|
package/build/next/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["next/index.ts"],"sourcesContent":[null],"names":["Location","useForegroundLocationPermissions","useBackgroundLocationPermissions","useNotificationPermissions","useLocationServices","PositionWatchHandle","LocationProvider","LocationUpdatesHandle","defineLocationTask","LocationProfile","LocationAccuracy","LocationScope","RequestPermissionsAccuracyOption","BackgroundSessionState"],"mappings":"AAAA,OAAO,KAAKA,QAAQ,MAAM,aAAa;AAEvC,SACEC,gCAAgC,EAChCC,gCAAgC,EAChCC,0BAA0B,EAC1BC,mBAAmB,EACnBC,mBAAmB,EACnBC,gBAAgB,EAChBC,qBAAqB,EACrBC,kBAAkB,QACb,OAAO;AAEd,SACEC,eAAe,EACfC,gBAAgB,EAChBC,aAAa,EACbC,gCAAgC,EAYhCC,sBAAsB,
|
|
1
|
+
{"version":3,"sources":["next/index.ts"],"sourcesContent":[null],"names":["Location","useForegroundLocationPermissions","useBackgroundLocationPermissions","useNotificationPermissions","useLocationServices","PositionWatchHandle","LocationProvider","LocationUpdatesHandle","defineLocationTask","LocationProfile","LocationAccuracy","LocationScope","RequestPermissionsAccuracyOption","BackgroundSessionState"],"mappings":"AAAA,OAAO,KAAKA,QAAQ,MAAM,aAAa;AAEvC,SACEC,gCAAgC,EAChCC,gCAAgC,EAChCC,0BAA0B,EAC1BC,mBAAmB,EACnBC,mBAAmB,EACnBC,gBAAgB,EAChBC,qBAAqB,EACrBC,kBAAkB,QACb,OAAO;AAEd,SACEC,eAAe,EACfC,gBAAgB,EAChBC,aAAa,EACbC,gCAAgC,EAYhCC,sBAAsB,QAOjB,UAAU"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Address, Coordinates, GeocodeOptions, ReverseGeocodeOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Finds the places that match an address string. Requires a network connection.
|
|
4
|
+
*
|
|
5
|
+
* @param address The text to look up, for example, `1 Infinite Loop, Cupertino`.
|
|
6
|
+
* @param options The language of the result.
|
|
7
|
+
* @return A promise that resolves to the matching addresses, or to an empty array when there are none.
|
|
8
|
+
* @throws When the device has no geocoding backend, geocoding is unavailable, or the request fails.
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const [match] = await Location.geocode('1 Infinite Loop, Cupertino');
|
|
12
|
+
* if (match) {
|
|
13
|
+
* console.log(match.coordinates.latitude, match.coordinates.longitude);
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
* @platform android
|
|
17
|
+
* @platform ios
|
|
18
|
+
*/
|
|
19
|
+
export declare function geocode(address: string, options?: GeocodeOptions): Promise<Address[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Finds the addresses at the given coordinates. Requires a network connection.
|
|
22
|
+
*
|
|
23
|
+
* @param coordinates The point to look up.
|
|
24
|
+
* @param options The language of the result.
|
|
25
|
+
* @return A promise that resolves to the addresses at the point, or to an empty array when there are none.
|
|
26
|
+
* @throws When the coordinates are invalid, the device has no geocoding backend, geocoding is unavailable, or the request fails.
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const position = await Location.getPosition();
|
|
30
|
+
* if (position) {
|
|
31
|
+
* const [address] = await Location.reverseGeocode(position.coordinates);
|
|
32
|
+
* console.log(address?.formattedAddress);
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
* @platform android
|
|
36
|
+
* @platform ios
|
|
37
|
+
*/
|
|
38
|
+
export declare function reverseGeocode(coordinates: Coordinates, options?: ReverseGeocodeOptions): Promise<Address[]>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Platform, UnavailabilityError } from 'expo';
|
|
2
|
+
import { NativeLocationModuleNext } from '../native';
|
|
3
|
+
/**
|
|
4
|
+
* Finds the places that match an address string. Requires a network connection.
|
|
5
|
+
*
|
|
6
|
+
* @param address The text to look up, for example, `1 Infinite Loop, Cupertino`.
|
|
7
|
+
* @param options The language of the result.
|
|
8
|
+
* @return A promise that resolves to the matching addresses, or to an empty array when there are none.
|
|
9
|
+
* @throws When the device has no geocoding backend, geocoding is unavailable, or the request fails.
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const [match] = await Location.geocode('1 Infinite Loop, Cupertino');
|
|
13
|
+
* if (match) {
|
|
14
|
+
* console.log(match.coordinates.latitude, match.coordinates.longitude);
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
* @platform android
|
|
18
|
+
* @platform ios
|
|
19
|
+
*/ export async function geocode(address, options) {
|
|
20
|
+
if (Platform.OS !== 'android' && Platform.OS !== 'ios') {
|
|
21
|
+
throw new UnavailabilityError('expo-location', 'geocode');
|
|
22
|
+
}
|
|
23
|
+
return NativeLocationModuleNext.geocode(address, options);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Finds the addresses at the given coordinates. Requires a network connection.
|
|
27
|
+
*
|
|
28
|
+
* @param coordinates The point to look up.
|
|
29
|
+
* @param options The language of the result.
|
|
30
|
+
* @return A promise that resolves to the addresses at the point, or to an empty array when there are none.
|
|
31
|
+
* @throws When the coordinates are invalid, the device has no geocoding backend, geocoding is unavailable, or the request fails.
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const position = await Location.getPosition();
|
|
35
|
+
* if (position) {
|
|
36
|
+
* const [address] = await Location.reverseGeocode(position.coordinates);
|
|
37
|
+
* console.log(address?.formattedAddress);
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
* @platform android
|
|
41
|
+
* @platform ios
|
|
42
|
+
*/ export async function reverseGeocode(coordinates, options) {
|
|
43
|
+
if (Platform.OS !== 'android' && Platform.OS !== 'ios') {
|
|
44
|
+
throw new UnavailabilityError('expo-location', 'reverseGeocode');
|
|
45
|
+
}
|
|
46
|
+
return NativeLocationModuleNext.reverseGeocode(coordinates, options);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=geocoding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["next/js/geocoding.ts"],"sourcesContent":[null],"names":["Platform","UnavailabilityError","NativeLocationModuleNext","geocode","address","options","OS","reverseGeocode","coordinates"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,mBAAmB,QAAQ,OAAO;AAErD,SAASC,wBAAwB,QAAQ,YAAY;AAGrD;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,eAAeC,QAAQC,OAAe,EAAEC,OAAwB;IACrE,IAAIL,SAASM,EAAE,KAAK,aAAaN,SAASM,EAAE,KAAK,OAAO;QACtD,MAAM,IAAIL,oBAAoB,iBAAiB;IACjD;IACA,OAAOC,yBAAyBC,OAAO,CAACC,SAASC;AACnD;AAEA;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,eAAeE,eACpBC,WAAwB,EACxBH,OAA+B;IAE/B,IAAIL,SAASM,EAAE,KAAK,aAAaN,SAASM,EAAE,KAAK,OAAO;QACtD,MAAM,IAAIL,oBAAoB,iBAAiB;IACjD;IACA,OAAOC,yBAAyBK,cAAc,CAACC,aAAaH;AAC9D"}
|
package/build/next/js/index.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export { LocationProvider, setLocationProvider, getSelectedLocationProviderName,
|
|
|
5
5
|
export { getForegroundPermissions, requestForegroundPermissions, getBackgroundPermissions, requestBackgroundPermissions, getNotificationPermissions, requestNotificationPermissions, useForegroundLocationPermissions, useBackgroundLocationPermissions, useNotificationPermissions, } from './Permissions';
|
|
6
6
|
export { LocationUpdatesHandle, defineLocationTask } from './LocationUpdatesHandle';
|
|
7
7
|
export { ensureBackgroundSessionStarted, stopBackgroundSession, getBackgroundSessionStatus, } from './BackgroundSession';
|
|
8
|
+
export { geocode, reverseGeocode } from './geocoding';
|
package/build/next/js/index.js
CHANGED
|
@@ -5,5 +5,6 @@ export { LocationProvider, setLocationProvider, getSelectedLocationProviderName
|
|
|
5
5
|
export { getForegroundPermissions, requestForegroundPermissions, getBackgroundPermissions, requestBackgroundPermissions, getNotificationPermissions, requestNotificationPermissions, useForegroundLocationPermissions, useBackgroundLocationPermissions, useNotificationPermissions } from './Permissions';
|
|
6
6
|
export { LocationUpdatesHandle, defineLocationTask } from './LocationUpdatesHandle';
|
|
7
7
|
export { ensureBackgroundSessionStarted, stopBackgroundSession, getBackgroundSessionStatus } from './BackgroundSession';
|
|
8
|
+
export { geocode, reverseGeocode } from './geocoding';
|
|
8
9
|
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["next/js/index.ts"],"sourcesContent":[null],"names":["getPosition","hasLocationServicesEnabled","enableLocationServices","useLocationServices","PositionWatchHandle","watchPosition","LocationProvider","setLocationProvider","getSelectedLocationProviderName","getForegroundPermissions","requestForegroundPermissions","getBackgroundPermissions","requestBackgroundPermissions","getNotificationPermissions","requestNotificationPermissions","useForegroundLocationPermissions","useBackgroundLocationPermissions","useNotificationPermissions","LocationUpdatesHandle","defineLocationTask","ensureBackgroundSessionStarted","stopBackgroundSession","getBackgroundSessionStatus"],"mappings":"AAAA,SAASA,WAAW,QAAQ,gBAAgB;AAC5C,SACEC,0BAA0B,EAC1BC,sBAAsB,EACtBC,mBAAmB,QACd,qBAAqB;AAC5B,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,wBAAwB;AAC3E,SACEC,gBAAgB,EAChBC,mBAAmB,EACnBC,+BAA+B,QAC1B,qBAAqB;AAC5B,SACEC,wBAAwB,EACxBC,4BAA4B,EAC5BC,wBAAwB,EACxBC,4BAA4B,EAC5BC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,gCAAgC,EAChCC,gCAAgC,EAChCC,0BAA0B,QACrB,gBAAgB;AACvB,SAASC,qBAAqB,EAAEC,kBAAkB,QAAQ,0BAA0B;AACpF,SACEC,8BAA8B,EAC9BC,qBAAqB,EACrBC,0BAA0B,QACrB,sBAAsB"}
|
|
1
|
+
{"version":3,"sources":["next/js/index.ts"],"sourcesContent":[null],"names":["getPosition","hasLocationServicesEnabled","enableLocationServices","useLocationServices","PositionWatchHandle","watchPosition","LocationProvider","setLocationProvider","getSelectedLocationProviderName","getForegroundPermissions","requestForegroundPermissions","getBackgroundPermissions","requestBackgroundPermissions","getNotificationPermissions","requestNotificationPermissions","useForegroundLocationPermissions","useBackgroundLocationPermissions","useNotificationPermissions","LocationUpdatesHandle","defineLocationTask","ensureBackgroundSessionStarted","stopBackgroundSession","getBackgroundSessionStatus","geocode","reverseGeocode"],"mappings":"AAAA,SAASA,WAAW,QAAQ,gBAAgB;AAC5C,SACEC,0BAA0B,EAC1BC,sBAAsB,EACtBC,mBAAmB,QACd,qBAAqB;AAC5B,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,wBAAwB;AAC3E,SACEC,gBAAgB,EAChBC,mBAAmB,EACnBC,+BAA+B,QAC1B,qBAAqB;AAC5B,SACEC,wBAAwB,EACxBC,4BAA4B,EAC5BC,wBAAwB,EACxBC,4BAA4B,EAC5BC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,gCAAgC,EAChCC,gCAAgC,EAChCC,0BAA0B,QACrB,gBAAgB;AACvB,SAASC,qBAAqB,EAAEC,kBAAkB,QAAQ,0BAA0B;AACpF,SACEC,8BAA8B,EAC9BC,qBAAqB,EACrBC,0BAA0B,QACrB,sBAAsB;AAC7B,SAASC,OAAO,EAAEC,cAAc,QAAQ,cAAc"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NativeModule } from 'expo';
|
|
2
2
|
import type { PermissionResponse, SharedRef } from 'expo';
|
|
3
|
-
import type { GetPositionOptions, LocationPermissionResponse, LocationProfile, LocationProviderRefType, Position, RequestPermissionsOptions } from '../../types';
|
|
3
|
+
import type { Address, Coordinates, GeocodeOptions, GetPositionOptions, LocationPermissionResponse, LocationProfile, LocationProviderRefType, Position, RequestPermissionsOptions, ReverseGeocodeOptions } from '../../types';
|
|
4
4
|
import type { NativeBackgroundSessionClass } from './NativeBackgroundSessionClass.types';
|
|
5
5
|
import type { NativeLocationProviderClass } from './NativeLocationProviderClass.types';
|
|
6
6
|
import type { NativeLocationUpdatesHandleClass } from './NativeLocationUpdatesHandleClass.types';
|
|
@@ -18,6 +18,8 @@ export declare class NativeLocationModuleNextClass extends NativeModule {
|
|
|
18
18
|
enableLocationServices(): Promise<boolean>;
|
|
19
19
|
getPosition(options?: GetPositionOptions): Promise<Position | null>;
|
|
20
20
|
watchPosition(profile?: LocationProfile): NativePositionWatchHandleClass;
|
|
21
|
+
geocode(address: string, options?: GeocodeOptions): Promise<Address[]>;
|
|
22
|
+
reverseGeocode(coordinates: Coordinates, options?: ReverseGeocodeOptions): Promise<Address[]>;
|
|
21
23
|
LocationProvider: typeof NativeLocationProviderClass;
|
|
22
24
|
PositionWatchHandle: typeof NativePositionWatchHandleClass;
|
|
23
25
|
LocationUpdatesHandle: typeof NativeLocationUpdatesHandleClass;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Coordinates } from './Position.types';
|
|
2
|
+
/**
|
|
3
|
+
* An address paired with the coordinates it stands for. Fields the platform does not know for a
|
|
4
|
+
* given place are `null`.
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* {
|
|
8
|
+
* coordinates: { latitude: 37.3317, longitude: -122.0301 },
|
|
9
|
+
* name: '1 Infinite Loop',
|
|
10
|
+
* formattedAddress: '1 Infinite Loop, Cupertino, CA 95014, United States',
|
|
11
|
+
* city: 'Cupertino',
|
|
12
|
+
* country: 'United States',
|
|
13
|
+
* isoCountryCode: 'US',
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
* @platform android
|
|
17
|
+
* @platform ios
|
|
18
|
+
*/
|
|
19
|
+
export type Address = {
|
|
20
|
+
/**
|
|
21
|
+
* The latitude and longitude of the place, in degrees, for example,
|
|
22
|
+
* `{ latitude: 37.3317, longitude: -122.0301 }`.
|
|
23
|
+
*/
|
|
24
|
+
coordinates: Coordinates;
|
|
25
|
+
/**
|
|
26
|
+
* The name of the place, for example, `1 Infinite Loop`. Each platform reads this from its own
|
|
27
|
+
* field, so it can be a building, a street, a postcode or an administrative area.
|
|
28
|
+
*/
|
|
29
|
+
name: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* The whole address on one line, for example,
|
|
32
|
+
* `1 Infinite Loop, Cupertino, CA 95014, United States`.
|
|
33
|
+
*/
|
|
34
|
+
formattedAddress: string | null;
|
|
35
|
+
/**
|
|
36
|
+
* The city name of the address, for example, `Cupertino`.
|
|
37
|
+
*
|
|
38
|
+
* This is `null` when the backend has no city for the place. That can happen even for a town you
|
|
39
|
+
* would name, in which case the city is often still part of `formattedAddress`.
|
|
40
|
+
*/
|
|
41
|
+
city: string | null;
|
|
42
|
+
/**
|
|
43
|
+
* The country name of the address, for example, `United States`.
|
|
44
|
+
*/
|
|
45
|
+
country: string | null;
|
|
46
|
+
/**
|
|
47
|
+
* The ISO 3166-1 alpha-2 country code of the address, for example, `US`.
|
|
48
|
+
*/
|
|
49
|
+
isoCountryCode: string | null;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Options for [`geocode`](#geocodeaddress-options).
|
|
53
|
+
* @platform android
|
|
54
|
+
* @platform ios
|
|
55
|
+
*/
|
|
56
|
+
export type GeocodeOptions = {
|
|
57
|
+
/**
|
|
58
|
+
* The language of the text fields in the result, as a BCP 47 tag such as `en-US`. Defaults to
|
|
59
|
+
* the device language.
|
|
60
|
+
*/
|
|
61
|
+
locale?: string;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Options for [`reverseGeocode`](#reversegeocodecoordinates-options).
|
|
65
|
+
* @platform android
|
|
66
|
+
* @platform ios
|
|
67
|
+
*/
|
|
68
|
+
export type ReverseGeocodeOptions = {
|
|
69
|
+
/**
|
|
70
|
+
* The language of the text fields in the result, as a BCP 47 tag such as `en-US`. Defaults to
|
|
71
|
+
* the device language.
|
|
72
|
+
*/
|
|
73
|
+
locale?: string;
|
|
74
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["next/types/Geocoding.types.ts"],"sourcesContent":[null],"names":[],"mappings":"AAiEA;;;;CAIC,GACD,WAME"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["next/types/index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,2BAA2B;AACzC,cAAc,uBAAuB;AACrC,cAAc,4BAA4B;AAC1C,cAAc,0BAA0B"}
|
|
1
|
+
{"version":3,"sources":["next/types/index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,2BAA2B;AACzC,cAAc,uBAAuB;AACrC,cAAc,4BAA4B;AAC1C,cAAc,0BAA0B;AACxC,cAAc,oBAAoB"}
|