mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
Update with new methods for cordova.plugins.diagnostic@3.4
This commit is contained in:
@@ -529,4 +529,56 @@ cordova.plugins.diagnostic.requestAndCheckMotionAuthorization(function(status){
|
||||
console.log("Motion authorization is " +status);
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isExternalStorageAuthorized(function(authorized){
|
||||
console.log("Location authorization is " + (authorized ? "authorized" : "unauthorized"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getExternalStorageAuthorizationStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("External storage authorization allowed");
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestExternalStorageAuthorization(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("External storage authorization allowed");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getExternalSdCardDetails(function(details){
|
||||
console.log("External SD card details: " + JSON.stringify(details));
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isNFCPresent(function(present){
|
||||
console.log("NFC hardware is " + (present ? "present" : "absent"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isNFCEnabled(function(enabled){
|
||||
console.log("NFC is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isNFCAvailable(function(available){
|
||||
console.log("NFC is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.registerNFCStateChangeHandler(function(state){
|
||||
if(state === cordova.plugins.diagnostic.NFCState.POWERED_ON){
|
||||
console.log("NFC is ready to use");
|
||||
}
|
||||
});
|
||||
+90
-3
@@ -1,4 +1,4 @@
|
||||
// Type definitions for cordova.plugins.diagnostic v3.3.0
|
||||
// Type definitions for cordova.plugins.diagnostic v3.4.x
|
||||
// Project: https://github.com/dpa99c/cordova-diagnostic-plugin
|
||||
// Definitions by: Dave Alden <https://github.com/dpa99c/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -164,8 +164,8 @@ interface Diagnostic {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
@@ -567,6 +567,93 @@ interface Diagnostic {
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the application is authorized to use external storage.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isExternalStorageAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Returns the authorisation status for runtime permission to use the external storage.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getExternalStorageAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Requests authorisation for runtime permission to use the external storage.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestExternalStorageAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Returns details of external SD card(s): absolute path, is writable, free space
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getExternalSdCardDetails?: (
|
||||
successCallback: (status: any) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if NFC hardware is present on device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isNFCPresent?: (
|
||||
successCallback: (present: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device setting for NFC is switched on.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isNFCEnabled?: (
|
||||
successCallback: (present: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if NFC is available to the app.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isNFCAvailable?: (
|
||||
successCallback: (present: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Registers a function to be called when a change in NFC state occurs.
|
||||
* Pass in a falsey value to de-register the currently registered function.
|
||||
* @param successCallback
|
||||
*/
|
||||
registerNFCStateChangeHandler?: (
|
||||
successCallback: (state: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Checks if the application is authorized to use the Camera Roll in Photos app.
|
||||
|
||||
Reference in New Issue
Block a user