@cap-kit/settings 8.0.0-next.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.
Files changed (34) hide show
  1. package/CapKitSettings.podspec +17 -0
  2. package/LICENSE +21 -0
  3. package/Package.swift +29 -0
  4. package/README.md +428 -0
  5. package/android/build.gradle +103 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/io/capkit/settings/SettingsConfig.kt +39 -0
  8. package/android/src/main/java/io/capkit/settings/SettingsImpl.kt +95 -0
  9. package/android/src/main/java/io/capkit/settings/SettingsPlugin.kt +91 -0
  10. package/android/src/main/java/io/capkit/settings/utils/SettingsLogger.kt +85 -0
  11. package/android/src/main/java/io/capkit/settings/utils/SettingsUtils.kt +75 -0
  12. package/android/src/main/res/.gitkeep +0 -0
  13. package/dist/docs.json +877 -0
  14. package/dist/esm/definitions.d.ts +686 -0
  15. package/dist/esm/definitions.js +423 -0
  16. package/dist/esm/definitions.js.map +1 -0
  17. package/dist/esm/index.d.ts +16 -0
  18. package/dist/esm/index.js +19 -0
  19. package/dist/esm/index.js.map +1 -0
  20. package/dist/esm/web.d.ts +43 -0
  21. package/dist/esm/web.js +68 -0
  22. package/dist/esm/web.js.map +1 -0
  23. package/dist/plugin.cjs.js +516 -0
  24. package/dist/plugin.cjs.js.map +1 -0
  25. package/dist/plugin.js +519 -0
  26. package/dist/plugin.js.map +1 -0
  27. package/ios/Sources/SettingsPlugin/SettingsConfig.swift +54 -0
  28. package/ios/Sources/SettingsPlugin/SettingsImpl.swift +84 -0
  29. package/ios/Sources/SettingsPlugin/SettingsPlugin.swift +103 -0
  30. package/ios/Sources/SettingsPlugin/Utils/SettingsLogger.swift +57 -0
  31. package/ios/Sources/SettingsPlugin/Utils/SettingsUtils.swift +70 -0
  32. package/ios/Sources/SettingsPlugin/Version.swift +16 -0
  33. package/ios/Tests/SettingsPluginTests/SettingsPluginTests.swift +21 -0
  34. package/package.json +98 -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 = 'CapKitSettings'
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/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
+ s.ios.deployment_target = '15.0'
15
+ s.dependency 'Capacitor'
16
+ s.swift_version = '5.1'
17
+ end
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Fabio Martino
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/Package.swift ADDED
@@ -0,0 +1,29 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "CapKitSettings",
6
+ platforms: [.iOS(.v15)],
7
+ products: [
8
+ .library(
9
+ name: "CapKitSettings",
10
+ targets: ["SettingsPlugin"])
11
+ ],
12
+ dependencies: [
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
14
+ ],
15
+ targets: [
16
+ .target(
17
+ name: "SettingsPlugin",
18
+ dependencies: [
19
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
20
+ .product(name: "Cordova", package: "capacitor-swift-pm")
21
+ ],
22
+ path: "ios/Sources/SettingsPlugin"
23
+ ),
24
+ .testTarget(
25
+ name: "SettingsPluginTests",
26
+ dependencies: ["SettingsPlugin"],
27
+ path: "ios/Tests/SettingsPluginTests")
28
+ ]
29
+ )
package/README.md ADDED
@@ -0,0 +1,428 @@
1
+ <p align="center">
2
+ <img
3
+ src="https://raw.githubusercontent.com/cap-kit/capacitor-plugins/main/assets/logo.png"
4
+ alt="CapKit Logo"
5
+ width="128"
6
+ />
7
+ </p>
8
+
9
+ <h3 align="center">Settings</h3>
10
+ <p align="center">
11
+ <strong>
12
+ <code>@cap-kit/settings</code>
13
+ </strong>
14
+ </p>
15
+
16
+ <p align="center">
17
+ A <strong>Capacitor plugin</strong> for opening system and application settings on <strong>iOS and Android</strong>.<br>
18
+ Provides a unified, state-based API to navigate users to relevant settings screens,
19
+ including app settings, notifications, connectivity, and other system sections.<br>
20
+ Built following the <strong>Cap-Kit architectural standards</strong> with strict separation
21
+ between JavaScript, bridge, and native implementations (Swift / Kotlin).
22
+ </p>
23
+
24
+ <p align="center">
25
+ <a href="https://www.npmjs.com/package/@cap-kit/settings">
26
+ <img src="https://img.shields.io/npm/v/@cap-kit/settings?color=blue&label=npm&logo=npm&style=flat-square" alt="npm version">
27
+ </a>
28
+ <a href="https://github.com/cap-kit/capacitor-plugins/actions">
29
+ <img src="https://img.shields.io/github/actions/workflow/status/cap-kit/capacitor-plugins/ci.yml?branch=main&label=CI&logo=github&style=flat-square" alt="CI Status" />
30
+ </a>
31
+ <a href="https://capacitorjs.com/">
32
+ <img src="https://img.shields.io/badge/Capacitor-Plugin-blue?logo=capacitor&style=flat-square" alt="Capacitor Plugin">
33
+ </a>
34
+ <a href="https://www.npmjs.com/package/@cap-kit/settings">
35
+ <img src="https://img.shields.io/npm/dm/@cap-kit/settings?style=flat-square" alt="Downloads" />
36
+ </a>
37
+ <a href="./LICENSE">
38
+ <img src="https://img.shields.io/npm/l/@cap-kit/settings?style=flat-square&logo=open-source-initiative&logoColor=white&color=green" alt="License" />
39
+ </a>
40
+ <img src="https://img.shields.io/maintenance/yes/2026?style=flat-square" alt="Maintained" />
41
+ </p>
42
+ <br>
43
+
44
+ ## Install
45
+
46
+ ```bash
47
+ pnpm add @cap-kit/settings
48
+ npx cap sync
49
+
50
+ ```
51
+
52
+ ## Configuration
53
+
54
+ <docgen-config>
55
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
56
+
57
+ Configuration options for the Settings plugin.
58
+
59
+ | Prop | Type | Description | Default | Since |
60
+ | -------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
61
+ | **`verboseLogging`** | <code>boolean</code> | Enables verbose native logging. When enabled, additional debug information is printed to the native console (Logcat on Android, Xcode on iOS). This option affects native logging behavior only and has no impact on the JavaScript API. | <code>false</code> | 1.0.0 |
62
+
63
+ ### Examples
64
+
65
+ In `capacitor.config.json`:
66
+
67
+ ```json
68
+ {
69
+ "plugins": {
70
+ "Settings": {
71
+ "verboseLogging": true
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ In `capacitor.config.ts`:
78
+
79
+ ```ts
80
+ /// <reference types="@cap-kit/settings" />
81
+
82
+ import { CapacitorConfig } from '@capacitor/cli';
83
+
84
+ const config: CapacitorConfig = {
85
+ plugins: {
86
+ Settings: {
87
+ verboseLogging: true,
88
+ },
89
+ },
90
+ };
91
+
92
+ export default config;
93
+ ```
94
+
95
+ </docgen-config>
96
+
97
+ ## API
98
+
99
+ <docgen-index>
100
+
101
+ * [`open(...)`](#open)
102
+ * [`openIOS(...)`](#openios)
103
+ * [`openAndroid(...)`](#openandroid)
104
+ * [`getPluginVersion()`](#getpluginversion)
105
+ * [Interfaces](#interfaces)
106
+ * [Enums](#enums)
107
+
108
+ </docgen-index>
109
+
110
+ <docgen-api>
111
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
112
+
113
+ Public JavaScript API for the Settings Capacitor plugin.
114
+
115
+ This plugin uses a state-based result model:
116
+ - operations never throw
117
+ - Promise rejection is not used
118
+ - failures are reported via `{ success, error?, code? }`
119
+
120
+ This design ensures consistent behavior across Android, iOS, and Web.
121
+
122
+ ### open(...)
123
+
124
+ ```typescript
125
+ open(options: PlatformOptions) => Promise<SettingsResult>
126
+ ```
127
+
128
+ Opens the specified settings option on the current platform.
129
+ On Web, this method is not supported.
130
+
131
+ | Param | Type | Description |
132
+ | ------------- | ----------------------------------------------------------- | ----------------------------------- |
133
+ | **`options`** | <code><a href="#platformoptions">PlatformOptions</a></code> | Platform-specific settings options. |
134
+
135
+ **Returns:** <code>Promise&lt;<a href="#settingsresult">SettingsResult</a>&gt;</code>
136
+
137
+ **Since:** 1.0.0
138
+
139
+ --------------------
140
+
141
+
142
+ ### openIOS(...)
143
+
144
+ ```typescript
145
+ openIOS(options: IOSOptions) => Promise<SettingsResult>
146
+ ```
147
+
148
+ Opens a specific system settings section. (iOS Only)
149
+
150
+ | Param | Type | Description |
151
+ | ------------- | ------------------------------------------------- | --------------------- |
152
+ | **`options`** | <code><a href="#iosoptions">IOSOptions</a></code> | iOS settings options. |
153
+
154
+ **Returns:** <code>Promise&lt;<a href="#settingsresult">SettingsResult</a>&gt;</code>
155
+
156
+ **Since:** 1.0.0
157
+
158
+ --------------------
159
+
160
+
161
+ ### openAndroid(...)
162
+
163
+ ```typescript
164
+ openAndroid(options: AndroidOptions) => Promise<SettingsResult>
165
+ ```
166
+
167
+ Opens a specific Android Intent. (Android Only)
168
+ On Web, this method is not supported.
169
+
170
+ | Param | Type | Description |
171
+ | ------------- | --------------------------------------------------------- | ------------------------- |
172
+ | **`options`** | <code><a href="#androidoptions">AndroidOptions</a></code> | Android settings options. |
173
+
174
+ **Returns:** <code>Promise&lt;<a href="#settingsresult">SettingsResult</a>&gt;</code>
175
+
176
+ **Since:** 1.0.0
177
+
178
+ --------------------
179
+
180
+
181
+ ### getPluginVersion()
182
+
183
+ ```typescript
184
+ getPluginVersion() => Promise<PluginVersionResult>
185
+ ```
186
+
187
+ Returns the native plugin version.
188
+
189
+ The returned version corresponds to the native implementation
190
+ bundled with the application.
191
+
192
+ **Returns:** <code>Promise&lt;<a href="#pluginversionresult">PluginVersionResult</a>&gt;</code>
193
+
194
+ **Since:** 1.0.0
195
+
196
+ #### Example
197
+
198
+ ```ts
199
+ const { version } = await Settings.getPluginVersion();
200
+ ```
201
+
202
+ --------------------
203
+
204
+
205
+ ### Interfaces
206
+
207
+
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
+ #### PlatformOptions
223
+
224
+ Platform-specific options for opening system settings.
225
+
226
+ This interface allows specifying settings options for both
227
+ Android and iOS in a single call.
228
+
229
+ | Prop | Type | Description |
230
+ | ------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
231
+ | **`optionAndroid`** | <code><a href="#androidsettings">AndroidSettings</a></code> | Android settings option to open. Used only when running on Android. Mapped internally to a system Intent. |
232
+ | **`optionIOS`** | <code><a href="#iossettings">IOSSettings</a></code> | iOS settings option to open. Used only when running on iOS. Mapped internally to an iOS settings URL scheme. |
233
+
234
+
235
+ #### IOSOptions
236
+
237
+ iOS-specific options for opening system settings.
238
+
239
+ | Prop | Type | Description |
240
+ | ------------ | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
241
+ | **`option`** | <code><a href="#iossettings">IOSSettings</a></code> | The iOS settings section to open. Most values correspond to internal iOS URL schemes. Availability depends on the iOS version and system configuration. |
242
+
243
+
244
+ #### AndroidOptions
245
+
246
+ Android-specific options for opening system settings.
247
+
248
+ | Prop | Type | Description |
249
+ | ------------ | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
250
+ | **`option`** | <code><a href="#androidsettings">AndroidSettings</a></code> | The Android settings section to open. Each value maps to a specific Android system Intent. Support varies depending on the device and OS version. |
251
+
252
+
253
+ #### PluginVersionResult
254
+
255
+ Result object returned by the `getPluginVersion()` method.
256
+
257
+ | Prop | Type | Description |
258
+ | ------------- | ------------------- | --------------------------------- |
259
+ | **`version`** | <code>string</code> | The native plugin version string. |
260
+
261
+
262
+ ### Enums
263
+
264
+
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
+ #### AndroidSettings
276
+
277
+ | Members | Value | Description |
278
+ | ---------------------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------- |
279
+ | **`Accessibility`** | <code>'accessibility'</code> | Opens Accessibility settings. |
280
+ | **`Account`** | <code>'account'</code> | Opens the Add Account screen. |
281
+ | **`AirplaneMode`** | <code>'airplane_mode'</code> | Opens Airplane Mode settings. |
282
+ | **`Apn`** | <code>'apn'</code> | Opens Access Point Name (APN) settings. |
283
+ | **`ApplicationDetails`** | <code>'application_details'</code> | Opens the Application Details screen for the current app. |
284
+ | **`ApplicationDevelopment`** | <code>'application_development'</code> | Opens Application Development settings. Availability depends on developer options being enabled. |
285
+ | **`Application`** | <code>'application'</code> | Opens Application settings. |
286
+ | **`AppNotification`** | <code>'app_notification'</code> | Opens app-specific notification settings. |
287
+ | **`BatteryOptimization`** | <code>'battery_optimization'</code> | Opens Battery Optimization settings. Allows managing apps excluded from battery optimizations. |
288
+ | **`Bluetooth`** | <code>'bluetooth'</code> | Opens Bluetooth settings. |
289
+ | **`Captioning`** | <code>'captioning'</code> | Opens Captioning settings. |
290
+ | **`Cast`** | <code>'cast'</code> | Opens Cast device settings. |
291
+ | **`DataRoaming`** | <code>'data_roaming'</code> | Opens Data Roaming settings. |
292
+ | **`Date`** | <code>'date'</code> | Opens Date & Time settings. |
293
+ | **`Display`** | <code>'display'</code> | Opens Display settings. |
294
+ | **`Dream`** | <code>'dream'</code> | Opens Dream (Daydream / Screensaver) settings. |
295
+ | **`Home`** | <code>'home'</code> | Opens Home app selection settings. |
296
+ | **`Keyboard`** | <code>'keyboard'</code> | Opens Input Method (Keyboard) settings. |
297
+ | **`KeyboardSubType`** | <code>'keyboard_subtype'</code> | Opens Input Method Subtype settings. |
298
+ | **`Locale`** | <code>'locale'</code> | Opens Language & Input (Locale) settings. |
299
+ | **`Location`** | <code>'location'</code> | Opens Location Services settings. |
300
+ | **`ManageApplications`** | <code>'manage_applications'</code> | Opens Manage Applications settings. |
301
+ | **`ManageAllApplications`** | <code>'manage_all_applications'</code> | Opens Manage All Applications settings. Availability depends on Android version and OEM. |
302
+ | **`MemoryCard`** | <code>'memory_card'</code> | Show settings for memory card storage |
303
+ | **`Network`** | <code>'network'</code> | Opens Network Operator settings. |
304
+ | **`Nfc`** | <code>'nfc'</code> | Opens NFC settings. |
305
+ | **`NfcSharing`** | <code>'nfcsharing'</code> | Opens NFC Sharing settings. |
306
+ | **`NfcPayment`** | <code>'nfc_payment'</code> | Opens NFC Payment settings. |
307
+ | **`Print`** | <code>'print'</code> | Opens Print settings. |
308
+ | **`Privacy`** | <code>'privacy'</code> | Opens Privacy settings. |
309
+ | **`QuickLaunch`** | <code>'quick_launch'</code> | Opens Quick Launch settings. |
310
+ | **`Search`** | <code>'search'</code> | Opens Search settings. |
311
+ | **`Security`** | <code>'security'</code> | Opens Security settings. |
312
+ | **`Settings`** | <code>'settings'</code> | Opens the main System Settings screen. |
313
+ | **`ShowRegulatoryInfo`** | <code>'show_regulatory_info'</code> | Opens Regulatory Information screen. |
314
+ | **`Sound`** | <code>'sound'</code> | Opens Sound & Volume settings. |
315
+ | **`Storage`** | <code>'storage'</code> | Opens Internal Storage settings. |
316
+ | **`Sync`** | <code>'sync'</code> | Opens Sync settings. |
317
+ | **`TextToSpeech`** | <code>'text_to_speech'</code> | Opens Text-to-Speech (TTS) settings. Uses a non-public intent on some devices. |
318
+ | **`Usage`** | <code>'usage'</code> | Opens Usage Access settings. Allows managing apps with access to usage data. |
319
+ | **`UserDictionary`** | <code>'user_dictionary'</code> | Opens User Dictionary settings. |
320
+ | **`VoiceInput`** | <code>'voice_input'</code> | Opens Voice Input settings. |
321
+ | **`VPN`** | <code>'vpn'</code> | Opens VPN settings. |
322
+ | **`Wifi`** | <code>'wifi'</code> | Opens Wi-Fi settings. |
323
+ | **`WifiIp`** | <code>'wifi_ip'</code> | Opens Wi-Fi IP settings. Availability varies by device and Android version. |
324
+ | **`Wireless`** | <code>'wireless'</code> | Opens Wireless & Networks settings. |
325
+ | **`ZenMode`** | <code>'zen_mode'</code> | Opens Zen Mode (Do Not Disturb) settings. This uses a non-public intent and may not work on all devices. |
326
+ | **`ZenModePriority`** | <code>'zen_mode_priority'</code> | Opens Zen Mode Priority settings. |
327
+ | **`ZenModeBlockedEffects`** | <code>'zen_mode_blocked_effects'</code> | Opens Zen Mode Blocked Effects settings. |
328
+
329
+
330
+ #### IOSSettings
331
+
332
+ | Members | Value | Description |
333
+ | ------------------------------ | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
334
+ | **`App`** | <code>'app'</code> | Opens the app-specific settings screen. This is the ONLY settings destination officially supported by Apple and is considered App Store safe. |
335
+ | **`AppNotification`** | <code>'appNotification'</code> | Opens the app-specific notification settings. - iOS 16+: opens the dedicated notification settings screen - iOS &lt;16: falls back to the app settings screen |
336
+ | **`About`** | <code>'about'</code> | Opens iOS "About" settings. |
337
+ | **`AutoLock`** | <code>'autoLock'</code> | Opens Auto-Lock settings. |
338
+ | **`Bluetooth`** | <code>'bluetooth'</code> | Opens Bluetooth settings. |
339
+ | **`DateTime`** | <code>'dateTime'</code> | Opens Date & Time settings. |
340
+ | **`FaceTime`** | <code>'facetime'</code> | Opens FaceTime settings. |
341
+ | **`General`** | <code>'general'</code> | Opens General settings. |
342
+ | **`Keyboard`** | <code>'keyboard'</code> | Opens Keyboard settings. |
343
+ | **`ICloud`** | <code>'iCloud'</code> | Opens iCloud settings. |
344
+ | **`ICloudStorageBackup`** | <code>'iCloudStorageBackup'</code> | Opens iCloud Storage & Backup settings. |
345
+ | **`International`** | <code>'international'</code> | Opens Language & Region (International) settings. |
346
+ | **`LocationServices`** | <code>'locationServices'</code> | Opens Location Services settings. |
347
+ | **`Music`** | <code>'music'</code> | Opens Music settings. |
348
+ | **`Notes`** | <code>'notes'</code> | Opens Notes settings. |
349
+ | **`Notifications`** | <code>'notifications'</code> | Opens Notifications settings. Note: this is the global notifications screen, not app-specific notifications. |
350
+ | **`Phone`** | <code>'phone'</code> | Opens Phone settings. |
351
+ | **`Photos`** | <code>'photos'</code> | Opens Photos settings. |
352
+ | **`ManagedConfigurationList`** | <code>'managedConfigurationList'</code> | Opens Managed Configuration profiles list. |
353
+ | **`Reset`** | <code>'reset'</code> | Opens Reset settings. |
354
+ | **`Ringtone`** | <code>'ringtone'</code> | Opens Ringtone settings. |
355
+ | **`Sounds`** | <code>'sounds'</code> | Opens Sounds settings. |
356
+ | **`SoftwareUpdate`** | <code>'softwareUpdate'</code> | Opens Software Update settings. |
357
+ | **`Store`** | <code>'store'</code> | Opens App Store settings. |
358
+ | **`Tracking`** | <code>'tracking'</code> | Opens App Tracking Transparency settings. Available on iOS 14+. |
359
+ | **`Wallpaper`** | <code>'wallpaper'</code> | Opens Wallpaper settings. |
360
+ | **`WiFi`** | <code>'wifi'</code> | Opens Wi-Fi settings. |
361
+ | **`Tethering`** | <code>'tethering'</code> | Opens Personal Hotspot (Tethering) settings. |
362
+ | **`DoNotDisturb`** | <code>'doNotDisturb'</code> | Opens Do Not Disturb settings. |
363
+ | **`TouchIdPasscode`** | <code>'touchIdPasscode'</code> | Opens Touch ID / Passcode settings. |
364
+ | **`ScreenTime`** | <code>'screenTime'</code> | Opens Screen Time settings. |
365
+ | **`Accessibility`** | <code>'accessibility'</code> | Opens Accessibility settings. |
366
+ | **`VPN`** | <code>'vpn'</code> | Opens VPN settings. |
367
+
368
+ </docgen-api>
369
+
370
+ ---
371
+
372
+ ## Platform limitations
373
+
374
+ ### iOS
375
+
376
+ Apple officially supports opening only the app-specific settings screen.
377
+ Other settings destinations rely on undocumented URL schemes and may change
378
+ or be restricted by future iOS versions or App Store review policies.
379
+
380
+ ### Android
381
+
382
+ Some Android system settings are not guaranteed to be available on all devices.
383
+
384
+ Certain options (such as Zen Mode / Do Not Disturb related settings) rely on
385
+ device-specific or undocumented system intents. Availability may vary depending on:
386
+
387
+ - Android version
388
+ - device manufacturer (OEM)
389
+ - system configuration or user restrictions
390
+
391
+ When a requested settings screen is not supported on the current device,
392
+ the plugin will return a structured result with:
393
+
394
+ ```ts
395
+ {
396
+ success: false,
397
+ code: 'UNAVAILABLE'
398
+ }
399
+ ```
400
+
401
+ This behavior is intentional and aligns with real-world Android platform constraints.
402
+
403
+ For additional context, see the discussion in the original implementation:
404
+ [https://github.com/RaphaelWoude/capacitor-native-settings/pull/63](https://github.com/RaphaelWoude/capacitor-native-settings/pull/63)
405
+
406
+ ---
407
+
408
+ ## Contributing
409
+
410
+ Contributions are welcome! Please read the [contributing guide](CONTRIBUTING.md) before submitting a pull request.
411
+
412
+ ---
413
+
414
+ ## Credits
415
+
416
+ This plugin is based on prior work from the Community and
417
+ has been refactored and modernized for **Capacitor v8** and
418
+ **Swift Package Manager** compatibility.
419
+
420
+ Original inspiration:
421
+
422
+ - [https://github.com/RaphaelWoude/capacitor-native-settings](https://github.com/RaphaelWoude/capacitor-native-settings)
423
+
424
+ ---
425
+
426
+ ## License
427
+
428
+ MIT
@@ -0,0 +1,103 @@
1
+ buildscript {
2
+ ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '2.2.20'
3
+ repositories {
4
+ google()
5
+ mavenCentral()
6
+ }
7
+ dependencies {
8
+ classpath 'com.android.tools.build:gradle:8.13.0'
9
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
10
+ }
11
+ }
12
+
13
+ plugins {
14
+ id "org.jlleitschuh.gradle.ktlint" version "12.1.1" apply false
15
+ }
16
+
17
+ ext {
18
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
19
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
20
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
21
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
22
+ androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.17.0'
23
+ }
24
+
25
+ apply plugin: 'com.android.library'
26
+ apply plugin: 'kotlin-android'
27
+ apply plugin: 'kotlin-parcelize'
28
+ apply plugin: 'org.jlleitschuh.gradle.ktlint'
29
+
30
+ import groovy.json.JsonSlurper
31
+
32
+ def getPluginVersion() {
33
+ try {
34
+ def packageJsonFile = file('../package.json')
35
+ if (packageJsonFile.exists()) {
36
+ def packageJson = new JsonSlurper().parseText(packageJsonFile.text)
37
+ return packageJson.version
38
+ }
39
+ } catch (Exception e) {
40
+ // Ignore errors and fallback
41
+ }
42
+ return "0.0.1"
43
+ }
44
+
45
+ def pluginVersion = getPluginVersion()
46
+
47
+ android {
48
+ namespace = "io.capkit.settings"
49
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion as Integer : 36
50
+
51
+ // AGP 8.0+ disables BuildConfig by default for libraries.
52
+ // We need to enable it to inject the plugin version.
53
+ buildFeatures {
54
+ buildConfig = true
55
+ }
56
+
57
+ defaultConfig {
58
+ minSdkVersion = project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion as Integer : 24
59
+ targetSdkVersion = project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion as Integer : 36
60
+ versionCode = 1
61
+
62
+ // Dynamic versioning (feature enabled)
63
+ versionName = pluginVersion
64
+
65
+ // Injects the version into the BuildConfig class ONLY if feature is enabled
66
+ buildConfigField "String", "PLUGIN_VERSION", "\"${pluginVersion}\""
67
+
68
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
69
+ }
70
+ buildTypes {
71
+ release {
72
+ minifyEnabled = false
73
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
74
+ }
75
+ }
76
+ lint {
77
+ abortOnError = false
78
+ }
79
+ compileOptions {
80
+ sourceCompatibility = JavaVersion.VERSION_21
81
+ targetCompatibility = JavaVersion.VERSION_21
82
+ }
83
+ kotlinOptions {
84
+ jvmTarget = JavaVersion.VERSION_21
85
+ }
86
+ }
87
+
88
+ repositories {
89
+ google()
90
+ mavenCentral()
91
+ }
92
+
93
+ dependencies {
94
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
95
+ implementation project(':capacitor-android')
96
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
97
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
98
+ implementation "androidx.core:core-ktx:$androidxCoreKTXVersion"
99
+
100
+ testImplementation "junit:junit:$junitVersion"
101
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
102
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
103
+ }
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,39 @@
1
+ package io.capkit.settings
2
+
3
+ import android.content.Context
4
+ import com.getcapacitor.Plugin
5
+
6
+ /**
7
+ * Plugin configuration holder.
8
+ *
9
+ * This class is responsible for reading and parsing configuration values
10
+ * defined under the `Settings` key in `capacitor.config.ts`.
11
+ *
12
+ * Configuration is read once during plugin initialization and treated as
13
+ * immutable runtime input.
14
+ */
15
+ class SettingsConfig(plugin: Plugin) {
16
+ /**
17
+ * Android application context.
18
+ * Exposed for native components that may require it.
19
+ */
20
+ val context: Context
21
+
22
+ /**
23
+ * Enables verbose / debug logging for the plugin.
24
+ *
25
+ * When enabled, additional logs are printed to Logcat via [Logger.debug].
26
+ *
27
+ * Default: false
28
+ */
29
+ val verboseLogging: Boolean
30
+
31
+ init {
32
+ context = plugin.context
33
+
34
+ val config = plugin.getConfig()
35
+
36
+ // Parse verboseLogging (default: false)
37
+ verboseLogging = config.getBoolean("verboseLogging", false)
38
+ }
39
+ }