@capgo/nativegeocoder 0.1.1 → 0.1.4
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/README.md +26 -0
- package/ios/Plugin/NativeGeocoderPlugin.swift +9 -9
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -9,6 +9,32 @@ npm install @capgo/nativegeocoder
|
|
|
9
9
|
npx cap sync
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
+
then import this into your code:
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
import { NativeGeocoder } from '@capgo/nativegeocoder';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## iOS
|
|
19
|
+
|
|
20
|
+
Apple requires privacy descriptions to be specified in `Info.plist` for location information:
|
|
21
|
+
|
|
22
|
+
- `NSLocationAlwaysUsageDescription` (`Privacy - Location Always Usage Description`)
|
|
23
|
+
- `NSLocationWhenInUseUsageDescription` (`Privacy - Location When In Use Usage Description`)
|
|
24
|
+
|
|
25
|
+
Read about [Configuring `Info.plist`](https://capacitorjs.com/docs/ios/configuration#configuring-infoplist) in the [iOS Guide](https://capacitorjs.com/docs/ios) for more information on setting iOS permissions in Xcode
|
|
26
|
+
|
|
27
|
+
## Android
|
|
28
|
+
|
|
29
|
+
This API requires the following permissions be added to your `AndroidManifest.xml`:
|
|
30
|
+
|
|
31
|
+
```xml
|
|
32
|
+
<!-- Geolocation API -->
|
|
33
|
+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
34
|
+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
35
|
+
<uses-feature android:name="android.hardware.location.gps" />
|
|
36
|
+
```
|
|
37
|
+
|
|
12
38
|
## API
|
|
13
39
|
|
|
14
40
|
<docgen-index>
|
|
@@ -10,14 +10,6 @@ public class NativeGeocoderPlugin: CAPPlugin {
|
|
|
10
10
|
private let implementation = NativeGeocoder()
|
|
11
11
|
|
|
12
12
|
@objc func reverseGeocode(_ call: CAPPluginCall) {
|
|
13
|
-
guard let addressString = call.getString("addressString") else {
|
|
14
|
-
call.reject("Missing addressString")
|
|
15
|
-
return
|
|
16
|
-
}
|
|
17
|
-
implementation.reverseGeocode(addressString: addressString, call: call)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@objc func forwardGeocode(_ call: CAPPluginCall) {
|
|
21
13
|
guard let latitude = call.getDouble("latitude") else {
|
|
22
14
|
call.reject("Missing latitude")
|
|
23
15
|
return
|
|
@@ -26,6 +18,14 @@ public class NativeGeocoderPlugin: CAPPlugin {
|
|
|
26
18
|
call.reject("Missing longitude")
|
|
27
19
|
return
|
|
28
20
|
}
|
|
29
|
-
implementation.
|
|
21
|
+
implementation.reverseGeocode(latitude: latitude, longitude: longitude, call: call)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@objc func forwardGeocode(_ call: CAPPluginCall) {
|
|
25
|
+
guard let addressString = call.getString("addressString") else {
|
|
26
|
+
call.reject("Missing addressString")
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
implementation.forwardGeocode(address: addressString, call: call)
|
|
30
30
|
}
|
|
31
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/nativegeocoder",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Capacitor plugin for native forward and reverse geocoding",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -25,8 +25,9 @@
|
|
|
25
25
|
"keywords": [
|
|
26
26
|
"capacitor",
|
|
27
27
|
"plugin",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
28
|
+
"native",
|
|
29
|
+
"geocoding",
|
|
30
|
+
"geocoder"
|
|
30
31
|
],
|
|
31
32
|
"scripts": {
|
|
32
33
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|