@capacitor/geolocation 6.0.2 → 7.0.0-alpha.1

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.
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
13
13
  s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}', 'geolocation/ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '13.0'
14
+ s.ios.deployment_target = '14.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
17
17
  end
package/Package.swift CHANGED
@@ -3,14 +3,14 @@ import PackageDescription
3
3
 
4
4
  let package = Package(
5
5
  name: "CapacitorGeolocation",
6
- platforms: [.iOS(.v13)],
6
+ platforms: [.iOS(.v14)],
7
7
  products: [
8
8
  .library(
9
9
  name: "CapacitorGeolocation",
10
10
  targets: ["GeolocationPlugin"])
11
11
  ],
12
12
  dependencies: [
13
- .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "6.0.0")
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main")
14
14
  ],
15
15
  targets: [
16
16
  .target(
package/README.md CHANGED
@@ -36,7 +36,7 @@ Read about [Setting Permissions](https://capacitorjs.com/docs/android/configurat
36
36
 
37
37
  This plugin will use the following project variables (defined in your app's `variables.gradle` file):
38
38
 
39
- - `playServicesLocationVersion` version of `com.google.android.gms:play-services-location` (default: `21.1.0`)
39
+ - `playServicesLocationVersion` version of `com.google.android.gms:play-services-location` (default: `21.3.0`)
40
40
 
41
41
  ## Example
42
42
 
@@ -171,11 +171,12 @@ Request location permissions. Will throw if system location services are disabl
171
171
 
172
172
  #### PositionOptions
173
173
 
174
- | Prop | Type | Description | Default | Since |
175
- | ------------------------ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
176
- | **`enableHighAccuracy`** | <code>boolean</code> | High accuracy mode (such as GPS, if available) On Android 12+ devices it will be ignored if users didn't grant ACCESS_FINE_LOCATION permissions (can be checked with location alias). | <code>false</code> | 1.0.0 |
177
- | **`timeout`** | <code>number</code> | The maximum wait time in milliseconds for location updates. In Android, since version 4.0.0 of the plugin, timeout gets ignored for getCurrentPosition. | <code>10000</code> | 1.0.0 |
178
- | **`maximumAge`** | <code>number</code> | The maximum age in milliseconds of a possible cached position that is acceptable to return | <code>0</code> | 1.0.0 |
174
+ | Prop | Type | Description | Default | Since |
175
+ | --------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
176
+ | **`enableHighAccuracy`** | <code>boolean</code> | High accuracy mode (such as GPS, if available) On Android 12+ devices it will be ignored if users didn't grant ACCESS_FINE_LOCATION permissions (can be checked with location alias). | <code>false</code> | 1.0.0 |
177
+ | **`timeout`** | <code>number</code> | The maximum wait time in milliseconds for location updates. In Android, since version 4.0.0 of the plugin, timeout gets ignored for getCurrentPosition. | <code>10000</code> | 1.0.0 |
178
+ | **`maximumAge`** | <code>number</code> | The maximum age in milliseconds of a possible cached position that is acceptable to return | <code>0</code> | 1.0.0 |
179
+ | **`minimumUpdateInterval`** | <code>number</code> | The minumum update interval for location updates. If location updates are available faster than this interval then an update will only occur if the minimum update interval has expired since the last location update. This parameter is only available for Android. It has no effect on iOS or Web platforms. | <code>5000</code> | 6.1.0 |
179
180
 
180
181
 
181
182
  #### ClearWatchOptions
@@ -1,10 +1,10 @@
1
1
  ext {
2
2
  capacitorVersion = System.getenv('CAPACITOR_VERSION')
3
3
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
4
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
5
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
6
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
7
- playServicesLocationVersion = project.hasProperty('playServicesLocationVersion') ? rootProject.ext.playServicesLocationVersion : '21.1.0'
4
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
5
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
6
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
7
+ playServicesLocationVersion = project.hasProperty('playServicesLocationVersion') ? rootProject.ext.playServicesLocationVersion : '21.3.0'
8
8
  }
9
9
 
10
10
  buildscript {
@@ -16,7 +16,7 @@ buildscript {
16
16
  }
17
17
  }
18
18
  dependencies {
19
- classpath 'com.android.tools.build:gradle:8.2.1'
19
+ classpath 'com.android.tools.build:gradle:8.7.2'
20
20
  if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
21
21
  classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
22
22
  }
@@ -32,10 +32,10 @@ if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
32
32
 
33
33
  android {
34
34
  namespace "com.capacitorjs.plugins.geolocation"
35
- compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
35
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
36
36
  defaultConfig {
37
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
38
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
37
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
38
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
39
39
  versionCode 1
40
40
  versionName "1.0"
41
41
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -50,8 +50,8 @@ android {
50
50
  abortOnError false
51
51
  }
52
52
  compileOptions {
53
- sourceCompatibility JavaVersion.VERSION_17
54
- targetCompatibility JavaVersion.VERSION_17
53
+ sourceCompatibility JavaVersion.VERSION_21
54
+ targetCompatibility JavaVersion.VERSION_21
55
55
  }
56
56
  publishing {
57
57
  singleVariant("release")
@@ -68,7 +68,12 @@ public class Geolocation {
68
68
  }
69
69
 
70
70
  @SuppressWarnings("MissingPermission")
71
- public void requestLocationUpdates(boolean enableHighAccuracy, int timeout, final LocationResultCallback resultCallback) {
71
+ public void requestLocationUpdates(
72
+ boolean enableHighAccuracy,
73
+ int timeout,
74
+ int minUpdateInterval,
75
+ final LocationResultCallback resultCallback
76
+ ) {
72
77
  int resultCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
73
78
  if (resultCode == ConnectionResult.SUCCESS) {
74
79
  clearLocationUpdates();
@@ -87,7 +92,7 @@ public class Geolocation {
87
92
 
88
93
  LocationRequest locationRequest = new LocationRequest.Builder(10000)
89
94
  .setMaxUpdateDelayMillis(timeout)
90
- .setMinUpdateIntervalMillis(5000)
95
+ .setMinUpdateIntervalMillis(minUpdateInterval)
91
96
  .setPriority(priority)
92
97
  .build();
93
98
 
@@ -172,10 +172,12 @@ public class GeolocationPlugin extends Plugin {
172
172
  @SuppressWarnings("MissingPermission")
173
173
  private void startWatch(final PluginCall call) {
174
174
  int timeout = call.getInt("timeout", 10000);
175
+ int minUpdateInterval = call.getInt("minimumUpdateInterval", 5000);
175
176
 
176
177
  implementation.requestLocationUpdates(
177
178
  isHighAccuracy(call),
178
179
  timeout,
180
+ minUpdateInterval,
179
181
  new LocationResultCallback() {
180
182
  @Override
181
183
  public void success(Location location) {
package/dist/docs.json CHANGED
@@ -214,6 +214,22 @@
214
214
  "docs": "The maximum age in milliseconds of a possible cached position that is acceptable to return",
215
215
  "complexTypes": [],
216
216
  "type": "number | undefined"
217
+ },
218
+ {
219
+ "name": "minimumUpdateInterval",
220
+ "tags": [
221
+ {
222
+ "text": "5000",
223
+ "name": "default"
224
+ },
225
+ {
226
+ "text": "6.1.0",
227
+ "name": "since"
228
+ }
229
+ ],
230
+ "docs": "The minumum update interval for location updates.\n\nIf location updates are available faster than this interval then an update\nwill only occur if the minimum update interval has expired since the last location update.\n\nThis parameter is only available for Android. It has no effect on iOS or Web platforms.",
231
+ "complexTypes": [],
232
+ "type": "number | undefined"
217
233
  }
218
234
  ]
219
235
  },
@@ -153,6 +153,18 @@ export interface PositionOptions {
153
153
  * @since 1.0.0
154
154
  */
155
155
  maximumAge?: number;
156
+ /**
157
+ * The minumum update interval for location updates.
158
+ *
159
+ * If location updates are available faster than this interval then an update
160
+ * will only occur if the minimum update interval has expired since the last location update.
161
+ *
162
+ * This parameter is only available for Android. It has no effect on iOS or Web platforms.
163
+ *
164
+ * @default 5000
165
+ * @since 6.1.0
166
+ */
167
+ minimumUpdateInterval?: number;
156
168
  }
157
169
  export declare type WatchPositionCallback = (position: Position | null, err?: any) => void;
158
170
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\nexport type CallbackID = string;\n\nexport interface PermissionStatus {\n /**\n * Permission state for location alias.\n *\n * On Android it requests/checks both ACCESS_COARSE_LOCATION and\n * ACCESS_FINE_LOCATION permissions.\n *\n * On iOS and web it requests/checks location permission.\n *\n * @since 1.0.0\n */\n location: PermissionState;\n\n /**\n * Permission state for coarseLocation alias.\n *\n * On Android it requests/checks ACCESS_COARSE_LOCATION.\n *\n * On Android 12+, users can choose between Approximate location (ACCESS_COARSE_LOCATION) or\n * Precise location (ACCESS_FINE_LOCATION), so this alias can be used if the app doesn't\n * need high accuracy.\n *\n * On iOS and web it will have the same value as location alias.\n *\n * @since 1.2.0\n */\n coarseLocation: PermissionState;\n}\n\nexport type GeolocationPermissionType = 'location' | 'coarseLocation';\n\nexport interface GeolocationPluginPermissions {\n permissions: GeolocationPermissionType[];\n}\n\nexport interface GeolocationPlugin {\n /**\n * Get the current GPS location of the device\n *\n * @since 1.0.0\n */\n getCurrentPosition(options?: PositionOptions): Promise<Position>;\n\n /**\n * Set up a watch for location changes. Note that watching for location changes\n * can consume a large amount of energy. Be smart about listening only when you need to.\n *\n * @since 1.0.0\n */\n watchPosition(\n options: PositionOptions,\n callback: WatchPositionCallback,\n ): Promise<CallbackID>;\n\n /**\n * Clear a given watch\n *\n * @since 1.0.0\n */\n clearWatch(options: ClearWatchOptions): Promise<void>;\n\n /**\n * Check location permissions. Will throw if system location services are disabled.\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request location permissions. Will throw if system location services are disabled.\n *\n * @since 1.0.0\n */\n requestPermissions(\n permissions?: GeolocationPluginPermissions,\n ): Promise<PermissionStatus>;\n}\n\nexport interface ClearWatchOptions {\n id: CallbackID;\n}\n\nexport interface Position {\n /**\n * Creation timestamp for coords\n *\n * @since 1.0.0\n */\n timestamp: number;\n\n /**\n * The GPS coordinates along with the accuracy of the data\n *\n * @since 1.0.0\n */\n coords: {\n /**\n * Latitude in decimal degrees\n *\n * @since 1.0.0\n */\n latitude: number;\n\n /**\n * longitude in decimal degrees\n *\n * @since 1.0.0\n */\n longitude: number;\n\n /**\n * Accuracy level of the latitude and longitude coordinates in meters\n *\n * @since 1.0.0\n */\n accuracy: number;\n\n /**\n * Accuracy level of the altitude coordinate in meters, if available.\n *\n * Available on all iOS versions and on Android 8.0+.\n *\n * @since 1.0.0\n */\n altitudeAccuracy: number | null | undefined;\n\n /**\n * The altitude the user is at (if available)\n *\n * @since 1.0.0\n */\n altitude: number | null;\n\n /**\n * The speed the user is traveling (if available)\n *\n * @since 1.0.0\n */\n speed: number | null;\n\n /**\n * The heading the user is facing (if available)\n *\n * @since 1.0.0\n */\n heading: number | null;\n };\n}\n\nexport interface PositionOptions {\n /**\n * High accuracy mode (such as GPS, if available)\n *\n * On Android 12+ devices it will be ignored if users didn't grant\n * ACCESS_FINE_LOCATION permissions (can be checked with location alias).\n *\n * @default false\n * @since 1.0.0\n */\n enableHighAccuracy?: boolean;\n\n /**\n * The maximum wait time in milliseconds for location updates.\n *\n * In Android, since version 4.0.0 of the plugin, timeout gets ignored for getCurrentPosition.\n *\n * @default 10000\n * @since 1.0.0\n */\n timeout?: number;\n\n /**\n * The maximum age in milliseconds of a possible cached position that is acceptable to return\n *\n * @default 0\n * @since 1.0.0\n */\n maximumAge?: number;\n}\n\nexport type WatchPositionCallback = (\n position: Position | null,\n err?: any,\n) => void;\n\n/**\n * @deprecated Use `PositionOptions`.\n * @since 1.0.0\n */\nexport type GeolocationOptions = PositionOptions;\n\n/**\n * @deprecated Use `WatchPositionCallback`.\n * @since 1.0.0\n */\nexport type GeolocationWatchCallback = WatchPositionCallback;\n\n/**\n * @deprecated Use `Position`.\n * @since 1.0.0\n */\nexport type GeolocationPosition = Position;\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\nexport type CallbackID = string;\n\nexport interface PermissionStatus {\n /**\n * Permission state for location alias.\n *\n * On Android it requests/checks both ACCESS_COARSE_LOCATION and\n * ACCESS_FINE_LOCATION permissions.\n *\n * On iOS and web it requests/checks location permission.\n *\n * @since 1.0.0\n */\n location: PermissionState;\n\n /**\n * Permission state for coarseLocation alias.\n *\n * On Android it requests/checks ACCESS_COARSE_LOCATION.\n *\n * On Android 12+, users can choose between Approximate location (ACCESS_COARSE_LOCATION) or\n * Precise location (ACCESS_FINE_LOCATION), so this alias can be used if the app doesn't\n * need high accuracy.\n *\n * On iOS and web it will have the same value as location alias.\n *\n * @since 1.2.0\n */\n coarseLocation: PermissionState;\n}\n\nexport type GeolocationPermissionType = 'location' | 'coarseLocation';\n\nexport interface GeolocationPluginPermissions {\n permissions: GeolocationPermissionType[];\n}\n\nexport interface GeolocationPlugin {\n /**\n * Get the current GPS location of the device\n *\n * @since 1.0.0\n */\n getCurrentPosition(options?: PositionOptions): Promise<Position>;\n\n /**\n * Set up a watch for location changes. Note that watching for location changes\n * can consume a large amount of energy. Be smart about listening only when you need to.\n *\n * @since 1.0.0\n */\n watchPosition(\n options: PositionOptions,\n callback: WatchPositionCallback,\n ): Promise<CallbackID>;\n\n /**\n * Clear a given watch\n *\n * @since 1.0.0\n */\n clearWatch(options: ClearWatchOptions): Promise<void>;\n\n /**\n * Check location permissions. Will throw if system location services are disabled.\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request location permissions. Will throw if system location services are disabled.\n *\n * @since 1.0.0\n */\n requestPermissions(\n permissions?: GeolocationPluginPermissions,\n ): Promise<PermissionStatus>;\n}\n\nexport interface ClearWatchOptions {\n id: CallbackID;\n}\n\nexport interface Position {\n /**\n * Creation timestamp for coords\n *\n * @since 1.0.0\n */\n timestamp: number;\n\n /**\n * The GPS coordinates along with the accuracy of the data\n *\n * @since 1.0.0\n */\n coords: {\n /**\n * Latitude in decimal degrees\n *\n * @since 1.0.0\n */\n latitude: number;\n\n /**\n * longitude in decimal degrees\n *\n * @since 1.0.0\n */\n longitude: number;\n\n /**\n * Accuracy level of the latitude and longitude coordinates in meters\n *\n * @since 1.0.0\n */\n accuracy: number;\n\n /**\n * Accuracy level of the altitude coordinate in meters, if available.\n *\n * Available on all iOS versions and on Android 8.0+.\n *\n * @since 1.0.0\n */\n altitudeAccuracy: number | null | undefined;\n\n /**\n * The altitude the user is at (if available)\n *\n * @since 1.0.0\n */\n altitude: number | null;\n\n /**\n * The speed the user is traveling (if available)\n *\n * @since 1.0.0\n */\n speed: number | null;\n\n /**\n * The heading the user is facing (if available)\n *\n * @since 1.0.0\n */\n heading: number | null;\n };\n}\n\nexport interface PositionOptions {\n /**\n * High accuracy mode (such as GPS, if available)\n *\n * On Android 12+ devices it will be ignored if users didn't grant\n * ACCESS_FINE_LOCATION permissions (can be checked with location alias).\n *\n * @default false\n * @since 1.0.0\n */\n enableHighAccuracy?: boolean;\n\n /**\n * The maximum wait time in milliseconds for location updates.\n *\n * In Android, since version 4.0.0 of the plugin, timeout gets ignored for getCurrentPosition.\n *\n * @default 10000\n * @since 1.0.0\n */\n timeout?: number;\n\n /**\n * The maximum age in milliseconds of a possible cached position that is acceptable to return\n *\n * @default 0\n * @since 1.0.0\n */\n maximumAge?: number;\n\n /**\n * The minumum update interval for location updates.\n *\n * If location updates are available faster than this interval then an update\n * will only occur if the minimum update interval has expired since the last location update.\n *\n * This parameter is only available for Android. It has no effect on iOS or Web platforms.\n *\n * @default 5000\n * @since 6.1.0\n */\n minimumUpdateInterval?: number;\n}\n\nexport type WatchPositionCallback = (\n position: Position | null,\n err?: any,\n) => void;\n\n/**\n * @deprecated Use `PositionOptions`.\n * @since 1.0.0\n */\nexport type GeolocationOptions = PositionOptions;\n\n/**\n * @deprecated Use `WatchPositionCallback`.\n * @since 1.0.0\n */\nexport type GeolocationWatchCallback = WatchPositionCallback;\n\n/**\n * @deprecated Use `Position`.\n * @since 1.0.0\n */\nexport type GeolocationPosition = Position;\n"]}
package/dist/esm/web.js CHANGED
@@ -14,7 +14,7 @@ export class GeolocationWeb extends WebPlugin {
14
14
  callback(pos);
15
15
  }, err => {
16
16
  callback(null, err);
17
- }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));
17
+ }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0, minimumUpdateInterval: 5000 }, options));
18
18
  return `${id}`;
19
19
  }
20
20
  async clearWatch(options) {
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C,MAAM,OAAO,cAAe,SAAQ,SAA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C;YAC1D,IAAI,EAAE,aAAa;SACpB,CAAC,CAAC;QACH,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF;AAED,MAAM,WAAW,GAAG,IAAI,cAAc,EAAE,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n CallbackID,\n GeolocationPlugin,\n PermissionStatus,\n Position,\n PositionOptions,\n WatchPositionCallback,\n} from './definitions';\n\nexport class GeolocationWeb extends WebPlugin implements GeolocationPlugin {\n async getCurrentPosition(options?: PositionOptions): Promise<Position> {\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(\n pos => {\n resolve(pos);\n },\n err => {\n reject(err);\n },\n {\n enableHighAccuracy: false,\n timeout: 10000,\n maximumAge: 0,\n ...options,\n },\n );\n });\n }\n\n async watchPosition(\n options: PositionOptions,\n callback: WatchPositionCallback,\n ): Promise<CallbackID> {\n const id = navigator.geolocation.watchPosition(\n pos => {\n callback(pos);\n },\n err => {\n callback(null, err);\n },\n {\n enableHighAccuracy: false,\n timeout: 10000,\n maximumAge: 0,\n ...options,\n },\n );\n\n return `${id}`;\n }\n\n async clearWatch(options: { id: string }): Promise<void> {\n window.navigator.geolocation.clearWatch(parseInt(options.id, 10));\n }\n\n async checkPermissions(): Promise<PermissionStatus> {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n\n const permission = await window.navigator.permissions.query({\n name: 'geolocation',\n });\n return { location: permission.state, coarseLocation: permission.state };\n }\n\n async requestPermissions(): Promise<PermissionStatus> {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n\nconst Geolocation = new GeolocationWeb();\n\nexport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AAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;YAC9D,MAAM,IAAI,CAAC,WAAW,CAAC,+CAA+C,CAAC,CAAC;SACzE;QAED,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC;YAC1D,IAAI,EAAE,aAAa;SACpB,CAAC,CAAC;QACH,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF;AAED,MAAM,WAAW,GAAG,IAAI,cAAc,EAAE,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n CallbackID,\n GeolocationPlugin,\n PermissionStatus,\n Position,\n PositionOptions,\n WatchPositionCallback,\n} from './definitions';\n\nexport class GeolocationWeb extends WebPlugin implements GeolocationPlugin {\n async getCurrentPosition(options?: PositionOptions): Promise<Position> {\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(\n pos => {\n resolve(pos);\n },\n err => {\n reject(err);\n },\n {\n enableHighAccuracy: false,\n timeout: 10000,\n maximumAge: 0,\n ...options,\n },\n );\n });\n }\n\n async watchPosition(\n options: PositionOptions,\n callback: WatchPositionCallback,\n ): Promise<CallbackID> {\n const id = navigator.geolocation.watchPosition(\n pos => {\n callback(pos);\n },\n err => {\n callback(null, err);\n },\n {\n enableHighAccuracy: false,\n timeout: 10000,\n maximumAge: 0,\n minimumUpdateInterval: 5000,\n ...options,\n },\n );\n\n return `${id}`;\n }\n\n async clearWatch(options: { id: string }): Promise<void> {\n window.navigator.geolocation.clearWatch(parseInt(options.id, 10));\n }\n\n async checkPermissions(): Promise<PermissionStatus> {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n\n const permission = await window.navigator.permissions.query({\n name: 'geolocation',\n });\n return { location: permission.state, coarseLocation: permission.state };\n }\n\n async requestPermissions(): Promise<PermissionStatus> {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n\nconst Geolocation = new GeolocationWeb();\n\nexport { Geolocation };\n"]}
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var core = require('@capacitor/core');
6
4
 
7
5
  const Geolocation$1 = core.registerPlugin('Geolocation', {
@@ -23,7 +21,7 @@ class GeolocationWeb extends core.WebPlugin {
23
21
  callback(pos);
24
22
  }, err => {
25
23
  callback(null, err);
26
- }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));
24
+ }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0, minimumUpdateInterval: 5000 }, options));
27
25
  return `${id}`;
28
26
  }
29
27
  async clearWatch(options) {
@@ -46,8 +44,8 @@ const Geolocation = new GeolocationWeb();
46
44
 
47
45
  var web = /*#__PURE__*/Object.freeze({
48
46
  __proto__: null,
49
- GeolocationWeb: GeolocationWeb,
50
- Geolocation: Geolocation
47
+ Geolocation: Geolocation,
48
+ GeolocationWeb: GeolocationWeb
51
49
  });
52
50
 
53
51
  exports.Geolocation = Geolocation$1;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Geolocation = registerPlugin('Geolocation', {\n web: () => import('./web').then(m => new m.GeolocationWeb()),\n});\nexport * from './definitions';\nexport { Geolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class GeolocationWeb extends WebPlugin {\n async getCurrentPosition(options) {\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(pos => {\n resolve(pos);\n }, err => {\n reject(err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));\n });\n }\n async watchPosition(options, callback) {\n const id = navigator.geolocation.watchPosition(pos => {\n callback(pos);\n }, err => {\n callback(null, err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));\n return `${id}`;\n }\n async clearWatch(options) {\n window.navigator.geolocation.clearWatch(parseInt(options.id, 10));\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n const permission = await window.navigator.permissions.query({\n name: 'geolocation',\n });\n return { location: permission.state, coarseLocation: permission.state };\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\nconst Geolocation = new GeolocationWeb();\nexport { Geolocation };\n//# sourceMappingURL=web.js.map"],"names":["Geolocation","registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAACA,aAAW,GAAGC,mBAAc,CAAC,aAAa,EAAE;AAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AAChE,CAAC;;ACFM,MAAM,cAAc,SAASC,cAAS,CAAC;AAC9C,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;AACtC,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAChD,YAAY,SAAS,CAAC,WAAW,CAAC,kBAAkB,CAAC,GAAG,IAAI;AAC5D,gBAAgB,OAAO,CAAC,GAAG,CAAC,CAAC;AAC7B,aAAa,EAAE,GAAG,IAAI;AACtB,gBAAgB,MAAM,CAAC,GAAG,CAAC,CAAC;AAC5B,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;AACrG,SAAS,CAAC,CAAC;AACX,K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ACD,MAAM,WAAW,GAAG,IAAI,cAAc,EAAE;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Geolocation = registerPlugin('Geolocation', {\n web: () => import('./web').then(m => new m.GeolocationWeb()),\n});\nexport * from './definitions';\nexport { Geolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class GeolocationWeb extends WebPlugin {\n async getCurrentPosition(options) {\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(pos => {\n resolve(pos);\n }, err => {\n reject(err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));\n });\n }\n async watchPosition(options, callback) {\n const id = navigator.geolocation.watchPosition(pos => {\n callback(pos);\n }, err => {\n callback(null, err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0, minimumUpdateInterval: 5000 }, options));\n return `${id}`;\n }\n async clearWatch(options) {\n window.navigator.geolocation.clearWatch(parseInt(options.id, 10));\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n const permission = await window.navigator.permissions.query({\n name: 'geolocation',\n });\n return { location: permission.state, coarseLocation: permission.state };\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\nconst Geolocation = new GeolocationWeb();\nexport { Geolocation };\n//# sourceMappingURL=web.js.map"],"names":["Geolocation","registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAACA,aAAW,GAAGC,mBAAc,CAAC,aAAa,EAAE;AAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AAChE,CAAC;;ACFM,MAAM,cAAc,SAASC,cAAS,CAAC;AAC9C,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;AACtC,QAAQ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,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC;AACpE,YAAY,IAAI,EAAE,aAAa;AAC/B,SAAS,CAAC;AACV,QAAQ,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,UAAU,CAAC,KAAK,EAAE;AAC/E;AACA,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D;AACA;AACA,MAAM,WAAW,GAAG,IAAI,cAAc,EAAE;;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -20,7 +20,7 @@ var capacitorGeolocation = (function (exports, core) {
20
20
  callback(pos);
21
21
  }, err => {
22
22
  callback(null, err);
23
- }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));
23
+ }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0, minimumUpdateInterval: 5000 }, options));
24
24
  return `${id}`;
25
25
  }
26
26
  async clearWatch(options) {
@@ -43,14 +43,12 @@ var capacitorGeolocation = (function (exports, core) {
43
43
 
44
44
  var web = /*#__PURE__*/Object.freeze({
45
45
  __proto__: null,
46
- GeolocationWeb: GeolocationWeb,
47
- Geolocation: Geolocation
46
+ Geolocation: Geolocation,
47
+ GeolocationWeb: GeolocationWeb
48
48
  });
49
49
 
50
50
  exports.Geolocation = Geolocation$1;
51
51
 
52
- Object.defineProperty(exports, '__esModule', { value: true });
53
-
54
52
  return exports;
55
53
 
56
54
  })({}, capacitorExports);
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Geolocation = registerPlugin('Geolocation', {\n web: () => import('./web').then(m => new m.GeolocationWeb()),\n});\nexport * from './definitions';\nexport { Geolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class GeolocationWeb extends WebPlugin {\n async getCurrentPosition(options) {\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(pos => {\n resolve(pos);\n }, err => {\n reject(err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));\n });\n }\n async watchPosition(options, callback) {\n const id = navigator.geolocation.watchPosition(pos => {\n callback(pos);\n }, err => {\n callback(null, err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));\n return `${id}`;\n }\n async clearWatch(options) {\n window.navigator.geolocation.clearWatch(parseInt(options.id, 10));\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n const permission = await window.navigator.permissions.query({\n name: 'geolocation',\n });\n return { location: permission.state, coarseLocation: permission.state };\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\nconst Geolocation = new GeolocationWeb();\nexport { Geolocation };\n//# sourceMappingURL=web.js.map"],"names":["Geolocation","registerPlugin","WebPlugin"],"mappings":";;;AACK,UAACA,aAAW,GAAGC,mBAAc,CAAC,aAAa,EAAE;IAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAChE,CAAC;;ICFM,MAAM,cAAc,SAASC,cAAS,CAAC;IAC9C,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;IACtC,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;IAChD,YAAY,SAAS,CAAC,WAAW,CAAC,kBAAkB,CAAC,GAAG,IAAI;IAC5D,gBAAgB,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7B,aAAa,EAAE,GAAG,IAAI;IACtB,gBAAgB,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,kBAAkB,EAAE,KAAK,EA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,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,CAAC;IACD,MAAM,WAAW,GAAG,IAAI,cAAc,EAAE;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Geolocation = registerPlugin('Geolocation', {\n web: () => import('./web').then(m => new m.GeolocationWeb()),\n});\nexport * from './definitions';\nexport { Geolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class GeolocationWeb extends WebPlugin {\n async getCurrentPosition(options) {\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(pos => {\n resolve(pos);\n }, err => {\n reject(err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));\n });\n }\n async watchPosition(options, callback) {\n const id = navigator.geolocation.watchPosition(pos => {\n callback(pos);\n }, err => {\n callback(null, err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0, minimumUpdateInterval: 5000 }, options));\n return `${id}`;\n }\n async clearWatch(options) {\n window.navigator.geolocation.clearWatch(parseInt(options.id, 10));\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n const permission = await window.navigator.permissions.query({\n name: 'geolocation',\n });\n return { location: permission.state, coarseLocation: permission.state };\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\nconst Geolocation = new GeolocationWeb();\nexport { Geolocation };\n//# sourceMappingURL=web.js.map"],"names":["Geolocation","registerPlugin","WebPlugin"],"mappings":";;;AACK,UAACA,aAAW,GAAGC,mBAAc,CAAC,aAAa,EAAE;IAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,cAAc,EA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,WAAW,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;IACxE,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,+CAA+C,CAAC;IACnF;IACA,QAAQ,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC;IACpE,YAAY,IAAI,EAAE,aAAa;IAC/B,SAAS,CAAC;IACV,QAAQ,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,UAAU,CAAC,KAAK,EAAE;IAC/E;IACA,IAAI,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D;IACA;IACA,MAAM,WAAW,GAAG,IAAI,cAAc,EAAE;;;;;;;;;;;;;;;;"}
@@ -38,7 +38,7 @@ public class GeolocationPlugin: CAPPlugin, CLLocationManagerDelegate, CAPBridged
38
38
  self.locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers
39
39
  }
40
40
 
41
- if CLLocationManager.authorizationStatus() == .notDetermined {
41
+ if self.locationManager.authorizationStatus == .notDetermined {
42
42
  self.locationManager.requestWhenInUseAuthorization()
43
43
  } else {
44
44
  self.locationManager.requestLocation()
@@ -59,7 +59,7 @@ public class GeolocationPlugin: CAPPlugin, CLLocationManagerDelegate, CAPBridged
59
59
  self.locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers
60
60
  }
61
61
 
62
- if CLLocationManager.authorizationStatus() == .notDetermined {
62
+ if self.locationManager.authorizationStatus == .notDetermined {
63
63
  self.locationManager.requestWhenInUseAuthorization()
64
64
  } else {
65
65
  self.locationManager.startUpdatingLocation()
@@ -121,13 +121,15 @@ public class GeolocationPlugin: CAPPlugin, CLLocationManagerDelegate, CAPBridged
121
121
  }
122
122
  }
123
123
 
124
- public func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
124
+ public func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
125
125
  let removalQueue = callQueue.filter { $0.value == .permissions }
126
126
  callQueue = callQueue.filter { $0.value != .permissions }
127
127
 
128
128
  for (id, _) in removalQueue {
129
129
  if let call = bridge?.savedCall(withID: id) {
130
- checkPermissions(call)
130
+ DispatchQueue(label: "permissionsQueue").async {
131
+ self.checkPermissions(call)
132
+ }
131
133
  bridge?.releaseCall(call)
132
134
  }
133
135
  }
@@ -161,7 +163,7 @@ public class GeolocationPlugin: CAPPlugin, CLLocationManagerDelegate, CAPBridged
161
163
  var status: String = ""
162
164
 
163
165
  if CLLocationManager.locationServicesEnabled() {
164
- switch CLLocationManager.authorizationStatus() {
166
+ switch self.locationManager.authorizationStatus {
165
167
  case .notDetermined:
166
168
  status = "prompt"
167
169
  case .restricted, .denied:
@@ -188,7 +190,7 @@ public class GeolocationPlugin: CAPPlugin, CLLocationManagerDelegate, CAPBridged
188
190
  if CLLocationManager.locationServicesEnabled() {
189
191
  // If state is not yet determined, request perms.
190
192
  // Otherwise, report back the state right away
191
- if CLLocationManager.authorizationStatus() == .notDetermined {
193
+ if self.locationManager.authorizationStatus == .notDetermined {
192
194
  bridge?.saveCall(call)
193
195
  callQueue[call.callbackId] = .permissions
194
196
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/geolocation",
3
- "version": "6.0.2",
3
+ "version": "7.0.0-alpha.1",
4
4
  "description": "The Geolocation API provides simple methods for getting and tracking the current position of the device using GPS, along with altitude, heading, and speed information if available.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  "scripts": {
33
33
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
34
- "verify:ios": "xcodebuild build -scheme CapacitorGeolocation -sdk iphonesimulator17.0 -destination 'OS=17.0,name=iPhone 15'",
34
+ "verify:ios": "xcodebuild build -scheme CapacitorGeolocation -destination generic/platform=iOS",
35
35
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
36
36
  "verify:web": "npm run build",
37
37
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
@@ -40,30 +40,30 @@
40
40
  "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
41
41
  "swiftlint": "node-swiftlint",
42
42
  "docgen": "docgen --api GeolocationPlugin --output-readme README.md --output-json dist/docs.json",
43
- "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
43
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
44
44
  "clean": "rimraf ./dist",
45
45
  "watch": "tsc --watch",
46
46
  "prepublishOnly": "npm run build",
47
47
  "publish:cocoapod": "pod trunk push ./CapacitorGeolocation.podspec --allow-warnings"
48
48
  },
49
49
  "devDependencies": {
50
- "@capacitor/android": "^6.0.0",
51
- "@capacitor/core": "^6.0.0",
50
+ "@capacitor/android": "next",
51
+ "@capacitor/core": "next",
52
52
  "@capacitor/docgen": "0.2.2",
53
- "@capacitor/ios": "^6.0.0",
53
+ "@capacitor/ios": "next",
54
54
  "@ionic/eslint-config": "^0.4.0",
55
55
  "@ionic/prettier-config": "~1.0.1",
56
56
  "@ionic/swiftlint-config": "^1.1.2",
57
57
  "eslint": "^8.57.0",
58
58
  "prettier": "~2.3.0",
59
59
  "prettier-plugin-java": "~1.0.2",
60
- "rimraf": "^3.0.0",
61
- "rollup": "^2.29.0",
60
+ "rimraf": "^6.0.1",
61
+ "rollup": "^4.26.0",
62
62
  "swiftlint": "^1.0.1",
63
63
  "typescript": "~4.1.5"
64
64
  },
65
65
  "peerDependencies": {
66
- "@capacitor/core": "^6.0.0"
66
+ "@capacitor/core": "next"
67
67
  },
68
68
  "prettier": "@ionic/prettier-config",
69
69
  "swiftlint": "@ionic/swiftlint-config",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "6e94aa5bf785e957d0cfac83b62b5355bcf7d1ed"
84
+ "gitHead": "2158e6aa205a584a258c34f606e694fdf31cdcc0"
85
85
  }