@capgo/capacitor-volume-buttons 7.0.6 → 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/README.md CHANGED
@@ -20,6 +20,7 @@ npx cap sync
20
20
 
21
21
  * [`addListener('volumeButtonPressed', ...)`](#addlistenervolumebuttonpressed-)
22
22
  * [`removeAllListeners()`](#removealllisteners)
23
+ * [`getPluginVersion()`](#getpluginversion)
23
24
  * [Interfaces](#interfaces)
24
25
  * [Type Aliases](#type-aliases)
25
26
 
@@ -28,6 +29,8 @@ npx cap sync
28
29
  <docgen-api>
29
30
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
30
31
 
32
+ Capacitor Volume Buttons Plugin for detecting hardware volume button presses.
33
+
31
34
  ### addListener('volumeButtonPressed', ...)
32
35
 
33
36
  ```typescript
@@ -36,13 +39,15 @@ addListener(eventName: 'volumeButtonPressed', listenerFunc: VolumeButtonListener
36
39
 
37
40
  Listen for presses on the hardware volume buttons.
38
41
 
39
- | Param | Type |
40
- | ------------------ | --------------------------------------------------------------------- |
41
- | **`eventName`** | <code>'volumeButtonPressed'</code> |
42
- | **`listenerFunc`** | <code><a href="#volumebuttonlistener">VolumeButtonListener</a></code> |
42
+ | Param | Type | Description |
43
+ | ------------------ | --------------------------------------------------------------------- | ------------------------------------------------------ |
44
+ | **`eventName`** | <code>'volumeButtonPressed'</code> | - The event name (must be 'volumeButtonPressed') |
45
+ | **`listenerFunc`** | <code><a href="#volumebuttonlistener">VolumeButtonListener</a></code> | - The function to call when a volume button is pressed |
43
46
 
44
47
  **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
45
48
 
49
+ **Since:** 1.0.0
50
+
46
51
  --------------------
47
52
 
48
53
 
@@ -54,6 +59,23 @@ removeAllListeners() => Promise<void>
54
59
 
55
60
  Removes all listeners for this plugin.
56
61
 
62
+ **Since:** 1.0.0
63
+
64
+ --------------------
65
+
66
+
67
+ ### getPluginVersion()
68
+
69
+ ```typescript
70
+ getPluginVersion() => Promise<{ version: string; }>
71
+ ```
72
+
73
+ Get the native Capacitor plugin version.
74
+
75
+ **Returns:** <code>Promise&lt;{ version: string; }&gt;</code>
76
+
77
+ **Since:** 1.0.0
78
+
57
79
  --------------------
58
80
 
59
81
 
@@ -69,9 +91,11 @@ Removes all listeners for this plugin.
69
91
 
70
92
  #### VolumeButtonPressed
71
93
 
72
- | Prop | Type |
73
- | --------------- | ----------------------------------------------------------------------- |
74
- | **`direction`** | <code><a href="#volumebuttondirection">VolumeButtonDirection</a></code> |
94
+ Event data for volume button press.
95
+
96
+ | Prop | Type | Description |
97
+ | --------------- | ----------------------------------------------------------------------- | ----------------------------- |
98
+ | **`direction`** | <code><a href="#volumebuttondirection">VolumeButtonDirection</a></code> | Direction of the button press |
75
99
 
76
100
 
77
101
  ### Type Aliases
@@ -79,11 +103,15 @@ Removes all listeners for this plugin.
79
103
 
80
104
  #### VolumeButtonListener
81
105
 
106
+ Listener function for volume button events.
107
+
82
108
  <code>(event: <a href="#volumebuttonpressed">VolumeButtonPressed</a>): void</code>
83
109
 
84
110
 
85
111
  #### VolumeButtonDirection
86
112
 
113
+ Direction of volume button press.
114
+
87
115
  <code>'up' | 'down'</code>
88
116
 
89
117
  </docgen-api>
@@ -4,11 +4,15 @@ import android.view.KeyEvent;
4
4
  import android.view.View;
5
5
  import com.getcapacitor.JSObject;
6
6
  import com.getcapacitor.Plugin;
7
+ import com.getcapacitor.PluginCall;
8
+ import com.getcapacitor.PluginMethod;
7
9
  import com.getcapacitor.annotation.CapacitorPlugin;
8
10
 
9
11
  @CapacitorPlugin(name = "VolumeButtons")
10
12
  public class VolumeButtonsPlugin extends Plugin {
11
13
 
14
+ private final String PLUGIN_VERSION = "7.1.3";
15
+
12
16
  @Override
13
17
  public void load() {
14
18
  super.load();
@@ -39,4 +43,15 @@ public class VolumeButtonsPlugin extends Plugin {
39
43
  }
40
44
  );
41
45
  }
46
+
47
+ @PluginMethod
48
+ public void getPluginVersion(final PluginCall call) {
49
+ try {
50
+ final JSObject ret = new JSObject();
51
+ ret.put("version", this.PLUGIN_VERSION);
52
+ call.resolve(ret);
53
+ } catch (final Exception e) {
54
+ call.reject("Could not get plugin version", e);
55
+ }
56
+ }
42
57
  }
package/dist/docs.json CHANGED
@@ -2,8 +2,13 @@
2
2
  "api": {
3
3
  "name": "VolumeButtonsPlugin",
4
4
  "slug": "volumebuttonsplugin",
5
- "docs": "",
6
- "tags": [],
5
+ "docs": "Capacitor Volume Buttons Plugin for detecting hardware volume button presses.",
6
+ "tags": [
7
+ {
8
+ "text": "1.0.0",
9
+ "name": "since"
10
+ }
11
+ ],
7
12
  "methods": [
8
13
  {
9
14
  "name": "addListener",
@@ -11,17 +16,38 @@
11
16
  "parameters": [
12
17
  {
13
18
  "name": "eventName",
14
- "docs": "",
19
+ "docs": "- The event name (must be 'volumeButtonPressed')",
15
20
  "type": "'volumeButtonPressed'"
16
21
  },
17
22
  {
18
23
  "name": "listenerFunc",
19
- "docs": "",
24
+ "docs": "- The function to call when a volume button is pressed",
20
25
  "type": "VolumeButtonListener"
21
26
  }
22
27
  ],
23
28
  "returns": "Promise<PluginListenerHandle> & PluginListenerHandle",
24
- "tags": [],
29
+ "tags": [
30
+ {
31
+ "name": "param",
32
+ "text": "eventName - The event name (must be 'volumeButtonPressed')"
33
+ },
34
+ {
35
+ "name": "param",
36
+ "text": "listenerFunc - The function to call when a volume button is pressed"
37
+ },
38
+ {
39
+ "name": "returns",
40
+ "text": "A promise that resolves to a listener handle"
41
+ },
42
+ {
43
+ "name": "since",
44
+ "text": "1.0.0"
45
+ },
46
+ {
47
+ "name": "example",
48
+ "text": "```typescript\nconst listener = await VolumeButtons.addListener(\n 'volumeButtonPressed',\n (event) => {\n console.log(`Volume ${event.direction} button pressed`);\n }\n);\n\n// Remove listener when done\nawait listener.remove();\n```"
49
+ }
50
+ ],
25
51
  "docs": "Listen for presses on the hardware volume buttons.",
26
52
  "complexTypes": [
27
53
  "PluginListenerHandle",
@@ -34,10 +60,50 @@
34
60
  "signature": "() => Promise<void>",
35
61
  "parameters": [],
36
62
  "returns": "Promise<void>",
37
- "tags": [],
63
+ "tags": [
64
+ {
65
+ "name": "returns",
66
+ "text": "Promise that resolves when all listeners are removed"
67
+ },
68
+ {
69
+ "name": "since",
70
+ "text": "1.0.0"
71
+ },
72
+ {
73
+ "name": "example",
74
+ "text": "```typescript\nawait VolumeButtons.removeAllListeners();\n```"
75
+ }
76
+ ],
38
77
  "docs": "Removes all listeners for this plugin.",
39
78
  "complexTypes": [],
40
79
  "slug": "removealllisteners"
80
+ },
81
+ {
82
+ "name": "getPluginVersion",
83
+ "signature": "() => Promise<{ version: string; }>",
84
+ "parameters": [],
85
+ "returns": "Promise<{ version: string; }>",
86
+ "tags": [
87
+ {
88
+ "name": "returns",
89
+ "text": "Promise that resolves with the plugin version"
90
+ },
91
+ {
92
+ "name": "throws",
93
+ "text": "Error if getting the version fails"
94
+ },
95
+ {
96
+ "name": "since",
97
+ "text": "1.0.0"
98
+ },
99
+ {
100
+ "name": "example",
101
+ "text": "```typescript\nconst { version } = await VolumeButtons.getPluginVersion();\nconsole.log('Plugin version:', version);\n```"
102
+ }
103
+ ],
104
+ "docs": "Get the native Capacitor plugin version.",
105
+ "complexTypes": [],
106
+ "slug": "getpluginversion"
41
107
  }
42
108
  ],
43
109
  "properties": []
@@ -62,14 +128,19 @@
62
128
  {
63
129
  "name": "VolumeButtonPressed",
64
130
  "slug": "volumebuttonpressed",
65
- "docs": "",
66
- "tags": [],
131
+ "docs": "Event data for volume button press.",
132
+ "tags": [
133
+ {
134
+ "text": "1.0.0",
135
+ "name": "since"
136
+ }
137
+ ],
67
138
  "methods": [],
68
139
  "properties": [
69
140
  {
70
141
  "name": "direction",
71
142
  "tags": [],
72
- "docs": "",
143
+ "docs": "Direction of the button press",
73
144
  "complexTypes": [
74
145
  "VolumeButtonDirection"
75
146
  ],
@@ -83,7 +154,7 @@
83
154
  {
84
155
  "name": "VolumeButtonListener",
85
156
  "slug": "volumebuttonlistener",
86
- "docs": "",
157
+ "docs": "Listener function for volume button events.",
87
158
  "types": [
88
159
  {
89
160
  "text": "(event: VolumeButtonPressed): void",
@@ -96,7 +167,7 @@
96
167
  {
97
168
  "name": "VolumeButtonDirection",
98
169
  "slug": "volumebuttondirection",
99
- "docs": "",
170
+ "docs": "Direction of volume button press.",
100
171
  "types": [
101
172
  {
102
173
  "text": "'up'",
@@ -1,16 +1,76 @@
1
1
  import type { PluginListenerHandle } from '@capacitor/core';
2
+ /**
3
+ * Direction of volume button press.
4
+ *
5
+ * @since 1.0.0
6
+ */
2
7
  export declare type VolumeButtonDirection = 'up' | 'down';
8
+ /**
9
+ * Event data for volume button press.
10
+ *
11
+ * @since 1.0.0
12
+ */
3
13
  export interface VolumeButtonPressed {
14
+ /** Direction of the button press */
4
15
  direction: VolumeButtonDirection;
5
16
  }
17
+ /**
18
+ * Listener function for volume button events.
19
+ *
20
+ * @since 1.0.0
21
+ */
6
22
  export declare type VolumeButtonListener = (event: VolumeButtonPressed) => void;
23
+ /**
24
+ * Capacitor Volume Buttons Plugin for detecting hardware volume button presses.
25
+ *
26
+ * @since 1.0.0
27
+ */
7
28
  export interface VolumeButtonsPlugin {
8
29
  /**
9
30
  * Listen for presses on the hardware volume buttons.
31
+ *
32
+ * @param eventName - The event name (must be 'volumeButtonPressed')
33
+ * @param listenerFunc - The function to call when a volume button is pressed
34
+ * @returns A promise that resolves to a listener handle
35
+ * @since 1.0.0
36
+ * @example
37
+ * ```typescript
38
+ * const listener = await VolumeButtons.addListener(
39
+ * 'volumeButtonPressed',
40
+ * (event) => {
41
+ * console.log(`Volume ${event.direction} button pressed`);
42
+ * }
43
+ * );
44
+ *
45
+ * // Remove listener when done
46
+ * await listener.remove();
47
+ * ```
10
48
  */
11
49
  addListener(eventName: 'volumeButtonPressed', listenerFunc: VolumeButtonListener): Promise<PluginListenerHandle> & PluginListenerHandle;
12
50
  /**
13
51
  * Removes all listeners for this plugin.
52
+ *
53
+ * @returns Promise that resolves when all listeners are removed
54
+ * @since 1.0.0
55
+ * @example
56
+ * ```typescript
57
+ * await VolumeButtons.removeAllListeners();
58
+ * ```
14
59
  */
15
60
  removeAllListeners(): Promise<void>;
61
+ /**
62
+ * Get the native Capacitor plugin version.
63
+ *
64
+ * @returns Promise that resolves with the plugin version
65
+ * @throws Error if getting the version fails
66
+ * @since 1.0.0
67
+ * @example
68
+ * ```typescript
69
+ * const { version } = await VolumeButtons.getPluginVersion();
70
+ * console.log('Plugin version:', version);
71
+ * ```
72
+ */
73
+ getPluginVersion(): Promise<{
74
+ version: string;
75
+ }>;
16
76
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport type VolumeButtonDirection = 'up' | 'down';\n\nexport interface VolumeButtonPressed {\n direction: VolumeButtonDirection;\n}\n\nexport type VolumeButtonListener = (event: VolumeButtonPressed) => void;\n\nexport interface VolumeButtonsPlugin {\n /**\n * Listen for presses on the hardware volume buttons.\n */\n addListener(\n eventName: 'volumeButtonPressed',\n listenerFunc: VolumeButtonListener,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n /**\n * Removes all listeners for this plugin.\n */\n removeAllListeners(): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * Direction of volume button press.\n *\n * @since 1.0.0\n */\nexport type VolumeButtonDirection = 'up' | 'down';\n\n/**\n * Event data for volume button press.\n *\n * @since 1.0.0\n */\nexport interface VolumeButtonPressed {\n /** Direction of the button press */\n direction: VolumeButtonDirection;\n}\n\n/**\n * Listener function for volume button events.\n *\n * @since 1.0.0\n */\nexport type VolumeButtonListener = (event: VolumeButtonPressed) => void;\n\n/**\n * Capacitor Volume Buttons Plugin for detecting hardware volume button presses.\n *\n * @since 1.0.0\n */\nexport interface VolumeButtonsPlugin {\n /**\n * Listen for presses on the hardware volume buttons.\n *\n * @param eventName - The event name (must be 'volumeButtonPressed')\n * @param listenerFunc - The function to call when a volume button is pressed\n * @returns A promise that resolves to a listener handle\n * @since 1.0.0\n * @example\n * ```typescript\n * const listener = await VolumeButtons.addListener(\n * 'volumeButtonPressed',\n * (event) => {\n * console.log(`Volume ${event.direction} button pressed`);\n * }\n * );\n *\n * // Remove listener when done\n * await listener.remove();\n * ```\n */\n addListener(\n eventName: 'volumeButtonPressed',\n listenerFunc: VolumeButtonListener,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Removes all listeners for this plugin.\n *\n * @returns Promise that resolves when all listeners are removed\n * @since 1.0.0\n * @example\n * ```typescript\n * await VolumeButtons.removeAllListeners();\n * ```\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Get the native Capacitor plugin version.\n *\n * @returns Promise that resolves with the plugin version\n * @throws Error if getting the version fails\n * @since 1.0.0\n * @example\n * ```typescript\n * const { version } = await VolumeButtons.getPluginVersion();\n * console.log('Plugin version:', version);\n * ```\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -6,4 +6,7 @@ export declare class VolumeButtonsWeb extends WebPlugin implements VolumeButtons
6
6
  addListener(eventName: 'volumeButtonPressed', listenerFunc: VolumeButtonListener): Promise<PluginListenerHandle> & PluginListenerHandle;
7
7
  removeAllListeners(): Promise<void>;
8
8
  private notifyUnsupported;
9
+ getPluginVersion(): Promise<{
10
+ version: string;
11
+ }>;
9
12
  }
package/dist/esm/web.js CHANGED
@@ -17,5 +17,8 @@ export class VolumeButtonsWeb extends WebPlugin {
17
17
  console.warn('VolumeButtons is not supported in web builds.');
18
18
  }
19
19
  }
20
+ async getPluginVersion() {
21
+ return { version: 'web' };
22
+ }
20
23
  }
21
24
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAKvD,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAA/C;;QACmB,aAAQ,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;IAoBtD,CAAC;IAlBC,WAAW,CACT,SAAgC,EAChC,YAAkC;QAElC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,YAAY,CAAyD,CAAC;IAC5G,CAAC;IAED,kBAAkB;QAChB,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,kBAAkB,EAAE,CAAC;IACpC,CAAC;IAEO,iBAAiB;QACvB,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE;YAC3B,OAAO,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;SAC/D;IACH,CAAC;CACF","sourcesContent":["import { Capacitor, WebPlugin } from '@capacitor/core';\nimport type { PluginListenerHandle } from '@capacitor/core';\n\nimport type { VolumeButtonListener, VolumeButtonsPlugin } from './definitions';\n\nexport class VolumeButtonsWeb extends WebPlugin implements VolumeButtonsPlugin {\n private readonly platform = Capacitor.getPlatform();\n\n addListener(\n eventName: 'volumeButtonPressed',\n listenerFunc: VolumeButtonListener,\n ): Promise<PluginListenerHandle> & PluginListenerHandle {\n this.notifyUnsupported();\n return super.addListener(eventName, listenerFunc) as Promise<PluginListenerHandle> & PluginListenerHandle;\n }\n\n removeAllListeners(): Promise<void> {\n this.notifyUnsupported();\n return super.removeAllListeners();\n }\n\n private notifyUnsupported() {\n if (this.platform === 'web') {\n console.warn('VolumeButtons is not supported in web builds.');\n }\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAKvD,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAA/C;;QACmB,aAAQ,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;IAwBtD,CAAC;IAtBC,WAAW,CACT,SAAgC,EAChC,YAAkC;QAElC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,YAAY,CAAyD,CAAC;IAC5G,CAAC;IAED,kBAAkB;QAChB,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,kBAAkB,EAAE,CAAC;IACpC,CAAC;IAEO,iBAAiB;QACvB,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE;YAC3B,OAAO,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;SAC/D;IACH,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { Capacitor, WebPlugin } from '@capacitor/core';\nimport type { PluginListenerHandle } from '@capacitor/core';\n\nimport type { VolumeButtonListener, VolumeButtonsPlugin } from './definitions';\n\nexport class VolumeButtonsWeb extends WebPlugin implements VolumeButtonsPlugin {\n private readonly platform = Capacitor.getPlatform();\n\n addListener(\n eventName: 'volumeButtonPressed',\n listenerFunc: VolumeButtonListener,\n ): Promise<PluginListenerHandle> & PluginListenerHandle {\n this.notifyUnsupported();\n return super.addListener(eventName, listenerFunc) as Promise<PluginListenerHandle> & PluginListenerHandle;\n }\n\n removeAllListeners(): Promise<void> {\n this.notifyUnsupported();\n return super.removeAllListeners();\n }\n\n private notifyUnsupported() {\n if (this.platform === 'web') {\n console.warn('VolumeButtons is not supported in web builds.');\n }\n }\n\n async getPluginVersion(): Promise<{ version: string }> {\n return { version: 'web' };\n }\n}\n"]}
@@ -24,6 +24,9 @@ class VolumeButtonsWeb extends core.WebPlugin {
24
24
  console.warn('VolumeButtons is not supported in web builds.');
25
25
  }
26
26
  }
27
+ async getPluginVersion() {
28
+ return { version: 'web' };
29
+ }
27
30
  }
28
31
 
29
32
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst VolumeButtons = registerPlugin('VolumeButtons', {\n web: () => import('./web').then((m) => new m.VolumeButtonsWeb()),\n});\nexport * from './definitions';\nexport { VolumeButtons };\n//# sourceMappingURL=index.js.map","import { Capacitor, WebPlugin } from '@capacitor/core';\nexport class VolumeButtonsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.platform = Capacitor.getPlatform();\n }\n addListener(eventName, listenerFunc) {\n this.notifyUnsupported();\n return super.addListener(eventName, listenerFunc);\n }\n removeAllListeners() {\n this.notifyUnsupported();\n return super.removeAllListeners();\n }\n notifyUnsupported() {\n if (this.platform === 'web') {\n console.warn('VolumeButtons is not supported in web builds.');\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin","Capacitor"],"mappings":";;;;AACK,MAAC,aAAa,GAAGA,mBAAc,CAAC,eAAe,EAAE;AACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACpE,CAAC;;ACFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;AAChD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;AAC3B,QAAQ,IAAI,CAAC,QAAQ,GAAGC,cAAS,CAAC,WAAW,EAAE;AAC/C,IAAI;AACJ,IAAI,WAAW,CAAC,SAAS,EAAE,YAAY,EAAE;AACzC,QAAQ,IAAI,CAAC,iBAAiB,EAAE;AAChC,QAAQ,OAAO,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,YAAY,CAAC;AACzD,IAAI;AACJ,IAAI,kBAAkB,GAAG;AACzB,QAAQ,IAAI,CAAC,iBAAiB,EAAE;AAChC,QAAQ,OAAO,KAAK,CAAC,kBAAkB,EAAE;AACzC,IAAI;AACJ,IAAI,iBAAiB,GAAG;AACxB,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE;AACrC,YAAY,OAAO,CAAC,IAAI,CAAC,+CAA+C,CAAC;AACzE,QAAQ;AACR,IAAI;AACJ;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst VolumeButtons = registerPlugin('VolumeButtons', {\n web: () => import('./web').then((m) => new m.VolumeButtonsWeb()),\n});\nexport * from './definitions';\nexport { VolumeButtons };\n//# sourceMappingURL=index.js.map","import { Capacitor, WebPlugin } from '@capacitor/core';\nexport class VolumeButtonsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.platform = Capacitor.getPlatform();\n }\n addListener(eventName, listenerFunc) {\n this.notifyUnsupported();\n return super.addListener(eventName, listenerFunc);\n }\n removeAllListeners() {\n this.notifyUnsupported();\n return super.removeAllListeners();\n }\n notifyUnsupported() {\n if (this.platform === 'web') {\n console.warn('VolumeButtons is not supported in web builds.');\n }\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin","Capacitor"],"mappings":";;;;AACK,MAAC,aAAa,GAAGA,mBAAc,CAAC,eAAe,EAAE;AACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACpE,CAAC;;ACFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;AAChD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;AAC3B,QAAQ,IAAI,CAAC,QAAQ,GAAGC,cAAS,CAAC,WAAW,EAAE;AAC/C,IAAI;AACJ,IAAI,WAAW,CAAC,SAAS,EAAE,YAAY,EAAE;AACzC,QAAQ,IAAI,CAAC,iBAAiB,EAAE;AAChC,QAAQ,OAAO,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,YAAY,CAAC;AACzD,IAAI;AACJ,IAAI,kBAAkB,GAAG;AACzB,QAAQ,IAAI,CAAC,iBAAiB,EAAE;AAChC,QAAQ,OAAO,KAAK,CAAC,kBAAkB,EAAE;AACzC,IAAI;AACJ,IAAI,iBAAiB,GAAG;AACxB,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE;AACrC,YAAY,OAAO,CAAC,IAAI,CAAC,+CAA+C,CAAC;AACzE,QAAQ;AACR,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -23,6 +23,9 @@ var capacitorVolumeButtons = (function (exports, core) {
23
23
  console.warn('VolumeButtons is not supported in web builds.');
24
24
  }
25
25
  }
26
+ async getPluginVersion() {
27
+ return { version: 'web' };
28
+ }
26
29
  }
27
30
 
28
31
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst VolumeButtons = registerPlugin('VolumeButtons', {\n web: () => import('./web').then((m) => new m.VolumeButtonsWeb()),\n});\nexport * from './definitions';\nexport { VolumeButtons };\n//# sourceMappingURL=index.js.map","import { Capacitor, WebPlugin } from '@capacitor/core';\nexport class VolumeButtonsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.platform = Capacitor.getPlatform();\n }\n addListener(eventName, listenerFunc) {\n this.notifyUnsupported();\n return super.addListener(eventName, listenerFunc);\n }\n removeAllListeners() {\n this.notifyUnsupported();\n return super.removeAllListeners();\n }\n notifyUnsupported() {\n if (this.platform === 'web') {\n console.warn('VolumeButtons is not supported in web builds.');\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin","Capacitor"],"mappings":";;;AACK,UAAC,aAAa,GAAGA,mBAAc,CAAC,eAAe,EAAE;IACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACpE,CAAC;;ICFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;IAChD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;IAC3B,QAAQ,IAAI,CAAC,QAAQ,GAAGC,cAAS,CAAC,WAAW,EAAE;IAC/C,IAAI;IACJ,IAAI,WAAW,CAAC,SAAS,EAAE,YAAY,EAAE;IACzC,QAAQ,IAAI,CAAC,iBAAiB,EAAE;IAChC,QAAQ,OAAO,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,YAAY,CAAC;IACzD,IAAI;IACJ,IAAI,kBAAkB,GAAG;IACzB,QAAQ,IAAI,CAAC,iBAAiB,EAAE;IAChC,QAAQ,OAAO,KAAK,CAAC,kBAAkB,EAAE;IACzC,IAAI;IACJ,IAAI,iBAAiB,GAAG;IACxB,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE;IACrC,YAAY,OAAO,CAAC,IAAI,CAAC,+CAA+C,CAAC;IACzE,QAAQ;IACR,IAAI;IACJ;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst VolumeButtons = registerPlugin('VolumeButtons', {\n web: () => import('./web').then((m) => new m.VolumeButtonsWeb()),\n});\nexport * from './definitions';\nexport { VolumeButtons };\n//# sourceMappingURL=index.js.map","import { Capacitor, WebPlugin } from '@capacitor/core';\nexport class VolumeButtonsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.platform = Capacitor.getPlatform();\n }\n addListener(eventName, listenerFunc) {\n this.notifyUnsupported();\n return super.addListener(eventName, listenerFunc);\n }\n removeAllListeners() {\n this.notifyUnsupported();\n return super.removeAllListeners();\n }\n notifyUnsupported() {\n if (this.platform === 'web') {\n console.warn('VolumeButtons is not supported in web builds.');\n }\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin","Capacitor"],"mappings":";;;AACK,UAAC,aAAa,GAAGA,mBAAc,CAAC,eAAe,EAAE;IACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACpE,CAAC;;ICFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;IAChD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;IAC3B,QAAQ,IAAI,CAAC,QAAQ,GAAGC,cAAS,CAAC,WAAW,EAAE;IAC/C,IAAI;IACJ,IAAI,WAAW,CAAC,SAAS,EAAE,YAAY,EAAE;IACzC,QAAQ,IAAI,CAAC,iBAAiB,EAAE;IAChC,QAAQ,OAAO,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,YAAY,CAAC;IACzD,IAAI;IACJ,IAAI,kBAAkB,GAAG;IACzB,QAAQ,IAAI,CAAC,iBAAiB,EAAE;IAChC,QAAQ,OAAO,KAAK,CAAC,kBAAkB,EAAE;IACzC,IAAI;IACJ,IAAI,iBAAiB,GAAG;IACxB,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE;IACrC,YAAY,OAAO,CAAC,IAAI,CAAC,+CAA+C,CAAC;IACzE,QAAQ;IACR,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ;;;;;;;;;;;;;;;"}
@@ -19,9 +19,12 @@ private extension MPVolumeView {
19
19
 
20
20
  @objc(VolumeButtonsPlugin)
21
21
  public class VolumeButtonsPlugin: CAPPlugin, CAPBridgedPlugin {
22
+ private let PLUGIN_VERSION: String = "7.1.3"
22
23
  public let identifier = "VolumeButtonsPlugin"
23
24
  public let jsName = "VolumeButtons"
24
- public let pluginMethods: [CAPPluginMethod] = []
25
+ public let pluginMethods: [CAPPluginMethod] = [
26
+ CAPPluginMethod(name: "getPluginVersion", returnType: CAPPluginReturnPromise)
27
+ ]
25
28
 
26
29
  private var audioLevel: Float = 0.0
27
30
  private var observingVolume = false
@@ -81,4 +84,9 @@ public class VolumeButtonsPlugin: CAPPlugin, CAPBridgedPlugin {
81
84
  audioLevel = 0.0625
82
85
  }
83
86
  }
87
+
88
+ @objc func getPluginVersion(_ call: CAPPluginCall) {
89
+ call.resolve(["version": self.PLUGIN_VERSION])
90
+ }
91
+
84
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-volume-buttons",
3
- "version": "7.0.6",
3
+ "version": "7.1.3",
4
4
  "description": "Capacitor plugin to listen to volume button presses",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",