@capgo/capacitor-shake 0.0.2 → 2.0.0
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 +5 -5
- package/android/build.gradle +9 -8
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/ee/forgr/capacitor/shake/CapacitorShakePlugin.java +8 -5
- package/dist/docs.json +3 -3
- package/dist/esm/definitions.d.ts +1 -1
- 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 +2 -4
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +3 -5
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorShakePlugin.swift +9 -10
- package/package.json +18 -16
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ npx cap sync
|
|
|
30
30
|
### addListener('shake', ...)
|
|
31
31
|
|
|
32
32
|
```typescript
|
|
33
|
-
addListener(eventName:
|
|
33
|
+
addListener(eventName: "shake", listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
| Param | Type |
|
|
@@ -38,7 +38,7 @@ addListener(eventName: 'shake', listenerFunc: () => void) => Promise<PluginListe
|
|
|
38
38
|
| **`eventName`** | <code>'shake'</code> |
|
|
39
39
|
| **`listenerFunc`** | <code>() => void</code> |
|
|
40
40
|
|
|
41
|
-
**Returns:** <code>
|
|
41
|
+
**Returns:** <code>any</code>
|
|
42
42
|
|
|
43
43
|
--------------------
|
|
44
44
|
|
|
@@ -48,8 +48,8 @@ addListener(eventName: 'shake', listenerFunc: () => void) => Promise<PluginListe
|
|
|
48
48
|
|
|
49
49
|
#### PluginListenerHandle
|
|
50
50
|
|
|
51
|
-
| Prop | Type
|
|
52
|
-
| ------------ |
|
|
53
|
-
| **`remove`** | <code>() =>
|
|
51
|
+
| Prop | Type |
|
|
52
|
+
| ------------ | ------------------------- |
|
|
53
|
+
| **`remove`** | <code>() => any</code> |
|
|
54
54
|
|
|
55
55
|
</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.6.1'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
@@ -11,17 +11,18 @@ buildscript {
|
|
|
11
11
|
mavenCentral()
|
|
12
12
|
}
|
|
13
13
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.0.0'
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
apply plugin: 'com.android.library'
|
|
19
19
|
|
|
20
20
|
android {
|
|
21
|
-
|
|
21
|
+
namespace "ee.forgr.capacitor.shake"
|
|
22
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
|
|
22
23
|
defaultConfig {
|
|
23
24
|
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
24
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
|
|
25
26
|
versionCode 1
|
|
26
27
|
versionName "1.0"
|
|
27
28
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -36,8 +37,8 @@ android {
|
|
|
36
37
|
abortOnError false
|
|
37
38
|
}
|
|
38
39
|
compileOptions {
|
|
39
|
-
sourceCompatibility JavaVersion.
|
|
40
|
-
targetCompatibility JavaVersion.
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
|
|
@@ -8,10 +8,13 @@ import com.getcapacitor.annotation.CapacitorPlugin;
|
|
|
8
8
|
import com.squareup.seismic.ShakeDetector;
|
|
9
9
|
|
|
10
10
|
@CapacitorPlugin(name = "CapacitorShake")
|
|
11
|
-
public class CapacitorShakePlugin
|
|
11
|
+
public class CapacitorShakePlugin
|
|
12
|
+
extends Plugin
|
|
13
|
+
implements ShakeDetector.Listener {
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
@Override
|
|
16
|
+
public void hearShake() {
|
|
17
|
+
JSObject ret = new JSObject();
|
|
18
|
+
notifyListeners("shake", ret);
|
|
19
|
+
}
|
|
17
20
|
}
|
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> & PluginListenerHandle",
|
|
11
11
|
"parameters": [
|
|
12
12
|
{
|
|
13
13
|
"name": "eventName",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"type": "() => void"
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
|
-
"returns": "
|
|
23
|
+
"returns": "any",
|
|
24
24
|
"tags": [],
|
|
25
25
|
"docs": "",
|
|
26
26
|
"complexTypes": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"tags": [],
|
|
45
45
|
"docs": "",
|
|
46
46
|
"complexTypes": [],
|
|
47
|
-
"type": "() =>
|
|
47
|
+
"type": "() => any"
|
|
48
48
|
}
|
|
49
49
|
]
|
|
50
50
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PluginListenerHandle } from "@capacitor/core";
|
|
2
2
|
export interface CapacitorShakePlugin {
|
|
3
|
-
addListener(eventName:
|
|
3
|
+
addListener(eventName: "shake", listenerFunc: () => void): Promise<PluginListenerHandle> & 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:
|
|
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> & 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,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;
|
|
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,iBACX,SAAQ,SAAS;
|
|
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"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var core = require('@capacitor/core');
|
|
6
4
|
|
|
7
|
-
const CapacitorShake = core.registerPlugin(
|
|
8
|
-
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CapacitorShakeWeb()),
|
|
5
|
+
const CapacitorShake = core.registerPlugin("CapacitorShake", {
|
|
6
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorShakeWeb()),
|
|
9
7
|
});
|
|
10
8
|
|
|
11
9
|
class CapacitorShakeWeb extends core.WebPlugin {
|
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,8 +1,8 @@
|
|
|
1
|
-
var
|
|
1
|
+
var capacitorCapacitorUpdater = (function (exports, core) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const CapacitorShake = core.registerPlugin(
|
|
5
|
-
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CapacitorShakeWeb()),
|
|
4
|
+
const CapacitorShake = core.registerPlugin("CapacitorShake", {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorShakeWeb()),
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
class CapacitorShakeWeb extends core.WebPlugin {
|
|
@@ -15,8 +15,6 @@ var capacitorCapacitorShake = (function (exports, core) {
|
|
|
15
15
|
|
|
16
16
|
exports.CapacitorShake = CapacitorShake;
|
|
17
17
|
|
|
18
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
19
|
-
|
|
20
18
|
return exports;
|
|
21
19
|
|
|
22
20
|
})({}, capacitorExports);
|
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;;;;;;;;;;;;;;;"}
|
|
@@ -7,31 +7,30 @@ extension UIDevice {
|
|
|
7
7
|
|
|
8
8
|
// Override the default behavior of shake gestures to send our notification instead.
|
|
9
9
|
extension UIWindow {
|
|
10
|
-
|
|
10
|
+
override open func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
|
|
11
11
|
if motion == .motionShake {
|
|
12
12
|
NotificationCenter.default.post(name: UIDevice.deviceDidShakeNotification, object: nil)
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
/**
|
|
19
18
|
* Please read the Capacitor iOS Plugin Development Guide
|
|
20
19
|
* here: https://capacitorjs.com/docs/plugins/ios
|
|
21
20
|
*/
|
|
22
21
|
@objc(CapacitorShakePlugin)
|
|
23
22
|
public class CapacitorShakePlugin: CAPPlugin {
|
|
24
|
-
|
|
23
|
+
|
|
25
24
|
override public func load() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
NotificationCenter.default.addObserver(
|
|
26
|
+
self,
|
|
27
|
+
selector: #selector(self.shaked),
|
|
28
|
+
name: UIDevice.deviceDidShakeNotification,
|
|
29
|
+
object: nil)
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
deinit {
|
|
34
|
-
|
|
33
|
+
NotificationCenter.default.removeObserver(self)
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
@objc private func shaked() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-shake",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Detect shake gesture in device",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -38,34 +38,36 @@
|
|
|
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",
|
|
41
|
-
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --
|
|
41
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --autocorrect --format",
|
|
42
42
|
"eslint": "eslint . --ext ts",
|
|
43
|
-
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
43
|
+
"prettier": "prettier --config .prettierrc.js \"**/*.{css,html,ts,js,java}\"",
|
|
44
44
|
"swiftlint": "node-swiftlint",
|
|
45
45
|
"docgen": "docgen --api CapacitorShakePlugin --output-readme README.md --output-json dist/docs.json",
|
|
46
|
-
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.
|
|
46
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
47
47
|
"clean": "rimraf ./dist",
|
|
48
48
|
"watch": "tsc --watch",
|
|
49
49
|
"prepublishOnly": "npm run build"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@capacitor/android": "^
|
|
53
|
-
"@capacitor/core": "^
|
|
54
|
-
"@capacitor/docgen": "^0.
|
|
55
|
-
"@capacitor/ios": "^
|
|
52
|
+
"@capacitor/android": "^5.0.3",
|
|
53
|
+
"@capacitor/core": "^5.0.3",
|
|
54
|
+
"@capacitor/docgen": "^0.2.1",
|
|
55
|
+
"@capacitor/ios": "^5.0.3",
|
|
56
56
|
"@ionic/eslint-config": "^0.3.0",
|
|
57
|
-
"@ionic/prettier-config": "^
|
|
57
|
+
"@ionic/prettier-config": "^3.0.0",
|
|
58
58
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
59
|
-
"eslint": "^
|
|
60
|
-
"
|
|
59
|
+
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
|
60
|
+
"@typescript-eslint/parser": "^5.59.7",
|
|
61
|
+
"eslint": "^8.41.0",
|
|
62
|
+
"prettier": "~2.8.8",
|
|
61
63
|
"prettier-plugin-java": "~1.0.2",
|
|
62
|
-
"rimraf": "^
|
|
63
|
-
"rollup": "^
|
|
64
|
-
"swiftlint": "^1.0.
|
|
65
|
-
"typescript": "~
|
|
64
|
+
"rimraf": "^5.0.1",
|
|
65
|
+
"rollup": "^3.23.0",
|
|
66
|
+
"swiftlint": "^1.0.2",
|
|
67
|
+
"typescript": "~5.0.4"
|
|
66
68
|
},
|
|
67
69
|
"peerDependencies": {
|
|
68
|
-
"@capacitor/core": "^
|
|
70
|
+
"@capacitor/core": "^5.0.0"
|
|
69
71
|
},
|
|
70
72
|
"prettier": "@ionic/prettier-config",
|
|
71
73
|
"swiftlint": "@ionic/swiftlint-config",
|