@capgo/capacitor-shake 6.0.46 → 7.1.3
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/CapgoCapacitorShake.podspec +1 -1
- package/README.md +6 -6
- package/android/build.gradle +9 -9
- package/android/src/main/java/ee/forgr/capacitor/shake/CapacitorShakePlugin.java +36 -2
- package/dist/docs.json +4 -4
- package/ios/Plugin/CapacitorShakePlugin.swift +4 -0
- package/package.json +26 -21
- package/ios/Plugin/CapacitorShakePlugin.h +0 -10
- package/ios/Plugin/CapacitorShakePlugin.m +0 -8
|
@@ -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
|
|
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
|
@@ -22,7 +22,7 @@ npx cap sync
|
|
|
22
22
|
|
|
23
23
|
<docgen-index>
|
|
24
24
|
|
|
25
|
-
* [`addListener('shake', ...)`](#addlistenershake)
|
|
25
|
+
* [`addListener('shake', ...)`](#addlistenershake-)
|
|
26
26
|
* [Interfaces](#interfaces)
|
|
27
27
|
|
|
28
28
|
</docgen-index>
|
|
@@ -33,7 +33,7 @@ npx cap sync
|
|
|
33
33
|
### addListener('shake', ...)
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
-
addListener(eventName: "shake", listenerFunc: () => void) =>
|
|
36
|
+
addListener(eventName: "shake", listenerFunc: () => void) => Promise<PluginListenerHandle>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
| Param | Type |
|
|
@@ -41,7 +41,7 @@ addListener(eventName: "shake", listenerFunc: () => void) => any
|
|
|
41
41
|
| **`eventName`** | <code>'shake'</code> |
|
|
42
42
|
| **`listenerFunc`** | <code>() => void</code> |
|
|
43
43
|
|
|
44
|
-
**Returns:** <code>
|
|
44
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
45
45
|
|
|
46
46
|
--------------------
|
|
47
47
|
|
|
@@ -51,8 +51,8 @@ addListener(eventName: "shake", listenerFunc: () => void) => any
|
|
|
51
51
|
|
|
52
52
|
#### PluginListenerHandle
|
|
53
53
|
|
|
54
|
-
| Prop | Type
|
|
55
|
-
| ------------ |
|
|
56
|
-
| **`remove`** | <code>() =>
|
|
54
|
+
| Prop | Type |
|
|
55
|
+
| ------------ | ----------------------------------------- |
|
|
56
|
+
| **`remove`** | <code>() => Promise<void></code> |
|
|
57
57
|
|
|
58
58
|
</docgen-api>
|
package/android/build.gradle
CHANGED
|
@@ -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.
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
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.
|
|
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 :
|
|
22
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
|
|
23
23
|
defaultConfig {
|
|
24
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
25
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
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.
|
|
41
|
-
targetCompatibility JavaVersion.
|
|
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) =>
|
|
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": "
|
|
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": "() =>
|
|
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": "
|
|
3
|
+
"version": "7.1.3",
|
|
4
4
|
"description": "Detect shake gesture in device",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"ios/Plugin/",
|
|
14
14
|
"CapgoCapacitorShake.podspec"
|
|
15
15
|
],
|
|
16
|
-
"author": "
|
|
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
|
|
20
|
+
"url": "git+https://github.com/Cap-go/capacitor-shake.git"
|
|
21
21
|
},
|
|
22
22
|
"bugs": {
|
|
23
|
-
"url": "https://github.com/Cap-go/capacitor-shake
|
|
23
|
+
"url": "https://github.com/Cap-go/capacitor-shake/issues"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"capacitor",
|
|
@@ -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 -
|
|
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": "^
|
|
53
|
-
"@capacitor/
|
|
54
|
-
"@capacitor/
|
|
55
|
-
"@capacitor/
|
|
56
|
-
"@
|
|
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": "^
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
61
|
-
"eslint": "^
|
|
62
|
-
"
|
|
63
|
-
"prettier
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
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": "
|
|
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
|
-
)
|