-
Notifications
You must be signed in to change notification settings - Fork 1k
/
declarations.ts
626 lines (568 loc) · 16.5 KB
/
declarations.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
export interface CapacitorConfig {
/**
* The unique identifier of your packaged app.
*
* This is also known as the Bundle ID in iOS and the Application ID in
* Android. It must be in reverse domain name notation, generally
* representing a domain name that you or your company owns.
*
* @since 1.0.0
*/
appId?: string;
/**
* The human-friendly name of your app.
*
* This should be what you'd see in the App Store, but can be changed after
* within each native platform after it is generated.
*
* @since 1.0.0
*/
appName?: string;
/**
* The directory of your compiled web assets.
*
* This directory should contain the final `index.html` of your app.
*
* @since 1.0.0
*/
webDir?: string;
/**
* The build configuration (as defined by the native app) under which Capacitor
* will send statements to the log system. This applies to log statements in
* native code as well as statements redirected from JavaScript (`console.debug`,
* `console.error`, etc.). Enabling logging will let statements render in the
* Xcode and Android Studio windows but can leak information on device if enabled
* in released builds.
*
* 'none' = logs are never produced
* 'debug' = logs are produced in debug builds but not production builds
* 'production' = logs are always produced
*
* @since 3.0.0
* @default debug
*/
loggingBehavior?: 'none' | 'debug' | 'production';
/**
* User agent of Capacitor Web View.
*
* @since 1.4.0
*/
overrideUserAgent?: string;
/**
* String to append to the original user agent of Capacitor Web View.
*
* This is disregarded if `overrideUserAgent` is used.
*
* @since 1.4.0
*/
appendUserAgent?: string;
/**
* Background color of the Capacitor Web View.
*
* @since 1.1.0
*/
backgroundColor?: string;
/**
* Enable zooming within the Capacitor Web View.
*
* @default false
* @since 6.0.0
*/
zoomEnabled?: boolean;
android?: {
/**
* Specify a custom path to the native Android project.
*
* @since 3.0.0
* @default android
*/
path?: string;
/**
* User agent of Capacitor Web View on Android.
*
* Overrides global `overrideUserAgent` option.
*
* @since 1.4.0
*/
overrideUserAgent?: string;
/**
* String to append to the original user agent of Capacitor Web View for Android.
*
* Overrides global `appendUserAgent` option.
*
* This is disregarded if `overrideUserAgent` is used.
*
* @since 1.4.0
*/
appendUserAgent?: string;
/**
* Background color of the Capacitor Web View for Android.
*
* Overrides global `backgroundColor` option.
*
* @since 1.1.0
*/
backgroundColor?: string;
/**
* Enable zooming within the Capacitor Web View for Android.
*
* @default false
* @since 6.0.0
*/
zoomEnabled?: boolean;
/**
* Enable mixed content in the Capacitor Web View for Android.
*
* [Mixed
* content](https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content)
* is disabled by default for security. During development, you may need to
* enable it to allow the Web View to load files from different schemes.
*
* **This is not intended for use in production.**
*
* @since 1.0.0
* @default false
*/
allowMixedContent?: boolean;
/**
* This enables a simpler keyboard which may have some limitations.
*
* This will capture JS keys using an alternative
* [`InputConnection`](https://developer.android.com/reference/android/view/inputmethod/InputConnection).
*
* @since 1.0.0
* @default false
*/
captureInput?: boolean;
/**
* Always enable debuggable web content.
*
* This is automatically enabled during development.
*
* @since 1.0.0
* @default false
*/
webContentsDebuggingEnabled?: boolean;
/**
* The build configuration under which Capacitor will generate logs on Android.
*
* Overrides global `loggingBehavior` option.
*
* @since 3.0.0
* @default debug
*/
loggingBehavior?: 'none' | 'debug' | 'production';
/**
* Allowlist of plugins to include during `npx cap sync` for Android.
*
* Overrides global `includePlugins` option.
*
* @since 3.0.0
*/
includePlugins?: string[];
/**
* Android flavor to use.
*
* If the app has flavors declared in the `build.gradle`
* configure the flavor you want to run with `npx cap run` command.
*
* @since 3.1.0
*/
flavor?: string;
/**
* Whether to give the webview initial focus.
*
* @since 3.5.1
* @default true
*/
initialFocus?: boolean;
/**
* The minimum supported webview version on Android supported by your app.
*
* The minimum supported cannot be lower than version `55`, which is required for Capacitor.
*
* If the device uses a lower WebView version, an error message will be shown on Logcat.
* If `server.errorPath` is configured, the WebView will redirect to that file, so can be
* used to show a custom error.
*
* @since 4.0.0
* @default 60
*/
minWebViewVersion?: number;
/**
* The minimum supported Huawei webview version on Android supported by your app.
*
* The minimum supported cannot be lower than version `10`, which is required for Capacitor.
*
* If the device uses a lower WebView version, an error message will be shown on Logcat.
* If `server.errorPath` is configured, the WebView will redirect to that file, so can be
* used to show a custom error.
*
* @since 4.6.4
* @default 10
*/
minHuaweiWebViewVersion?: number;
buildOptions?: {
/**
* Path to your keystore
*
* @since 4.4.0
*/
keystorePath?: string;
/**
* Password to your keystore
*
* @since 4.4.0
*/
keystorePassword?: string;
/**
* Alias in the keystore to use
*
* @since 4.4.0
*/
keystoreAlias?: string;
/**
* Password for the alias in the keystore to use
*
* @since 4.4.0
*/
keystoreAliasPassword?: string;
/**
* Bundle type for your release build
*
* @since 4.4.0
* @default "AAB"
*/
releaseType?: 'AAB' | 'APK';
/**
* Program to sign your build with
*
* @since 5.1.0
* @default "jarsigner"
*/
signingType?: 'apksigner' | 'jarsigner';
};
/**
* Use legacy [addJavascriptInterface](https://developer.android.com/reference/android/webkit/WebView#addJavascriptInterface(java.lang.Object,%20java.lang.String))
* instead of the new and more secure [addWebMessageListener](https://developer.android.com/reference/androidx/webkit/WebViewCompat#addWebMessageListener(android.webkit.WebView,java.lang.String,java.util.Set%3Cjava.lang.String%3E,androidx.webkit.WebViewCompat.WebMessageListener))
*
* @since 4.5.0
* @default false
*/
useLegacyBridge?: boolean;
};
ios?: {
/**
* Specify a custom path to the native iOS project.
*
* @since 3.0.0
* @default ios
*/
path?: string;
/**
* iOS build scheme to use.
*
* Usually this matches your app's target in Xcode. You can use the
* following command to list schemes:
*
* ```shell
* xcodebuild -workspace ios/App/App.xcworkspace -list
* ```
*
* @since 3.0.0
* @default App
*/
scheme?: string;
/**
* User agent of Capacitor Web View on iOS.
*
* Overrides global `overrideUserAgent` option.
*
* @since 1.4.0
*/
overrideUserAgent?: string;
/**
* String to append to the original user agent of Capacitor Web View for iOS.
*
* Overrides global `appendUserAgent` option.
*
* This is disregarded if `overrideUserAgent` is used.
*
* @since 1.4.0
*/
appendUserAgent?: string;
/**
* Background color of the Capacitor Web View for iOS.
*
* Overrides global `backgroundColor` option.
*
* @since 1.1.0
*/
backgroundColor?: string;
/**
* Enable zooming within the Capacitor Web View for iOS.
*
* @default false
* @since 6.0.0
*/
zoomEnabled?: boolean;
/**
* Configure the scroll view's content inset adjustment behavior.
*
* This will set the
* [`contentInsetAdjustmentBehavior`](https://developer.apple.com/documentation/uikit/uiscrollview/2902261-contentinsetadjustmentbehavior)
* property on the Web View's
* [`UIScrollView`](https://developer.apple.com/documentation/uikit/uiscrollview).
*
* @since 2.0.0
* @default never
*/
contentInset?: 'automatic' | 'scrollableAxes' | 'never' | 'always';
/**
* Configure whether the scroll view is scrollable.
*
* This will set the
* [`isScrollEnabled`](https://developer.apple.com/documentation/uikit/uiscrollview/1619395-isscrollenabled)
* property on the Web View's
* [`UIScrollView`](https://developer.apple.com/documentation/uikit/uiscrollview).
*
* @since 1.0.0
*/
scrollEnabled?: boolean;
/**
* Configure custom linker flags for compiling Cordova plugins.
*
* @since 1.0.0
* @default []
*/
cordovaLinkerFlags?: string[];
/**
* Allow destination previews when pressing on links.
*
* This will set the
* [`allowsLinkPreview`](https://developer.apple.com/documentation/webkit/wkwebview/1415000-allowslinkpreview)
* property on the Web View, instead of using the default value.
*
* @since 2.0.0
*/
allowsLinkPreview?: boolean;
/**
* The build configuration under which Capacitor will generate logs on iOS.
*
* Overrides global `loggingBehavior` option.
*
* @since 3.0.0
* @default debug
*/
loggingBehavior?: 'none' | 'debug' | 'production';
/**
* Allowlist of plugins to include during `npx cap sync` for iOS.
*
* Overrides global `includePlugins` option.
*
* @since 3.0.0
*/
includePlugins?: string[];
/**
* Sets WKWebView configuration for limitsNavigationsToAppBoundDomains.
*
* If the Info.plist file includes `WKAppBoundDomains` key, it's recommended to
* set this option to true, otherwise some features won't work.
* But as side effect, it blocks navigation outside the domains in the
* `WKAppBoundDomains` list.
* `localhost` (or the value configured as `server.hostname`) also needs to be
* added to the `WKAppBoundDomains` list.
*
* @since 3.1.0
* @default false
*/
limitsNavigationsToAppBoundDomains?: boolean;
/**
* The content mode for the web view to use when it loads and renders web content.
*
* - 'recommended': The content mode that is appropriate for the current device.
* - 'desktop': The content mode that represents a desktop experience.
* - 'mobile': The content mode that represents a mobile experience.
*
* @since 4.0.0
* @default recommended
*/
preferredContentMode?: 'recommended' | 'desktop' | 'mobile';
/**
* Configure if Capacitor will handle local/push notifications.
* Set to false if you want to use your own UNUserNotificationCenter to handle notifications.
*
* @since 4.5.0
* @default true
*/
handleApplicationNotifications?: boolean;
/**
* Using Xcode 14.3, on iOS 16.4 and greater, enable debuggable web content for release builds.
*
* If not set, it's `true` for development builds.
*
* @since 4.8.0
* @default false
*/
webContentsDebuggingEnabled?: boolean;
};
server?: {
/**
* Configure the local hostname of the device.
*
* It is recommended to keep this as `localhost` as it allows the use of
* Web APIs that would otherwise require a [secure
* context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts)
* such as
* [`navigator.geolocation`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/geolocation)
* and
* [`MediaDevices.getUserMedia`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia).
*
* @since 1.0.0
* @default localhost
*/
hostname?: string;
/**
* Configure the local scheme on iOS.
*
* [Can't be set to schemes that the WKWebView already handles, such as http or https](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/2875766-seturlschemehandler)
* This can be useful when migrating from
* [`cordova-plugin-ionic-webview`](https://github.com/ionic-team/cordova-plugin-ionic-webview),
* where the default scheme on iOS is `ionic`.
*
* @since 1.2.0
* @default capacitor
*/
iosScheme?: string;
/**
* Configure the local scheme on Android.
*
* Custom schemes on Android are unable to change the URL path as of Webview 117. Changing this value from anything other than `http` or `https` can result in your
* application unable to resolve routing. If you must change this for some reason, consider using a hash-based url strategy, but there are no guarentees that this
* will continue to work long term as allowing non-standard schemes to modify query parameters and url fragments is only allowed for compatibility reasons.
* https://ionic.io/blog/capacitor-android-customscheme-issue-with-chrome-117
*
* @since 1.2.0
* @default https
*/
androidScheme?: string;
/**
* Load an external URL in the Web View.
*
* This is intended for use with live-reload servers.
*
* **This is not intended for use in production.**
*
* @since 1.0.0
*/
url?: string;
/**
* Allow cleartext traffic in the Web View.
*
* On Android, all cleartext traffic is disabled by default as of API 28.
*
* This is intended for use with live-reload servers where unencrypted HTTP
* traffic is often used.
*
* **This is not intended for use in production.**
*
* @since 1.5.0
* @default false
*/
cleartext?: boolean;
/**
* Set additional URLs the Web View can navigate to.
*
* By default, all external URLs are opened in the external browser (not
* the Web View).
*
* **This is not intended for use in production.**
*
* @since 1.0.0
* @default []
*/
allowNavigation?: string[];
/**
* Specify path to a local html page to display in case of errors.
* On Android the html file won't have access to Capacitor plugins.
*
* @since 4.0.0
* @default null
*/
errorPath?: string;
};
cordova?: {
/**
* Populates <access> tags in the config.xml with the origin set to
* the values entered here.
* If not provided, a single <access origin="*" /> tag gets included.
* It only has effect on a few Cordova plugins that respect the whitelist.
*
* @since 3.3.0
*/
accessOrigins?: string[];
/**
* Configure Cordova preferences.
*
* @since 1.3.0
*/
preferences?: { [key: string]: string | undefined };
};
/**
* Configure plugins.
*
* This is an object with configuration values specified by plugin class
* name.
*
* @since 1.0.0
*/
plugins?: PluginsConfig;
/**
* Allowlist of plugins to include during `npx cap sync`.
*
* This should be an array of strings representing the npm package name of
* plugins to include when running `npx cap sync`. If unset, Capacitor will
* inspect `package.json` for a list of potential plugins.
*
* @since 3.0.0
*/
includePlugins?: string[];
}
export interface PluginsConfig {
/**
* Plugin configuration by class name.
*
* @since 1.0.0
*/
[key: string]:
| {
[key: string]: any;
}
| undefined;
/**
* Capacitor Cookies plugin configuration
*
* @since 4.3.0
*/
CapacitorCookies?: {
/**
* Enable CapacitorCookies to override the global `document.cookie` on native.
*
* @default false
*/
enabled?: boolean;
};
/**
* Capacitor Http plugin configuration
*
* @since 4.3.0
*/
CapacitorHttp?: {
/**
* Enable CapacitorHttp to override the global `fetch` and `XMLHttpRequest` on native.
*
* @default false
*/
enabled?: boolean;
};
}