@capgo/capacitor-flash 6.0.6 → 7.0.1

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
@@ -50,12 +50,12 @@ Works out of the box
50
50
  ### isAvailable()
51
51
 
52
52
  ```typescript
53
- isAvailable() => any
53
+ isAvailable() => Promise<{ value: boolean; }>
54
54
  ```
55
55
 
56
56
  Checks if flashlight is available
57
57
 
58
- **Returns:** <code>any</code>
58
+ **Returns:** <code>Promise&lt;{ value: boolean; }&gt;</code>
59
59
 
60
60
  --------------------
61
61
 
@@ -63,7 +63,7 @@ Checks if flashlight is available
63
63
  ### switchOn(...)
64
64
 
65
65
  ```typescript
66
- switchOn(options: { intensity?: number; }) => any
66
+ switchOn(options: { intensity?: number; }) => Promise<void>
67
67
  ```
68
68
 
69
69
  Turns the flashlight on
@@ -72,33 +72,29 @@ Turns the flashlight on
72
72
  | ------------- | ------------------------------------ |
73
73
  | **`options`** | <code>{ intensity?: number; }</code> |
74
74
 
75
- **Returns:** <code>any</code>
76
-
77
75
  --------------------
78
76
 
79
77
 
80
78
  ### switchOff()
81
79
 
82
80
  ```typescript
83
- switchOff() => any
81
+ switchOff() => Promise<void>
84
82
  ```
85
83
 
86
84
  Turns the flashlight off
87
85
 
88
- **Returns:** <code>any</code>
89
-
90
86
  --------------------
91
87
 
92
88
 
93
89
  ### isSwitchedOn()
94
90
 
95
91
  ```typescript
96
- isSwitchedOn() => any
92
+ isSwitchedOn() => Promise<{ value: boolean; }>
97
93
  ```
98
94
 
99
95
  Checks if the flashlight is turned on or off
100
96
 
101
- **Returns:** <code>any</code>
97
+ **Returns:** <code>Promise&lt;{ value: boolean; }&gt;</code>
102
98
 
103
99
  --------------------
104
100
 
@@ -106,12 +102,12 @@ Checks if the flashlight is turned on or off
106
102
  ### toggle()
107
103
 
108
104
  ```typescript
109
- toggle() => any
105
+ toggle() => Promise<{ value: boolean; }>
110
106
  ```
111
107
 
112
108
  Toggle the flashlight
113
109
 
114
- **Returns:** <code>any</code>
110
+ **Returns:** <code>Promise&lt;{ value: boolean; }&gt;</code>
115
111
 
116
112
  --------------------
117
113
 
@@ -1,8 +1,8 @@
1
1
  ext {
2
2
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
4
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
5
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
3
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
4
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
5
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
6
6
  }
7
7
 
8
8
  buildscript {
@@ -11,7 +11,7 @@ buildscript {
11
11
  google()
12
12
  }
13
13
  dependencies {
14
- classpath 'com.android.tools.build:gradle:8.2.1'
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.plugin.capacitor_flash"
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
 
@@ -16,118 +16,129 @@ import com.getcapacitor.annotation.CapacitorPlugin;
16
16
  import com.getcapacitor.annotation.Permission;
17
17
  import com.getcapacitor.annotation.PermissionCallback;
18
18
 
19
- @CapacitorPlugin(name = "CapacitorFlash", permissions = { @Permission(alias = "camera", strings = { Manifest.permission.CAMERA }) })
19
+ @CapacitorPlugin(
20
+ name = "CapacitorFlash",
21
+ permissions = {
22
+ @Permission(alias = "camera", strings = { Manifest.permission.CAMERA }),
23
+ }
24
+ )
20
25
  public class CapacitorFlashPlugin extends Plugin {
21
26
 
22
- private String cameraId;
23
- boolean isFlashStateOn = false;
27
+ private String cameraId;
28
+ boolean isFlashStateOn = false;
24
29
 
25
- private CameraManager cameraManager;
30
+ private CameraManager cameraManager;
26
31
 
27
- @Override
28
- public void load() {
29
- cameraManager = (CameraManager) this.bridge.getContext().getSystemService(Context.CAMERA_SERVICE);
30
- try {
31
- if (cameraManager != null) {
32
- cameraId = cameraManager.getCameraIdList()[0];
33
- }
34
- } catch (CameraAccessException e) {
35
- e.printStackTrace();
36
- }
32
+ @Override
33
+ public void load() {
34
+ cameraManager = (CameraManager) this.bridge.getContext()
35
+ .getSystemService(Context.CAMERA_SERVICE);
36
+ try {
37
+ if (cameraManager != null) {
38
+ cameraId = cameraManager.getCameraIdList()[0];
39
+ }
40
+ } catch (CameraAccessException e) {
41
+ e.printStackTrace();
37
42
  }
43
+ }
38
44
 
39
- @PluginMethod
40
- public void isAvailable(PluginCall call) {
41
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M && getPermissionState("camera") != PermissionState.GRANTED) {
42
- requestPermissionForAlias("camera", call, "cameraPermsCallback");
43
- } else {
44
- getAvailibility(call);
45
- }
45
+ @PluginMethod
46
+ public void isAvailable(PluginCall call) {
47
+ if (
48
+ Build.VERSION.SDK_INT <= Build.VERSION_CODES.M &&
49
+ getPermissionState("camera") != PermissionState.GRANTED
50
+ ) {
51
+ requestPermissionForAlias("camera", call, "cameraPermsCallback");
52
+ } else {
53
+ getAvailibility(call);
46
54
  }
55
+ }
47
56
 
48
- @PermissionCallback
49
- private void getAvailibility(PluginCall call) {
50
- JSObject ret = new JSObject();
51
- if (cameraManager == null) {
52
- ret.put("value", false);
53
- call.resolve(ret);
54
- return;
55
- }
56
- try {
57
- boolean flashAvailable = cameraManager.getCameraCharacteristics(cameraId).get(CameraCharacteristics.FLASH_INFO_AVAILABLE);
58
- ret.put("value", flashAvailable);
59
- } catch (CameraAccessException e) {
60
- e.printStackTrace();
61
- ret.put("value", false);
62
- }
63
- call.resolve(ret);
57
+ @PermissionCallback
58
+ private void getAvailibility(PluginCall call) {
59
+ JSObject ret = new JSObject();
60
+ if (cameraManager == null) {
61
+ ret.put("value", false);
62
+ call.resolve(ret);
63
+ return;
64
64
  }
65
-
66
- @RequiresApi(api = Build.VERSION_CODES.M)
67
- @PluginMethod
68
- public void switchOn(PluginCall call) {
69
- String value = call.getString("instensity"); // cannot be use in android
70
- JSObject ret = new JSObject();
71
- if (cameraManager == null) {
72
- ret.put("value", false);
73
- call.resolve(ret);
74
- return;
75
- }
76
- try {
77
- cameraManager.setTorchMode(cameraId, true);
78
- isFlashStateOn = true;
79
- ret.put("value", true);
80
- } catch (Exception e) {
81
- e.printStackTrace();
82
- ret.put("value", false);
83
- }
84
- call.resolve(ret);
65
+ try {
66
+ boolean flashAvailable = cameraManager
67
+ .getCameraCharacteristics(cameraId)
68
+ .get(CameraCharacteristics.FLASH_INFO_AVAILABLE);
69
+ ret.put("value", flashAvailable);
70
+ } catch (CameraAccessException e) {
71
+ e.printStackTrace();
72
+ ret.put("value", false);
85
73
  }
74
+ call.resolve(ret);
75
+ }
86
76
 
87
- @RequiresApi(api = Build.VERSION_CODES.M)
88
- @PluginMethod
89
- public void switchOff(PluginCall call) {
90
- JSObject ret = new JSObject();
91
- if (cameraManager == null) {
92
- ret.put("value", false);
93
- call.resolve(ret);
94
- return;
95
- }
96
- try {
97
- cameraManager.setTorchMode(cameraId, false);
98
- isFlashStateOn = false;
99
- ret.put("value", true);
100
- } catch (Exception e) {
101
- e.printStackTrace();
102
- ret.put("value", false);
103
- }
104
- call.resolve(ret);
77
+ @RequiresApi(api = Build.VERSION_CODES.M)
78
+ @PluginMethod
79
+ public void switchOn(PluginCall call) {
80
+ String value = call.getString("instensity"); // cannot be use in android
81
+ JSObject ret = new JSObject();
82
+ if (cameraManager == null) {
83
+ ret.put("value", false);
84
+ call.resolve(ret);
85
+ return;
86
+ }
87
+ try {
88
+ cameraManager.setTorchMode(cameraId, true);
89
+ isFlashStateOn = true;
90
+ ret.put("value", true);
91
+ } catch (Exception e) {
92
+ e.printStackTrace();
93
+ ret.put("value", false);
105
94
  }
95
+ call.resolve(ret);
96
+ }
106
97
 
107
- @PluginMethod
108
- public void isSwitchedOn(PluginCall call) {
109
- JSObject ret = new JSObject();
110
- ret.put("value", isFlashStateOn);
111
- call.resolve(ret);
98
+ @RequiresApi(api = Build.VERSION_CODES.M)
99
+ @PluginMethod
100
+ public void switchOff(PluginCall call) {
101
+ JSObject ret = new JSObject();
102
+ if (cameraManager == null) {
103
+ ret.put("value", false);
104
+ call.resolve(ret);
105
+ return;
106
+ }
107
+ try {
108
+ cameraManager.setTorchMode(cameraId, false);
109
+ isFlashStateOn = false;
110
+ ret.put("value", true);
111
+ } catch (Exception e) {
112
+ e.printStackTrace();
113
+ ret.put("value", false);
112
114
  }
115
+ call.resolve(ret);
116
+ }
113
117
 
114
- @RequiresApi(api = Build.VERSION_CODES.M)
115
- @PluginMethod
116
- public void toggle(PluginCall call) {
117
- JSObject ret = new JSObject();
118
- if (cameraManager == null) {
119
- ret.put("value", false);
120
- call.resolve(ret);
121
- return;
122
- }
123
- try {
124
- isFlashStateOn = !isFlashStateOn;
125
- cameraManager.setTorchMode(cameraId, isFlashStateOn);
126
- ret.put("value", isFlashStateOn);
127
- } catch (Exception e) {
128
- e.printStackTrace();
129
- ret.put("value", false);
130
- }
131
- call.resolve(ret);
118
+ @PluginMethod
119
+ public void isSwitchedOn(PluginCall call) {
120
+ JSObject ret = new JSObject();
121
+ ret.put("value", isFlashStateOn);
122
+ call.resolve(ret);
123
+ }
124
+
125
+ @RequiresApi(api = Build.VERSION_CODES.M)
126
+ @PluginMethod
127
+ public void toggle(PluginCall call) {
128
+ JSObject ret = new JSObject();
129
+ if (cameraManager == null) {
130
+ ret.put("value", false);
131
+ call.resolve(ret);
132
+ return;
133
+ }
134
+ try {
135
+ isFlashStateOn = !isFlashStateOn;
136
+ cameraManager.setTorchMode(cameraId, isFlashStateOn);
137
+ ret.put("value", isFlashStateOn);
138
+ } catch (Exception e) {
139
+ e.printStackTrace();
140
+ ret.put("value", false);
132
141
  }
142
+ call.resolve(ret);
143
+ }
133
144
  }
package/dist/docs.json CHANGED
@@ -7,9 +7,9 @@
7
7
  "methods": [
8
8
  {
9
9
  "name": "isAvailable",
10
- "signature": "() => any",
10
+ "signature": "() => Promise<{ value: boolean; }>",
11
11
  "parameters": [],
12
- "returns": "any",
12
+ "returns": "Promise<{ value: boolean; }>",
13
13
  "tags": [
14
14
  {
15
15
  "name": "returns",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  {
24
24
  "name": "switchOn",
25
- "signature": "(options: { intensity?: number; }) => any",
25
+ "signature": "(options: { intensity?: number; }) => Promise<void>",
26
26
  "parameters": [
27
27
  {
28
28
  "name": "options",
@@ -30,7 +30,7 @@
30
30
  "type": "{ intensity?: number | undefined; }"
31
31
  }
32
32
  ],
33
- "returns": "any",
33
+ "returns": "Promise<void>",
34
34
  "tags": [
35
35
  {
36
36
  "name": "returns",
@@ -47,9 +47,9 @@
47
47
  },
48
48
  {
49
49
  "name": "switchOff",
50
- "signature": "() => any",
50
+ "signature": "() => Promise<void>",
51
51
  "parameters": [],
52
- "returns": "any",
52
+ "returns": "Promise<void>",
53
53
  "tags": [
54
54
  {
55
55
  "name": "rejects",
@@ -62,9 +62,9 @@
62
62
  },
63
63
  {
64
64
  "name": "isSwitchedOn",
65
- "signature": "() => any",
65
+ "signature": "() => Promise<{ value: boolean; }>",
66
66
  "parameters": [],
67
- "returns": "any",
67
+ "returns": "Promise<{ value: boolean; }>",
68
68
  "tags": [
69
69
  {
70
70
  "name": "returns",
@@ -77,9 +77,9 @@
77
77
  },
78
78
  {
79
79
  "name": "toggle",
80
- "signature": "() => any",
80
+ "signature": "() => Promise<{ value: boolean; }>",
81
81
  "parameters": [],
82
- "returns": "any",
82
+ "returns": "Promise<{ value: boolean; }>",
83
83
  "tags": [
84
84
  {
85
85
  "name": "returns",
@@ -1,4 +1,4 @@
1
- import type { CapacitorFlashPlugin } from './definitions';
1
+ import type { CapacitorFlashPlugin } from "./definitions";
2
2
  declare const CapacitorFlash: CapacitorFlashPlugin;
3
- export * from './definitions';
3
+ export * from "./definitions";
4
4
  export { CapacitorFlash };
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { registerPlugin } from '@capacitor/core';
2
- const CapacitorFlash = registerPlugin('CapacitorFlash', {
3
- web: () => import('./web').then((m) => new m.CapacitorFlashWeb()),
1
+ import { registerPlugin } from "@capacitor/core";
2
+ const CapacitorFlash = registerPlugin("CapacitorFlash", {
3
+ web: () => import("./web").then((m) => new m.CapacitorFlashWeb()),
4
4
  });
5
- export * from './definitions';
5
+ export * from "./definitions";
6
6
  export { CapacitorFlash };
7
7
  //# sourceMappingURL=index.js.map
package/dist/esm/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { WebPlugin } from '@capacitor/core';
2
- import type { CapacitorFlashPlugin } from './definitions';
1
+ import { WebPlugin } from "@capacitor/core";
2
+ import type { CapacitorFlashPlugin } from "./definitions";
3
3
  export declare class CapacitorFlashWeb extends WebPlugin implements CapacitorFlashPlugin {
4
4
  isAvailable(): Promise<{
5
5
  value: boolean;
package/dist/esm/web.js CHANGED
@@ -1,20 +1,20 @@
1
- import { WebPlugin } from '@capacitor/core';
1
+ import { WebPlugin } from "@capacitor/core";
2
2
  export class CapacitorFlashWeb extends WebPlugin {
3
3
  isAvailable() {
4
4
  return Promise.resolve({ value: false });
5
5
  }
6
6
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
7
  switchOn(_options) {
8
- throw new Error('Method not implemented.');
8
+ throw new Error("Method not implemented.");
9
9
  }
10
10
  switchOff() {
11
- throw new Error('Method not implemented.');
11
+ throw new Error("Method not implemented.");
12
12
  }
13
13
  isSwitchedOn() {
14
- throw new Error('Method not implemented.');
14
+ throw new Error("Method not implemented.");
15
15
  }
16
16
  toggle() {
17
- throw new Error('Method not implemented.');
17
+ throw new Error("Method not implemented.");
18
18
  }
19
19
  }
20
20
  //# 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,iBAAkB,SAAQ,SAAS;IAC9C,WAAW;QACT,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,6DAA6D;IAC7D,QAAQ,CAAC,QAAgC;QACvC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,SAAS;QACP,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,YAAY;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF"}
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;IAGjB,WAAW;QACT,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,6DAA6D;IAC7D,QAAQ,CAAC,QAAgC;QACvC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,SAAS;QACP,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,YAAY;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  var core = require('@capacitor/core');
4
4
 
5
- const CapacitorFlash = core.registerPlugin('CapacitorFlash', {
5
+ const CapacitorFlash = core.registerPlugin("CapacitorFlash", {
6
6
  web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorFlashWeb()),
7
7
  });
8
8
 
@@ -12,16 +12,16 @@ class CapacitorFlashWeb extends core.WebPlugin {
12
12
  }
13
13
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
14
  switchOn(_options) {
15
- throw new Error('Method not implemented.');
15
+ throw new Error("Method not implemented.");
16
16
  }
17
17
  switchOff() {
18
- throw new Error('Method not implemented.');
18
+ throw new Error("Method not implemented.");
19
19
  }
20
20
  isSwitchedOn() {
21
- throw new Error('Method not implemented.');
21
+ throw new Error("Method not implemented.");
22
22
  }
23
23
  toggle() {
24
- throw new Error('Method not implemented.');
24
+ throw new Error("Method not implemented.");
25
25
  }
26
26
  }
27
27
 
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorFlash = registerPlugin('CapacitorFlash', {\n web: () => import('./web').then((m) => new m.CapacitorFlashWeb()),\n});\nexport * from './definitions';\nexport { CapacitorFlash };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorFlashWeb extends WebPlugin {\n isAvailable() {\n return Promise.resolve({ value: false });\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n switchOn(_options) {\n throw new Error('Method not implemented.');\n }\n switchOff() {\n throw new Error('Method not implemented.');\n }\n isSwitchedOn() {\n throw new Error('Method not implemented.');\n }\n toggle() {\n throw new Error('Method not implemented.');\n }\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,IAAI,WAAW,GAAG;AAClB,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AACjD,KAAK;AACL;AACA,IAAI,QAAQ,CAAC,QAAQ,EAAE;AACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACnD,KAAK;AACL,IAAI,SAAS,GAAG;AAChB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACnD,KAAK;AACL,IAAI,YAAY,GAAG;AACnB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACnD,KAAK;AACL,IAAI,MAAM,GAAG;AACb,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACnD,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst CapacitorFlash = registerPlugin(\"CapacitorFlash\", {\n web: () => import(\"./web\").then((m) => new m.CapacitorFlashWeb()),\n});\nexport * from \"./definitions\";\nexport { CapacitorFlash };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class CapacitorFlashWeb extends WebPlugin {\n isAvailable() {\n return Promise.resolve({ value: false });\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n switchOn(_options) {\n throw new Error(\"Method not implemented.\");\n }\n switchOff() {\n throw new Error(\"Method not implemented.\");\n }\n isSwitchedOn() {\n throw new Error(\"Method not implemented.\");\n }\n toggle() {\n throw new Error(\"Method not implemented.\");\n }\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,IAAI,WAAW,GAAG;AAClB,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAChD;AACA;AACA,IAAI,QAAQ,CAAC,QAAQ,EAAE;AACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAClD;AACA,IAAI,SAAS,GAAG;AAChB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAClD;AACA,IAAI,YAAY,GAAG;AACnB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAClD;AACA,IAAI,MAAM,GAAG;AACb,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAClD;AACA;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var capacitorCapacitorFlash = (function (exports, core) {
2
2
  'use strict';
3
3
 
4
- const CapacitorFlash = core.registerPlugin('CapacitorFlash', {
4
+ const CapacitorFlash = core.registerPlugin("CapacitorFlash", {
5
5
  web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorFlashWeb()),
6
6
  });
7
7
 
@@ -11,16 +11,16 @@ var capacitorCapacitorFlash = (function (exports, core) {
11
11
  }
12
12
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
13
  switchOn(_options) {
14
- throw new Error('Method not implemented.');
14
+ throw new Error("Method not implemented.");
15
15
  }
16
16
  switchOff() {
17
- throw new Error('Method not implemented.');
17
+ throw new Error("Method not implemented.");
18
18
  }
19
19
  isSwitchedOn() {
20
- throw new Error('Method not implemented.');
20
+ throw new Error("Method not implemented.");
21
21
  }
22
22
  toggle() {
23
- throw new Error('Method not implemented.');
23
+ throw new Error("Method not implemented.");
24
24
  }
25
25
  }
26
26
 
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorFlash = registerPlugin('CapacitorFlash', {\n web: () => import('./web').then((m) => new m.CapacitorFlashWeb()),\n});\nexport * from './definitions';\nexport { CapacitorFlash };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorFlashWeb extends WebPlugin {\n isAvailable() {\n return Promise.resolve({ value: false });\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n switchOn(_options) {\n throw new Error('Method not implemented.');\n }\n switchOff() {\n throw new Error('Method not implemented.');\n }\n isSwitchedOn() {\n throw new Error('Method not implemented.');\n }\n toggle() {\n throw new Error('Method not implemented.');\n }\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,IAAI,WAAW,GAAG;IAClB,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACjD,KAAK;IACL;IACA,IAAI,QAAQ,CAAC,QAAQ,EAAE;IACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnD,KAAK;IACL,IAAI,SAAS,GAAG;IAChB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnD,KAAK;IACL,IAAI,YAAY,GAAG;IACnB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnD,KAAK;IACL,IAAI,MAAM,GAAG;IACb,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnD,KAAK;IACL;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst CapacitorFlash = registerPlugin(\"CapacitorFlash\", {\n web: () => import(\"./web\").then((m) => new m.CapacitorFlashWeb()),\n});\nexport * from \"./definitions\";\nexport { CapacitorFlash };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class CapacitorFlashWeb extends WebPlugin {\n isAvailable() {\n return Promise.resolve({ value: false });\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n switchOn(_options) {\n throw new Error(\"Method not implemented.\");\n }\n switchOff() {\n throw new Error(\"Method not implemented.\");\n }\n isSwitchedOn() {\n throw new Error(\"Method not implemented.\");\n }\n toggle() {\n throw new Error(\"Method not implemented.\");\n }\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,IAAI,WAAW,GAAG;IAClB,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAChD;IACA;IACA,IAAI,QAAQ,CAAC,QAAQ,EAAE;IACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD;IACA,IAAI,SAAS,GAAG;IAChB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD;IACA,IAAI,YAAY,GAAG;IACnB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD;IACA,IAAI,MAAM,GAAG;IACb,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD;IACA;;;;;;;;;;;;;;;"}
@@ -7,6 +7,16 @@ import Capacitor
7
7
  */
8
8
  @objc(CapacitorFlashPlugin)
9
9
  public class CapacitorFlashPlugin: CAPPlugin {
10
+ public let identifier = "CapacitorFlashPlugin"
11
+ public let jsName = "CapacitorFlash"
12
+ public let pluginMethods: [CAPPluginMethod] = [
13
+ CAPPluginMethod(name: "isAvailable", returnType: CAPPluginReturnPromise),
14
+ CAPPluginMethod(name: "switchOn", returnType: CAPPluginReturnPromise),
15
+ CAPPluginMethod(name: "switchOff", returnType: CAPPluginReturnPromise),
16
+ CAPPluginMethod(name: "isSwitchedOn", returnType: CAPPluginReturnPromise),
17
+ CAPPluginMethod(name: "toggle", returnType: CAPPluginReturnPromise)
18
+ ]
19
+
10
20
  private let implementation = CapacitorFlash()
11
21
 
12
22
  @objc func isAvailable(_ call: CAPPluginCall) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-flash",
3
- "version": "6.0.6",
3
+ "version": "7.0.1",
4
4
  "description": "Switch the Flashlight / Torch of your 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
  "CapgoCapacitorFlash.podspec"
15
15
  ],
16
- "author": "Martin Donadieu",
16
+ "author": "Martin Donadieu <martin@capgo.app>",
17
17
  "license": "MIT",
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "git+https://github.com/riderx/capacitor-flash.git"
20
+ "url": "git+https://github.com/Cap-go/capacitor-flash.git"
21
21
  },
22
22
  "bugs": {
23
- "url": "https://github.com/riderx/capacitor-flash/issues"
23
+ "url": "https://github.com/Cap-go/capacitor-flash/issues"
24
24
  },
25
25
  "keywords": [
26
26
  "capacitor",
@@ -36,9 +36,9 @@
36
36
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
37
37
  "verify:web": "npm run build",
38
38
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
39
- "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
40
- "eslint": "eslint . --ext ts",
41
- "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
39
+ "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --autocorrect --format",
40
+ "eslint": "eslint .",
41
+ "prettier": "prettier --config .prettierrc.js \"**/*.{css,html,ts,js,java}\"",
42
42
  "swiftlint": "node-swiftlint",
43
43
  "docgen": "docgen --api CapacitorFlashPlugin --output-readme README.md --output-json dist/docs.json",
44
44
  "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
@@ -47,34 +47,33 @@
47
47
  "prepublishOnly": "npm run build"
48
48
  },
49
49
  "devDependencies": {
50
- "@capacitor/android": "^6.0.0",
51
- "@capacitor/cli": "^6.0.0",
52
- "@capacitor/core": "^6.0.0",
53
- "@capacitor/docgen": "^0.2.1",
54
- "@capacitor/ios": "^6.0.0",
55
- "@ionic/eslint-config": "^0.3.0",
56
- "@ionic/prettier-config": "^3.0.0",
57
- "@ionic/swiftlint-config": "^1.1.2",
58
- "@typescript-eslint/eslint-plugin": "^5.59.6",
59
- "@typescript-eslint/parser": "^5.59.6",
60
- "eslint": "^8.41.0",
61
- "eslint-plugin-import": "^2.27.5",
62
- "husky": "^8.0.3",
63
- "prettier": "^2.8.8",
64
- "prettier-plugin-java": "^2.1.0",
65
- "rimraf": "^5.0.1",
66
- "rollup": "^3.23.0",
67
- "swiftlint": "^1.0.2",
68
- "typescript": "^5.0.4"
50
+ "@capacitor/android": "^7.0.0",
51
+ "@capacitor/cli": "^7.0.0",
52
+ "@capacitor/core": "^7.0.0",
53
+ "@capacitor/docgen": "^0.3.0",
54
+ "@capacitor/ios": "^7.0.0",
55
+ "@ionic/eslint-config": "^0.4.0",
56
+ "@ionic/prettier-config": "^4.0.0",
57
+ "@ionic/swiftlint-config": "^2.0.0",
58
+ "@types/node": "^22.13.1",
59
+ "eslint": "^8.57.0",
60
+ "eslint-plugin-import": "^2.31.0",
61
+ "husky": "^9.1.7",
62
+ "prettier": "^3.4.2",
63
+ "prettier-plugin-java": "^2.6.7",
64
+ "rimraf": "^6.0.1",
65
+ "rollup": "^4.34.6",
66
+ "swiftlint": "^2.0.0",
67
+ "typescript": "^5.7.3"
69
68
  },
70
69
  "peerDependencies": {
71
- "@capacitor/core": "^6.0.0"
70
+ "@capacitor/core": ">=7.0.0"
72
71
  },
73
- "prettier": "@ionic/prettier-config",
74
- "swiftlint": "@ionic/swiftlint-config",
75
72
  "eslintConfig": {
76
73
  "extends": "@ionic/eslint-config/recommended"
77
74
  },
75
+ "prettier": "@ionic/prettier-config",
76
+ "swiftlint": "@ionic/swiftlint-config",
78
77
  "capacitor": {
79
78
  "ios": {
80
79
  "src": "ios"
@@ -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,12 +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(CapacitorFlashPlugin, "CapacitorFlash",
7
- CAP_PLUGIN_METHOD(isAvailable, CAPPluginReturnPromise);
8
- CAP_PLUGIN_METHOD(switchOn, CAPPluginReturnPromise);
9
- CAP_PLUGIN_METHOD(switchOff, CAPPluginReturnPromise);
10
- CAP_PLUGIN_METHOD(isSwitchedOn, CAPPluginReturnPromise);
11
- CAP_PLUGIN_METHOD(toggle, CAPPluginReturnPromise);
12
- )