@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 CHANGED
@@ -33,7 +33,7 @@ npx cap sync
33
33
  ### addListener('shake', ...)
34
34
 
35
35
  ```typescript
36
- addListener(eventName: "shake", listenerFunc: () => void) => Promise<PluginListenerHandle>
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
- @Override
17
- public void load() {
18
- super.load();
14
+ @Override
15
+ public void load() {
16
+ super.load();
19
17
 
20
- SensorManager sensorManager = null;
21
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
22
- sensorManager = (SensorManager) this.bridge.getActivity()
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
- if (sensorManager == null) {
26
- Log.e(
27
- "CapacitorShakePlugin",
28
- "This device couldn't find SENSOR_SERVICE. Perhaps your device doesn't support it"
29
- );
30
- return;
31
- }
32
- } else {
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
- try {
41
- ShakeDetector sd = new ShakeDetector(this);
42
- sd.start(sensorManager, SensorManager.SENSOR_DELAY_GAME);
43
- Log.i("CapacitorShakePlugin", "ShakeDetector started");
44
- } catch (Exception e) {
45
- Log.e("CapacitorShakePlugin", "Failed to start the shakeDetector", e);
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
- @Override
50
- public void hearShake() {
51
- JSObject ret = new JSObject();
52
- notifyListeners("shake", ret);
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: \"shake\", listenerFunc: () => void) => Promise<PluginListenerHandle>",
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 "@capacitor/core";
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
2
  export interface CapacitorShakePlugin {
3
- addListener(eventName: "shake", listenerFunc: () => void): Promise<PluginListenerHandle>;
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 \"@capacitor/core\";\n\nexport interface CapacitorShakePlugin {\n addListener(\n eventName: \"shake\",\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n}\n"]}
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"]}
@@ -1,4 +1,4 @@
1
- import type { CapacitorShakePlugin } from "./definitions";
1
+ import type { CapacitorShakePlugin } from './definitions';
2
2
  declare const CapacitorShake: CapacitorShakePlugin;
3
- export * from "./definitions";
3
+ export * from './definitions';
4
4
  export { CapacitorShake };
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { registerPlugin } from "@capacitor/core";
2
- const CapacitorShake = registerPlugin("CapacitorShake", {
3
- web: () => import("./web").then((m) => new m.CapacitorShakeWeb()),
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 "./definitions";
5
+ export * from './definitions';
6
6
  export { CapacitorShake };
7
7
  //# sourceMappingURL=index.js.map
@@ -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 \"@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"]}
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 "@capacitor/core";
2
- import type { CapacitorShakePlugin } from "./definitions";
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
@@ -1,4 +1,4 @@
1
- import { WebPlugin } from "@capacitor/core";
1
+ import { WebPlugin } from '@capacitor/core';
2
2
  export class CapacitorShakeWeb extends WebPlugin {
3
3
  }
4
4
  //# sourceMappingURL=web.js.map
@@ -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,iBACX,SAAQ,SAAS;CACiB","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type { CapacitorShakePlugin } from \"./definitions\";\n\nexport class CapacitorShakeWeb\n extends WebPlugin\n implements CapacitorShakePlugin {}\n"]}
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"]}
@@ -2,7 +2,7 @@
2
2
 
3
3
  var core = require('@capacitor/core');
4
4
 
5
- const CapacitorShake = core.registerPlugin("CapacitorShake", {
5
+ const CapacitorShake = core.registerPlugin('CapacitorShake', {
6
6
  web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorShakeWeb()),
7
7
  });
8
8
 
@@ -1 +1 @@
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;;;;;;;;;"}
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("CapacitorShake", {
4
+ const CapacitorShake = core.registerPlugin('CapacitorShake', {
5
5
  web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorShakeWeb()),
6
6
  });
7
7
 
@@ -1 +1 @@
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;;;;;;;;;;;;;;;"}
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.21",
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 --config .prettierrc.js \"**/*.{css,html,ts,js,java}\"",
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",