@capgo/capacitor-shake 6.0.45 → 7.1.2

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.
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '13.0'
14
+ s.ios.deployment_target = '14.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
17
17
  end
package/README.md CHANGED
@@ -1,10 +1,13 @@
1
- <a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
1
+ # @capgo/capacitor-shake
2
+
3
+ <a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
2
4
 
3
5
  <div align="center">
4
- <h2><a href="https://capgo.app/">Check out: Capgo Instant updates for capacitor</a></h2>
6
+ <h2><a href="https://capgo.app/?ref=plugin"> ➡️ Get Instant updates for your App with Capgo 🚀</a></h2>
7
+ <h2><a href="https://capgo.app/consulting/?ref=plugin"> Fix your annoying bug now, Hire a Capacitor expert 💪</a></h2>
5
8
  </div>
6
9
 
7
- # @capgo/capacitor-shake
10
+
8
11
 
9
12
  Detect shake gesture in device
10
13
 
@@ -19,7 +22,7 @@ npx cap sync
19
22
 
20
23
  <docgen-index>
21
24
 
22
- * [`addListener('shake', ...)`](#addlistenershake)
25
+ * [`addListener('shake', ...)`](#addlistenershake-)
23
26
  * [Interfaces](#interfaces)
24
27
 
25
28
  </docgen-index>
@@ -30,7 +33,7 @@ npx cap sync
30
33
  ### addListener('shake', ...)
31
34
 
32
35
  ```typescript
33
- addListener(eventName: "shake", listenerFunc: () => void) => any
36
+ addListener(eventName: "shake", listenerFunc: () => void) => Promise<PluginListenerHandle>
34
37
  ```
35
38
 
36
39
  | Param | Type |
@@ -38,7 +41,7 @@ addListener(eventName: "shake", listenerFunc: () => void) => any
38
41
  | **`eventName`** | <code>'shake'</code> |
39
42
  | **`listenerFunc`** | <code>() =&gt; void</code> |
40
43
 
41
- **Returns:** <code>any</code>
44
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
42
45
 
43
46
  --------------------
44
47
 
@@ -48,8 +51,8 @@ addListener(eventName: "shake", listenerFunc: () => void) => any
48
51
 
49
52
  #### PluginListenerHandle
50
53
 
51
- | Prop | Type |
52
- | ------------ | ------------------------- |
53
- | **`remove`** | <code>() =&gt; any</code> |
54
+ | Prop | Type |
55
+ | ------------ | ----------------------------------------- |
56
+ | **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
54
57
 
55
58
  </docgen-api>
@@ -1,8 +1,8 @@
1
1
  ext {
2
2
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
6
6
  }
7
7
 
8
8
  buildscript {
@@ -11,7 +11,7 @@ buildscript {
11
11
  mavenCentral()
12
12
  }
13
13
  dependencies {
14
- classpath 'com.android.tools.build:gradle:8.6.0'
14
+ classpath 'com.android.tools.build:gradle:8.7.2'
15
15
  }
16
16
  }
17
17
 
@@ -19,10 +19,10 @@ apply plugin: 'com.android.library'
19
19
 
20
20
  android {
21
21
  namespace "ee.forgr.capacitor.shake"
22
- compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
22
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
23
23
  defaultConfig {
24
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
25
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
24
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
26
26
  versionCode 1
27
27
  versionName "1.0"
28
28
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -37,8 +37,8 @@ android {
37
37
  abortOnError false
38
38
  }
39
39
  compileOptions {
40
- sourceCompatibility JavaVersion.VERSION_17
41
- targetCompatibility JavaVersion.VERSION_17
40
+ sourceCompatibility JavaVersion.VERSION_21
41
+ targetCompatibility JavaVersion.VERSION_21
42
42
  }
43
43
  }
44
44
 
@@ -1,9 +1,10 @@
1
1
  package ee.forgr.capacitor.shake;
2
2
 
3
+ import android.content.Context;
4
+ import android.hardware.SensorManager;
5
+ import android.util.Log;
3
6
  import com.getcapacitor.JSObject;
4
7
  import com.getcapacitor.Plugin;
5
- import com.getcapacitor.PluginCall;
6
- import com.getcapacitor.PluginMethod;
7
8
  import com.getcapacitor.annotation.CapacitorPlugin;
8
9
  import com.squareup.seismic.ShakeDetector;
9
10
 
@@ -12,6 +13,39 @@ public class CapacitorShakePlugin
12
13
  extends Plugin
13
14
  implements ShakeDetector.Listener {
14
15
 
16
+ @Override
17
+ public void load() {
18
+ super.load();
19
+
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);
24
+
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
+ }
39
+
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);
46
+ }
47
+ }
48
+
15
49
  @Override
16
50
  public void hearShake() {
17
51
  JSObject ret = new JSObject();
package/dist/docs.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "methods": [
8
8
  {
9
9
  "name": "addListener",
10
- "signature": "(eventName: \"shake\", listenerFunc: () => void) => any",
10
+ "signature": "(eventName: \"shake\", listenerFunc: () => void) => Promise<PluginListenerHandle>",
11
11
  "parameters": [
12
12
  {
13
13
  "name": "eventName",
@@ -20,13 +20,13 @@
20
20
  "type": "() => void"
21
21
  }
22
22
  ],
23
- "returns": "any",
23
+ "returns": "Promise<PluginListenerHandle>",
24
24
  "tags": [],
25
25
  "docs": "",
26
26
  "complexTypes": [
27
27
  "PluginListenerHandle"
28
28
  ],
29
- "slug": "addlistenershake"
29
+ "slug": "addlistenershake-"
30
30
  }
31
31
  ],
32
32
  "properties": []
@@ -44,7 +44,7 @@
44
44
  "tags": [],
45
45
  "docs": "",
46
46
  "complexTypes": [],
47
- "type": "() => any"
47
+ "type": "() => Promise<void>"
48
48
  }
49
49
  ]
50
50
  }
@@ -20,6 +20,10 @@ extension UIWindow {
20
20
  */
21
21
  @objc(CapacitorShakePlugin)
22
22
  public class CapacitorShakePlugin: CAPPlugin {
23
+ public let identifier = "CapacitorShakePlugin"
24
+ public let jsName = "CapacitorShake"
25
+ public let pluginMethods: [CAPPluginMethod] = [
26
+ ]
23
27
 
24
28
  override public func load() {
25
29
  NotificationCenter.default.addObserver(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-shake",
3
- "version": "6.0.45",
3
+ "version": "7.1.2",
4
4
  "description": "Detect shake gesture in device",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -13,11 +13,11 @@
13
13
  "ios/Plugin/",
14
14
  "CapgoCapacitorShake.podspec"
15
15
  ],
16
- "author": "Martin Donadieu <martindonadieu@gmail.com>",
16
+ "author": "Cap-go <contact@capgo.app>",
17
17
  "license": "MIT",
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "git+https://github.com/Cap-go/capacitor-shake.git.git"
20
+ "url": "git+https://github.com/Cap-go/capacitor-shake.git"
21
21
  },
22
22
  "bugs": {
23
23
  "url": "https://github.com/Cap-go/capacitor-shake.git/issues"
@@ -34,7 +34,7 @@
34
34
  ],
35
35
  "scripts": {
36
36
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
37
- "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
37
+ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -sdk iphoneos -scheme Plugin && cd ..",
38
38
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
39
39
  "verify:web": "npm run build",
40
40
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
@@ -49,25 +49,30 @@
49
49
  "prepublishOnly": "npm run build"
50
50
  },
51
51
  "devDependencies": {
52
- "@capacitor/android": "^6.0.0",
53
- "@capacitor/core": "^6.0.0",
54
- "@capacitor/docgen": "^0.2.1",
55
- "@capacitor/ios": "^6.0.0",
56
- "@ionic/eslint-config": "^0.3.0",
52
+ "@capacitor/android": "^7.0.0",
53
+ "@capacitor/cli": "^7.0.0",
54
+ "@capacitor/core": "^7.0.0",
55
+ "@capacitor/docgen": "^0.3.0",
56
+ "@capacitor/ios": "^7.0.0",
57
+ "@ionic/eslint-config": "^0.4.0",
57
58
  "@ionic/prettier-config": "^4.0.0",
58
- "@ionic/swiftlint-config": "^1.1.2",
59
- "@typescript-eslint/eslint-plugin": "^7.8.0",
60
- "@typescript-eslint/parser": "^7.8.0",
61
- "eslint": "^9.1.1",
62
- "prettier": "~3.3.0",
63
- "prettier-plugin-java": "~2.6.0",
64
- "rimraf": "^5.0.5",
65
- "rollup": "^4.17.1",
66
- "swiftlint": "^1.0.2",
67
- "typescript": "~5.5.0"
59
+ "@ionic/swiftlint-config": "^2.0.0",
60
+ "@types/node": "^22.13.1",
61
+ "eslint": "^8.57.0",
62
+ "eslint-plugin-import": "^2.31.0",
63
+ "husky": "^9.1.7",
64
+ "prettier": "^3.4.2",
65
+ "prettier-plugin-java": "^2.6.7",
66
+ "rimraf": "^6.0.1",
67
+ "rollup": "^4.34.6",
68
+ "swiftlint": "^2.0.0",
69
+ "typescript": "^5.7.3"
68
70
  },
69
71
  "peerDependencies": {
70
- "@capacitor/core": "^6.0.0"
72
+ "@capacitor/core": ">=7.0.0"
73
+ },
74
+ "eslintConfig": {
75
+ "extends": "@ionic/eslint-config/recommended"
71
76
  },
72
77
  "prettier": "@ionic/prettier-config",
73
78
  "swiftlint": "@ionic/swiftlint-config",
@@ -1,10 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
-
3
- //! Project version number for Plugin.
4
- FOUNDATION_EXPORT double PluginVersionNumber;
5
-
6
- //! Project version string for Plugin.
7
- FOUNDATION_EXPORT const unsigned char PluginVersionString[];
8
-
9
- // In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
10
-
@@ -1,8 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import <Capacitor/Capacitor.h>
3
-
4
- // Define the plugin using the CAP_PLUGIN Macro, and
5
- // each method the plugin supports using the CAP_PLUGIN_METHOD macro.
6
- CAP_PLUGIN(CapacitorShakePlugin, "CapacitorShake",
7
- CAP_PLUGIN_METHOD(echo, CAPPluginReturnPromise);
8
- )