cordova.plugins.diagnostic 6.0.4

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 (75) hide show
  1. package/.github/FUNDING.yml +6 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +123 -0
  3. package/.github/ISSUE_TEMPLATE/documentation-issue.md +36 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +41 -0
  5. package/.github/PULL_REQUEST_TEMPLATE.md +37 -0
  6. package/.github/stale.yml +17 -0
  7. package/CHANGELOG.md +390 -0
  8. package/README.md +3709 -0
  9. package/cordova.plugins.diagnostic.d.ts +1113 -0
  10. package/package.json +54 -0
  11. package/plugin.xml +496 -0
  12. package/scripts/apply-modules.js +165 -0
  13. package/scripts/logger.js +94 -0
  14. package/src/android/Diagnostic.java +856 -0
  15. package/src/android/Diagnostic_Bluetooth.java +297 -0
  16. package/src/android/Diagnostic_Camera.java +134 -0
  17. package/src/android/Diagnostic_External_Storage.java +273 -0
  18. package/src/android/Diagnostic_Location.java +319 -0
  19. package/src/android/Diagnostic_NFC.java +270 -0
  20. package/src/android/Diagnostic_Notifications.java +157 -0
  21. package/src/android/Diagnostic_Wifi.java +155 -0
  22. package/src/ios/Diagnostic.h +56 -0
  23. package/src/ios/Diagnostic.m +282 -0
  24. package/src/ios/Diagnostic_Bluetooth.h +24 -0
  25. package/src/ios/Diagnostic_Bluetooth.m +170 -0
  26. package/src/ios/Diagnostic_Calendar.h +24 -0
  27. package/src/ios/Diagnostic_Calendar.m +94 -0
  28. package/src/ios/Diagnostic_Camera.h +27 -0
  29. package/src/ios/Diagnostic_Camera.m +194 -0
  30. package/src/ios/Diagnostic_Contacts.h +24 -0
  31. package/src/ios/Diagnostic_Contacts.m +93 -0
  32. package/src/ios/Diagnostic_Location.h +31 -0
  33. package/src/ios/Diagnostic_Location.m +284 -0
  34. package/src/ios/Diagnostic_Microphone.h +21 -0
  35. package/src/ios/Diagnostic_Microphone.m +97 -0
  36. package/src/ios/Diagnostic_Motion.h +27 -0
  37. package/src/ios/Diagnostic_Motion.m +143 -0
  38. package/src/ios/Diagnostic_Notifications.h +22 -0
  39. package/src/ios/Diagnostic_Notifications.m +235 -0
  40. package/src/ios/Diagnostic_Reminders.h +24 -0
  41. package/src/ios/Diagnostic_Reminders.m +93 -0
  42. package/src/ios/Diagnostic_Wifi.h +19 -0
  43. package/src/ios/Diagnostic_Wifi.m +108 -0
  44. package/src/windows/diagnosticProxy.bluetooth.js +23 -0
  45. package/src/windows/diagnosticProxy.camera.js +35 -0
  46. package/src/windows/diagnosticProxy.js +137 -0
  47. package/src/windows/diagnosticProxy.location.js +54 -0
  48. package/src/windows/diagnosticProxy.wifi.js +18 -0
  49. package/www/android/diagnostic.bluetooth.js +211 -0
  50. package/www/android/diagnostic.calendar.js +90 -0
  51. package/www/android/diagnostic.camera.js +203 -0
  52. package/www/android/diagnostic.contacts.js +91 -0
  53. package/www/android/diagnostic.external_storage.js +102 -0
  54. package/www/android/diagnostic.js +1309 -0
  55. package/www/android/diagnostic.location.js +282 -0
  56. package/www/android/diagnostic.microphone.js +89 -0
  57. package/www/android/diagnostic.nfc.js +127 -0
  58. package/www/android/diagnostic.notifications.js +74 -0
  59. package/www/android/diagnostic.wifi.js +90 -0
  60. package/www/ios/diagnostic.bluetooth.js +127 -0
  61. package/www/ios/diagnostic.calendar.js +97 -0
  62. package/www/ios/diagnostic.camera.js +212 -0
  63. package/www/ios/diagnostic.contacts.js +98 -0
  64. package/www/ios/diagnostic.js +990 -0
  65. package/www/ios/diagnostic.location.js +236 -0
  66. package/www/ios/diagnostic.microphone.js +99 -0
  67. package/www/ios/diagnostic.motion.js +160 -0
  68. package/www/ios/diagnostic.notifications.js +189 -0
  69. package/www/ios/diagnostic.reminders.js +97 -0
  70. package/www/ios/diagnostic.wifi.js +80 -0
  71. package/www/windows/diagnostic.bluetooth.js +51 -0
  72. package/www/windows/diagnostic.camera.js +41 -0
  73. package/www/windows/diagnostic.js +169 -0
  74. package/www/windows/diagnostic.location.js +35 -0
  75. package/www/windows/diagnostic.wifi.js +51 -0
@@ -0,0 +1,127 @@
1
+ /* globals cordova, require, exports, module */
2
+
3
+ /**
4
+ * Diagnostic Bluetooth plugin for iOS
5
+ *
6
+ * Copyright (c) 2015 Working Edge Ltd.
7
+ * Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
8
+ **/
9
+ var Diagnostic_Bluetooth = (function(){
10
+ /***********************
11
+ *
12
+ * Internal properties
13
+ *
14
+ *********************/
15
+ var Diagnostic_Bluetooth = {};
16
+
17
+ var Diagnostic = require("cordova.plugins.diagnostic.Diagnostic");
18
+
19
+ /********************
20
+ *
21
+ * Public properties
22
+ *
23
+ ********************/
24
+
25
+ Diagnostic.bluetoothState = Diagnostic_Bluetooth.bluetoothState = {
26
+ "UNKNOWN": "unknown",
27
+ "RESETTING": "resetting",
28
+ "UNSUPPORTED": "unsupported",
29
+ "UNAUTHORIZED": "unauthorized",
30
+ "POWERED_OFF": "powered_off",
31
+ "POWERED_ON": "powered_on"
32
+ };
33
+
34
+
35
+
36
+ /********************
37
+ *
38
+ * Internal functions
39
+ *
40
+ ********************/
41
+
42
+ /*****************************
43
+ *
44
+ * Protected member functions
45
+ *
46
+ ****************************/
47
+ Diagnostic_Bluetooth._onBluetoothStateChange = function(){};
48
+
49
+
50
+ /**********************
51
+ *
52
+ * Public API functions
53
+ *
54
+ **********************/
55
+
56
+ /**
57
+ * Checks if the device has Bluetooth LE capabilities and if so that Bluetooth is switched on
58
+ *
59
+ * @param {Function} successCallback - The callback which will be called when operation is successful.
60
+ * This callback function is passed a single boolean parameter which is TRUE if device has Bluetooth LE and Bluetooth is switched on.
61
+ * @param {Function} errorCallback - The callback which will be called when operation encounters an error.
62
+ * This callback function is passed a single string parameter containing the error message.
63
+ */
64
+ Diagnostic_Bluetooth.isBluetoothAvailable = function(successCallback, errorCallback) {
65
+ return cordova.exec(Diagnostic._ensureBoolean(successCallback),
66
+ errorCallback,
67
+ 'Diagnostic_Bluetooth',
68
+ 'isBluetoothAvailable',
69
+ []);
70
+ };
71
+
72
+ /**
73
+ * Returns the state of Bluetooth LE on the device.
74
+ *
75
+ * @param {Function} successCallback - The callback which will be called when operation is successful.
76
+ * This callback function is passed a single string parameter which indicates the Bluetooth state as a constant in `cordova.plugins.diagnostic.bluetoothState`.
77
+ * @param {Function} errorCallback - The callback which will be called when operation encounters an error.
78
+ * This callback function is passed a single string parameter containing the error message.
79
+ */
80
+ Diagnostic_Bluetooth.getBluetoothState = function(successCallback, errorCallback) {
81
+ return cordova.exec(successCallback,
82
+ errorCallback,
83
+ 'Diagnostic_Bluetooth',
84
+ 'getBluetoothState',
85
+ []);
86
+ };
87
+
88
+
89
+ /**
90
+ * Registers a function to be called when a change in Bluetooth state occurs.
91
+ * Pass in a falsey value to de-register the currently registered function.
92
+ *
93
+ * @param {Function} successCallback - function call when a change in Bluetooth state occurs.
94
+ * This callback function is passed a single string parameter which indicates the Bluetooth state as a constant in `cordova.plugins.diagnostic.bluetoothState`.
95
+ */
96
+ Diagnostic_Bluetooth.registerBluetoothStateChangeHandler = function(successCallback){
97
+ Diagnostic_Bluetooth._onBluetoothStateChange = successCallback || function(){};
98
+ return cordova.exec(successCallback,
99
+ null,
100
+ 'Diagnostic_Bluetooth',
101
+ 'ensureBluetoothManager',
102
+ []);
103
+ };
104
+
105
+ /**
106
+ * Requests Bluetooth authorization for the application.
107
+ * The outcome of the authorization request can be determined by registering a handler using `registerBluetoothStateChangeHandler()`.
108
+ *
109
+ * @param {Function} successCallback - The callback which will be called when operation is successful.
110
+ * This callback function is not passed any parameters.
111
+ * @param {Function} errorCallback - The callback which will be called when operation encounters an error.
112
+ * This callback function is passed a single string parameter containing the error message.
113
+ */
114
+ Diagnostic_Bluetooth.requestBluetoothAuthorization = function(successCallback, errorCallback) {
115
+ return cordova.exec(
116
+ successCallback,
117
+ errorCallback,
118
+ 'Diagnostic_Bluetooth',
119
+ 'requestBluetoothAuthorization',
120
+ []);
121
+ };
122
+
123
+
124
+
125
+ return Diagnostic_Bluetooth;
126
+ });
127
+ module.exports = new Diagnostic_Bluetooth();
@@ -0,0 +1,97 @@
1
+ /* globals cordova, require, exports, module */
2
+
3
+ /**
4
+ * Diagnostic Calendar plugin for iOS
5
+ *
6
+ * Copyright (c) 2015 Working Edge Ltd.
7
+ * Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
8
+ **/
9
+ var Diagnostic_Calendar = (function(){
10
+ /***********************
11
+ *
12
+ * Internal properties
13
+ *
14
+ *********************/
15
+ var Diagnostic_Calendar = {};
16
+
17
+ var Diagnostic = require("cordova.plugins.diagnostic.Diagnostic");
18
+
19
+ /********************
20
+ *
21
+ * Public properties
22
+ *
23
+ ********************/
24
+
25
+ /********************
26
+ *
27
+ * Internal functions
28
+ *
29
+ ********************/
30
+
31
+ /*****************************
32
+ *
33
+ * Protected member functions
34
+ *
35
+ ****************************/
36
+
37
+
38
+ /**********************
39
+ *
40
+ * Public API functions
41
+ *
42
+ **********************/
43
+ /**
44
+ * Checks if the application is authorized to use calendar.
45
+ *
46
+ * @param {Function} successCallback - The callback which will be called when operation is successful.
47
+ * This callback function is passed a single boolean parameter which is TRUE if calendar is authorized for use.
48
+ * @param {Function} errorCallback - The callback which will be called when operation encounters an error.
49
+ * This callback function is passed a single string parameter containing the error message.
50
+ */
51
+ Diagnostic_Calendar.isCalendarAuthorized = function(successCallback, errorCallback) {
52
+ return cordova.exec(Diagnostic._ensureBoolean(successCallback),
53
+ errorCallback,
54
+ 'Diagnostic_Calendar',
55
+ 'isCalendarAuthorized',
56
+ []);
57
+ };
58
+
59
+ /**
60
+ * Returns the calendar event authorization status for the application.
61
+ *
62
+ * @param {Function} successCallback - The callback which will be called when operation is successful.
63
+ * This callback function is passed a single string parameter which indicates the authorization status as a constant in `cordova.plugins.diagnostic.permissionStatus`.
64
+ * @param {Function} errorCallback - The callback which will be called when operation encounters an error.
65
+ * This callback function is passed a single string parameter containing the error message.
66
+ */
67
+ Diagnostic_Calendar.getCalendarAuthorizationStatus = function(successCallback, errorCallback) {
68
+ return cordova.exec(successCallback,
69
+ errorCallback,
70
+ 'Diagnostic_Calendar',
71
+ 'getCalendarAuthorizationStatus',
72
+ []);
73
+ };
74
+
75
+ /**
76
+ * Requests calendar event authorization for the application.
77
+ * Should only be called if authorization status is NOT_REQUESTED. Calling it when in any other state will have no effect.
78
+ *
79
+ * @param {Function} successCallback - The callback which will be called when operation is successful.
80
+ * This callback function is passed a single string parameter indicating whether access to calendar was granted or denied:
81
+ * `cordova.plugins.diagnostic.permissionStatus.GRANTED` or `cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS`
82
+ * @param {Function} errorCallback - The callback which will be called when operation encounters an error.
83
+ * This callback function is passed a single string parameter containing the error message.
84
+ */
85
+ Diagnostic_Calendar.requestCalendarAuthorization = function(successCallback, errorCallback) {
86
+ return cordova.exec(function(isGranted){
87
+ successCallback(isGranted ? Diagnostic.permissionStatus.GRANTED : Diagnostic.permissionStatus.DENIED_ALWAYS);
88
+ },
89
+ errorCallback,
90
+ 'Diagnostic_Calendar',
91
+ 'requestCalendarAuthorization',
92
+ []);
93
+ };
94
+
95
+ return Diagnostic_Calendar;
96
+ });
97
+ module.exports = new Diagnostic_Calendar();
@@ -0,0 +1,212 @@
1
+ /* globals cordova, require, exports, module */
2
+
3
+ /**
4
+ * Diagnostic Camera plugin for iOS
5
+ *
6
+ * Copyright (c) 2015 Working Edge Ltd.
7
+ * Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
8
+ **/
9
+ var Diagnostic_Camera = (function(){
10
+ /***********************
11
+ *
12
+ * Internal properties
13
+ *
14
+ *********************/
15
+ var Diagnostic_Camera = {};
16
+
17
+ var Diagnostic = require("cordova.plugins.diagnostic.Diagnostic");
18
+
19
+ /********************
20
+ *
21
+ * Public properties
22
+ *
23
+ ********************/
24
+
25
+ /********************
26
+ *
27
+ * Internal functions
28
+ *
29
+ ********************/
30
+
31
+ function mapFromLegacyCameraApi() {
32
+ var params;
33
+ if (typeof arguments[0] === "function") {
34
+ params = (arguments.length > 2 && typeof arguments[2] === "object") ? arguments[2] : {};
35
+ params.successCallback = arguments[0];
36
+ if(arguments.length > 1 && typeof arguments[1] === "function") {
37
+ params.errorCallback = arguments[1];
38
+ }
39
+ }else { // if (typeof arguments[0] === "object")
40
+ params = arguments[0];
41
+ }
42
+ return params;
43
+ }
44
+
45
+ /*****************************
46
+ *
47
+ * Protected member functions
48
+ *
49
+ ****************************/
50
+
51
+
52
+ /**********************
53
+ *
54
+ * Public API functions
55
+ *
56
+ **********************/
57
+
58
+ /**
59
+ * Checks if camera is enabled for use.
60
+ * On iOS this returns true if both the device has a camera AND the application is authorized to use it.
61
+ *
62
+ * @param {Object} params - (optional) parameters:
63
+ * - {Function} successCallback - The callback which will be called when operation is successful.
64
+ * This callback function is passed a single boolean parameter which is TRUE if camera is present and authorized for use.
65
+ * - {Function} errorCallback - The callback which will be called when operation encounters an error.
66
+ * This callback function is passed a single string parameter containing the error message.
67
+ */
68
+ Diagnostic_Camera.isCameraAvailable = function(params) {
69
+ params = mapFromLegacyCameraApi.apply(this, arguments);
70
+
71
+ params.successCallback = params.successCallback || function(){};
72
+ return cordova.exec(Diagnostic._ensureBoolean(params.successCallback),
73
+ params.errorCallback,
74
+ 'Diagnostic_Camera',
75
+ 'isCameraAvailable',
76
+ []);
77
+ };
78
+
79
+ /**
80
+ * Checks if camera hardware is present on device.
81
+ *
82
+ * @param {Function} successCallback - The callback which will be called when operation is successful.
83
+ * This callback function is passed a single boolean parameter which is TRUE if camera is present
84
+ * @param {Function} errorCallback - The callback which will be called when operation encounters an error.
85
+ * This callback function is passed a single string parameter containing the error message.
86
+ */
87
+ Diagnostic_Camera.isCameraPresent = function(successCallback, errorCallback) {
88
+ return cordova.exec(Diagnostic._ensureBoolean(successCallback),
89
+ errorCallback,
90
+ 'Diagnostic_Camera',
91
+ 'isCameraPresent',
92
+ []);
93
+ };
94
+
95
+
96
+ /**
97
+ * Checks if the application is authorized to use the camera.
98
+ *
99
+ * @param {Object} params - (optional) parameters:
100
+ * - {Function} successCallback - The callback which will be called when operation is successful.
101
+ * This callback function is passed a single boolean parameter which is TRUE if camera is authorized for use.
102
+ * - {Function} errorCallback - The callback which will be called when operation encounters an error.
103
+ * This callback function is passed a single string parameter containing the error message.
104
+ */
105
+ Diagnostic_Camera.isCameraAuthorized = function(params) {
106
+ params = mapFromLegacyCameraApi.apply(this, arguments);
107
+
108
+ return cordova.exec(Diagnostic._ensureBoolean(params.successCallback),
109
+ params.errorCallback,
110
+ 'Diagnostic_Camera',
111
+ 'isCameraAuthorized',
112
+ []);
113
+ };
114
+
115
+ /**
116
+ * Returns the camera authorization status for the application.
117
+ *
118
+ * @param {Object} params - (optional) parameters:
119
+ * - {Function} successCallback - The callback which will be called when operation is successful.
120
+ * This callback function is passed a single string parameter which indicates the authorization status as a constant in `cordova.plugins.diagnostic.permissionStatus`.
121
+ * - {Function} errorCallback - The callback which will be called when operation encounters an error.
122
+ * This callback function is passed a single string parameter containing the error message.
123
+ */
124
+ Diagnostic_Camera.getCameraAuthorizationStatus = function(params) {
125
+ params = mapFromLegacyCameraApi.apply(this, arguments);
126
+
127
+ return cordova.exec(params.successCallback,
128
+ params.errorCallback,
129
+ 'Diagnostic_Camera',
130
+ 'getCameraAuthorizationStatus',
131
+ []);
132
+ };
133
+
134
+ /**
135
+ * Requests camera authorization for the application.
136
+ * Should only be called if authorization status is NOT_REQUESTED. Calling it when in any other state will have no effect.
137
+ *
138
+ * @param {Object} params - (optional) parameters:
139
+ * - {Function} successCallback - The callback which will be called when operation is successful.
140
+ * This callback function is passed a single string parameter indicating whether access to the camera was granted or denied:
141
+ * `cordova.plugins.diagnostic.permissionStatus.GRANTED` or `cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS`
142
+ * - {Function} errorCallback - The callback which will be called when operation encounters an error.
143
+ * This callback function is passed a single string parameter containing the error message.
144
+ */
145
+ Diagnostic_Camera.requestCameraAuthorization = function(params){
146
+ params = mapFromLegacyCameraApi.apply(this, arguments);
147
+
148
+ params.successCallback = params.successCallback || function(){};
149
+ return cordova.exec(function(isGranted){
150
+ params.successCallback(isGranted ? Diagnostic.permissionStatus.GRANTED : Diagnostic.permissionStatus.DENIED_ALWAYS);
151
+ },
152
+ params.errorCallback,
153
+ 'Diagnostic_Camera',
154
+ 'requestCameraAuthorization',
155
+ []);
156
+ };
157
+
158
+ /**
159
+ * Checks if the application is authorized to use the Camera Roll in Photos app.
160
+ *
161
+ * @param {Function} successCallback - The callback which will be called when operation is successful.
162
+ * This callback function is passed a single boolean parameter which is TRUE if access to Camera Roll is authorized.
163
+ * @param {Function} errorCallback - The callback which will be called when operation encounters an error.
164
+ * This callback function is passed a single string parameter containing the error message.
165
+ */
166
+ Diagnostic_Camera.isCameraRollAuthorized = function(successCallback, errorCallback) {
167
+ return cordova.exec(Diagnostic._ensureBoolean(successCallback),
168
+ errorCallback,
169
+ 'Diagnostic_Camera',
170
+ 'isCameraRollAuthorized',
171
+ []);
172
+ };
173
+
174
+ /**
175
+ * Returns the authorization status for the application to use the Camera Roll in Photos app.
176
+ *
177
+ * @param {Function} successCallback - The callback which will be called when operation is successful.
178
+ * This callback function is passed a single string parameter which indicates the authorization status as a constant in `cordova.plugins.diagnostic.permissionStatus`.
179
+ * @param {Function} errorCallback - The callback which will be called when operation encounters an error.
180
+ * This callback function is passed a single string parameter containing the error message.
181
+ */
182
+ Diagnostic_Camera.getCameraRollAuthorizationStatus = function(successCallback, errorCallback) {
183
+ return cordova.exec(successCallback,
184
+ errorCallback,
185
+ 'Diagnostic_Camera',
186
+ 'getCameraRollAuthorizationStatus',
187
+ []);
188
+ };
189
+
190
+ /**
191
+ * Requests camera roll authorization for the application.
192
+ * Should only be called if authorization status is NOT_REQUESTED. Calling it when in any other state will have no effect.
193
+ *
194
+ * @param {Function} successCallback - The callback which will be called when operation is successful.
195
+ * This callback function is passed a single string parameter indicating the new authorization status:
196
+ * `cordova.plugins.diagnostic.permissionStatus.GRANTED` or `cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS`
197
+ * @param {Function} errorCallback - The callback which will be called when operation encounters an error.
198
+ * This callback function is passed a single string parameter containing the error message.
199
+ */
200
+ Diagnostic_Camera.requestCameraRollAuthorization = function(successCallback, errorCallback) {
201
+ return cordova.exec(function(status){
202
+ successCallback(status === "authorized" ? Diagnostic.permissionStatus.GRANTED : Diagnostic.permissionStatus.DENIED_ALWAYS);
203
+ },
204
+ errorCallback,
205
+ 'Diagnostic_Camera',
206
+ 'requestCameraRollAuthorization',
207
+ []);
208
+ };
209
+
210
+ return Diagnostic_Camera;
211
+ });
212
+ module.exports = new Diagnostic_Camera();
@@ -0,0 +1,98 @@
1
+ /* globals cordova, require, exports, module */
2
+
3
+ /**
4
+ * Diagnostic Contacts plugin for iOS
5
+ *
6
+ * Copyright (c) 2015 Working Edge Ltd.
7
+ * Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
8
+ **/
9
+ var Diagnostic_Contacts = (function(){
10
+ /***********************
11
+ *
12
+ * Internal properties
13
+ *
14
+ *********************/
15
+ var Diagnostic_Contacts = {};
16
+
17
+ var Diagnostic = require("cordova.plugins.diagnostic.Diagnostic");
18
+
19
+ /********************
20
+ *
21
+ * Public properties
22
+ *
23
+ ********************/
24
+
25
+ /********************
26
+ *
27
+ * Internal functions
28
+ *
29
+ ********************/
30
+
31
+ /*****************************
32
+ *
33
+ * Protected member functions
34
+ *
35
+ ****************************/
36
+
37
+
38
+ /**********************
39
+ *
40
+ * Public API functions
41
+ *
42
+ **********************/
43
+
44
+ /**
45
+ * Checks if the application is authorized to use contacts (address book).
46
+ *
47
+ * @param {Function} successCallback - The callback which will be called when operation is successful.
48
+ * This callback function is passed a single boolean parameter which is TRUE if contacts is authorized for use.
49
+ * @param {Function} errorCallback - The callback which will be called when operation encounters an error.
50
+ * This callback function is passed a single string parameter containing the error message.
51
+ */
52
+ Diagnostic_Contacts.isContactsAuthorized = function(successCallback, errorCallback) {
53
+ return cordova.exec(Diagnostic._ensureBoolean(successCallback),
54
+ errorCallback,
55
+ 'Diagnostic_Contacts',
56
+ 'isAddressBookAuthorized',
57
+ []);
58
+ };
59
+
60
+ /**
61
+ * Returns the contacts (address book) authorization status for the application.
62
+ *
63
+ * @param {Function} successCallback - The callback which will be called when operation is successful.
64
+ * This callback function is passed a single string parameter which indicates the authorization status as a constant in `cordova.plugins.diagnostic.permissionStatus`.
65
+ * @param {Function} errorCallback - The callback which will be called when operation encounters an error.
66
+ * This callback function is passed a single string parameter containing the error message.
67
+ */
68
+ Diagnostic_Contacts.getContactsAuthorizationStatus = function(successCallback, errorCallback) {
69
+ return cordova.exec(successCallback,
70
+ errorCallback,
71
+ 'Diagnostic_Contacts',
72
+ 'getAddressBookAuthorizationStatus',
73
+ []);
74
+ };
75
+
76
+ /**
77
+ * Requests contacts (address book) authorization for the application.
78
+ * Should only be called if authorization status is NOT_REQUESTED. Calling it when in any other state will have no effect.
79
+ *
80
+ * @param {Function} successCallback - The callback which will be called when operation is successful.
81
+ * This callback function is passed a single string parameter indicating whether access to contacts was granted or denied:
82
+ * `cordova.plugins.diagnostic.permissionStatus.GRANTED` or `cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS`
83
+ * @param {Function} errorCallback - The callback which will be called when operation encounters an error.
84
+ * This callback function is passed a single string parameter containing the error message.
85
+ */
86
+ Diagnostic_Contacts.requestContactsAuthorization = function(successCallback, errorCallback) {
87
+ return cordova.exec(function(isGranted){
88
+ successCallback(isGranted ? Diagnostic.permissionStatus.GRANTED : Diagnostic.permissionStatus.DENIED_ALWAYS);
89
+ },
90
+ errorCallback,
91
+ 'Diagnostic_Contacts',
92
+ 'requestAddressBookAuthorization',
93
+ []);
94
+ };
95
+
96
+ return Diagnostic_Contacts;
97
+ });
98
+ module.exports = new Diagnostic_Contacts();