@cap-kit/settings 8.0.0 → 8.0.2
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/Package.swift +2 -6
- package/README.md +12 -42
- package/android/src/main/java/io/capkit/settings/SettingsError.kt +25 -0
- package/android/src/main/java/io/capkit/settings/SettingsImpl.kt +18 -47
- package/android/src/main/java/io/capkit/settings/SettingsPlugin.kt +74 -21
- package/dist/docs.json +6 -76
- package/dist/esm/definitions.d.ts +3 -28
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +4 -4
- package/dist/esm/web.js +3 -16
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +3 -15
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +3 -15
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/SettingsPlugin/SettingsConfig.swift +5 -4
- package/ios/Sources/SettingsPlugin/SettingsError.swift +30 -0
- package/ios/Sources/SettingsPlugin/SettingsImpl.swift +20 -39
- package/ios/Sources/SettingsPlugin/SettingsPlugin.swift +49 -33
- package/ios/Sources/SettingsPlugin/Version.swift +2 -2
- package/package.json +4 -4
package/Package.swift
CHANGED
|
@@ -10,7 +10,7 @@ let package = Package(
|
|
|
10
10
|
targets: ["SettingsPlugin"])
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
|
-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.2")
|
|
14
14
|
],
|
|
15
15
|
targets: [
|
|
16
16
|
.target(
|
|
@@ -20,10 +20,6 @@ let package = Package(
|
|
|
20
20
|
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
21
|
],
|
|
22
22
|
path: "ios/Sources/SettingsPlugin"
|
|
23
|
-
)
|
|
24
|
-
.testTarget(
|
|
25
|
-
name: "SettingsPluginTests",
|
|
26
|
-
dependencies: ["SettingsPlugin"],
|
|
27
|
-
path: "ios/Tests/SettingsPluginTests")
|
|
23
|
+
)
|
|
28
24
|
]
|
|
29
25
|
)
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
<p align="center">
|
|
17
17
|
A <strong>Capacitor plugin</strong> for opening system and application settings on <strong>iOS and Android</strong>.<br>
|
|
18
|
-
Provides a unified
|
|
18
|
+
Provides a unified Promise-based API to navigate users to relevant settings screens,
|
|
19
19
|
including app settings, notifications, connectivity, and other system sections.<br>
|
|
20
20
|
Built following the <strong>Cap-Kit architectural standards</strong> with strict separation
|
|
21
21
|
between JavaScript, bridge, and native implementations (Swift / Kotlin).
|
|
@@ -122,7 +122,7 @@ This design ensures consistent behavior across Android, iOS, and Web.
|
|
|
122
122
|
### open(...)
|
|
123
123
|
|
|
124
124
|
```typescript
|
|
125
|
-
open(options: PlatformOptions) => Promise<
|
|
125
|
+
open(options: PlatformOptions) => Promise<void>
|
|
126
126
|
```
|
|
127
127
|
|
|
128
128
|
Opens the specified settings option on the current platform.
|
|
@@ -132,8 +132,6 @@ On Web, this method is not supported.
|
|
|
132
132
|
| ------------- | ----------------------------------------------------------- | ----------------------------------- |
|
|
133
133
|
| **`options`** | <code><a href="#platformoptions">PlatformOptions</a></code> | Platform-specific settings options. |
|
|
134
134
|
|
|
135
|
-
**Returns:** <code>Promise<<a href="#settingsresult">SettingsResult</a>></code>
|
|
136
|
-
|
|
137
135
|
**Since:** 1.0.0
|
|
138
136
|
|
|
139
137
|
--------------------
|
|
@@ -142,7 +140,7 @@ On Web, this method is not supported.
|
|
|
142
140
|
### openIOS(...)
|
|
143
141
|
|
|
144
142
|
```typescript
|
|
145
|
-
openIOS(options: IOSOptions) => Promise<
|
|
143
|
+
openIOS(options: IOSOptions) => Promise<void>
|
|
146
144
|
```
|
|
147
145
|
|
|
148
146
|
Opens a specific system settings section. (iOS Only)
|
|
@@ -151,8 +149,6 @@ Opens a specific system settings section. (iOS Only)
|
|
|
151
149
|
| ------------- | ------------------------------------------------- | --------------------- |
|
|
152
150
|
| **`options`** | <code><a href="#iosoptions">IOSOptions</a></code> | iOS settings options. |
|
|
153
151
|
|
|
154
|
-
**Returns:** <code>Promise<<a href="#settingsresult">SettingsResult</a>></code>
|
|
155
|
-
|
|
156
152
|
**Since:** 1.0.0
|
|
157
153
|
|
|
158
154
|
--------------------
|
|
@@ -161,7 +157,7 @@ Opens a specific system settings section. (iOS Only)
|
|
|
161
157
|
### openAndroid(...)
|
|
162
158
|
|
|
163
159
|
```typescript
|
|
164
|
-
openAndroid(options: AndroidOptions) => Promise<
|
|
160
|
+
openAndroid(options: AndroidOptions) => Promise<void>
|
|
165
161
|
```
|
|
166
162
|
|
|
167
163
|
Opens a specific Android Intent. (Android Only)
|
|
@@ -171,8 +167,6 @@ On Web, this method is not supported.
|
|
|
171
167
|
| ------------- | --------------------------------------------------------- | ------------------------- |
|
|
172
168
|
| **`options`** | <code><a href="#androidoptions">AndroidOptions</a></code> | Android settings options. |
|
|
173
169
|
|
|
174
|
-
**Returns:** <code>Promise<<a href="#settingsresult">SettingsResult</a>></code>
|
|
175
|
-
|
|
176
170
|
**Since:** 1.0.0
|
|
177
171
|
|
|
178
172
|
--------------------
|
|
@@ -205,20 +199,6 @@ const { version } = await Settings.getPluginVersion();
|
|
|
205
199
|
### Interfaces
|
|
206
200
|
|
|
207
201
|
|
|
208
|
-
#### SettingsResult
|
|
209
|
-
|
|
210
|
-
Response object for settings open operations.
|
|
211
|
-
|
|
212
|
-
All platforms return a state-based result object.
|
|
213
|
-
Promise rejection is NOT used.
|
|
214
|
-
|
|
215
|
-
| Prop | Type | Description |
|
|
216
|
-
| ------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
217
|
-
| **`success`** | <code>boolean</code> | Indicates if the operation was successful. |
|
|
218
|
-
| **`error`** | <code>string</code> | Human-readable error message, if the operation failed. |
|
|
219
|
-
| **`code`** | <code><a href="#settingserrorcode">SettingsErrorCode</a></code> | Machine-readable error code. This field is present when `success` is false and allows programmatic handling of platform limitations or failures. |
|
|
220
|
-
|
|
221
|
-
|
|
222
202
|
#### PlatformOptions
|
|
223
203
|
|
|
224
204
|
Platform-specific options for opening system settings.
|
|
@@ -262,16 +242,6 @@ Result object returned by the `getPluginVersion()` method.
|
|
|
262
242
|
### Enums
|
|
263
243
|
|
|
264
244
|
|
|
265
|
-
#### SettingsErrorCode
|
|
266
|
-
|
|
267
|
-
| Members | Value | Description |
|
|
268
|
-
| ----------------------- | -------------------------------- | --------------------------------------------------------------------------------- |
|
|
269
|
-
| **`UNAVAILABLE`** | <code>'UNAVAILABLE'</code> | The device does not have the requested hardware. |
|
|
270
|
-
| **`PERMISSION_DENIED`** | <code>'PERMISSION_DENIED'</code> | The user denied the permission or the feature is disabled in settings. |
|
|
271
|
-
| **`INIT_FAILED`** | <code>'INIT_FAILED'</code> | The Settings plugin failed to initialize (e.g., runtime error or Looper failure). |
|
|
272
|
-
| **`UNKNOWN_TYPE`** | <code>'UNKNOWN_TYPE'</code> | The requested Settings plugin type is not valid or not supported by the plugin. |
|
|
273
|
-
|
|
274
|
-
|
|
275
245
|
#### AndroidSettings
|
|
276
246
|
|
|
277
247
|
| Members | Value | Description |
|
|
@@ -389,19 +359,19 @@ device-specific or undocumented system intents. Availability may vary depending
|
|
|
389
359
|
- system configuration or user restrictions
|
|
390
360
|
|
|
391
361
|
When a requested settings screen is not supported on the current device,
|
|
392
|
-
the plugin
|
|
362
|
+
the plugin rejects the Promise with the error code:
|
|
393
363
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}
|
|
399
|
-
```
|
|
364
|
+
- `UNAVAILABLE`
|
|
365
|
+
|
|
366
|
+
Consumers are expected to handle this case using standard `try / catch`
|
|
367
|
+
error handling.
|
|
400
368
|
|
|
401
369
|
This behavior is intentional and aligns with real-world Android platform constraints.
|
|
402
370
|
|
|
403
|
-
For
|
|
371
|
+
For historical context on Android intent limitations, see the discussion in the
|
|
372
|
+
original implementation:
|
|
404
373
|
[https://github.com/RaphaelWoude/capacitor-native-settings/pull/63](https://github.com/RaphaelWoude/capacitor-native-settings/pull/63)
|
|
374
|
+
Note that this plugin does not use the state-based result model found in that implementation.
|
|
405
375
|
|
|
406
376
|
---
|
|
407
377
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package io.capkit.settings
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Native error model for the Settings plugin (Android).
|
|
5
|
+
*
|
|
6
|
+
* IMPORTANT:
|
|
7
|
+
* - Extends Throwable to allow usage with Result.failure(...)
|
|
8
|
+
* - Must NOT reference Capacitor or JavaScript
|
|
9
|
+
* - Mapping to JS error codes happens ONLY in the Plugin layer
|
|
10
|
+
*/
|
|
11
|
+
sealed class SettingsError(
|
|
12
|
+
message: String,
|
|
13
|
+
) : Throwable(message) {
|
|
14
|
+
/** Feature or capability is not available on this device */
|
|
15
|
+
class Unavailable(message: String) : SettingsError(message)
|
|
16
|
+
|
|
17
|
+
/** Permission was denied by the user or system */
|
|
18
|
+
class PermissionDenied(message: String) : SettingsError(message)
|
|
19
|
+
|
|
20
|
+
/** Plugin failed to initialize correctly */
|
|
21
|
+
class InitFailed(message: String) : SettingsError(message)
|
|
22
|
+
|
|
23
|
+
/** Unsupported or unknown type/value was provided */
|
|
24
|
+
class UnknownType(message: String) : SettingsError(message)
|
|
25
|
+
}
|
|
@@ -6,17 +6,15 @@ import io.capkit.settings.utils.SettingsLogger
|
|
|
6
6
|
import io.capkit.settings.utils.SettingsUtils
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* - extracting call parameters
|
|
19
|
-
* - resolving results to JavaScript
|
|
9
|
+
Native Android implementation for the Settings plugin.
|
|
10
|
+
|
|
11
|
+
Responsibilities:
|
|
12
|
+
- Perform platform logic
|
|
13
|
+
- Throw typed SettingsError values on failure
|
|
14
|
+
|
|
15
|
+
Forbidden:
|
|
16
|
+
- Accessing PluginCall
|
|
17
|
+
- Referencing Capacitor APIs
|
|
20
18
|
*/
|
|
21
19
|
class SettingsImpl(
|
|
22
20
|
private val context: Context,
|
|
@@ -46,50 +44,23 @@ class SettingsImpl(
|
|
|
46
44
|
/**
|
|
47
45
|
* Opens an Android system settings screen.
|
|
48
46
|
*
|
|
49
|
-
*
|
|
50
|
-
* - the option maps to a valid Intent
|
|
51
|
-
* - an Activity exists to handle the Intent
|
|
52
|
-
*
|
|
53
|
-
* No Activity result is awaited, by design.
|
|
54
|
-
*
|
|
55
|
-
* @param option JavaScript-facing settings key
|
|
56
|
-
* @return standardized Result object (state-based)
|
|
47
|
+
* @throws SettingsError if the operation fails
|
|
57
48
|
*/
|
|
58
|
-
fun open(option: String)
|
|
59
|
-
SettingsLogger.debug("Requested Android settings option:", option)
|
|
60
|
-
|
|
49
|
+
fun open(option: String) {
|
|
61
50
|
val intent =
|
|
62
51
|
SettingsUtils.resolveIntent(option, context.packageName)
|
|
63
|
-
?:
|
|
64
|
-
|
|
65
|
-
error = "Requested setting is not available on Android",
|
|
66
|
-
code = "UNAVAILABLE",
|
|
52
|
+
?: throw SettingsError.Unavailable(
|
|
53
|
+
"Requested setting is not available on Android",
|
|
67
54
|
)
|
|
68
55
|
|
|
69
56
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
70
57
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Result(success = true)
|
|
75
|
-
} else {
|
|
76
|
-
SettingsLogger.error("No activity found to handle intent for option: $option")
|
|
77
|
-
Result(
|
|
78
|
-
success = false,
|
|
79
|
-
error = "Cannot open settings URL",
|
|
80
|
-
code = "UNAVAILABLE",
|
|
58
|
+
if (intent.resolveActivity(context.packageManager) == null) {
|
|
59
|
+
throw SettingsError.Unavailable(
|
|
60
|
+
"No activity found to handle settings intent",
|
|
81
61
|
)
|
|
82
62
|
}
|
|
83
|
-
}
|
|
84
63
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
*
|
|
88
|
-
* This mirrors the iOS result model and the public TypeScript API.
|
|
89
|
-
*/
|
|
90
|
-
data class Result(
|
|
91
|
-
val success: Boolean,
|
|
92
|
-
val error: String? = null,
|
|
93
|
-
val code: String? = null,
|
|
94
|
-
)
|
|
64
|
+
context.startActivity(intent)
|
|
65
|
+
}
|
|
95
66
|
}
|
|
@@ -21,20 +21,35 @@ import com.getcapacitor.annotation.CapacitorPlugin
|
|
|
21
21
|
name = "Settings",
|
|
22
22
|
)
|
|
23
23
|
class SettingsPlugin : Plugin() {
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Properties
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
|
|
24
28
|
/**
|
|
25
|
-
*
|
|
29
|
+
* Immutable plugin configuration parsed from capacitor.config.ts.
|
|
26
30
|
*/
|
|
27
31
|
private lateinit var config: SettingsConfig
|
|
28
32
|
|
|
29
33
|
/**
|
|
30
|
-
* Native implementation containing
|
|
34
|
+
* Native implementation containing platform-specific logic only.
|
|
35
|
+
*
|
|
36
|
+
* IMPORTANT:
|
|
37
|
+
* - Must NOT access PluginCall
|
|
38
|
+
* - Must NOT reference Capacitor APIs
|
|
31
39
|
*/
|
|
32
40
|
private lateinit var implementation: SettingsImpl
|
|
33
41
|
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// Lifecycle
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
|
|
34
46
|
/**
|
|
35
|
-
*
|
|
47
|
+
* Called once when the plugin is loaded by the Capacitor bridge.
|
|
36
48
|
*
|
|
37
|
-
*
|
|
49
|
+
* This is the correct place to:
|
|
50
|
+
* - read static configuration
|
|
51
|
+
* - initialize native resources
|
|
52
|
+
* - inject configuration into the implementation
|
|
38
53
|
*/
|
|
39
54
|
override fun load() {
|
|
40
55
|
super.load()
|
|
@@ -44,7 +59,35 @@ class SettingsPlugin : Plugin() {
|
|
|
44
59
|
implementation.updateConfig(config)
|
|
45
60
|
}
|
|
46
61
|
|
|
47
|
-
//
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// Error Mapping
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Maps native SettingsError instances to JS-facing SettingsErrorCode values.
|
|
68
|
+
*
|
|
69
|
+
* IMPORTANT:
|
|
70
|
+
* - This is the ONLY place where native errors are translated
|
|
71
|
+
* - SettingsImpl must NEVER know about JS or Capacitor error codes
|
|
72
|
+
*/
|
|
73
|
+
private fun reject(
|
|
74
|
+
call: PluginCall,
|
|
75
|
+
error: SettingsError,
|
|
76
|
+
) {
|
|
77
|
+
val code =
|
|
78
|
+
when (error) {
|
|
79
|
+
is SettingsError.Unavailable -> "UNAVAILABLE"
|
|
80
|
+
is SettingsError.PermissionDenied -> "PERMISSION_DENIED"
|
|
81
|
+
is SettingsError.InitFailed -> "INIT_FAILED"
|
|
82
|
+
is SettingsError.UnknownType -> "UNKNOWN_TYPE"
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
call.reject(error.message, code)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// Open
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
48
91
|
|
|
49
92
|
/**
|
|
50
93
|
* Opens a platform-specific settings screen (legacy key).
|
|
@@ -52,24 +95,45 @@ class SettingsPlugin : Plugin() {
|
|
|
52
95
|
@PluginMethod
|
|
53
96
|
fun open(call: PluginCall) {
|
|
54
97
|
val option = call.getString("optionAndroid") ?: ""
|
|
55
|
-
|
|
56
|
-
call.resolve(result.toJS())
|
|
98
|
+
handleOpen(call, option)
|
|
57
99
|
}
|
|
58
100
|
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
// Open (Android)
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
|
|
59
105
|
/**
|
|
60
106
|
* Opens an Android settings screen.
|
|
61
107
|
*/
|
|
62
108
|
@PluginMethod
|
|
63
109
|
fun openAndroid(call: PluginCall) {
|
|
64
110
|
val option = call.getString("option") ?: ""
|
|
65
|
-
|
|
66
|
-
call.resolve(result.toJS())
|
|
111
|
+
handleOpen(call, option)
|
|
67
112
|
}
|
|
68
113
|
|
|
69
|
-
|
|
114
|
+
private fun handleOpen(
|
|
115
|
+
call: PluginCall,
|
|
116
|
+
option: String,
|
|
117
|
+
) {
|
|
118
|
+
try {
|
|
119
|
+
implementation.open(option)
|
|
120
|
+
call.resolve()
|
|
121
|
+
} catch (error: SettingsError) {
|
|
122
|
+
reject(call, error)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
// Version
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
70
129
|
|
|
71
130
|
/**
|
|
72
131
|
* Returns the native plugin version.
|
|
132
|
+
*
|
|
133
|
+
* NOTE:
|
|
134
|
+
* - This method is guaranteed not to fail
|
|
135
|
+
* - Therefore it does NOT use TestError
|
|
136
|
+
* - Version is injected at build time from package.json
|
|
73
137
|
*/
|
|
74
138
|
@PluginMethod
|
|
75
139
|
fun getPluginVersion(call: PluginCall) {
|
|
@@ -77,15 +141,4 @@ class SettingsPlugin : Plugin() {
|
|
|
77
141
|
ret.put("version", BuildConfig.PLUGIN_VERSION)
|
|
78
142
|
call.resolve(ret)
|
|
79
143
|
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Converts a native Result into a JSObject.
|
|
83
|
-
*/
|
|
84
|
-
private fun SettingsImpl.Result.toJS(): JSObject {
|
|
85
|
-
val obj = JSObject()
|
|
86
|
-
obj.put("success", success)
|
|
87
|
-
if (error != null) obj.put("error", error)
|
|
88
|
-
if (code != null) obj.put("code", code)
|
|
89
|
-
return obj
|
|
90
|
-
}
|
|
91
144
|
}
|
package/dist/docs.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"methods": [
|
|
8
8
|
{
|
|
9
9
|
"name": "open",
|
|
10
|
-
"signature": "(options: PlatformOptions) => Promise<
|
|
10
|
+
"signature": "(options: PlatformOptions) => Promise<void>",
|
|
11
11
|
"parameters": [
|
|
12
12
|
{
|
|
13
13
|
"name": "options",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"type": "PlatformOptions"
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
|
-
"returns": "Promise<
|
|
18
|
+
"returns": "Promise<void>",
|
|
19
19
|
"tags": [
|
|
20
20
|
{
|
|
21
21
|
"name": "param",
|
|
@@ -32,14 +32,13 @@
|
|
|
32
32
|
],
|
|
33
33
|
"docs": "Opens the specified settings option on the current platform.\nOn Web, this method is not supported.",
|
|
34
34
|
"complexTypes": [
|
|
35
|
-
"SettingsResult",
|
|
36
35
|
"PlatformOptions"
|
|
37
36
|
],
|
|
38
37
|
"slug": "open"
|
|
39
38
|
},
|
|
40
39
|
{
|
|
41
40
|
"name": "openIOS",
|
|
42
|
-
"signature": "(options: IOSOptions) => Promise<
|
|
41
|
+
"signature": "(options: IOSOptions) => Promise<void>",
|
|
43
42
|
"parameters": [
|
|
44
43
|
{
|
|
45
44
|
"name": "options",
|
|
@@ -47,7 +46,7 @@
|
|
|
47
46
|
"type": "IOSOptions"
|
|
48
47
|
}
|
|
49
48
|
],
|
|
50
|
-
"returns": "Promise<
|
|
49
|
+
"returns": "Promise<void>",
|
|
51
50
|
"tags": [
|
|
52
51
|
{
|
|
53
52
|
"name": "platforms",
|
|
@@ -72,14 +71,13 @@
|
|
|
72
71
|
],
|
|
73
72
|
"docs": "Opens a specific system settings section. (iOS Only)",
|
|
74
73
|
"complexTypes": [
|
|
75
|
-
"SettingsResult",
|
|
76
74
|
"IOSOptions"
|
|
77
75
|
],
|
|
78
76
|
"slug": "openios"
|
|
79
77
|
},
|
|
80
78
|
{
|
|
81
79
|
"name": "openAndroid",
|
|
82
|
-
"signature": "(options: AndroidOptions) => Promise<
|
|
80
|
+
"signature": "(options: AndroidOptions) => Promise<void>",
|
|
83
81
|
"parameters": [
|
|
84
82
|
{
|
|
85
83
|
"name": "options",
|
|
@@ -87,7 +85,7 @@
|
|
|
87
85
|
"type": "AndroidOptions"
|
|
88
86
|
}
|
|
89
87
|
],
|
|
90
|
-
"returns": "Promise<
|
|
88
|
+
"returns": "Promise<void>",
|
|
91
89
|
"tags": [
|
|
92
90
|
{
|
|
93
91
|
"name": "platforms",
|
|
@@ -108,7 +106,6 @@
|
|
|
108
106
|
],
|
|
109
107
|
"docs": "Opens a specific Android Intent. (Android Only)\nOn Web, this method is not supported.",
|
|
110
108
|
"complexTypes": [
|
|
111
|
-
"SettingsResult",
|
|
112
109
|
"AndroidOptions"
|
|
113
110
|
],
|
|
114
111
|
"slug": "openandroid"
|
|
@@ -142,43 +139,6 @@
|
|
|
142
139
|
"properties": []
|
|
143
140
|
},
|
|
144
141
|
"interfaces": [
|
|
145
|
-
{
|
|
146
|
-
"name": "SettingsResult",
|
|
147
|
-
"slug": "settingsresult",
|
|
148
|
-
"docs": "Response object for settings open operations.\n\nAll platforms return a state-based result object.\nPromise rejection is NOT used.",
|
|
149
|
-
"tags": [],
|
|
150
|
-
"methods": [],
|
|
151
|
-
"properties": [
|
|
152
|
-
{
|
|
153
|
-
"name": "success",
|
|
154
|
-
"tags": [],
|
|
155
|
-
"docs": "Indicates if the operation was successful.",
|
|
156
|
-
"complexTypes": [],
|
|
157
|
-
"type": "boolean"
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
"name": "error",
|
|
161
|
-
"tags": [],
|
|
162
|
-
"docs": "Human-readable error message, if the operation failed.",
|
|
163
|
-
"complexTypes": [],
|
|
164
|
-
"type": "string | undefined"
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
"name": "code",
|
|
168
|
-
"tags": [
|
|
169
|
-
{
|
|
170
|
-
"text": "SettingsErrorCode.UNAVAILABLE",
|
|
171
|
-
"name": "example"
|
|
172
|
-
}
|
|
173
|
-
],
|
|
174
|
-
"docs": "Machine-readable error code.\n\nThis field is present when `success` is false and allows\nprogrammatic handling of platform limitations or failures.",
|
|
175
|
-
"complexTypes": [
|
|
176
|
-
"SettingsErrorCode"
|
|
177
|
-
],
|
|
178
|
-
"type": "SettingsErrorCode"
|
|
179
|
-
}
|
|
180
|
-
]
|
|
181
|
-
},
|
|
182
142
|
{
|
|
183
143
|
"name": "PlatformOptions",
|
|
184
144
|
"slug": "platformoptions",
|
|
@@ -309,36 +269,6 @@
|
|
|
309
269
|
}
|
|
310
270
|
],
|
|
311
271
|
"enums": [
|
|
312
|
-
{
|
|
313
|
-
"name": "SettingsErrorCode",
|
|
314
|
-
"slug": "settingserrorcode",
|
|
315
|
-
"members": [
|
|
316
|
-
{
|
|
317
|
-
"name": "UNAVAILABLE",
|
|
318
|
-
"value": "'UNAVAILABLE'",
|
|
319
|
-
"tags": [],
|
|
320
|
-
"docs": "The device does not have the requested hardware."
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
"name": "PERMISSION_DENIED",
|
|
324
|
-
"value": "'PERMISSION_DENIED'",
|
|
325
|
-
"tags": [],
|
|
326
|
-
"docs": "The user denied the permission or the feature is disabled in settings."
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
"name": "INIT_FAILED",
|
|
330
|
-
"value": "'INIT_FAILED'",
|
|
331
|
-
"tags": [],
|
|
332
|
-
"docs": "The Settings plugin failed to initialize (e.g., runtime error or Looper failure)."
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
"name": "UNKNOWN_TYPE",
|
|
336
|
-
"value": "'UNKNOWN_TYPE'",
|
|
337
|
-
"tags": [],
|
|
338
|
-
"docs": "The requested Settings plugin type is not valid or not supported by the plugin."
|
|
339
|
-
}
|
|
340
|
-
]
|
|
341
|
-
},
|
|
342
272
|
{
|
|
343
273
|
"name": "AndroidSettings",
|
|
344
274
|
"slug": "androidsettings",
|
|
@@ -91,31 +91,6 @@ export interface SettingsError {
|
|
|
91
91
|
*/
|
|
92
92
|
code: SettingsErrorCode;
|
|
93
93
|
}
|
|
94
|
-
/**
|
|
95
|
-
* Response object for settings open operations.
|
|
96
|
-
*
|
|
97
|
-
* All platforms return a state-based result object.
|
|
98
|
-
* Promise rejection is NOT used.
|
|
99
|
-
*/
|
|
100
|
-
export interface SettingsResult {
|
|
101
|
-
/**
|
|
102
|
-
* Indicates if the operation was successful.
|
|
103
|
-
*/
|
|
104
|
-
success: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Human-readable error message, if the operation failed.
|
|
107
|
-
*/
|
|
108
|
-
error?: string;
|
|
109
|
-
/**
|
|
110
|
-
* Machine-readable error code.
|
|
111
|
-
*
|
|
112
|
-
* This field is present when `success` is false and allows
|
|
113
|
-
* programmatic handling of platform limitations or failures.
|
|
114
|
-
*
|
|
115
|
-
* @example SettingsErrorCode.UNAVAILABLE
|
|
116
|
-
*/
|
|
117
|
-
code?: SettingsErrorCode;
|
|
118
|
-
}
|
|
119
94
|
/**
|
|
120
95
|
* Platform-specific options for opening system settings.
|
|
121
96
|
*
|
|
@@ -633,7 +608,7 @@ export interface SettingsPlugin {
|
|
|
633
608
|
*
|
|
634
609
|
* @since 1.0.0
|
|
635
610
|
*/
|
|
636
|
-
open(options: PlatformOptions): Promise<
|
|
611
|
+
open(options: PlatformOptions): Promise<void>;
|
|
637
612
|
/**
|
|
638
613
|
* Opens a specific system settings section. (iOS Only)
|
|
639
614
|
*
|
|
@@ -654,7 +629,7 @@ export interface SettingsPlugin {
|
|
|
654
629
|
*
|
|
655
630
|
* @since 1.0.0
|
|
656
631
|
*/
|
|
657
|
-
openIOS(options: IOSOptions): Promise<
|
|
632
|
+
openIOS(options: IOSOptions): Promise<void>;
|
|
658
633
|
/**
|
|
659
634
|
* Opens a specific Android Intent. (Android Only)
|
|
660
635
|
* On Web, this method is not supported.
|
|
@@ -666,7 +641,7 @@ export interface SettingsPlugin {
|
|
|
666
641
|
*
|
|
667
642
|
* @since 1.0.0
|
|
668
643
|
*/
|
|
669
|
-
openAndroid(options: AndroidOptions): Promise<
|
|
644
|
+
openAndroid(options: AndroidOptions): Promise<void>;
|
|
670
645
|
/**
|
|
671
646
|
* Returns the native plugin version.
|
|
672
647
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAkDxC;;;;;;;;;;;GAWG;AACH,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B,uDAAuD;IACvD,gDAA2B,CAAA;IAC3B,6EAA6E;IAC7E,4DAAuC,CAAA;IACvC,wFAAwF;IACxF,gDAA2B,CAAA;IAC3B,sFAAsF;IACtF,kDAA6B,CAAA;AAC/B,CAAC,EATW,iBAAiB,KAAjB,iBAAiB,QAS5B;
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAkDxC;;;;;;;;;;;GAWG;AACH,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B,uDAAuD;IACvD,gDAA2B,CAAA;IAC3B,6EAA6E;IAC7E,4DAAuC,CAAA;IACvC,wFAAwF;IACxF,gDAA2B,CAAA;IAC3B,sFAAsF;IACtF,kDAA6B,CAAA;AAC/B,CAAC,EATW,iBAAiB,KAAjB,iBAAiB,QAS5B;AAuID;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAN,IAAY,eAmQX;AAnQD,WAAY,eAAe;IACzB;;OAEG;IACH,kDAA+B,CAAA;IAE/B;;OAEG;IACH,sCAAmB,CAAA;IAEnB;;OAEG;IACH,iDAA8B,CAAA;IAE9B;;OAEG;IACH,8BAAW,CAAA;IAEX;;OAEG;IACH,6DAA0C,CAA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G;IACH,4BAAa,CAAA;IAEb;;OAEG;IACH,sCAAuB,CAAA;IAEvB;;OAEG;IACH,4CAA6B,CAAA;IAE7B;;OAEG;IACH,kDAAmC,CAAA;IAEnC;;OAEG;IACH,wCAAyB,CAAA;IAEzB;;OAEG;IACH,8CAA+B,CAAA;IAE/B;;OAEG;IACH,0BAAW,CAAA;AACb,CAAC,EAhLW,WAAW,KAAX,WAAW,QAgLtB"}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import { SettingsPlugin,
|
|
2
|
+
import { SettingsPlugin, PluginVersionResult } from './definitions';
|
|
3
3
|
/**
|
|
4
4
|
* Web implementation of the Settings plugin.
|
|
5
5
|
*
|
|
@@ -20,19 +20,19 @@ export declare class SettingsWeb extends WebPlugin implements SettingsPlugin {
|
|
|
20
20
|
* This operation is not supported on the Web, as browsers do not
|
|
21
21
|
* provide APIs to open operating system settings.
|
|
22
22
|
*/
|
|
23
|
-
open(): Promise<
|
|
23
|
+
open(): Promise<void>;
|
|
24
24
|
/**
|
|
25
25
|
* Attempts to open an iOS settings screen.
|
|
26
26
|
*
|
|
27
27
|
* This operation is not supported on the Web.
|
|
28
28
|
*/
|
|
29
|
-
openIOS(): Promise<
|
|
29
|
+
openIOS(): Promise<void>;
|
|
30
30
|
/**
|
|
31
31
|
* Attempts to open an Android settings screen.
|
|
32
32
|
*
|
|
33
33
|
* This operation is not supported on the Web.
|
|
34
34
|
*/
|
|
35
|
-
openAndroid(): Promise<
|
|
35
|
+
openAndroid(): Promise<void>;
|
|
36
36
|
/**
|
|
37
37
|
* Returns the plugin version.
|
|
38
38
|
*
|