@capgo/capacitor-shake 7.1.21 → 7.1.25
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 +1 -1
- package/android/src/main/java/ee/forgr/capacitor/shake/CapacitorShakePlugin.java +27 -36
- package/dist/docs.json +1 -1
- package/dist/esm/definitions.d.ts +2 -2
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +1 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +1 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ npx cap sync
|
|
|
33
33
|
### addListener('shake', ...)
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
-
addListener(eventName:
|
|
36
|
+
addListener(eventName: 'shake', listenerFunc: () => void) => Promise<PluginListenerHandle>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
| Param | Type |
|
|
@@ -9,46 +9,37 @@ import com.getcapacitor.annotation.CapacitorPlugin;
|
|
|
9
9
|
import com.squareup.seismic.ShakeDetector;
|
|
10
10
|
|
|
11
11
|
@CapacitorPlugin(name = "CapacitorShake")
|
|
12
|
-
public class CapacitorShakePlugin
|
|
13
|
-
extends Plugin
|
|
14
|
-
implements ShakeDetector.Listener {
|
|
12
|
+
public class CapacitorShakePlugin extends Plugin implements ShakeDetector.Listener {
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
@Override
|
|
15
|
+
public void load() {
|
|
16
|
+
super.load();
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.getSystemService(Context.SENSOR_SERVICE);
|
|
18
|
+
SensorManager sensorManager = null;
|
|
19
|
+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
|
|
20
|
+
sensorManager = (SensorManager) this.bridge.getActivity().getSystemService(Context.SENSOR_SERVICE);
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Log.e(
|
|
34
|
-
"CapacitorShakePlugin",
|
|
35
|
-
"This device doesn't support the getSystemService. Minimal android version: 23"
|
|
36
|
-
);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
22
|
+
if (sensorManager == null) {
|
|
23
|
+
Log.e("CapacitorShakePlugin", "This device couldn't find SENSOR_SERVICE. Perhaps your device doesn't support it");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
Log.e("CapacitorShakePlugin", "This device doesn't support the getSystemService. Minimal android version: 23");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
39
30
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
try {
|
|
32
|
+
ShakeDetector sd = new ShakeDetector(this);
|
|
33
|
+
sd.start(sensorManager, SensorManager.SENSOR_DELAY_GAME);
|
|
34
|
+
Log.i("CapacitorShakePlugin", "ShakeDetector started");
|
|
35
|
+
} catch (Exception e) {
|
|
36
|
+
Log.e("CapacitorShakePlugin", "Failed to start the shakeDetector", e);
|
|
37
|
+
}
|
|
46
38
|
}
|
|
47
|
-
}
|
|
48
39
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
@Override
|
|
41
|
+
public void hearShake() {
|
|
42
|
+
JSObject ret = new JSObject();
|
|
43
|
+
notifyListeners("shake", ret);
|
|
44
|
+
}
|
|
54
45
|
}
|
package/dist/docs.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"methods": [
|
|
8
8
|
{
|
|
9
9
|
"name": "addListener",
|
|
10
|
-
"signature": "(eventName:
|
|
10
|
+
"signature": "(eventName: 'shake', listenerFunc: () => void) => Promise<PluginListenerHandle>",
|
|
11
11
|
"parameters": [
|
|
12
12
|
{
|
|
13
13
|
"name": "eventName",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginListenerHandle } from
|
|
1
|
+
import type { PluginListenerHandle } from '@capacitor/core';
|
|
2
2
|
export interface CapacitorShakePlugin {
|
|
3
|
-
addListener(eventName:
|
|
3
|
+
addListener(eventName: 'shake', listenerFunc: () => void): Promise<PluginListenerHandle>;
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface CapacitorShakePlugin {\n addListener(eventName: 'shake', listenerFunc: () => void): Promise<PluginListenerHandle>;\n}\n"]}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { registerPlugin } from
|
|
2
|
-
const CapacitorShake = registerPlugin(
|
|
3
|
-
web: () => import(
|
|
1
|
+
import { registerPlugin } from '@capacitor/core';
|
|
2
|
+
const CapacitorShake = registerPlugin('CapacitorShake', {
|
|
3
|
+
web: () => import('./web').then((m) => new m.CapacitorShakeWeb()),
|
|
4
4
|
});
|
|
5
|
-
export * from
|
|
5
|
+
export * from './definitions';
|
|
6
6
|
export { CapacitorShake };
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,cAAc,GAAG,cAAc,CAAuB,gBAAgB,EAAE;IAC5E,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;CAClE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { registerPlugin } from
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,cAAc,GAAG,cAAc,CAAuB,gBAAgB,EAAE;IAC5E,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;CAClE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { CapacitorShakePlugin } from './definitions';\n\nconst CapacitorShake = registerPlugin<CapacitorShakePlugin>('CapacitorShake', {\n web: () => import('./web').then((m) => new m.CapacitorShakeWeb()),\n});\n\nexport * from './definitions';\nexport { CapacitorShake };\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WebPlugin } from
|
|
2
|
-
import type { CapacitorShakePlugin } from
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { CapacitorShakePlugin } from './definitions';
|
|
3
3
|
export declare class CapacitorShakeWeb extends WebPlugin implements CapacitorShakePlugin {
|
|
4
4
|
}
|
package/dist/esm/web.js
CHANGED
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,iBAAkB,SAAQ,SAAS;CAAmC","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorShakePlugin } from './definitions';\n\nexport class CapacitorShakeWeb extends WebPlugin implements CapacitorShakePlugin {}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@capacitor/core');
|
|
4
4
|
|
|
5
|
-
const CapacitorShake = core.registerPlugin(
|
|
5
|
+
const CapacitorShake = core.registerPlugin('CapacitorShake', {
|
|
6
6
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorShakeWeb()),
|
|
7
7
|
});
|
|
8
8
|
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorShake = registerPlugin('CapacitorShake', {\n web: () => import('./web').then((m) => new m.CapacitorShakeWeb()),\n});\nexport * from './definitions';\nexport { CapacitorShake };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorShakeWeb extends WebPlugin {\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;AACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACrE,CAAC;;ACFM,MAAM,iBAAiB,SAASC,cAAS,CAAC;AACjD;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var capacitorCapacitorUpdater = (function (exports, core) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const CapacitorShake = core.registerPlugin(
|
|
4
|
+
const CapacitorShake = core.registerPlugin('CapacitorShake', {
|
|
5
5
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorShakeWeb()),
|
|
6
6
|
});
|
|
7
7
|
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorShake = registerPlugin('CapacitorShake', {\n web: () => import('./web').then((m) => new m.CapacitorShakeWeb()),\n});\nexport * from './definitions';\nexport { CapacitorShake };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorShakeWeb extends WebPlugin {\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;IACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACrE,CAAC;;ICFM,MAAM,iBAAiB,SAASC,cAAS,CAAC;IACjD;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-shake",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.25",
|
|
4
4
|
"description": "Detect shake gesture in device",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
43
43
|
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --autocorrect --format",
|
|
44
44
|
"eslint": "eslint .",
|
|
45
|
-
"prettier": "prettier
|
|
45
|
+
"prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
|
|
46
46
|
"swiftlint": "node-swiftlint",
|
|
47
47
|
"docgen": "docgen --api CapacitorShakePlugin --output-readme README.md --output-json dist/docs.json",
|
|
48
48
|
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|