@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.
- package/CapgoCapacitorFlash.podspec +1 -1
- package/README.md +8 -12
- package/android/build.gradle +9 -9
- package/android/src/main/java/ee/forgr/plugin/capacitor_flash/CapacitorFlashPlugin.java +109 -98
- package/dist/docs.json +10 -10
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +5 -5
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +5 -5
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +5 -5
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorFlashPlugin.swift +10 -0
- package/package.json +28 -29
- package/ios/Plugin/CapacitorFlashPlugin.h +0 -10
- package/ios/Plugin/CapacitorFlashPlugin.m +0 -12
|
@@ -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
|
@@ -50,12 +50,12 @@ Works out of the box
|
|
|
50
50
|
### isAvailable()
|
|
51
51
|
|
|
52
52
|
```typescript
|
|
53
|
-
isAvailable() =>
|
|
53
|
+
isAvailable() => Promise<{ value: boolean; }>
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
Checks if flashlight is available
|
|
57
57
|
|
|
58
|
-
**Returns:** <code>
|
|
58
|
+
**Returns:** <code>Promise<{ value: boolean; }></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; }) =>
|
|
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() =>
|
|
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() =>
|
|
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>
|
|
97
|
+
**Returns:** <code>Promise<{ value: boolean; }></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() =>
|
|
105
|
+
toggle() => Promise<{ value: boolean; }>
|
|
110
106
|
```
|
|
111
107
|
|
|
112
108
|
Toggle the flashlight
|
|
113
109
|
|
|
114
|
-
**Returns:** <code>
|
|
110
|
+
**Returns:** <code>Promise<{ value: boolean; }></code>
|
|
115
111
|
|
|
116
112
|
--------------------
|
|
117
113
|
|
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
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1
|
|
4
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
5
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '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
|
|
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 :
|
|
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
|
|
|
@@ -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(
|
|
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
|
-
|
|
23
|
-
|
|
27
|
+
private String cameraId;
|
|
28
|
+
boolean isFlashStateOn = false;
|
|
24
29
|
|
|
25
|
-
|
|
30
|
+
private CameraManager cameraManager;
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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": "() =>
|
|
10
|
+
"signature": "() => Promise<{ value: boolean; }>",
|
|
11
11
|
"parameters": [],
|
|
12
|
-
"returns": "
|
|
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; }) =>
|
|
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": "
|
|
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": "() =>
|
|
50
|
+
"signature": "() => Promise<void>",
|
|
51
51
|
"parameters": [],
|
|
52
|
-
"returns": "
|
|
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": "() =>
|
|
65
|
+
"signature": "() => Promise<{ value: boolean; }>",
|
|
66
66
|
"parameters": [],
|
|
67
|
-
"returns": "
|
|
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": "() =>
|
|
80
|
+
"signature": "() => Promise<{ value: boolean; }>",
|
|
81
81
|
"parameters": [],
|
|
82
|
-
"returns": "
|
|
82
|
+
"returns": "Promise<{ value: boolean; }>",
|
|
83
83
|
"tags": [
|
|
84
84
|
{
|
|
85
85
|
"name": "returns",
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { registerPlugin } from
|
|
2
|
-
const CapacitorFlash = registerPlugin(
|
|
3
|
-
web: () => import(
|
|
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
|
|
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
|
|
2
|
-
import type { CapacitorFlashPlugin } from
|
|
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
|
|
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(
|
|
8
|
+
throw new Error("Method not implemented.");
|
|
9
9
|
}
|
|
10
10
|
switchOff() {
|
|
11
|
-
throw new Error(
|
|
11
|
+
throw new Error("Method not implemented.");
|
|
12
12
|
}
|
|
13
13
|
isSwitchedOn() {
|
|
14
|
-
throw new Error(
|
|
14
|
+
throw new Error("Method not implemented.");
|
|
15
15
|
}
|
|
16
16
|
toggle() {
|
|
17
|
-
throw new Error(
|
|
17
|
+
throw new Error("Method not implemented.");
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=web.js.map
|
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,
|
|
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"}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@capacitor/core');
|
|
4
4
|
|
|
5
|
-
const CapacitorFlash = core.registerPlugin(
|
|
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(
|
|
15
|
+
throw new Error("Method not implemented.");
|
|
16
16
|
}
|
|
17
17
|
switchOff() {
|
|
18
|
-
throw new Error(
|
|
18
|
+
throw new Error("Method not implemented.");
|
|
19
19
|
}
|
|
20
20
|
isSwitchedOn() {
|
|
21
|
-
throw new Error(
|
|
21
|
+
throw new Error("Method not implemented.");
|
|
22
22
|
}
|
|
23
23
|
toggle() {
|
|
24
|
-
throw new Error(
|
|
24
|
+
throw new Error("Method not implemented.");
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
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 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(
|
|
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(
|
|
14
|
+
throw new Error("Method not implemented.");
|
|
15
15
|
}
|
|
16
16
|
switchOff() {
|
|
17
|
-
throw new Error(
|
|
17
|
+
throw new Error("Method not implemented.");
|
|
18
18
|
}
|
|
19
19
|
isSwitchedOn() {
|
|
20
|
-
throw new Error(
|
|
20
|
+
throw new Error("Method not implemented.");
|
|
21
21
|
}
|
|
22
22
|
toggle() {
|
|
23
|
-
throw new Error(
|
|
23
|
+
throw new Error("Method not implemented.");
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
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 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": "
|
|
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/
|
|
20
|
+
"url": "git+https://github.com/Cap-go/capacitor-flash.git"
|
|
21
21
|
},
|
|
22
22
|
"bugs": {
|
|
23
|
-
"url": "https://github.com/
|
|
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 -- --
|
|
40
|
-
"eslint": "eslint .
|
|
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": "^
|
|
51
|
-
"@capacitor/cli": "^
|
|
52
|
-
"@capacitor/core": "^
|
|
53
|
-
"@capacitor/docgen": "^0.
|
|
54
|
-
"@capacitor/ios": "^
|
|
55
|
-
"@ionic/eslint-config": "^0.
|
|
56
|
-
"@ionic/prettier-config": "^
|
|
57
|
-
"@ionic/swiftlint-config": "^
|
|
58
|
-
"@
|
|
59
|
-
"
|
|
60
|
-
"eslint": "^
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"prettier": "^2.
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
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": "
|
|
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
|
-
)
|