@capgo/capacitor-accelerometer 7.0.0
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/CapgoCapacitorAccelerometer.podspec +17 -0
- package/LICENSE +21 -0
- package/Package.swift +28 -0
- package/README.md +243 -0
- package/android/build.gradle +57 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/app/capgo/accelerometer/CapacitorAccelerometerPlugin.java +160 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +367 -0
- package/dist/esm/definitions.d.ts +141 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +19 -0
- package/dist/esm/web.js +95 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +109 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +112 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/CapacitorAccelerometerPlugin/CapacitorAccelerometerPlugin.swift +114 -0
- package/ios/Tests/CapacitorAccelerometerPluginTests/CapacitorAccelerometerPluginTests.swift +9 -0
- package/package.json +89 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
const CapacitorAccelerometer = core.registerPlugin('CapacitorAccelerometer', {
|
|
6
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorAccelerometerWeb()),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const DEFAULT_MEASUREMENT = { x: 0, y: 0, z: 0 };
|
|
10
|
+
class CapacitorAccelerometerWeb extends core.WebPlugin {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.lastMeasurement = Object.assign({}, DEFAULT_MEASUREMENT);
|
|
14
|
+
this.motionHandler = null;
|
|
15
|
+
this.permissionState = 'prompt';
|
|
16
|
+
this.handleMotion = (event) => {
|
|
17
|
+
var _a, _b, _c, _d;
|
|
18
|
+
const accel = (_a = event.accelerationIncludingGravity) !== null && _a !== void 0 ? _a : event.acceleration;
|
|
19
|
+
if (!accel) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
this.lastMeasurement = {
|
|
23
|
+
x: (_b = accel.x) !== null && _b !== void 0 ? _b : 0,
|
|
24
|
+
y: (_c = accel.y) !== null && _c !== void 0 ? _c : 0,
|
|
25
|
+
z: (_d = accel.z) !== null && _d !== void 0 ? _d : 0,
|
|
26
|
+
};
|
|
27
|
+
this.notifyListeners('measurement', Object.assign({}, this.lastMeasurement));
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
supportsDeviceMotion() {
|
|
31
|
+
return typeof window !== 'undefined' && typeof window.DeviceMotionEvent !== 'undefined';
|
|
32
|
+
}
|
|
33
|
+
get motionEventConstructor() {
|
|
34
|
+
return this.supportsDeviceMotion() ? window.DeviceMotionEvent : null;
|
|
35
|
+
}
|
|
36
|
+
async getMeasurement() {
|
|
37
|
+
return Object.assign({}, this.lastMeasurement);
|
|
38
|
+
}
|
|
39
|
+
async isAvailable() {
|
|
40
|
+
return { isAvailable: this.supportsDeviceMotion() };
|
|
41
|
+
}
|
|
42
|
+
async startMeasurementUpdates() {
|
|
43
|
+
await this.ensurePermission(true);
|
|
44
|
+
if (!this.supportsDeviceMotion()) {
|
|
45
|
+
throw this.unavailable('DeviceMotionEvent is not available in this browser.');
|
|
46
|
+
}
|
|
47
|
+
if (this.motionHandler) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.motionHandler = this.handleMotion;
|
|
51
|
+
window.addEventListener('devicemotion', this.motionHandler);
|
|
52
|
+
}
|
|
53
|
+
async stopMeasurementUpdates() {
|
|
54
|
+
if (this.motionHandler && this.supportsDeviceMotion()) {
|
|
55
|
+
window.removeEventListener('devicemotion', this.motionHandler);
|
|
56
|
+
}
|
|
57
|
+
this.motionHandler = null;
|
|
58
|
+
}
|
|
59
|
+
async checkPermissions() {
|
|
60
|
+
await this.ensurePermission(false);
|
|
61
|
+
return { accelerometer: this.permissionState };
|
|
62
|
+
}
|
|
63
|
+
async requestPermissions() {
|
|
64
|
+
await this.ensurePermission(true);
|
|
65
|
+
return { accelerometer: this.permissionState };
|
|
66
|
+
}
|
|
67
|
+
async addListener(eventName, listenerFunc) {
|
|
68
|
+
const handle = await super.addListener(eventName, listenerFunc);
|
|
69
|
+
return handle;
|
|
70
|
+
}
|
|
71
|
+
async removeAllListeners() {
|
|
72
|
+
await super.removeAllListeners();
|
|
73
|
+
}
|
|
74
|
+
async ensurePermission(request) {
|
|
75
|
+
if (!this.supportsDeviceMotion()) {
|
|
76
|
+
this.permissionState = 'denied';
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const constructor = this.motionEventConstructor;
|
|
80
|
+
if (!(constructor === null || constructor === void 0 ? void 0 : constructor.requestPermission)) {
|
|
81
|
+
// Platforms without explicit permission prompts expose motion data if feature is available.
|
|
82
|
+
this.permissionState = 'granted';
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (!request) {
|
|
86
|
+
// We cannot probe state without prompting, assume prompt until user interacts.
|
|
87
|
+
if (this.permissionState === 'prompt') {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
const status = await constructor.requestPermission();
|
|
94
|
+
this.permissionState = status === 'granted' ? 'granted' : 'denied';
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.warn('CapacitorAccelerometer: permission request failed', error);
|
|
98
|
+
this.permissionState = 'denied';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
104
|
+
__proto__: null,
|
|
105
|
+
CapacitorAccelerometerWeb: CapacitorAccelerometerWeb
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
exports.CapacitorAccelerometer = CapacitorAccelerometer;
|
|
109
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorAccelerometer = registerPlugin('CapacitorAccelerometer', {\n web: () => import('./web').then((m) => new m.CapacitorAccelerometerWeb()),\n});\nexport * from './definitions';\nexport { CapacitorAccelerometer };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst DEFAULT_MEASUREMENT = { x: 0, y: 0, z: 0 };\nexport class CapacitorAccelerometerWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.lastMeasurement = Object.assign({}, DEFAULT_MEASUREMENT);\n this.motionHandler = null;\n this.permissionState = 'prompt';\n this.handleMotion = (event) => {\n var _a, _b, _c, _d;\n const accel = (_a = event.accelerationIncludingGravity) !== null && _a !== void 0 ? _a : event.acceleration;\n if (!accel) {\n return;\n }\n this.lastMeasurement = {\n x: (_b = accel.x) !== null && _b !== void 0 ? _b : 0,\n y: (_c = accel.y) !== null && _c !== void 0 ? _c : 0,\n z: (_d = accel.z) !== null && _d !== void 0 ? _d : 0,\n };\n this.notifyListeners('measurement', Object.assign({}, this.lastMeasurement));\n };\n }\n supportsDeviceMotion() {\n return typeof window !== 'undefined' && typeof window.DeviceMotionEvent !== 'undefined';\n }\n get motionEventConstructor() {\n return this.supportsDeviceMotion() ? window.DeviceMotionEvent : null;\n }\n async getMeasurement() {\n return Object.assign({}, this.lastMeasurement);\n }\n async isAvailable() {\n return { isAvailable: this.supportsDeviceMotion() };\n }\n async startMeasurementUpdates() {\n await this.ensurePermission(true);\n if (!this.supportsDeviceMotion()) {\n throw this.unavailable('DeviceMotionEvent is not available in this browser.');\n }\n if (this.motionHandler) {\n return;\n }\n this.motionHandler = this.handleMotion;\n window.addEventListener('devicemotion', this.motionHandler);\n }\n async stopMeasurementUpdates() {\n if (this.motionHandler && this.supportsDeviceMotion()) {\n window.removeEventListener('devicemotion', this.motionHandler);\n }\n this.motionHandler = null;\n }\n async checkPermissions() {\n await this.ensurePermission(false);\n return { accelerometer: this.permissionState };\n }\n async requestPermissions() {\n await this.ensurePermission(true);\n return { accelerometer: this.permissionState };\n }\n async addListener(eventName, listenerFunc) {\n const handle = await super.addListener(eventName, listenerFunc);\n return handle;\n }\n async removeAllListeners() {\n await super.removeAllListeners();\n }\n async ensurePermission(request) {\n if (!this.supportsDeviceMotion()) {\n this.permissionState = 'denied';\n return;\n }\n const constructor = this.motionEventConstructor;\n if (!(constructor === null || constructor === void 0 ? void 0 : constructor.requestPermission)) {\n // Platforms without explicit permission prompts expose motion data if feature is available.\n this.permissionState = 'granted';\n return;\n }\n if (!request) {\n // We cannot probe state without prompting, assume prompt until user interacts.\n if (this.permissionState === 'prompt') {\n return;\n }\n return;\n }\n try {\n const status = await constructor.requestPermission();\n this.permissionState = status === 'granted' ? 'granted' : 'denied';\n }\n catch (error) {\n console.warn('CapacitorAccelerometer: permission request failed', error);\n this.permissionState = 'denied';\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,sBAAsB,GAAGA,mBAAc,CAAC,wBAAwB,EAAE;AACxE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,yBAAyB,EAAE,CAAC;AAC7E,CAAC;;ACFD,MAAM,mBAAmB,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AACzC,MAAM,yBAAyB,SAASC,cAAS,CAAC;AACzD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;A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G,QAAQ;AAC3C,QAAQ;AACR,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var capacitorCapacitorAccelerometer = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const CapacitorAccelerometer = core.registerPlugin('CapacitorAccelerometer', {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorAccelerometerWeb()),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const DEFAULT_MEASUREMENT = { x: 0, y: 0, z: 0 };
|
|
9
|
+
class CapacitorAccelerometerWeb extends core.WebPlugin {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.lastMeasurement = Object.assign({}, DEFAULT_MEASUREMENT);
|
|
13
|
+
this.motionHandler = null;
|
|
14
|
+
this.permissionState = 'prompt';
|
|
15
|
+
this.handleMotion = (event) => {
|
|
16
|
+
var _a, _b, _c, _d;
|
|
17
|
+
const accel = (_a = event.accelerationIncludingGravity) !== null && _a !== void 0 ? _a : event.acceleration;
|
|
18
|
+
if (!accel) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
this.lastMeasurement = {
|
|
22
|
+
x: (_b = accel.x) !== null && _b !== void 0 ? _b : 0,
|
|
23
|
+
y: (_c = accel.y) !== null && _c !== void 0 ? _c : 0,
|
|
24
|
+
z: (_d = accel.z) !== null && _d !== void 0 ? _d : 0,
|
|
25
|
+
};
|
|
26
|
+
this.notifyListeners('measurement', Object.assign({}, this.lastMeasurement));
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
supportsDeviceMotion() {
|
|
30
|
+
return typeof window !== 'undefined' && typeof window.DeviceMotionEvent !== 'undefined';
|
|
31
|
+
}
|
|
32
|
+
get motionEventConstructor() {
|
|
33
|
+
return this.supportsDeviceMotion() ? window.DeviceMotionEvent : null;
|
|
34
|
+
}
|
|
35
|
+
async getMeasurement() {
|
|
36
|
+
return Object.assign({}, this.lastMeasurement);
|
|
37
|
+
}
|
|
38
|
+
async isAvailable() {
|
|
39
|
+
return { isAvailable: this.supportsDeviceMotion() };
|
|
40
|
+
}
|
|
41
|
+
async startMeasurementUpdates() {
|
|
42
|
+
await this.ensurePermission(true);
|
|
43
|
+
if (!this.supportsDeviceMotion()) {
|
|
44
|
+
throw this.unavailable('DeviceMotionEvent is not available in this browser.');
|
|
45
|
+
}
|
|
46
|
+
if (this.motionHandler) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this.motionHandler = this.handleMotion;
|
|
50
|
+
window.addEventListener('devicemotion', this.motionHandler);
|
|
51
|
+
}
|
|
52
|
+
async stopMeasurementUpdates() {
|
|
53
|
+
if (this.motionHandler && this.supportsDeviceMotion()) {
|
|
54
|
+
window.removeEventListener('devicemotion', this.motionHandler);
|
|
55
|
+
}
|
|
56
|
+
this.motionHandler = null;
|
|
57
|
+
}
|
|
58
|
+
async checkPermissions() {
|
|
59
|
+
await this.ensurePermission(false);
|
|
60
|
+
return { accelerometer: this.permissionState };
|
|
61
|
+
}
|
|
62
|
+
async requestPermissions() {
|
|
63
|
+
await this.ensurePermission(true);
|
|
64
|
+
return { accelerometer: this.permissionState };
|
|
65
|
+
}
|
|
66
|
+
async addListener(eventName, listenerFunc) {
|
|
67
|
+
const handle = await super.addListener(eventName, listenerFunc);
|
|
68
|
+
return handle;
|
|
69
|
+
}
|
|
70
|
+
async removeAllListeners() {
|
|
71
|
+
await super.removeAllListeners();
|
|
72
|
+
}
|
|
73
|
+
async ensurePermission(request) {
|
|
74
|
+
if (!this.supportsDeviceMotion()) {
|
|
75
|
+
this.permissionState = 'denied';
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const constructor = this.motionEventConstructor;
|
|
79
|
+
if (!(constructor === null || constructor === void 0 ? void 0 : constructor.requestPermission)) {
|
|
80
|
+
// Platforms without explicit permission prompts expose motion data if feature is available.
|
|
81
|
+
this.permissionState = 'granted';
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (!request) {
|
|
85
|
+
// We cannot probe state without prompting, assume prompt until user interacts.
|
|
86
|
+
if (this.permissionState === 'prompt') {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
const status = await constructor.requestPermission();
|
|
93
|
+
this.permissionState = status === 'granted' ? 'granted' : 'denied';
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
console.warn('CapacitorAccelerometer: permission request failed', error);
|
|
97
|
+
this.permissionState = 'denied';
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
103
|
+
__proto__: null,
|
|
104
|
+
CapacitorAccelerometerWeb: CapacitorAccelerometerWeb
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
exports.CapacitorAccelerometer = CapacitorAccelerometer;
|
|
108
|
+
|
|
109
|
+
return exports;
|
|
110
|
+
|
|
111
|
+
})({}, capacitorExports);
|
|
112
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorAccelerometer = registerPlugin('CapacitorAccelerometer', {\n web: () => import('./web').then((m) => new m.CapacitorAccelerometerWeb()),\n});\nexport * from './definitions';\nexport { CapacitorAccelerometer };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst DEFAULT_MEASUREMENT = { x: 0, y: 0, z: 0 };\nexport class CapacitorAccelerometerWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.lastMeasurement = Object.assign({}, DEFAULT_MEASUREMENT);\n this.motionHandler = null;\n this.permissionState = 'prompt';\n this.handleMotion = (event) => {\n var _a, _b, _c, _d;\n const accel = (_a = event.accelerationIncludingGravity) !== null && _a !== void 0 ? _a : event.acceleration;\n if (!accel) {\n return;\n }\n this.lastMeasurement = {\n x: (_b = accel.x) !== null && _b !== void 0 ? _b : 0,\n y: (_c = accel.y) !== null && _c !== void 0 ? _c : 0,\n z: (_d = accel.z) !== null && _d !== void 0 ? _d : 0,\n };\n this.notifyListeners('measurement', Object.assign({}, this.lastMeasurement));\n };\n }\n supportsDeviceMotion() {\n return typeof window !== 'undefined' && typeof window.DeviceMotionEvent !== 'undefined';\n }\n get motionEventConstructor() {\n return this.supportsDeviceMotion() ? window.DeviceMotionEvent : null;\n }\n async getMeasurement() {\n return Object.assign({}, this.lastMeasurement);\n }\n async isAvailable() {\n return { isAvailable: this.supportsDeviceMotion() };\n }\n async startMeasurementUpdates() {\n await this.ensurePermission(true);\n if (!this.supportsDeviceMotion()) {\n throw this.unavailable('DeviceMotionEvent is not available in this browser.');\n }\n if (this.motionHandler) {\n return;\n }\n this.motionHandler = this.handleMotion;\n window.addEventListener('devicemotion', this.motionHandler);\n }\n async stopMeasurementUpdates() {\n if (this.motionHandler && this.supportsDeviceMotion()) {\n window.removeEventListener('devicemotion', this.motionHandler);\n }\n this.motionHandler = null;\n }\n async checkPermissions() {\n await this.ensurePermission(false);\n return { accelerometer: this.permissionState };\n }\n async requestPermissions() {\n await this.ensurePermission(true);\n return { accelerometer: this.permissionState };\n }\n async addListener(eventName, listenerFunc) {\n const handle = await super.addListener(eventName, listenerFunc);\n return handle;\n }\n async removeAllListeners() {\n await super.removeAllListeners();\n }\n async ensurePermission(request) {\n if (!this.supportsDeviceMotion()) {\n this.permissionState = 'denied';\n return;\n }\n const constructor = this.motionEventConstructor;\n if (!(constructor === null || constructor === void 0 ? void 0 : constructor.requestPermission)) {\n // Platforms without explicit permission prompts expose motion data if feature is available.\n this.permissionState = 'granted';\n return;\n }\n if (!request) {\n // We cannot probe state without prompting, assume prompt until user interacts.\n if (this.permissionState === 'prompt') {\n return;\n }\n return;\n }\n try {\n const status = await constructor.requestPermission();\n this.permissionState = status === 'granted' ? 'granted' : 'denied';\n }\n catch (error) {\n console.warn('CapacitorAccelerometer: permission request failed', error);\n this.permissionState = 'denied';\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,sBAAsB,GAAGA,mBAAc,CAAC,wBAAwB,EAAE;IACxE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,yBAAyB,EAAE,CAAC;IAC7E,CAAC;;ICFD,MAAM,mBAAmB,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IACzC,MAAM,yBAAyB,SAASC,cAAS,CAAC;IACzD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;IAC3B,QAAQ,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,mBAAmB,CAAC;IACrE,QAAQ,IAAI,CAAC,aAAa,GAAG,IAAI;IACjC,QAAQ,IAAI,CAAC,eAAe,GAAG,QAAQ;IACvC,QAAQ,IAAI,CAAC,YAAY,GAAG,CAAC,KAAK,KAAK;IACvC,YAAY,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;IAC9B,YAAY,MAAM,KAAK,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,4BAA4B,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,KAAK,CAAC,YAAY;IACvH,YAAY,IAAI,CAAC,KAAK,EAAE;IACxB,gBAAgB;IAChB,YAAY;IACZ,YAAY,IAAI,CAAC,eAAe,GAAG;IACnC,gBAAgB,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,CAAC;IACpE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GAAG,MAAM,GAAG,WAAW,CAAC,iBAAiB,CAAC,EAAE;IACxG;IACA,YAAY,IAAI,CAAC,eAAe,GAAG,SAAS;IAC5C,YAAY;IACZ,QAAQ;IACR,QAAQ,IAAI,CAAC,OAAO,EAAE;IACtB;IACA,YAAY,IAAI,IAAI,CAAC,eAAe,KAAK,QAAQ,EAAE;IACnD,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACZ,QAAQ;IACR,QAAQ,IAAI;IACZ,YAAY,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,iBAAiB,EAAE;IAChE,YAAY,IAAI,CAAC,eAAe,GAAG,MAAM,KAAK,SAAS,GAAG,SAAS,GAAG,QAAQ;IAC9E,QAAQ;IACR,QAAQ,OAAO,KAAK,EAAE;IACtB,YAAY,OAAO,CAAC,IAAI,CAAC,mDAAmD,EAAE,KAAK,CAAC;IACpF,YAAY,IAAI,CAAC,eAAe,GAAG,QAAQ;IAC3C,QAAQ;IACR,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import Capacitor
|
|
2
|
+
import CoreMotion
|
|
3
|
+
import Foundation
|
|
4
|
+
|
|
5
|
+
@objc(CapacitorAccelerometerPlugin)
|
|
6
|
+
public class CapacitorAccelerometerPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
7
|
+
public let identifier = "CapacitorAccelerometerPlugin"
|
|
8
|
+
public let jsName = "CapacitorAccelerometer"
|
|
9
|
+
public let pluginMethods: [CAPPluginMethod] = [
|
|
10
|
+
CAPPluginMethod(name: "getMeasurement", returnType: CAPPluginReturnPromise),
|
|
11
|
+
CAPPluginMethod(name: "isAvailable", returnType: CAPPluginReturnPromise),
|
|
12
|
+
CAPPluginMethod(name: "startMeasurementUpdates", returnType: CAPPluginReturnPromise),
|
|
13
|
+
CAPPluginMethod(name: "stopMeasurementUpdates", returnType: CAPPluginReturnPromise),
|
|
14
|
+
CAPPluginMethod(name: "checkPermissions", returnType: CAPPluginReturnPromise),
|
|
15
|
+
CAPPluginMethod(name: "requestPermissions", returnType: CAPPluginReturnPromise),
|
|
16
|
+
CAPPluginMethod(name: "removeAllListeners", returnType: CAPPluginReturnPromise)
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
private let motionManager = CMMotionManager()
|
|
20
|
+
private let queue = OperationQueue()
|
|
21
|
+
private var latestMeasurement: [String: Double] = ["x": 0, "y": 0, "z": 0]
|
|
22
|
+
|
|
23
|
+
public override func load() {
|
|
24
|
+
super.load()
|
|
25
|
+
queue.qualityOfService = .userInteractive
|
|
26
|
+
motionManager.accelerometerUpdateInterval = 0.02
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@objc func getMeasurement(_ call: CAPPluginCall) {
|
|
30
|
+
guard motionManager.isAccelerometerAvailable else {
|
|
31
|
+
call.reject("Accelerometer not available")
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
call.resolve(latestMeasurement)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@objc func isAvailable(_ call: CAPPluginCall) {
|
|
38
|
+
call.resolve(["isAvailable": motionManager.isAccelerometerAvailable])
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@objc func startMeasurementUpdates(_ call: CAPPluginCall) {
|
|
42
|
+
guard motionManager.isAccelerometerAvailable else {
|
|
43
|
+
call.reject("Accelerometer not available")
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if motionManager.isAccelerometerActive {
|
|
48
|
+
call.resolve()
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
motionManager.startAccelerometerUpdates(to: queue) { [weak self] data, error in
|
|
53
|
+
guard let self, let data else {
|
|
54
|
+
if let error {
|
|
55
|
+
CAPLog.print("CapacitorAccelerometerPlugin", "Accelerometer error: \(error.localizedDescription)")
|
|
56
|
+
}
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let measurement: [String: Double] = [
|
|
61
|
+
"x": data.acceleration.x,
|
|
62
|
+
"y": data.acceleration.y,
|
|
63
|
+
"z": data.acceleration.z
|
|
64
|
+
]
|
|
65
|
+
self.latestMeasurement = measurement
|
|
66
|
+
|
|
67
|
+
DispatchQueue.main.async {
|
|
68
|
+
self.notifyListeners("measurement", data: measurement)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
call.resolve()
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@objc func stopMeasurementUpdates(_ call: CAPPluginCall) {
|
|
76
|
+
if motionManager.isAccelerometerActive {
|
|
77
|
+
motionManager.stopAccelerometerUpdates()
|
|
78
|
+
}
|
|
79
|
+
call.resolve()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@objc override public func checkPermissions(_ call: CAPPluginCall) {
|
|
83
|
+
call.resolve(["accelerometer": currentPermissionState()])
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@objc override public func requestPermissions(_ call: CAPPluginCall) {
|
|
87
|
+
call.resolve(["accelerometer": currentPermissionState()])
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@objc override public func removeAllListeners(_ call: CAPPluginCall) {
|
|
91
|
+
super.removeAllListeners(call)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private func currentPermissionState() -> String {
|
|
95
|
+
guard motionManager.isAccelerometerAvailable else {
|
|
96
|
+
return "denied"
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if #available(iOS 11.0, *) {
|
|
100
|
+
switch CMMotionActivityManager.authorizationStatus() {
|
|
101
|
+
case .authorized:
|
|
102
|
+
return "granted"
|
|
103
|
+
case .denied, .restricted:
|
|
104
|
+
return "denied"
|
|
105
|
+
case .notDetermined:
|
|
106
|
+
return "prompt"
|
|
107
|
+
@unknown default:
|
|
108
|
+
return "prompt"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return "granted"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import XCTest
|
|
2
|
+
@testable import CapacitorAccelerometerPlugin
|
|
3
|
+
|
|
4
|
+
final class CapacitorAccelerometerPluginTests: XCTestCase {
|
|
5
|
+
func testPluginInitialises() {
|
|
6
|
+
let plugin = CapacitorAccelerometerPlugin()
|
|
7
|
+
XCTAssertEqual(plugin.identifier, "CapacitorAccelerometerPlugin")
|
|
8
|
+
}
|
|
9
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@capgo/capacitor-accelerometer",
|
|
3
|
+
"version": "7.0.0",
|
|
4
|
+
"description": "Read device accelerometer measurements with Capacitor",
|
|
5
|
+
"main": "dist/plugin.cjs.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/esm/index.d.ts",
|
|
8
|
+
"unpkg": "dist/plugin.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"android/src/main/",
|
|
11
|
+
"android/build.gradle",
|
|
12
|
+
"dist/",
|
|
13
|
+
"ios/Sources",
|
|
14
|
+
"ios/Tests",
|
|
15
|
+
"Package.swift",
|
|
16
|
+
"CapgoCapacitorAccelerometer.podspec"
|
|
17
|
+
],
|
|
18
|
+
"author": "Cap-go <contact@capgo.app>",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/Cap-go/capacitor-accelerometer.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/Cap-go/capacitor-accelerometer/issues"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"capacitor",
|
|
29
|
+
"plugin",
|
|
30
|
+
"native",
|
|
31
|
+
"accelerometer",
|
|
32
|
+
"sensor",
|
|
33
|
+
"motion",
|
|
34
|
+
"capgo",
|
|
35
|
+
"capacitor"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
39
|
+
"verify:ios": "xcodebuild -scheme CapgoCapacitorAccelerometer -destination generic/platform=iOS",
|
|
40
|
+
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
41
|
+
"verify:web": "npm run build",
|
|
42
|
+
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
43
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --autocorrect --format",
|
|
44
|
+
"eslint": "eslint . --ext .ts",
|
|
45
|
+
"prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
|
|
46
|
+
"swiftlint": "node-swiftlint",
|
|
47
|
+
"docgen": "docgen --api CapacitorAccelerometerPlugin --output-readme README.md --output-json dist/docs.json",
|
|
48
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
49
|
+
"clean": "rimraf ./dist",
|
|
50
|
+
"watch": "tsc --watch",
|
|
51
|
+
"prepublishOnly": "npm run build"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@capacitor/android": "^7.0.0",
|
|
55
|
+
"@capacitor/cli": "^7.0.0",
|
|
56
|
+
"@capacitor/core": "^7.0.0",
|
|
57
|
+
"@capacitor/docgen": "^0.3.0",
|
|
58
|
+
"@capacitor/ios": "^7.0.0",
|
|
59
|
+
"@ionic/eslint-config": "^0.4.0",
|
|
60
|
+
"@ionic/prettier-config": "^4.0.0",
|
|
61
|
+
"@ionic/swiftlint-config": "^2.0.0",
|
|
62
|
+
"@types/node": "^22.13.1",
|
|
63
|
+
"eslint": "^8.57.0",
|
|
64
|
+
"eslint-plugin-import": "^2.31.0",
|
|
65
|
+
"husky": "^9.1.7",
|
|
66
|
+
"prettier": "^3.4.2",
|
|
67
|
+
"prettier-plugin-java": "^2.6.7",
|
|
68
|
+
"rimraf": "^6.0.1",
|
|
69
|
+
"rollup": "^4.34.6",
|
|
70
|
+
"swiftlint": "^2.0.0",
|
|
71
|
+
"typescript": "^5.7.3"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"@capacitor/core": ">=7.0.0"
|
|
75
|
+
},
|
|
76
|
+
"eslintConfig": {
|
|
77
|
+
"extends": "@ionic/eslint-config/recommended"
|
|
78
|
+
},
|
|
79
|
+
"prettier": "@ionic/prettier-config",
|
|
80
|
+
"swiftlint": "@ionic/swiftlint-config",
|
|
81
|
+
"capacitor": {
|
|
82
|
+
"ios": {
|
|
83
|
+
"src": "ios"
|
|
84
|
+
},
|
|
85
|
+
"android": {
|
|
86
|
+
"src": "android"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|