-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
Copy pathindex.ts
1089 lines (994 loc) · 33.1 KB
/
index.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
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core';
/**
* @name Diagnostic
* @description
* Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi
* @usage
* ```typescript
* import { Diagnostic } from '@awesome-cordova-plugins/diagnostic/ngx';
*
* constructor(private diagnostic: Diagnostic) { }
*
* ...
*
* let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); }
* let errorCallback = (e) => console.error(e);
*
* this.diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback);
*
* this.diagnostic.isBluetoothAvailable().then(successCallback, errorCallback);
*
*
* this.diagnostic.getBluetoothState()
* .then((state) => {
* if (state == this.diagnostic.bluetoothState.POWERED_ON){
* // do something
* } else {
* // do something else
* }
* }).catch(e => console.error(e));
*
* ```
*/
@Plugin({
pluginName: 'Diagnostic',
plugin: 'cordova.plugins.diagnostic',
pluginRef: 'cordova.plugins.diagnostic',
repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin',
platforms: ['Android', 'iOS', 'Windows'],
})
@Injectable()
export class Diagnostic extends AwesomeCordovaNativePlugin {
permission = {
READ_CALENDAR: 'READ_CALENDAR',
WRITE_CALENDAR: 'WRITE_CALENDAR',
CAMERA: 'CAMERA',
READ_CONTACTS: 'READ_CONTACTS',
WRITE_CONTACTS: 'WRITE_CONTACTS',
GET_ACCOUNTS: 'GET_ACCOUNTS',
ACCESS_FINE_LOCATION: 'ACCESS_FINE_LOCATION',
ACCESS_COARSE_LOCATION: 'ACCESS_COARSE_LOCATION',
RECORD_AUDIO: 'RECORD_AUDIO',
READ_PHONE_STATE: 'READ_PHONE_STATE',
CALL_PHONE: 'CALL_PHONE',
ADD_VOICEMAIL: 'ADD_VOICEMAIL',
USE_SIP: 'USE_SIP',
PROCESS_OUTGOING_CALLS: 'PROCESS_OUTGOING_CALLS',
READ_CALL_LOG: 'READ_CALL_LOG',
WRITE_CALL_LOG: 'WRITE_CALL_LOG',
SEND_SMS: 'SEND_SMS',
RECEIVE_SMS: 'RECEIVE_SMS',
READ_SMS: 'READ_SMS',
RECEIVE_WAP_PUSH: 'RECEIVE_WAP_PUSH',
RECEIVE_MMS: 'RECEIVE_MMS',
WRITE_EXTERNAL_STORAGE: 'WRITE_EXTERNAL_STORAGE',
READ_EXTERNAL_STORAGE: 'READ_EXTERNAL_STORAGE',
BODY_SENSORS: 'BODY_SENSORS',
BLUETOOTH_ADVERTISE: "BLUETOOTH_ADVERTISE",
BLUETOOTH_SCAN: "BLUETOOTH_SCAN",
BLUETOOTH_CONNECT: "BLUETOOTH_CONNECT",
};
@CordovaProperty()
permissionStatus: {
GRANTED: string;
/**
* @deprecated cordova.plugins.diagnostic@5.0.0 uses DENIED_ONCE to unify DENIED* statuses across iOS/Android
*/
DENIED: string;
DENIED_ONCE: string;
NOT_REQUESTED: string;
DENIED_ALWAYS: string;
RESTRICTED: string;
GRANTED_WHEN_IN_USE: string;
};
locationAuthorizationMode = {
ALWAYS: 'always',
WHEN_IN_USE: 'when_in_use',
};
/**
* Location accuracy authorization
*/
locationAccuracyAuthorization = {
FULL: 'full',
REDUCED: 'reduced',
};
permissionGroups = {
CALENDAR: ['READ_CALENDAR', 'WRITE_CALENDAR'],
CAMERA: ['CAMERA'],
CONTACTS: ['READ_CONTACTS', 'WRITE_CONTACTS', 'GET_ACCOUNTS'],
LOCATION: ['ACCESS_FINE_LOCATION', 'ACCESS_COARSE_LOCATION'],
MICROPHONE: ['RECORD_AUDIO'],
PHONE: [
'READ_PHONE_STATE',
'CALL_PHONE',
'ADD_VOICEMAIL',
'USE_SIP',
'PROCESS_OUTGOING_CALLS',
'READ_CALL_LOG',
'WRITE_CALL_LOG',
],
SENSORS: ['BODY_SENSORS'],
SMS: ['SEND_SMS', 'RECEIVE_SMS', 'READ_SMS', 'RECEIVE_WAP_PUSH', 'RECEIVE_MMS'],
STORAGE: ['READ_EXTERNAL_STORAGE', 'WRITE_EXTERNAL_STORAGE'],
NEARBY_DEVICES: ["BLUETOOTH_ADVERTISE", "BLUETOOTH_SCAN", "BLUETOOTH_CONNECT"],
};
locationMode = {
HIGH_ACCURACY: 'high_accuracy',
DEVICE_ONLY: 'device_only',
BATTERY_SAVING: 'battery_saving',
LOCATION_OFF: 'location_off',
};
bluetoothState = {
UNKNOWN: 'unknown',
RESETTING: 'resetting', // iOS
UNSUPPORTED: 'unsupported', // iOS
UNAUTHORIZED: 'unauthorized', // iOS
POWERED_OFF: 'powered_off',
POWERED_ON: 'powered_on',
POWERING_OFF: 'powering_off',
POWERING_ON: 'powering_on',
};
@CordovaProperty()
NFCState: {
UNKNOWN: string;
POWERED_OFF: string;
POWERED_ON: string;
POWERING_ON: string;
POWERING_OFF: string;
};
@CordovaProperty()
motionStatus: {
NOT_REQUESTED: string;
GRANTED: string;
DENIED: string;
RESTRICTED: string;
NOT_AVAILABLE: string;
NOT_DETERMINED: string;
UNKNOWN: string;
};
/**
* Access to the photo library (iOS 14+)
*
* ADD_ONLY - can add to but not read from Photo Library
* READ_WRITE - can both add to and read from Photo Library
*
*/
photoLibraryAccessLevel = {
ADD_ONLY: 'add_only',
READ_WRITE: 'read_write',
};
/**
* Checks if app is able to access device location.
*
* @returns {Promise<any>}
*/
@Cordova()
isLocationAvailable(): Promise<any> {
return;
}
/**
* Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
* On Android this requires permission. `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />`
*
* @returns {Promise<any>}
*/
@Cordova()
isWifiAvailable(): Promise<any> {
return;
}
/**
* Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
* application is authorized to use it.
*
* @param {boolean} [externalStorage] Android only: If true, checks permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission.
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
* @returns {Promise<any>}
*/
@Cordova({ callbackOrder: 'reverse' })
isCameraAvailable(externalStorage?: boolean): Promise<any> {
return;
}
/**
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
* On Android this requires permission <uses-permission android:name="android.permission.BLUETOOTH" />
*
* @returns {Promise<any>}
*/
@Cordova()
isBluetoothAvailable(): Promise<any> {
return;
}
/**
* Displays the device location settings to allow user to enable location services/change location mode.
*/
@Cordova({ sync: true, platforms: ['Android', 'Windows 10', 'iOS'] })
switchToLocationSettings(): void {}
/**
* Displays mobile settings to allow user to enable mobile data.
*/
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
switchToMobileDataSettings(): void {}
/**
* Displays Bluetooth settings to allow user to enable Bluetooth.
*/
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
switchToBluetoothSettings(): void {}
/**
* Displays WiFi settings to allow user to enable WiFi.
*/
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
switchToWifiSettings(): void {}
/**
* Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()`
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'Windows 10'] })
isWifiEnabled(): Promise<boolean> {
return;
}
/**
* Enables/disables WiFi on the device.
* Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android
*
* @param {boolean} state
* @returns {Promise<any>}
*/
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
setWifiState(state: boolean): Promise<any> {
return;
}
/**
* Enables/disables Bluetooth on the device.
* Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android
*
* @param {boolean} state
* @returns {Promise<any>}
*/
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
setBluetoothState(state: boolean): Promise<any> {
return;
}
// ANDROID AND IOS ONLY
/**
* Returns true if the device setting for location is on. On Android this returns true if Location Mode is switched on. On iOS this returns true if Location Services is switched on.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
isLocationEnabled(): Promise<boolean> {
return;
}
/**
* Checks if the application is authorized to use location.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*
* @returns {Promise<any>}
*/
@Cordova()
isLocationAuthorized(): Promise<any> {
return;
}
/**
* Returns the location authorization status for the application.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
getLocationAuthorizationStatus(): Promise<any> {
return;
}
/**
* Returns the location authorization status for the application.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*
* @param {string} [mode] location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use". (this.locationAuthorizationMode)
* @param {string} [accuracy] requested location accuracy: "full" or "reduced". If not specified, defaults to "full". (this.locationAccuracyAuthorization)
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
requestLocationAuthorization(mode?: string, accuracy?: string): Promise<any> {
return;
}
/**
* Checks if camera hardware is present on device.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
isCameraPresent(): Promise<any> {
return;
}
/**
* Checks if the application is authorized to use the camera.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
*
* @param {boolean} [externalStorage] Android only: If true, checks permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission.
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
isCameraAuthorized(externalStorage?: boolean): Promise<any> {
return;
}
/**
* Returns the camera authorization status for the application.
*
* @param {boolean} [externalStorage] Android only: If true, checks permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission.
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
getCameraAuthorizationStatus(externalStorage?: boolean): Promise<any> {
return;
}
/**
* Requests camera authorization for the application.
*
* @param {boolean} [externalStorage] Android only: If true, requests permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission.
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
requestCameraAuthorization(externalStorage?: boolean): Promise<any> {
return;
}
/**
* Checks if the application is authorized to use the microphone.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
isMicrophoneAuthorized(): Promise<boolean> {
return;
}
/**
* Returns the microphone authorization status for the application.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
getMicrophoneAuthorizationStatus(): Promise<any> {
return;
}
/**
* Requests microphone authorization for the application.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
requestMicrophoneAuthorization(): Promise<any> {
return;
}
/**
* Checks if the application is authorized to use contacts (address book).
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
isContactsAuthorized(): Promise<boolean> {
return;
}
/**
* Returns the contacts authorization status for the application.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
getContactsAuthorizationStatus(): Promise<any> {
return;
}
/**
* Requests contacts authorization for the application.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
requestContactsAuthorization(): Promise<any> {
return;
}
/**
* Checks if the application is authorized to use the calendar.
*
* Notes for Android:
* - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
*
* Notes for iOS:
* - This relates to Calendar Events (not Calendar Reminders)
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
isCalendarAuthorized(): Promise<boolean> {
return;
}
/**
* Returns the calendar authorization status for the application.
*
* Notes for Android:
* - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return `GRANTED` status as permissions are already granted at installation time.
*
* Notes for iOS:
* - This relates to Calendar Events (not Calendar Reminders)
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
getCalendarAuthorizationStatus(): Promise<any> {
return;
}
/**
* Requests calendar authorization for the application.
*
* Notes for iOS:
* - Should only be called if authorization status is NOT_DETERMINED. Calling it when in any other state will have no effect and just return the current authorization status.
* - This relates to Calendar Events (not Calendar Reminders)
*
* Notes for Android:
* - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
* - This requests permission for `READ_CALENDAR` run-time permission
* - Required permissions must be added to `AndroidManifest.xml` as appropriate - see Android permissions: `READ_CALENDAR`, `WRITE_CALENDAR`
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
requestCalendarAuthorization(): Promise<any> {
return;
}
/**
* Opens settings page for this app.
* On Android, this opens the "App Info" page in the Settings app.
* On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
switchToSettings(): Promise<any> {
return;
}
/**
* Returns the state of Bluetooth on the device.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
getBluetoothState(): Promise<any> {
return;
}
/**
* Registers a function to be called when a change in Bluetooth state occurs.
*
* @param {Function} handler
*/
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
registerBluetoothStateChangeHandler(handler: Function): void {}
/**
* Registers a function to be called when a change in Location state occurs.
*
* @param {Function} handler
*/
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
registerLocationStateChangeHandler(handler: Function): void {}
// ANDROID ONLY
/**
* Checks if high-accuracy locations are available to the app from GPS hardware.
* Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorized to use location.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
isGpsLocationAvailable(): Promise<boolean> {
return;
}
/**
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
* Returns true if Location mode is enabled and is set to either:
* - Device only = GPS hardware only (high accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
isGpsLocationEnabled(): Promise<any> {
return;
}
/**
* Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points.
* Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorized to use location.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
isNetworkLocationAvailable(): Promise<any> {
return;
}
/**
* Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points.
* Returns true if Location mode is enabled and is set to either:
* - Battery saving = network triangulation and Wifi network IDs (low accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
isNetworkLocationEnabled(): Promise<any> {
return;
}
/**
* Returns the current location mode setting for the device.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
getLocationMode(): Promise<any> {
return;
}
/**
* Returns the current authorization status for a given permission.
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*
* @param permission
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
getPermissionAuthorizationStatus(permission: any): Promise<any> {
return;
}
/**
* Returns the current authorization status for multiple permissions.
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*
* @param {any[]} permissions
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
getPermissionsAuthorizationStatus(permissions: any[]): Promise<any> {
return;
}
/**
* Requests app to be granted authorization for a runtime permission.
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
*
* @param permission
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
requestRuntimePermission(permission: any): Promise<any> {
return;
}
/**
* Requests app to be granted authorization for multiple runtime permissions.
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*
* @param {any[]} permissions
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
requestRuntimePermissions(permissions: any[]): Promise<any> {
return;
}
/**
* Indicates if the plugin is currently requesting a runtime permission via the native API.
* Note that only one request can be made concurrently because the native API cannot handle concurrent requests,
* so the plugin will invoke the error callback if attempting to make more than one simultaneous request.
* Multiple permission requests should be grouped into a single call since the native API is setup to handle batch requests of multiple permission groups.
*
* @returns {boolean}
*/
@Cordova({ sync: true })
isRequestingPermission(): boolean {
return;
}
/**
* Registers a function to be called when a runtime permission request has completed.
* Pass in a falsy value to de-register the currently registered function.
*
* @param {Function} handler
*/
@Cordova({ sync: true })
registerPermissionRequestCompleteHandler(handler: Function): void {
return;
}
/**
* Checks if the device setting for Bluetooth is switched on.
* This requires `BLUETOOTH` permission on Android
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
isBluetoothEnabled(): Promise<boolean> {
return;
}
/**
* Checks if the device has Bluetooth capabilities.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
hasBluetoothSupport(): Promise<boolean> {
return;
}
/**
* Checks if the device has Bluetooth Low Energy (LE) capabilities.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
hasBluetoothLESupport(): Promise<boolean> {
return;
}
/**
* Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
hasBluetoothLEPeripheralSupport(): Promise<boolean> {
return;
}
/**
* Returns the Bluetooth authorization status of the application on the device.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
getBluetoothAuthorizationStatus(): Promise<any> {
return;
}
/**
* Checks if the application is authorized to use external storage.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
isExternalStorageAuthorized(): Promise<boolean> {
return;
}
/**
* CReturns the external storage authorization status for the application.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
getExternalStorageAuthorizationStatus(): Promise<any> {
return;
}
/**
* Requests external storage authorization for the application.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
requestExternalStorageAuthorization(): Promise<any> {
return;
}
/**
* Returns details of external SD card(s): absolute path, is writable, free space.
*
* The intention of this method is to return the location and details of removable external SD cards.
* This differs from the "external directories" returned by cordova-plugin-file which return mount points relating to non-removable (internal) storage.
*
* Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#getexternalsdcarddetails)
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
getExternalSdCardDetails(): Promise<any> {
return;
}
/**
* Switches to the wireless settings page in the Settings app. Allows configuration of wireless controls such as Wi-Fi, Bluetooth and Mobile networks.
*/
@Cordova({
platforms: ['Android'],
sync: true,
})
switchToWirelessSettings(): void {}
/**
* Displays NFC settings to allow user to enable NFC.
*/
@Cordova({
platforms: ['Android'],
sync: true,
})
switchToNFCSettings(): void {}
/**
* Checks if NFC hardware is present on device.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
isNFCPresent(): Promise<boolean> {
return;
}
/**
* Checks if the device setting for NFC is switched on.
* Note: this operation does not require NFC permission in the manifest.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
isNFCEnabled(): Promise<boolean> {
return;
}
/**
* Checks if NFC is available to the app. Returns true if the device has NFC capabilities AND if NFC setting is switched on.
* Note: this operation does not require NFC permission in the manifest.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
isNFCAvailable(): Promise<boolean> {
return;
}
/**
* Registers a function to be called when a change in NFC state occurs. Pass in a falsy value to de-register the currently registered function.
*
* @param {Function} hander callback function to be called when NFC state changes
* @param handler
* @returns {Promise<any>}
*/
@Cordova({
platforms: ['Android'],
sync: true,
})
registerNFCStateChangeHandler(handler: Function): void {}
/**
* Checks if the device data roaming setting is enabled.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
isDataRoamingEnabled(): Promise<boolean> {
return;
}
/**
* Checks if the device setting for ADB(debug) is switched on.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
isADBModeEnabled(): Promise<boolean> {
return;
}
/**
* Checks if the device is rooted.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
isDeviceRooted(): Promise<boolean> {
return;
}
// IOS ONLY
/**
* Checks if the application is authorized to use the Camera Roll in Photos app.
*
* @param accessLevel - (optional) On iOS 14+, specifies the level of access to the photo library to query as a constant in cordova.plugins.diagnostic.photoLibraryAccessLevel`
* Possible values are:
* ADD_ONLY - can add to but not read from Photo Library
* READ_WRITE - can both add to and read from Photo Library
* Defaults to ADD_ONLY if not specified
* Has no effect on iOS 13 or below
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'], callbackOrder: 'reverse' })
isCameraRollAuthorized(accessLevel?: string): Promise<boolean> {
return;
}
/**
* Returns the authorization status for the application to use the Camera Roll in Photos app.
*
* @param accessLevel - (optional) On iOS 14+, specifies the level of access to the photo library to query as a constant in cordova.plugins.diagnostic.photoLibraryAccessLevel`
* Possible values are:
* ADD_ONLY - can add to but not read from Photo Library
* READ_WRITE - can both add to and read from Photo Library
* Defaults to ADD_ONLY if not specified
* Has no effect on iOS 13 or below
*
* @returns {Promise<string>}
*/
@Cordova({ platforms: ['iOS'], callbackOrder: 'reverse' })
getCameraRollAuthorizationStatus(accessLevel?: string): Promise<string> {
return;
}
/**
* Requests camera roll authorization for the application.
* Should only be called if authorization status is NOT_REQUESTED.
* Calling it when in any other state will have no effect.
*
* @param accessLevel - (optional) On iOS 14+, specifies the level of access to the photo library to query as a constant in cordova.plugins.diagnostic.photoLibraryAccessLevel`
* Possible values are:
* ADD_ONLY - can add to but not read from Photo Library
* READ_WRITE - can both add to and read from Photo Library
* Defaults to ADD_ONLY if not specified
* Has no effect on iOS 13 or below
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'], callbackOrder: 'reverse' })
requestCameraRollAuthorization(accessLevel?: string): Promise<any> {
return;
}
/**
* Checks if remote (push) notifications are enabled.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS', 'Android'] })
isRemoteNotificationsEnabled(): Promise<boolean> {
return;
}
/**
* Indicates if the app is registered for remote (push) notifications on the device.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
isRegisteredForRemoteNotifications(): Promise<boolean> {
return;
}
/**
* Returns the authorization status for the application to use Remote Notifications.
* Note: Works on iOS 10+ only (iOS 9 and below will invoke the error callback).
*
* @returns {Promise<string>}
*/
@Cordova({ platforms: ['iOS'] })
getRemoteNotificationsAuthorizationStatus(): Promise<string> {
return;
}
/**
* Requests reminders authorization for the application.
*
* @param types
* @param omitRegistration
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
requestRemoteNotificationsAuthorization(types?: string[], omitRegistration?: boolean): Promise<string> {
return;
}
/**
* Indicates the current setting of notification types for the app in the Settings app.
* Note: on iOS 8+, if "Allow Notifications" switch is OFF, all types will be returned as disabled.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
getRemoteNotificationTypes(): Promise<any> {
return;
}
/**
* Checks if the application is authorized to use reminders.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
isRemindersAuthorized(): Promise<boolean> {
return;
}
/**
* Returns the reminders authorization status for the application.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
getRemindersAuthorizationStatus(): Promise<any> {
return;
}
/**
* Requests reminders authorization for the application.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
requestRemindersAuthorization(): Promise<any> {
return;
}
/**
* Checks if the application is authorized for background refresh.
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
isBackgroundRefreshAuthorized(): Promise<boolean> {
return;
}
/**
* Returns the background refresh authorization status for the application.
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
getBackgroundRefreshStatus(): Promise<any> {
return;
}
/**
* Requests Bluetooth authorization for the application.
*
* Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#requestbluetoothauthorization)