@capgo/capacitor-pedometer 8.0.28 → 8.0.30
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.
|
@@ -24,7 +24,7 @@ import com.getcapacitor.annotation.PermissionCallback;
|
|
|
24
24
|
)
|
|
25
25
|
public class CapacitorPedometerPlugin extends Plugin implements SensorEventListener {
|
|
26
26
|
|
|
27
|
-
private final String pluginVersion = "8.0.
|
|
27
|
+
private final String pluginVersion = "8.0.30";
|
|
28
28
|
private static final String PERMISSION_GRANTED = "granted";
|
|
29
29
|
private static final String PERMISSION_DENIED = "denied";
|
|
30
30
|
private static final String PERMISSION_PROMPT = "prompt";
|
|
@@ -121,7 +121,7 @@ public class CapacitorPedometerPlugin extends Plugin implements SensorEventListe
|
|
|
121
121
|
@PluginMethod
|
|
122
122
|
public void requestPermissions(PluginCall call) {
|
|
123
123
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
124
|
-
if (getPermissionState(
|
|
124
|
+
if (getPermissionState("activityRecognition") != PermissionState.GRANTED) {
|
|
125
125
|
requestPermissionForAlias("activityRecognition", call, "permissionCallback");
|
|
126
126
|
} else {
|
|
127
127
|
JSObject result = new JSObject();
|
|
@@ -206,14 +206,17 @@ public class CapacitorPedometerPlugin extends Plugin implements SensorEventListe
|
|
|
206
206
|
|
|
207
207
|
private boolean hasActivityRecognitionPermission() {
|
|
208
208
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
209
|
-
return getPermissionState(
|
|
209
|
+
return getPermissionState("activityRecognition") == PermissionState.GRANTED;
|
|
210
210
|
}
|
|
211
211
|
return true; // No permission needed on older Android versions
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
private String getPermissionState() {
|
|
215
215
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
216
|
-
PermissionState state = getPermissionState(
|
|
216
|
+
PermissionState state = getPermissionState("activityRecognition");
|
|
217
|
+
if (state == null) {
|
|
218
|
+
return PERMISSION_PROMPT;
|
|
219
|
+
}
|
|
217
220
|
switch (state) {
|
|
218
221
|
case GRANTED:
|
|
219
222
|
return PERMISSION_GRANTED;
|
|
@@ -4,7 +4,7 @@ import Foundation
|
|
|
4
4
|
|
|
5
5
|
@objc(CapacitorPedometerPlugin)
|
|
6
6
|
public class CapacitorPedometerPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
7
|
-
private let pluginVersion: String = "8.0.
|
|
7
|
+
private let pluginVersion: String = "8.0.30"
|
|
8
8
|
public let identifier = "CapacitorPedometerPlugin"
|
|
9
9
|
public let jsName = "CapacitorPedometer"
|
|
10
10
|
public let pluginMethods: [CAPPluginMethod] = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-pedometer",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.30",
|
|
4
4
|
"description": "Capacitor plugin for accessing pedometer data including steps, distance, pace, cadence, and floors",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|