@capgo/capacitor-shake 7.1.20 → 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.
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
10
10
  s.homepage = package['repository']['url']
11
11
  s.author = package['author']
12
12
  s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
- s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
13
+ s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '14.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
package/Package.swift ADDED
@@ -0,0 +1,28 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "CapgoCapacitorShake",
6
+ platforms: [.iOS(.v14)],
7
+ products: [
8
+ .library(
9
+ name: "CapgoCapacitorShake",
10
+ targets: ["CapacitorShakePlugin"])
11
+ ],
12
+ dependencies: [
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
14
+ ],
15
+ targets: [
16
+ .target(
17
+ name: "CapacitorShakePlugin",
18
+ dependencies: [
19
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
20
+ .product(name: "Cordova", package: "capacitor-swift-pm")
21
+ ],
22
+ path: "ios/Sources/CapacitorShakePlugin"),
23
+ .testTarget(
24
+ name: "CapacitorShakePluginTests",
25
+ dependencies: ["CapacitorShakePlugin"],
26
+ path: "ios/Tests/CapacitorShakePluginTests")
27
+ ]
28
+ )
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;;;;;;;;;;;;;;;"}
@@ -0,0 +1,13 @@
1
+ import XCTest
2
+ @testable import CapacitorShakePlugin
3
+
4
+ final class CapacitorShakeTests: XCTestCase {
5
+ func testEcho() {
6
+ // Ensure the helper mirrors the passed value.
7
+ let implementation = CapacitorShake()
8
+ let value = "Hello, World!"
9
+ let result = implementation.echo(value)
10
+
11
+ XCTAssertEqual(value, result)
12
+ }
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-shake",
3
- "version": "7.1.20",
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",
@@ -10,7 +10,9 @@
10
10
  "android/src/main/",
11
11
  "android/build.gradle",
12
12
  "dist/",
13
- "ios/Plugin/",
13
+ "ios/Sources",
14
+ "ios/Tests",
15
+ "Package.swift",
14
16
  "CapgoCapacitorShake.podspec"
15
17
  ],
16
18
  "author": "Cap-go <contact@capgo.app>",
@@ -34,13 +36,13 @@
34
36
  ],
35
37
  "scripts": {
36
38
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
37
- "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -sdk iphoneos -scheme Plugin && cd ..",
39
+ "verify:ios": "xcodebuild -scheme CapgoCapacitorShake -destination generic/platform=iOS",
38
40
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
39
41
  "verify:web": "npm run build",
40
42
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
41
43
  "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --autocorrect --format",
42
44
  "eslint": "eslint .",
43
- "prettier": "prettier --config .prettierrc.js \"**/*.{css,html,ts,js,java}\"",
45
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
44
46
  "swiftlint": "node-swiftlint",
45
47
  "docgen": "docgen --api CapacitorShakePlugin --output-readme README.md --output-json dist/docs.json",
46
48
  "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>$(DEVELOPMENT_LANGUAGE)</string>
7
- <key>CFBundleExecutable</key>
8
- <string>$(EXECUTABLE_NAME)</string>
9
- <key>CFBundleIdentifier</key>
10
- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
- <key>CFBundleInfoDictionaryVersion</key>
12
- <string>6.0</string>
13
- <key>CFBundleName</key>
14
- <string>$(PRODUCT_NAME)</string>
15
- <key>CFBundlePackageType</key>
16
- <string>FMWK</string>
17
- <key>CFBundleShortVersionString</key>
18
- <string>1.0</string>
19
- <key>CFBundleVersion</key>
20
- <string>$(CURRENT_PROJECT_VERSION)</string>
21
- <key>NSPrincipalClass</key>
22
- <string></string>
23
- </dict>
24
- </plist>