@dimer47/capacitor-plugin-asam 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/CapacitorPluginAsam.podspec +17 -0
- package/LICENSE +21 -0
- package/README.md +163 -0
- package/dist/docs.json +85 -0
- package/dist/esm/android.d.ts +18 -0
- package/dist/esm/android.js +17 -0
- package/dist/esm/android.js.map +1 -0
- package/dist/esm/definitions.d.ts +39 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +18 -0
- package/dist/esm/web.js +17 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +55 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +58 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/Asam.swift +58 -0
- package/ios/Plugin/AsamPlugin.h +10 -0
- package/ios/Plugin/AsamPlugin.m +11 -0
- package/ios/Plugin/AsamPlugin.swift +45 -0
- package/ios/Plugin/Info.plist +24 -0
- package/package.json +73 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'CapacitorPluginAsam'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
s.homepage = package['repository']['url']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
|
+
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
+
s.ios.deployment_target = '15.0'
|
|
15
|
+
s.dependency 'Capacitor'
|
|
16
|
+
s.swift_version = '5.9'
|
|
17
|
+
end
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 IACHI Dimitri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# đą Capacitor Plugin ASAM (Autonomous Single App Mode)
|
|
2
|
+
|
|
3
|
+
       
|
|
4
|
+
|
|
5
|
+
**â ī¸ iOS only** â This plugin uses native iOS APIs and is not available on Android or Web.
|
|
6
|
+
|
|
7
|
+
Easily integrate **Autonomous Single App Mode** (ASAM) in your iOS app, allowing it to control Single App Mode sessions for focused, distraction-free user experiences. Ideal for educational, testing, or kiosk applications. đđĒ
|
|
8
|
+
|
|
9
|
+
## đ Features
|
|
10
|
+
|
|
11
|
+
- đ **Enable / Disable** Single App Mode programmatically
|
|
12
|
+
- đ **Check** if ASAM is currently enabled
|
|
13
|
+
- ⥠**Async/Await** support â all methods return Promises
|
|
14
|
+
- đĻ **Compatible** with Capacitor 5, 6, 7 & 8
|
|
15
|
+
- đ **Supports** iOS 15 through iOS 26+
|
|
16
|
+
|
|
17
|
+
## đ Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install capacitor-plugin-asam
|
|
21
|
+
npx cap sync
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## âī¸ Configuration
|
|
25
|
+
|
|
26
|
+
To enable the Autonomous Single App Mode (ASAM) on iOS devices, administrators must utilize a **Mobile Device Management (MDM)** system or **Apple Configurator**.
|
|
27
|
+
|
|
28
|
+
These tools are essential for setting up and managing ASAM, as they provide the ability to create and deploy specific configuration profiles to iOS devices.
|
|
29
|
+
|
|
30
|
+
These profiles dictate which applications can run in ASAM, ensuring controlled and secure usage of the devices in environments like schools, businesses, or public kiosks. Without MDM or Apple Configurator, activating ASAM on iOS devices is not feasible.
|
|
31
|
+
|
|
32
|
+
> đĄ **Tip:** Make sure to allowlist your app's bundle ID in the MDM configuration for Autonomous Single App Mode.
|
|
33
|
+
|
|
34
|
+
## đšī¸ Usage
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
// import the plugin
|
|
38
|
+
import { Asam } from "capacitor-plugin-asam";
|
|
39
|
+
|
|
40
|
+
// --------------------
|
|
41
|
+
// â
Enable ASAM using setASAM
|
|
42
|
+
|
|
43
|
+
let r = await Asam.setASAM({ enable: true });
|
|
44
|
+
if (!r.success)
|
|
45
|
+
console.error("Failed to enable ASAM");
|
|
46
|
+
|
|
47
|
+
let isEnabled = (await Asam.isASAMEnabled()).enabled;
|
|
48
|
+
console.log("ASAM is enabled: " + isEnabled);
|
|
49
|
+
|
|
50
|
+
// --------------------
|
|
51
|
+
// â
Another way to enable ASAM using enableASAM
|
|
52
|
+
|
|
53
|
+
r = await Asam.enableASAM();
|
|
54
|
+
if (!r.success)
|
|
55
|
+
console.error("Failed to enable ASAM");
|
|
56
|
+
|
|
57
|
+
isEnabled = (await Asam.isASAMEnabled()).enabled;
|
|
58
|
+
console.log("ASAM is enabled: " + isEnabled);
|
|
59
|
+
|
|
60
|
+
// --------------------
|
|
61
|
+
// đ Disable ASAM using disableASAM
|
|
62
|
+
|
|
63
|
+
r = await Asam.disableASAM();
|
|
64
|
+
if (!r.success)
|
|
65
|
+
console.error("Failed to disable ASAM");
|
|
66
|
+
|
|
67
|
+
isEnabled = (await Asam.isASAMEnabled()).enabled;
|
|
68
|
+
console.log("ASAM is enabled: " + isEnabled);
|
|
69
|
+
|
|
70
|
+
// --------------------
|
|
71
|
+
// đ Another way to disable ASAM using setASAM
|
|
72
|
+
|
|
73
|
+
r = await Asam.setASAM({ enable: false });
|
|
74
|
+
if (!r.success)
|
|
75
|
+
console.error("Failed to disable ASAM");
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## đ§Ž API
|
|
79
|
+
|
|
80
|
+
> đ **Full documentation with detailed examples:** [docs/api.md](docs/api.md)
|
|
81
|
+
|
|
82
|
+
<docgen-index>
|
|
83
|
+
|
|
84
|
+
* [`setASAM(...)`](#setasam)
|
|
85
|
+
* [`enableASAM()`](#enableasam)
|
|
86
|
+
* [`disableASAM()`](#disableasam)
|
|
87
|
+
* [`isASAMEnabled()`](#isasamenabled)
|
|
88
|
+
|
|
89
|
+
</docgen-index>
|
|
90
|
+
|
|
91
|
+
<docgen-api>
|
|
92
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
93
|
+
|
|
94
|
+
### setASAM(...)
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
setASAM(options: { enable: boolean; }) => Promise<{ success: boolean; }>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Enable or disable Autonomous Single App Mode (ASAM) based on the `enable` parameter.
|
|
101
|
+
|
|
102
|
+
| Param | Type | Description |
|
|
103
|
+
| ------------- | --------------------------------- | --------------------------------------------------------- |
|
|
104
|
+
| **`options`** | <code>{ enable: boolean; }</code> | - `enable: true` to activate ASAM, `false` to deactivate. |
|
|
105
|
+
|
|
106
|
+
**Returns:** <code>Promise<{ success: boolean; }></code>
|
|
107
|
+
|
|
108
|
+
--------------------
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### enableASAM()
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
enableASAM() => Promise<{ success: boolean; }>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Enable Autonomous Single App Mode (ASAM) on the device.
|
|
118
|
+
Shortcut for `setASAM({ enable: true })`.
|
|
119
|
+
|
|
120
|
+
**Returns:** <code>Promise<{ success: boolean; }></code>
|
|
121
|
+
|
|
122
|
+
--------------------
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### disableASAM()
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
disableASAM() => Promise<{ success: boolean; }>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Disable Autonomous Single App Mode (ASAM) on the device.
|
|
132
|
+
Shortcut for `setASAM({ enable: false })`.
|
|
133
|
+
|
|
134
|
+
**Returns:** <code>Promise<{ success: boolean; }></code>
|
|
135
|
+
|
|
136
|
+
--------------------
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
### isASAMEnabled()
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
isASAMEnabled() => Promise<{ enabled: boolean; }>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Check whether Autonomous Single App Mode (ASAM) is currently active on the device.
|
|
146
|
+
|
|
147
|
+
**Returns:** <code>Promise<{ enabled: boolean; }></code>
|
|
148
|
+
|
|
149
|
+
--------------------
|
|
150
|
+
|
|
151
|
+
</docgen-api>
|
|
152
|
+
|
|
153
|
+
## đ§Ē Testing
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
npm test
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
This runs the iOS unit tests via Xcode on the iOS Simulator.
|
|
160
|
+
|
|
161
|
+
## đ§ž License
|
|
162
|
+
|
|
163
|
+
[MIT](LICENSE)
|
package/dist/docs.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "AsamPlugin",
|
|
4
|
+
"slug": "asamplugin",
|
|
5
|
+
"docs": "",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"methods": [
|
|
8
|
+
{
|
|
9
|
+
"name": "setASAM",
|
|
10
|
+
"signature": "(options: { enable: boolean; }) => Promise<{ success: boolean; }>",
|
|
11
|
+
"parameters": [
|
|
12
|
+
{
|
|
13
|
+
"name": "options",
|
|
14
|
+
"docs": "- `enable: true` to activate ASAM, `false` to deactivate.",
|
|
15
|
+
"type": "{ enable: boolean; }"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"returns": "Promise<{ success: boolean; }>",
|
|
19
|
+
"tags": [
|
|
20
|
+
{
|
|
21
|
+
"name": "param",
|
|
22
|
+
"text": "options - `enable: true` to activate ASAM, `false` to deactivate."
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "returns",
|
|
26
|
+
"text": "`{ success: true }` if the operation succeeded, `{ success: false }` otherwise."
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"docs": "Enable or disable Autonomous Single App Mode (ASAM) based on the `enable` parameter.",
|
|
30
|
+
"complexTypes": [],
|
|
31
|
+
"slug": "setasam"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "enableASAM",
|
|
35
|
+
"signature": "() => Promise<{ success: boolean; }>",
|
|
36
|
+
"parameters": [],
|
|
37
|
+
"returns": "Promise<{ success: boolean; }>",
|
|
38
|
+
"tags": [
|
|
39
|
+
{
|
|
40
|
+
"name": "returns",
|
|
41
|
+
"text": "`{ success: true }` if ASAM was enabled successfully."
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"docs": "Enable Autonomous Single App Mode (ASAM) on the device.\nShortcut for `setASAM({ enable: true })`.",
|
|
45
|
+
"complexTypes": [],
|
|
46
|
+
"slug": "enableasam"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "disableASAM",
|
|
50
|
+
"signature": "() => Promise<{ success: boolean; }>",
|
|
51
|
+
"parameters": [],
|
|
52
|
+
"returns": "Promise<{ success: boolean; }>",
|
|
53
|
+
"tags": [
|
|
54
|
+
{
|
|
55
|
+
"name": "returns",
|
|
56
|
+
"text": "`{ success: true }` if ASAM was disabled successfully."
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"docs": "Disable Autonomous Single App Mode (ASAM) on the device.\nShortcut for `setASAM({ enable: false })`.",
|
|
60
|
+
"complexTypes": [],
|
|
61
|
+
"slug": "disableasam"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "isASAMEnabled",
|
|
65
|
+
"signature": "() => Promise<{ enabled: boolean; }>",
|
|
66
|
+
"parameters": [],
|
|
67
|
+
"returns": "Promise<{ enabled: boolean; }>",
|
|
68
|
+
"tags": [
|
|
69
|
+
{
|
|
70
|
+
"name": "returns",
|
|
71
|
+
"text": "`{ enabled: true }` if ASAM / Guided Access is currently active."
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"docs": "Check whether Autonomous Single App Mode (ASAM) is currently active on the device.",
|
|
75
|
+
"complexTypes": [],
|
|
76
|
+
"slug": "isasamenabled"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"properties": []
|
|
80
|
+
},
|
|
81
|
+
"interfaces": [],
|
|
82
|
+
"enums": [],
|
|
83
|
+
"typeAliases": [],
|
|
84
|
+
"pluginConfigs": []
|
|
85
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { AsamPlugin } from './definitions';
|
|
3
|
+
export declare class AsamAndroid extends WebPlugin implements AsamPlugin {
|
|
4
|
+
setASAM(_options: {
|
|
5
|
+
enable: boolean;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
success: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
enableASAM(): Promise<{
|
|
10
|
+
success: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
disableASAM(): Promise<{
|
|
13
|
+
success: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
isASAMEnabled(): Promise<{
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
export class AsamAndroid extends WebPlugin {
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
|
+
setASAM(_options) {
|
|
5
|
+
throw this.unimplemented('setASAM is not implemented on web.');
|
|
6
|
+
}
|
|
7
|
+
enableASAM() {
|
|
8
|
+
throw this.unimplemented('enableASAM is not implemented on web.');
|
|
9
|
+
}
|
|
10
|
+
disableASAM() {
|
|
11
|
+
throw this.unimplemented('disableASAM is not implemented on web.');
|
|
12
|
+
}
|
|
13
|
+
isASAMEnabled() {
|
|
14
|
+
throw this.unimplemented('isASAMEnabled is not implemented on web.');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,WAAY,SAAQ,SAAS;IACxC,6DAA6D;IAC7D,OAAO,CAAC,QAA6B;QACnC,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,UAAU;QACR,MAAM,IAAI,CAAC,aAAa,CAAC,uCAAuC,CAAC,CAAC;IACpE,CAAC;IAED,WAAW;QACT,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC,CAAC;IACrE,CAAC;IAED,aAAa;QACX,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC,CAAC;IACvE,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { AsamPlugin } from './definitions';\n\nexport class AsamAndroid extends WebPlugin implements AsamPlugin {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setASAM(_options: { enable: boolean }): Promise<{ success: boolean }> {\n throw this.unimplemented('setASAM is not implemented on web.');\n }\n\n enableASAM(): Promise<{ success: boolean }> {\n throw this.unimplemented('enableASAM is not implemented on web.');\n }\n\n disableASAM(): Promise<{ success: boolean }> {\n throw this.unimplemented('disableASAM is not implemented on web.');\n }\n\n isASAMEnabled(): Promise<{ enabled: boolean }> {\n throw this.unimplemented('isASAMEnabled is not implemented on web.');\n }\n}\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface AsamPlugin {
|
|
2
|
+
/**
|
|
3
|
+
* Enable or disable Autonomous Single App Mode (ASAM) based on the `enable` parameter.
|
|
4
|
+
*
|
|
5
|
+
* @param options - `enable: true` to activate ASAM, `false` to deactivate.
|
|
6
|
+
* @returns `{ success: true }` if the operation succeeded, `{ success: false }` otherwise.
|
|
7
|
+
*/
|
|
8
|
+
setASAM(options: {
|
|
9
|
+
enable: boolean;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Enable Autonomous Single App Mode (ASAM) on the device.
|
|
15
|
+
* Shortcut for `setASAM({ enable: true })`.
|
|
16
|
+
*
|
|
17
|
+
* @returns `{ success: true }` if ASAM was enabled successfully.
|
|
18
|
+
*/
|
|
19
|
+
enableASAM(): Promise<{
|
|
20
|
+
success: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Disable Autonomous Single App Mode (ASAM) on the device.
|
|
24
|
+
* Shortcut for `setASAM({ enable: false })`.
|
|
25
|
+
*
|
|
26
|
+
* @returns `{ success: true }` if ASAM was disabled successfully.
|
|
27
|
+
*/
|
|
28
|
+
disableASAM(): Promise<{
|
|
29
|
+
success: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Check whether Autonomous Single App Mode (ASAM) is currently active on the device.
|
|
33
|
+
*
|
|
34
|
+
* @returns `{ enabled: true }` if ASAM / Guided Access is currently active.
|
|
35
|
+
*/
|
|
36
|
+
isASAMEnabled(): Promise<{
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface AsamPlugin {\n /**\n * Enable or disable Autonomous Single App Mode (ASAM) based on the `enable` parameter.\n *\n * @param options - `enable: true` to activate ASAM, `false` to deactivate.\n * @returns `{ success: true }` if the operation succeeded, `{ success: false }` otherwise.\n */\n setASAM(options: { enable: boolean }): Promise<{ success: boolean }>;\n\n /**\n * Enable Autonomous Single App Mode (ASAM) on the device.\n * Shortcut for `setASAM({ enable: true })`.\n *\n * @returns `{ success: true }` if ASAM was enabled successfully.\n */\n enableASAM(): Promise<{ success: boolean }>;\n\n /**\n * Disable Autonomous Single App Mode (ASAM) on the device.\n * Shortcut for `setASAM({ enable: false })`.\n *\n * @returns `{ success: true }` if ASAM was disabled successfully.\n */\n disableASAM(): Promise<{ success: boolean }>;\n\n /**\n * Check whether Autonomous Single App Mode (ASAM) is currently active on the device.\n *\n * @returns `{ enabled: true }` if ASAM / Guided Access is currently active.\n */\n isASAMEnabled(): Promise<{ enabled: boolean }>;\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { registerPlugin } from '@capacitor/core';
|
|
2
|
+
const Asam = registerPlugin('Asam', {
|
|
3
|
+
web: () => import('./web').then(m => new m.AsamWeb()),
|
|
4
|
+
android: () => import('./android').then(m => new m.AsamAndroid()),
|
|
5
|
+
});
|
|
6
|
+
export * from './definitions';
|
|
7
|
+
export { Asam };
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,IAAI,GAAG,cAAc,CAAa,MAAM,EAAE;IAC9C,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IACrD,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;CAClE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { AsamPlugin } from './definitions';\n\nconst Asam = registerPlugin<AsamPlugin>('Asam', {\n web: () => import('./web').then(m => new m.AsamWeb()),\n android: () => import('./android').then(m => new m.AsamAndroid()),\n});\n\nexport * from './definitions';\nexport { Asam };\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { AsamPlugin } from './definitions';
|
|
3
|
+
export declare class AsamWeb extends WebPlugin implements AsamPlugin {
|
|
4
|
+
setASAM(_options: {
|
|
5
|
+
enable: boolean;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
success: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
enableASAM(): Promise<{
|
|
10
|
+
success: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
disableASAM(): Promise<{
|
|
13
|
+
success: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
isASAMEnabled(): Promise<{
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
export class AsamWeb extends WebPlugin {
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
|
+
setASAM(_options) {
|
|
5
|
+
throw this.unavailable('setASAM is not available on web.');
|
|
6
|
+
}
|
|
7
|
+
enableASAM() {
|
|
8
|
+
throw this.unavailable('enableASAM is not available on web.');
|
|
9
|
+
}
|
|
10
|
+
disableASAM() {
|
|
11
|
+
throw this.unavailable('disableASAM is not available on web.');
|
|
12
|
+
}
|
|
13
|
+
isASAMEnabled() {
|
|
14
|
+
throw this.unavailable('isASAMEnabled is not available on web.');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +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,OAAQ,SAAQ,SAAS;IACpC,6DAA6D;IAC7D,OAAO,CAAC,QAA6B;QACnC,MAAM,IAAI,CAAC,WAAW,CAAC,kCAAkC,CAAC,CAAC;IAC7D,CAAC;IAED,UAAU;QACR,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC,CAAC;IAChE,CAAC;IAED,WAAW;QACT,MAAM,IAAI,CAAC,WAAW,CAAC,sCAAsC,CAAC,CAAC;IACjE,CAAC;IAED,aAAa;QACX,MAAM,IAAI,CAAC,WAAW,CAAC,wCAAwC,CAAC,CAAC;IACnE,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { AsamPlugin } from './definitions';\n\nexport class AsamWeb extends WebPlugin implements AsamPlugin {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setASAM(_options: { enable: boolean }): Promise<{ success: boolean }> {\n throw this.unavailable('setASAM is not available on web.');\n }\n\n enableASAM(): Promise<{ success: boolean }> {\n throw this.unavailable('enableASAM is not available on web.');\n }\n\n disableASAM(): Promise<{ success: boolean }> {\n throw this.unavailable('disableASAM is not available on web.');\n }\n\n isASAMEnabled(): Promise<{ enabled: boolean }> {\n throw this.unavailable('isASAMEnabled is not available on web.');\n }\n}\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@capacitor/core');
|
|
6
|
+
|
|
7
|
+
const Asam = core.registerPlugin('Asam', {
|
|
8
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.AsamWeb()),
|
|
9
|
+
android: () => Promise.resolve().then(function () { return android; }).then(m => new m.AsamAndroid()),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
class AsamWeb extends core.WebPlugin {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14
|
+
setASAM(_options) {
|
|
15
|
+
throw this.unavailable('setASAM is not available on web.');
|
|
16
|
+
}
|
|
17
|
+
enableASAM() {
|
|
18
|
+
throw this.unavailable('enableASAM is not available on web.');
|
|
19
|
+
}
|
|
20
|
+
disableASAM() {
|
|
21
|
+
throw this.unavailable('disableASAM is not available on web.');
|
|
22
|
+
}
|
|
23
|
+
isASAMEnabled() {
|
|
24
|
+
throw this.unavailable('isASAMEnabled is not available on web.');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
29
|
+
__proto__: null,
|
|
30
|
+
AsamWeb: AsamWeb
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
class AsamAndroid extends core.WebPlugin {
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
35
|
+
setASAM(_options) {
|
|
36
|
+
throw this.unimplemented('setASAM is not implemented on web.');
|
|
37
|
+
}
|
|
38
|
+
enableASAM() {
|
|
39
|
+
throw this.unimplemented('enableASAM is not implemented on web.');
|
|
40
|
+
}
|
|
41
|
+
disableASAM() {
|
|
42
|
+
throw this.unimplemented('disableASAM is not implemented on web.');
|
|
43
|
+
}
|
|
44
|
+
isASAMEnabled() {
|
|
45
|
+
throw this.unimplemented('isASAMEnabled is not implemented on web.');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var android = /*#__PURE__*/Object.freeze({
|
|
50
|
+
__proto__: null,
|
|
51
|
+
AsamAndroid: AsamAndroid
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
exports.Asam = Asam;
|
|
55
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js","esm/android.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Asam = registerPlugin('Asam', {\n web: () => import('./web').then(m => new m.AsamWeb()),\n android: () => import('./android').then(m => new m.AsamAndroid()),\n});\nexport * from './definitions';\nexport { Asam };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AsamWeb extends WebPlugin {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setASAM(_options) {\n throw this.unavailable('setASAM is not available on web.');\n }\n enableASAM() {\n throw this.unavailable('enableASAM is not available on web.');\n }\n disableASAM() {\n throw this.unavailable('disableASAM is not available on web.');\n }\n isASAMEnabled() {\n throw this.unavailable('isASAMEnabled is not available on web.');\n }\n}\n//# sourceMappingURL=web.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AsamAndroid extends WebPlugin {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setASAM(_options) {\n throw this.unimplemented('setASAM is not implemented on web.');\n }\n enableASAM() {\n throw this.unimplemented('enableASAM is not implemented on web.');\n }\n disableASAM() {\n throw this.unimplemented('disableASAM is not implemented on web.');\n }\n isASAMEnabled() {\n throw this.unimplemented('isASAMEnabled is not implemented on web.');\n }\n}\n//# sourceMappingURL=android.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,IAAI,GAAGA,mBAAc,CAAC,MAAM,EAAE;AACpC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AACzD,IAAI,OAAO,EAAE,MAAM,uDAAmB,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AACrE,CAAC;;ACHM,MAAM,OAAO,SAASC,cAAS,CAAC;AACvC;AACA,IAAI,OAAO,CAAC,QAAQ,EAAE;AACtB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,kCAAkC,CAAC,CAAC;AACnE,KAAK;AACL,IAAI,UAAU,GAAG;AACjB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC,CAAC;AACtE,KAAK;AACL,IAAI,WAAW,GAAG;AAClB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,sCAAsC,CAAC,CAAC;AACvE,KAAK;AACL,IAAI,aAAa,GAAG;AACpB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,wCAAwC,CAAC,CAAC;AACzE,KAAK;AACL;;;;;;;ACdO,MAAM,WAAW,SAASA,cAAS,CAAC;AAC3C;AACA,IAAI,OAAO,CAAC,QAAQ,EAAE;AACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;AACvE,KAAK;AACL,IAAI,UAAU,GAAG;AACjB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,uCAAuC,CAAC,CAAC;AAC1E,KAAK;AACL,IAAI,WAAW,GAAG;AAClB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC,CAAC;AAC3E,KAAK;AACL,IAAI,aAAa,GAAG;AACpB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC,CAAC;AAC7E,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var capacitorAsam = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const Asam = core.registerPlugin('Asam', {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.AsamWeb()),
|
|
6
|
+
android: () => Promise.resolve().then(function () { return android; }).then(m => new m.AsamAndroid()),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
class AsamWeb extends core.WebPlugin {
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
|
+
setASAM(_options) {
|
|
12
|
+
throw this.unavailable('setASAM is not available on web.');
|
|
13
|
+
}
|
|
14
|
+
enableASAM() {
|
|
15
|
+
throw this.unavailable('enableASAM is not available on web.');
|
|
16
|
+
}
|
|
17
|
+
disableASAM() {
|
|
18
|
+
throw this.unavailable('disableASAM is not available on web.');
|
|
19
|
+
}
|
|
20
|
+
isASAMEnabled() {
|
|
21
|
+
throw this.unavailable('isASAMEnabled is not available on web.');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
26
|
+
__proto__: null,
|
|
27
|
+
AsamWeb: AsamWeb
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
class AsamAndroid extends core.WebPlugin {
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
|
+
setASAM(_options) {
|
|
33
|
+
throw this.unimplemented('setASAM is not implemented on web.');
|
|
34
|
+
}
|
|
35
|
+
enableASAM() {
|
|
36
|
+
throw this.unimplemented('enableASAM is not implemented on web.');
|
|
37
|
+
}
|
|
38
|
+
disableASAM() {
|
|
39
|
+
throw this.unimplemented('disableASAM is not implemented on web.');
|
|
40
|
+
}
|
|
41
|
+
isASAMEnabled() {
|
|
42
|
+
throw this.unimplemented('isASAMEnabled is not implemented on web.');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var android = /*#__PURE__*/Object.freeze({
|
|
47
|
+
__proto__: null,
|
|
48
|
+
AsamAndroid: AsamAndroid
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
exports.Asam = Asam;
|
|
52
|
+
|
|
53
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
54
|
+
|
|
55
|
+
return exports;
|
|
56
|
+
|
|
57
|
+
})({}, capacitorExports);
|
|
58
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js","esm/android.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Asam = registerPlugin('Asam', {\n web: () => import('./web').then(m => new m.AsamWeb()),\n android: () => import('./android').then(m => new m.AsamAndroid()),\n});\nexport * from './definitions';\nexport { Asam };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AsamWeb extends WebPlugin {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setASAM(_options) {\n throw this.unavailable('setASAM is not available on web.');\n }\n enableASAM() {\n throw this.unavailable('enableASAM is not available on web.');\n }\n disableASAM() {\n throw this.unavailable('disableASAM is not available on web.');\n }\n isASAMEnabled() {\n throw this.unavailable('isASAMEnabled is not available on web.');\n }\n}\n//# sourceMappingURL=web.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AsamAndroid extends WebPlugin {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setASAM(_options) {\n throw this.unimplemented('setASAM is not implemented on web.');\n }\n enableASAM() {\n throw this.unimplemented('enableASAM is not implemented on web.');\n }\n disableASAM() {\n throw this.unimplemented('disableASAM is not implemented on web.');\n }\n isASAMEnabled() {\n throw this.unimplemented('isASAMEnabled is not implemented on web.');\n }\n}\n//# sourceMappingURL=android.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,IAAI,GAAGA,mBAAc,CAAC,MAAM,EAAE;IACpC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IACzD,IAAI,OAAO,EAAE,MAAM,uDAAmB,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IACrE,CAAC;;ICHM,MAAM,OAAO,SAASC,cAAS,CAAC;IACvC;IACA,IAAI,OAAO,CAAC,QAAQ,EAAE;IACtB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,kCAAkC,CAAC,CAAC;IACnE,KAAK;IACL,IAAI,UAAU,GAAG;IACjB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC,CAAC;IACtE,KAAK;IACL,IAAI,WAAW,GAAG;IAClB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,sCAAsC,CAAC,CAAC;IACvE,KAAK;IACL,IAAI,aAAa,GAAG;IACpB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,wCAAwC,CAAC,CAAC;IACzE,KAAK;IACL;;;;;;;ICdO,MAAM,WAAW,SAASA,cAAS,CAAC;IAC3C;IACA,IAAI,OAAO,CAAC,QAAQ,EAAE;IACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACvE,KAAK;IACL,IAAI,UAAU,GAAG;IACjB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,uCAAuC,CAAC,CAAC;IAC1E,KAAK;IACL,IAAI,WAAW,GAAG;IAClB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC,CAAC;IAC3E,KAAK;IACL,IAAI,aAAa,GAAG;IACpB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC,CAAC;IAC7E,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import UIKit
|
|
3
|
+
|
|
4
|
+
/// Protocol abstracting Guided Access operations for testability.
|
|
5
|
+
public protocol GuidedAccessProvider {
|
|
6
|
+
func requestGuidedAccessSession(enabled: Bool) async -> Bool
|
|
7
|
+
var isGuidedAccessEnabled: Bool { get }
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/// Default implementation using UIAccessibility system APIs.
|
|
11
|
+
public struct SystemGuidedAccessProvider: GuidedAccessProvider {
|
|
12
|
+
public init() {}
|
|
13
|
+
|
|
14
|
+
@MainActor
|
|
15
|
+
public func requestGuidedAccessSession(enabled: Bool) async -> Bool {
|
|
16
|
+
await withCheckedContinuation { continuation in
|
|
17
|
+
UIAccessibility.requestGuidedAccessSession(enabled: enabled) { success in
|
|
18
|
+
continuation.resume(returning: success)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@MainActor
|
|
24
|
+
public var isGuidedAccessEnabled: Bool {
|
|
25
|
+
UIAccessibility.isGuidedAccessEnabled
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@objc public class Asam: NSObject {
|
|
30
|
+
private let provider: GuidedAccessProvider
|
|
31
|
+
|
|
32
|
+
public init(provider: GuidedAccessProvider = SystemGuidedAccessProvider()) {
|
|
33
|
+
self.provider = provider
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@objc public func setASAM(_ enable: Bool, completion: @escaping (Bool) -> Void) {
|
|
37
|
+
Task { @MainActor in
|
|
38
|
+
let success = await provider.requestGuidedAccessSession(enabled: enable)
|
|
39
|
+
print("From Native -> ASAM requested to be \(enable ? "enabled" : "disabled").")
|
|
40
|
+
print("From Native -> ASAM is \(success ? "enabled" : "disabled").")
|
|
41
|
+
completion(success)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@objc public func enableASAM(completion: @escaping (Bool) -> Void) {
|
|
46
|
+
setASAM(true, completion: completion)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@objc public func disableASAM(completion: @escaping (Bool) -> Void) {
|
|
50
|
+
setASAM(false, completion: completion)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@objc public func isASAMEnabled(_ callback: @escaping (Bool) -> Void) {
|
|
54
|
+
Task { @MainActor in
|
|
55
|
+
callback(provider.isGuidedAccessEnabled)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
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(AsamPlugin, "Asam",
|
|
7
|
+
CAP_PLUGIN_METHOD(setASAM, CAPPluginReturnPromise);
|
|
8
|
+
CAP_PLUGIN_METHOD(enableASAM, CAPPluginReturnPromise);
|
|
9
|
+
CAP_PLUGIN_METHOD(disableASAM, CAPPluginReturnPromise);
|
|
10
|
+
CAP_PLUGIN_METHOD(isASAMEnabled, CAPPluginReturnPromise);
|
|
11
|
+
)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Please read the Capacitor iOS Plugin Development Guide
|
|
6
|
+
* here: https://capacitorjs.com/docs/plugins/ios
|
|
7
|
+
*/
|
|
8
|
+
@objc(AsamPlugin)
|
|
9
|
+
public class AsamPlugin: CAPPlugin {
|
|
10
|
+
private let implementation = Asam()
|
|
11
|
+
|
|
12
|
+
@objc func setASAM(_ call: CAPPluginCall) {
|
|
13
|
+
let enable = call.getBool("enable") ?? false
|
|
14
|
+
|
|
15
|
+
implementation.setASAM(enable, completion: { success in
|
|
16
|
+
call.resolve([
|
|
17
|
+
"success": success
|
|
18
|
+
])
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@objc func enableASAM(_ call: CAPPluginCall) {
|
|
23
|
+
implementation.setASAM(true, completion: { success in
|
|
24
|
+
call.resolve([
|
|
25
|
+
"success": success
|
|
26
|
+
])
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@objc func disableASAM(_ call: CAPPluginCall) {
|
|
31
|
+
implementation.setASAM(false, completion: { success in
|
|
32
|
+
call.resolve([
|
|
33
|
+
"success": success
|
|
34
|
+
])
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@objc func isASAMEnabled(_ call: CAPPluginCall) {
|
|
39
|
+
implementation.isASAMEnabled { enabled in
|
|
40
|
+
call.resolve([
|
|
41
|
+
"enabled": enabled
|
|
42
|
+
])
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
|
+
<key>CFBundleExecutable</key>
|
|
8
|
+
<string>$(EXECUTABLE_NAME)</string>
|
|
9
|
+
<key>CFBundleIdentifier</key>
|
|
10
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
12
|
+
<string>6.0</string>
|
|
13
|
+
<key>CFBundleName</key>
|
|
14
|
+
<string>$(PRODUCT_NAME)</string>
|
|
15
|
+
<key>CFBundlePackageType</key>
|
|
16
|
+
<string>FMWK</string>
|
|
17
|
+
<key>CFBundleShortVersionString</key>
|
|
18
|
+
<string>1.0</string>
|
|
19
|
+
<key>CFBundleVersion</key>
|
|
20
|
+
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
21
|
+
<key>NSPrincipalClass</key>
|
|
22
|
+
<string></string>
|
|
23
|
+
</dict>
|
|
24
|
+
</plist>
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dimer47/capacitor-plugin-asam",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Easily integrate Autonomous Single App Mode in your app, allowing it to control Single App Mode sessions for focused, distraction-free user experiences. Ideal for educational, testing, or kiosk applications.",
|
|
5
|
+
"main": "dist/plugin.cjs.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/esm/index.d.ts",
|
|
8
|
+
"unpkg": "dist/plugin.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/",
|
|
11
|
+
"ios/Plugin/",
|
|
12
|
+
"CapacitorPluginAsam.podspec"
|
|
13
|
+
],
|
|
14
|
+
"author": "Dimer47",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/dimer47/capacitor-plugin-asam.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/dimer47/capacitor-plugin-asam/issues"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"capacitor",
|
|
25
|
+
"plugin",
|
|
26
|
+
"native"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"verify": "npm run verify:ios && npm run verify:web",
|
|
30
|
+
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
|
|
31
|
+
"verify:web": "npm run build",
|
|
32
|
+
"test": "cd ios && pod install && xcodebuild test -workspace Plugin.xcworkspace -scheme Plugin -destination 'platform=iOS Simulator,name=iPhone 17 Pro,OS=latest' && cd ..",
|
|
33
|
+
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
34
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
|
|
35
|
+
"eslint": "eslint . --ext ts",
|
|
36
|
+
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
37
|
+
"swiftlint": "node-swiftlint",
|
|
38
|
+
"docgen": "docgen --api AsamPlugin --output-readme README.md --output-json dist/docs.json",
|
|
39
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
|
|
40
|
+
"clean": "rimraf ./dist",
|
|
41
|
+
"watch": "tsc --watch",
|
|
42
|
+
"prepublishOnly": "npm run build"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@capacitor/android": "^8.0.0",
|
|
46
|
+
"@capacitor/core": "^8.0.0",
|
|
47
|
+
"@capacitor/docgen": "^0.0.18",
|
|
48
|
+
"@capacitor/ios": "^8.0.0",
|
|
49
|
+
"@ionic/eslint-config": "^0.3.0",
|
|
50
|
+
"@ionic/prettier-config": "^1.0.1",
|
|
51
|
+
"@ionic/swiftlint-config": "^1.1.2",
|
|
52
|
+
"eslint": "^7.11.0",
|
|
53
|
+
"prettier": "~2.3.0",
|
|
54
|
+
"prettier-plugin-java": "~1.0.2",
|
|
55
|
+
"rimraf": "^3.0.2",
|
|
56
|
+
"rollup": "^2.32.0",
|
|
57
|
+
"swiftlint": "^1.0.1",
|
|
58
|
+
"typescript": "~4.1.5"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"@capacitor/core": ">=5.0.0"
|
|
62
|
+
},
|
|
63
|
+
"prettier": "@ionic/prettier-config",
|
|
64
|
+
"swiftlint": "@ionic/swiftlint-config",
|
|
65
|
+
"eslintConfig": {
|
|
66
|
+
"extends": "@ionic/eslint-config/recommended"
|
|
67
|
+
},
|
|
68
|
+
"capacitor": {
|
|
69
|
+
"ios": {
|
|
70
|
+
"src": "ios"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|