Commit 1b38b02e authored by wangqinghua's avatar wangqinghua

update

parent 4610d512
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.smart19.starter" version="4.5.6" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <widget id="io.ionic.smart19.starter.test" version="4.6.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>部机关党建云</name> <name>部机关党建云</name>
<description>组织部党建云平台App.</description> <description>组织部党建云平台App.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author> <author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
......
This diff is collapsed.
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.smart19.starter" version="4.5.6" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <widget id="io.ionic.smart19.starter.test" version="4.6.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>部机关党建云</name> <name>部机关党建云</name>
<description>组织部党建云平台App.</description> <description>组织部党建云平台App.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author> <author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
......
{ {
"prepare_queue": { "prepare_queue": {
"installed": [], "installed": [],
"uninstalled": [] "uninstalled": []
}, },
"config_munge": { "config_munge": {
"files": {} "files": {}
}, },
"installed_plugins": { "installed_plugins": {
"cordova-plugin-app-version": { "cordova-plugin-app-version": {
"PACKAGE_NAME": "io.ionic.starter" "PACKAGE_NAME": "io.ionic.starter"
}, },
"cordova-plugin-badge": { "cordova-plugin-badge": {
"PACKAGE_NAME": "io.ionic.starter" "PACKAGE_NAME": "io.ionic.starter"
}, },
"cordova-plugin-device": { "cordova-plugin-device": {
"PACKAGE_NAME": "io.ionic.starter" "PACKAGE_NAME": "io.ionic.starter"
}, },
"cordova-plugin-file": { "cordova-plugin-file": {
"PACKAGE_NAME": "io.ionic.starter" "PACKAGE_NAME": "io.ionic.starter"
}, },
"cordova-plugin-geolocation": { "cordova-plugin-geolocation": {
"PACKAGE_NAME": "io.ionic.starter" "PACKAGE_NAME": "io.ionic.starter"
}, },
"cordova-plugin-ionic-webview": { "cordova-plugin-ionic-webview": {
"PACKAGE_NAME": "io.ionic.starter" "PACKAGE_NAME": "io.ionic.starter"
}, },
"cordova-plugin-whitelist": { "cordova-plugin-whitelist": {
"PACKAGE_NAME": "io.ionic.starter" "PACKAGE_NAME": "io.ionic.starter"
}, },
"cordova-plugin-file-opener2": { "cordova-plugin-file-opener2": {
"PACKAGE_NAME": "io.ionic.starter" "PACKAGE_NAME": "io.ionic.starter"
}, },
"cordova-plugin-ionic-keyboard": { "cordova-plugin-ionic-keyboard": {
"PACKAGE_NAME": "io.ionic.starter" "PACKAGE_NAME": "io.ionic.starter"
}, },
"cordova.plugins.diagnostic": { "cordova.plugins.diagnostic": {
"PACKAGE_NAME": "io.ionic.smart19.starter.test" "PACKAGE_NAME": "io.ionic.smart19.starter.test"
}, },
"integrator-cordova-plugin-downloader": { "integrator-cordova-plugin-downloader": {
"PACKAGE_NAME": "io.ionic.smart19.starter" "PACKAGE_NAME": "io.ionic.smart19.starter"
}, },
"phonegap-plugin-mobile-accessibility": { "phonegap-plugin-mobile-accessibility": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-camera": { "cordova-plugin-camera": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-file-transfer": { "cordova-plugin-file-transfer": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-splashscreen": { "cordova-plugin-splashscreen": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"com.moust.cordova.videoplayer": { "com.moust.cordova.videoplayer": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-screen-orientation": { "cordova-plugin-screen-orientation": {
"PACKAGE_NAME": "io.ionic.smart19.starter" "PACKAGE_NAME": "io.ionic.smart19.starter"
}, },
"cordova-plugin-appavailability": { "cordova-plugin-appavailability": {
"PACKAGE_NAME": "io.ionic.smart19.starter" "PACKAGE_NAME": "io.ionic.smart19.starter"
}, },
"cordova-sms-plugin": { "cordova-sms-plugin": {
"PACKAGE_NAME": "io.ionic.smart19.starter" "PACKAGE_NAME": "io.ionic.smart19.starter"
}, },
"cordova-plugin-statusbar": { "cordova-plugin-statusbar": {
"PACKAGE_NAME": "io.ionic.smart19.starter.test" "PACKAGE_NAME": "io.ionic.smart19.starter.test"
}, },
"phonegap-plugin-barcodescanner": { "phonegap-plugin-barcodescanner": {
"ANDROID_SUPPORT_V4_VERSION": "27.+", "ANDROID_SUPPORT_V4_VERSION": "27.+",
"PACKAGE_NAME": "io.ionic.smart19.starter" "PACKAGE_NAME": "io.ionic.smart19.starter"
} }
}, },
"dependent_plugins": { "dependent_plugins": {
"cordova-plugin-network-information": { "cordova-plugin-network-information": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"es6-promise-plugin": { "es6-promise-plugin": {
"PACKAGE_NAME": "io.ionic.smart19.starter" "PACKAGE_NAME": "io.ionic.smart19.starter"
}
} }
} }
\ No newline at end of file }
{ {
"prepare_queue": { "prepare_queue": {
"installed": [], "installed": [],
"uninstalled": [] "uninstalled": []
}, },
"config_munge": { "config_munge": {
"files": {} "files": {}
}, },
"installed_plugins": { "installed_plugins": {
"cordova-plugin-app-version": { "cordova-plugin-app-version": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-badge": { "cordova-plugin-badge": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-camera": { "cordova-plugin-camera": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-device": { "cordova-plugin-device": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-file": { "cordova-plugin-file": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-file-opener2": { "cordova-plugin-file-opener2": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-file-transfer": { "cordova-plugin-file-transfer": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-geolocation": { "cordova-plugin-geolocation": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-ionic-keyboard": { "cordova-plugin-ionic-keyboard": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-ionic-webview": { "cordova-plugin-ionic-webview": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-whitelist": { "cordova-plugin-whitelist": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova.plugins.diagnostic": { "cordova.plugins.diagnostic": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"integrator-cordova-plugin-downloader": { "integrator-cordova-plugin-downloader": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"ionic-plugin-keyboard": { "ionic-plugin-keyboard": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"phonegap-plugin-mobile-accessibility": { "phonegap-plugin-mobile-accessibility": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-splashscreen": { "cordova-plugin-splashscreen": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"com.moust.cordova.videoplayer": { "com.moust.cordova.videoplayer": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}, },
"cordova-plugin-screen-orientation": { "cordova-plugin-screen-orientation": {
"PACKAGE_NAME": "io.ionic.smart19.starter" "PACKAGE_NAME": "io.ionic.smart19.starter"
}, },
"cordova-plugin-appavailability": { "cordova-plugin-appavailability": {
"PACKAGE_NAME": "io.ionic.smart19.starter" "PACKAGE_NAME": "io.ionic.smart19.starter"
}, },
"cordova-sms-plugin": { "cordova-sms-plugin": {
"PACKAGE_NAME": "io.ionic.smart19.starter" "PACKAGE_NAME": "io.ionic.smart19.starter"
}, },
"cordova-plugin-statusbar": { "cordova-plugin-statusbar": {
"PACKAGE_NAME": "io.ionic.smart19.starter.test" "PACKAGE_NAME": "io.ionic.smart19.starter.test"
}, },
"phonegap-plugin-barcodescanner": { "phonegap-plugin-barcodescanner": {
"PACKAGE_NAME": "io.ionic.smart19.starter" "PACKAGE_NAME": "io.ionic.smart19.starter"
} }
}, },
"dependent_plugins": { "dependent_plugins": {
"cordova-plugin-network-information": { "cordova-plugin-network-information": {
"PACKAGE_NAME": "io.ionic.partyCloud.starter.test" "PACKAGE_NAME": "io.ionic.partyCloud.starter.test"
}
} }
} }
\ No newline at end of file }
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
"cordova-plugin-file-transfer": { "cordova-plugin-file-transfer": {
"source": { "source": {
"type": "registry", "type": "registry",
"id": "cordova-plugin-file-transfer" "id": "cordova-plugin-file-transfer@~1.7.1"
}, },
"is_top_level": true, "is_top_level": true,
"variables": {} "variables": {}
......
{ {
"prepare_queue": { "prepare_queue": {
"installed": [], "installed": [],
"uninstalled": [] "uninstalled": []
}, },
"config_munge": { "config_munge": {
"files": {} "files": {}
}, },
"installed_plugins": { "installed_plugins": {
"com.moust.cordova.videoplayer": { "com.moust.cordova.videoplayer": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-app-version": { "cordova-plugin-app-version": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-appavailability": { "cordova-plugin-appavailability": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-badge": { "cordova-plugin-badge": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-camera": { "cordova-plugin-camera": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-device": { "cordova-plugin-device": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-file": { "cordova-plugin-file": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-file-opener2": { "cordova-plugin-file-opener2": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-file-transfer": { "cordova-plugin-file-transfer": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-geolocation": { "cordova-plugin-geolocation": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-ionic-keyboard": { "cordova-plugin-ionic-keyboard": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-ionic-webview": { "cordova-plugin-ionic-webview": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-screen-orientation": { "cordova-plugin-screen-orientation": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-splashscreen": { "cordova-plugin-splashscreen": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-statusbar": { "cordova-plugin-statusbar": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-plugin-whitelist": { "cordova-plugin-whitelist": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova-sms-plugin": { "cordova-sms-plugin": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"cordova.plugins.diagnostic": { "cordova.plugins.diagnostic": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"integrator-cordova-plugin-downloader": { "integrator-cordova-plugin-downloader": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"ionic-plugin-keyboard": { "ionic-plugin-keyboard": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"phonegap-plugin-mobile-accessibility": { "phonegap-plugin-mobile-accessibility": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"phonegap-plugin-barcodescanner": { "phonegap-plugin-barcodescanner": {
"CAMERA_USAGE_DESCRIPTION": " ", "CAMERA_USAGE_DESCRIPTION": " ",
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
} }
}, },
"dependent_plugins": { "dependent_plugins": {
"cordova-plugin-network-information": { "cordova-plugin-network-information": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}, },
"es6-promise-plugin": { "es6-promise-plugin": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}
} }
} }
\ No newline at end of file }
...@@ -64,7 +64,7 @@ export class MyApp { ...@@ -64,7 +64,7 @@ export class MyApp {
}); });
//app字体不跟随手机字体大小变化 //app字体不跟随手机字体大小变化
cordova.plugins.mobileAccess.usePreferredTextZoom(false); this.mobileAccess.usePreferredTextZoom(false);
}); });
...@@ -73,7 +73,7 @@ export class MyApp { ...@@ -73,7 +73,7 @@ export class MyApp {
//用户设备 //用户设备
device() { device() {
if (this.platform.is('android')) { if (this.platform.is('android')) {
cordova.plugins.screenOrientation.lock('portrait-primary'); //锁定竖屏 this.screenOrientation.lock('portrait-primary'); //锁定竖屏
this.checkVersion(); this.checkVersion();
} }
} }
...@@ -82,7 +82,7 @@ export class MyApp { ...@@ -82,7 +82,7 @@ export class MyApp {
async checkVersion() { async checkVersion() {
let appVersion; let appVersion;
await cordova.plugins.getVersionNumber().then((ver: string) => { await this.appVersion.getVersionNumber().then((ver: string) => {
appVersion = ver.trim(); appVersion = ver.trim();
}); });
await this.appUpdateService.compariVersion().subscribe(res => { await this.appUpdateService.compariVersion().subscribe(res => {
......
This diff is collapsed.
This diff is collapsed.
cordova.define("com.moust.cordova.videoplayer.VideoPlayer", function(require, exports, module) {
var exec = require("cordova/exec");
module.exports = {
DEFAULT_OPTIONS: {
volume: 1.0,
scalingMode: 1
},
SCALING_MODE: {
SCALE_TO_FIT: 1,
SCALE_TO_FIT_WITH_CROPPING: 2
},
play: function (path, options, successCallback, errorCallback) {
options = this.merge(this.DEFAULT_OPTIONS, options);
exec(successCallback, errorCallback, "VideoPlayer", "play", [path, options]);
},
close: function (successCallback, errorCallback) {
exec(successCallback, errorCallback, "VideoPlayer", "close", []);
},
merge: function () {
var obj = {};
Array.prototype.slice.call(arguments).forEach(function(source) {
for (var prop in source) {
obj[prop] = source[prop];
}
});
return obj;
}
};
});
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
cordova.define("cordova-hot-code-push-plugin.chcp", function(require, exports, module) {
var exec = require('cordova/exec'),
channel = require('cordova/channel'),
// Reference name for the plugin
PLUGIN_NAME = 'HotCodePush',
// Plugin methods on the native side that can be called from JavaScript
pluginNativeMethod = {
INITIALIZE: 'jsInitPlugin',
FETCH_UPDATE: 'jsFetchUpdate',
INSTALL_UPDATE: 'jsInstallUpdate',
CONFIGURE: 'jsConfigure',
REQUEST_APP_UPDATE: 'jsRequestAppUpdate',
IS_UPDATE_AVAILABLE_FOR_INSTALLATION: 'jsIsUpdateAvailableForInstallation',
GET_INFO: 'jsGetVersionInfo'
};
// Called when Cordova is ready for work.
// Here we will send default callback to the native side through which it will send to us different events.
channel.onCordovaReady.subscribe(function() {
ensureCustomEventExists();
exec(nativeCallback, null, PLUGIN_NAME, pluginNativeMethod.INITIALIZE, []);
});
/**
* Method is called when native side sends us different events.
* Those events can be about update download/installation process.
*
* @param {String} msg - JSON formatted string with call arguments
*/
function nativeCallback(msg) {
// parse call arguments
var resultObj = processMessageFromNative(msg);
if (resultObj.action == null) {
console.log('Action is not provided, skipping');
return;
}
broadcastEventFromNative(resultObj);
}
/**
* Parse arguments that were sent from the native side.
* Arguments are a JSON string of type:
* { action: "action identifier", error: {...error data...}, data: {...some additional data..} }
* Some parameters may not exist, but the resulting object will have them all.
*
* @param {String} msg - arguments as JSON string
* @return {Object} parsed string
*/
function processMessageFromNative(msg) {
var errorContent = null,
dataContent = null,
actionId = null;
try {
var resultObj = JSON.parse(msg);
if (resultObj.hasOwnProperty('error')) {
errorContent = resultObj.error;
}
if (resultObj.hasOwnProperty('data')) {
dataContent = resultObj.data;
}
if (resultObj.hasOwnProperty('action')) {
actionId = resultObj.action;
}
} catch (err) {}
return {
action: actionId,
error: errorContent,
data: dataContent
};
}
function callNativeMethod(methodName, options, callback) {
var innerCallback = function(msg) {
var resultObj = processMessageFromNative(msg);
if (callback !== undefined && callback != null) {
callback(resultObj.error, resultObj.data);
}
};
var sendArgs = [];
if (options !== null && options !== undefined) {
sendArgs.push(options);
}
exec(innerCallback, null, PLUGIN_NAME, methodName, sendArgs);
}
// region Update/Install events
/*
* Polyfill for adding CustomEvent which may not exist on older versions of Android.
* See https://developer.mozilla.org/fr/docs/Web/API/CustomEvent for more details.
*/
function ensureCustomEventExists() {
// Create only if it doesn't exist
if (window.CustomEvent) {
return;
}
var CustomEvent = function(event, params) {
params = params || {
bubbles: false,
cancelable: false,
detail: undefined
};
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
};
CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent;
}
/**
* Broadcast event that was received from the native side.
*
* @param {Object} arguments, received from the native side
*/
function broadcastEventFromNative(nativeMessage) {
var params = {};
if (nativeMessage.error != null) {
params.error = nativeMessage.error;
}
var chcpEvent = new CustomEvent(nativeMessage.action, {
'detail': params
});
document.dispatchEvent(chcpEvent);
}
// endregion
/**
* Public module of the plugin.
* May be used by developers to send commands to the plugin.
*/
var chcp = {
// Plugin error codes
error: {
NOTHING_TO_INSTALL: 1,
NOTHING_TO_UPDATE: 2,
FAILED_TO_DOWNLOAD_APPLICATION_CONFIG: -1,
APPLICATION_BUILD_VERSION_TOO_LOW: -2,
FAILED_TO_DOWNLOAD_CONTENT_MANIFEST: -3,
FAILED_TO_DOWNLOAD_UPDATE_FILES: -4,
FAILED_TO_MOVE_LOADED_FILES_TO_INSTALLATION_FOLDER: -5,
UPDATE_IS_INVALID: -6,
FAILED_TO_COPY_FILES_FROM_PREVIOUS_RELEASE: -7,
FAILED_TO_COPY_NEW_CONTENT_FILES: -8,
LOCAL_VERSION_OF_APPLICATION_CONFIG_NOT_FOUND: -9,
LOCAL_VERSION_OF_MANIFEST_NOT_FOUND: -10,
LOADED_VERSION_OF_APPLICATION_CONFIG_NOT_FOUND: -11,
LOADED_VERSION_OF_MANIFEST_NOT_FOUND: -12,
FAILED_TO_INSTALL_ASSETS_ON_EXTERNAL_STORAGE: -13,
CANT_INSTALL_WHILE_DOWNLOAD_IN_PROGRESS: -14,
CANT_DOWNLOAD_UPDATE_WHILE_INSTALLATION_IN_PROGRESS: -15,
INSTALLATION_ALREADY_IN_PROGRESS: -16,
DOWNLOAD_ALREADY_IN_PROGRESS: -17,
ASSETS_FOLDER_IN_NOT_YET_INSTALLED: -18,
NEW_APPLICATION_CONFIG_IS_INVALID: -19
},
// Plugin events
event: {
BEFORE_ASSETS_INSTALLATION: 'chcp_beforeAssetsInstalledOnExternalStorage',
ASSETS_INSTALLATION_FAILED: 'chcp_assetsInstallationError',
ASSETS_INSTALLED: 'chcp_assetsInstalledOnExternalStorage',
NOTHING_TO_UPDATE: 'chcp_nothingToUpdate',
UPDATE_LOAD_FAILED: 'chcp_updateLoadFailed',
UPDATE_IS_READY_TO_INSTALL: 'chcp_updateIsReadyToInstall',
BEFORE_UPDATE_INSTALLATION: 'chcp_beforeInstall',
UPDATE_INSTALLATION_FAILED: 'chcp_updateInstallFailed',
UPDATE_INSTALLED: 'chcp_updateInstalled',
NOTHING_TO_INSTALL: 'chcp_nothingToInstall'
},
/**
* DEPRECATED! WILL BE REMOVED EVENTUALLY!
*
* If you want to set config-url - use chcp.fetchUpdate(callback, options).
* If you want to set auto-download/auto-install preference - do it in config.xml instead of this method.
*
* Set plugin options.
* Options are send to the native side.
* As soon as they are processed - callback is called.
*
* @param {Object} options - options to set
* @param {Callback(error)} callback - callback to call when options are set
*/
configure: function(options, callback) {
if (options === undefined || options == null) {
return;
}
callNativeMethod(pluginNativeMethod.CONFIGURE, options, callback);
},
/**
* Show dialog with the request to update application through the Store (App Store or Google Play).
* For that purpose you can use any other cordova library, this is just a small helper method.
*
* @param {String} message - message to show in the dialog
* @param {Callback()} onStoreOpenCallback - called when user redirects to the Store
* @param {Callback()} onUserDismissedDialogCallback - called when user declines to go to the Store
*/
requestApplicationUpdate: function(message, onStoreOpenCallback, onUserDismissedDialogCallback) {
if (message == undefined || message.length == 0) {
return;
}
var onSuccessInnerCallback = function(msg) {
if (onStoreOpenCallback) {
onStoreOpenCallback();
}
};
var onFailureInnerCallback = function(msg) {
if (onUserDismissedDialogCallback) {
onUserDismissedDialogCallback();
}
};
exec(onSuccessInnerCallback, onFailureInnerCallback, PLUGIN_NAME, pluginNativeMethod.REQUEST_APP_UPDATE, [message]);
},
/**
* Check if any new content is available on the server and download it.
* Usually this is done automatically by the plugin, but can be triggered at any time from the web page.
*
* @param {Callback(error, data)} callback - called when native side finished update process
* @param {Object} options - additional options, such as "config-url" and additional http headers.
*/
fetchUpdate: function(callback, options) {
callNativeMethod(pluginNativeMethod.FETCH_UPDATE, options, callback);
},
/**
* Install update if there is anything to install.
*
* @param {Callback(error)} callback - called when native side finishes installation process
*/
installUpdate: function(callback) {
callNativeMethod(pluginNativeMethod.INSTALL_UPDATE, null, callback);
},
/**
* Check if update was loaded and ready to be installed.
* If update was loaded and can be installed - "data" property of the callback will contain the name of the current version and the name of the new
* version.
* If not - "error" will contain code chcp.error.NOTHING_TO_INSTALL.
*
* @param {Callback(error, data)} callback - called, when information is retrieved from the native side.
*/
isUpdateAvailableForInstallation: function(callback) {
callNativeMethod(pluginNativeMethod.IS_UPDATE_AVAILABLE_FOR_INSTALLATION, null, callback);
},
/**
* Get information about the current version like current release version, app build version and so on.
* The "data" property of the callback will contain all the information.
*
* @param {Callback(error, data)} callback - called, when information is retrieved from the native side.
*/
getVersionInfo: function(callback) {
callNativeMethod(pluginNativeMethod.GET_INFO, null, callback);
}
};
module.exports = chcp;
});
cordova.define("cordova-plugin-app-version.AppVersionPlugin", function(require, exports, module) {
/*jslint indent: 2 */
/*global window, jQuery, angular, cordova */
"use strict";
// Returns a jQuery or AngularJS deferred object, or pass a success and fail callbacks if you don't want to use jQuery or AngularJS
var getPromisedCordovaExec = function (command, success, fail) {
var toReturn, deferred, injector, $q;
if (success === undefined) {
if (window.jQuery) {
deferred = jQuery.Deferred();
success = deferred.resolve;
fail = deferred.reject;
toReturn = deferred;
} else if (window.angular) {
injector = angular.injector(["ng"]);
$q = injector.get("$q");
deferred = $q.defer();
success = deferred.resolve;
fail = deferred.reject;
toReturn = deferred.promise;
} else if (window.when && window.when.promise) {
deferred = when.defer();
success = deferred.resolve;
fail = deferred.reject;
toReturn = deferred.promise;
} else if (window.Promise) {
toReturn = new Promise(function(c, e) {
success = c;
fail = e;
});
} else if (window.WinJS && window.WinJS.Promise) {
toReturn = new WinJS.Promise(function(c, e) {
success = c;
fail = e;
});
} else {
return console.error('AppVersion either needs a success callback, or jQuery/AngularJS/Promise/WinJS.Promise defined for using promises');
}
}
// 5th param is NOT optional. must be at least empty array
cordova.exec(success, fail, "AppVersion", command, []);
return toReturn;
};
var getAppVersion = function (success, fail) {
return getPromisedCordovaExec('getVersionNumber', success, fail);
};
getAppVersion.getAppName = function (success, fail) {
return getPromisedCordovaExec('getAppName', success, fail);
};
getAppVersion.getPackageName = function (success, fail) {
return getPromisedCordovaExec('getPackageName', success, fail);
};
getAppVersion.getVersionNumber = function (success, fail) {
return getPromisedCordovaExec('getVersionNumber', success, fail);
};
getAppVersion.getVersionCode = function (success, fail) {
return getPromisedCordovaExec('getVersionCode', success, fail);
};
module.exports = getAppVersion;
});
cordova.define("cordova-plugin-appavailability.AppAvailability", function(require, exports, module) {
var appAvailability = {
check: function(urlScheme, successCallback, errorCallback) {
cordova.exec(
successCallback,
errorCallback,
"AppAvailability",
"checkAvailability",
[urlScheme]
);
},
checkBool: function(urlScheme, callback) {
cordova.exec(
function(success) { callback(success); },
function(error) { callback(error); },
"AppAvailability",
"checkAvailability",
[urlScheme]
);
}
};
module.exports = appAvailability;
});
cordova.define("cordova-plugin-badge.Badge", function(require, exports, module) {
/*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apache License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://opensource.org/licenses/Apache-2.0/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*/
var exec = require('cordova/exec'),
channel = require('cordova/channel'),
ua = navigator.userAgent.toLowerCase(),
isIOS = ua.indexOf('ipad') > -1 || ua.indexOf('iphone') > -1,
isMac = ua.indexOf('macintosh') > -1,
isWin = window.Windows !== undefined,
isAndroid = !isWin && ua.indexOf('android') > -1,
isWinPC = isWin && Windows.System.Profile.AnalyticsInfo.versionInfo.deviceFamily.includes('Desktop'),
isDesktop = isMac || isWinPC;
// Default settings
exports._config = { indicator: 'badge', autoClear: false };
/**
* Clears the badge number.
*
* @param [ Function ] callback The callback function to be execute later.
* @param [ Function ] scope Optional scope for the callback function.
*
* @return [ Void ]
*/
exports.clear = function (callback, scope) {
this.exec('clear', null, callback, scope);
};
/**
* Sets the badge number.
*
* @param [ Int ] badge The new badge number.
* @param [ Function ] callback The callback function to be execute later.
* @param [ Function ] scope Optional scope for the callback function.
*
* @return [ Void ]
*/
exports.set = function (badge, callback, scope) {
var args = [parseInt(badge) || 0];
this.requestPermission(function (granted) {
if (granted) {
this.exec('set', args, callback, scope);
}
}, this);
};
/**
* Gets the badge of the app icon.
*
* @param [ Function ] callback The callback function to be execute later.
* @param [ Function ] scope Optional scope for the callback function.
*
* @return [ Void ]
*/
exports.get = function (callback, scope) {
this.exec('get', null, callback, scope);
};
/**
* Increases the badge number.
*
* @param [ Int ] count Number to add to the badge number.
* @param [ Function ] callback The callback function to be execute later.
* @param [ Function ] scope Optional scope for the callback function.
*
* @return [ Void ]
*/
exports.increase = function (count, callback, scope) {
this.get(function (badge) {
this.set(badge + (count || 1), callback, scope);
}, this);
};
/**
* Decreases the badge number.
*
* @param [ Int ] count Number to substract to the badge number.
* @param [ Function ] callback The callback function to be execute later.
* @param [ Function ] scope Optional scope for the callback function.
*
* @return [ Void ]
*/
exports.decrease = function (count, callback, scope) {
this.get(function (badge) {
this.set(Math.max(0, badge - (count || 1)), callback, scope);
}, this);
};
/**
* Check support to show badges.
*
* @param [ Function ] callback The callback function to be execute later.
* @param [ Function ] scope Optional scope for the callback function.
*
* @return [ Void ]
*/
exports.isSupported = function (callback, scope) {
if (isAndroid) {
this.exec('check', null, callback, scope);
} else {
this.createCallbackFn(callback, scope)(true);
}
};
/**
* Check permission to show badges.
*
* @param [ Function ] callback The callback function to be execute later.
* @param [ Function ] scope Optional scope for the callback function.
*
* @return [ Void ]
*/
exports.hasPermission = function (callback, scope) {
if (isIOS) {
this.exec('check', null, callback, scope);
} else {
this.createCallbackFn(callback, scope)(true);
}
};
/**
* Request permission to show badges.
*
* @param [ Function ] callback The callback function to be execute later.
* @param [ Function ] scope Optional scope for the callback function.
*
* @return [ Void ]
*/
exports.requestPermission = function (callback, scope) {
if (isIOS) {
this.exec('request', null, callback, scope);
} else {
this.createCallbackFn(callback, scope)(true);
}
};
/**
* Configures the plugin's platform options.
*
* @param [ Hash ] object Optional config settings.
*
* @return [ Hash ] The merged config settings.
*/
exports.configure = function (config) {
this.mergeConfig(config);
this.exec('save', this._config);
return this._config;
};
/**
* Merge the config values with the current ones.
*
* @param [ Hash ] object Optional config settings.
*
* @return [ Hash ] The merged config settings.
*/
exports.mergeConfig = function (config) {
return Object.assign(this._config, config);
};
/**
* Create callback, which will be executed within a specific scope.
*
* @param [ Function ] callback The callback function to be execute later.
* @param [ Function ] scope Optional scope for the callback function.
*
* @return [ Function ] The new callback function
*/
exports.createCallbackFn = function (callbackFn, scope) {
if (typeof callbackFn != 'function')
return;
return function () {
callbackFn.apply(scope || this, arguments);
};
};
/**
* Clear the badge if autoClear is on and the indicator type is badge.
*
* @return [ Void ]
*/
exports.clearIf = function () {
if (this._config.autoClear && this._config.indicator == 'badge') {
this.clear();
}
};
/**
* Execute the native counterpart.
*
* @param [ String ] action The name of the action to execute.
* @param [ Array ] args Array of arguments to pass with.
* @param [ Function ] callback The callback function to be execute later.
* @param [ Function ] scope Optional scope for the callback function.
*
* @return [ Void ]
*/
exports.exec = function (action, args, callback, scope) {
var fn = this.createCallbackFn(callback, scope),
params = [];
if (Array.isArray(args)) {
params = args;
} else if (args) {
params.push(args);
}
exec(fn, null, 'Badge', action, params);
};
// Clear badge on app start if autoClear is set to true
channel.onCordovaReady.subscribe(function () {
exports.exec('load', null, function (config) {
this.mergeConfig(config);
this.clearIf();
}, exports);
});
// Clear badge on app resume if autoClear is set to true
channel.onResume.subscribe(function () {
exports.clearIf();
});
// Clear badge on app resume if autoClear is set to true
channel.onActivated.subscribe(function () {
exports.clearIf();
});
if (isDesktop) {
// Clear badge on app resume if autoClear is set to true
document.addEventListener('visibilitychange', function () {
if (!document.hidden) { exports.clearIf(); }
}, false);
// Clear badge on app resume if autoClear is set to true
window.addEventListener('focus', function () {
exports.clearIf();
}, false);
}
// Polyfill for Object.assign
if (typeof Object.assign != 'function') {
Object.assign = function(target) {
'use strict';
if (target == null) {
throw new TypeError('Cannot convert undefined or null to object');
}
target = Object(target);
for (var index = 1; index < arguments.length; index++) {
var source = arguments[index];
if (source != null) {
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
return target;
};
}
});
cordova.define("cordova-plugin-camera.camera", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var argscheck = require('cordova/argscheck');
var exec = require('cordova/exec');
var Camera = require('./Camera');
// XXX: commented out
// CameraPopoverHandle = require('./CameraPopoverHandle');
/**
* @namespace navigator
*/
/**
* @exports camera
*/
var cameraExport = {};
// Tack on the Camera Constants to the base camera plugin.
for (var key in Camera) {
cameraExport[key] = Camera[key];
}
/**
* Callback function that provides an error message.
* @callback module:camera.onError
* @param {string} message - The message is provided by the device's native code.
*/
/**
* Callback function that provides the image data.
* @callback module:camera.onSuccess
* @param {string} imageData - Base64 encoding of the image data, _or_ the image file URI, depending on [`cameraOptions`]{@link module:camera.CameraOptions} in effect.
* @example
* // Show image
* //
* function cameraCallback(imageData) {
* var image = document.getElementById('myImage');
* image.src = "data:image/jpeg;base64," + imageData;
* }
*/
/**
* Optional parameters to customize the camera settings.
* * [Quirks](#CameraOptions-quirks)
* @typedef module:camera.CameraOptions
* @type {Object}
* @property {number} [quality=50] - Quality of the saved image, expressed as a range of 0-100, where 100 is typically full resolution with no loss from file compression. (Note that information about the camera's resolution is unavailable.)
* @property {module:Camera.DestinationType} [destinationType=FILE_URI] - Choose the format of the return value.
* @property {module:Camera.PictureSourceType} [sourceType=CAMERA] - Set the source of the picture.
* @property {Boolean} [allowEdit=false] - Allow simple editing of image before selection.
* @property {module:Camera.EncodingType} [encodingType=JPEG] - Choose the returned image file's encoding.
* @property {number} [targetWidth] - Width in pixels to scale image. Must be used with `targetHeight`. Aspect ratio remains constant.
* @property {number} [targetHeight] - Height in pixels to scale image. Must be used with `targetWidth`. Aspect ratio remains constant.
* @property {module:Camera.MediaType} [mediaType=PICTURE] - Set the type of media to select from. Only works when `PictureSourceType` is `PHOTOLIBRARY` or `SAVEDPHOTOALBUM`.
* @property {Boolean} [correctOrientation] - Rotate the image to correct for the orientation of the device during capture.
* @property {Boolean} [saveToPhotoAlbum] - Save the image to the photo album on the device after capture.
* @property {module:CameraPopoverOptions} [popoverOptions] - iOS-only options that specify popover location in iPad.
* @property {module:Camera.Direction} [cameraDirection=BACK] - Choose the camera to use (front- or back-facing).
*/
/**
* @description Takes a photo using the camera, or retrieves a photo from the device's
* image gallery. The image is passed to the success callback as a
* Base64-encoded `String`, or as the URI for the image file.
*
* The `camera.getPicture` function opens the device's default camera
* application that allows users to snap pictures by default - this behavior occurs,
* when `Camera.sourceType` equals [`Camera.PictureSourceType.CAMERA`]{@link module:Camera.PictureSourceType}.
* Once the user snaps the photo, the camera application closes and the application is restored.
*
* If `Camera.sourceType` is `Camera.PictureSourceType.PHOTOLIBRARY` or
* `Camera.PictureSourceType.SAVEDPHOTOALBUM`, then a dialog displays
* that allows users to select an existing image.
*
* The return value is sent to the [`cameraSuccess`]{@link module:camera.onSuccess} callback function, in
* one of the following formats, depending on the specified
* `cameraOptions`:
*
* - A `String` containing the Base64-encoded photo image.
* - A `String` representing the image file location on local storage (default).
*
* You can do whatever you want with the encoded image or URI, for
* example:
*
* - Render the image in an `<img>` tag, as in the example below
* - Save the data locally (`LocalStorage`, [Lawnchair](http://brianleroux.github.com/lawnchair/), etc.)
* - Post the data to a remote server
*
* __NOTE__: Photo resolution on newer devices is quite good. Photos
* selected from the device's gallery are not downscaled to a lower
* quality, even if a `quality` parameter is specified. To avoid common
* memory problems, set `Camera.destinationType` to `FILE_URI` rather
* than `DATA_URL`.
*
* __Supported Platforms__
*
* - Android
* - BlackBerry
* - Browser
* - Firefox
* - FireOS
* - iOS
* - Windows
* - WP8
* - Ubuntu
*
* More examples [here](#camera-getPicture-examples). Quirks [here](#camera-getPicture-quirks).
*
* @example
* navigator.camera.getPicture(cameraSuccess, cameraError, cameraOptions);
* @param {module:camera.onSuccess} successCallback
* @param {module:camera.onError} errorCallback
* @param {module:camera.CameraOptions} options CameraOptions
*/
cameraExport.getPicture = function (successCallback, errorCallback, options) {
argscheck.checkArgs('fFO', 'Camera.getPicture', arguments);
options = options || {};
var getValue = argscheck.getValue;
var quality = getValue(options.quality, 50);
var destinationType = getValue(options.destinationType, Camera.DestinationType.FILE_URI);
var sourceType = getValue(options.sourceType, Camera.PictureSourceType.CAMERA);
var targetWidth = getValue(options.targetWidth, -1);
var targetHeight = getValue(options.targetHeight, -1);
var encodingType = getValue(options.encodingType, Camera.EncodingType.JPEG);
var mediaType = getValue(options.mediaType, Camera.MediaType.PICTURE);
var allowEdit = !!options.allowEdit;
var correctOrientation = !!options.correctOrientation;
var saveToPhotoAlbum = !!options.saveToPhotoAlbum;
var popoverOptions = getValue(options.popoverOptions, null);
var cameraDirection = getValue(options.cameraDirection, Camera.Direction.BACK);
var args = [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType,
mediaType, allowEdit, correctOrientation, saveToPhotoAlbum, popoverOptions, cameraDirection];
exec(successCallback, errorCallback, 'Camera', 'takePicture', args);
// XXX: commented out
// return new CameraPopoverHandle();
};
/**
* Removes intermediate image files that are kept in temporary storage
* after calling [`camera.getPicture`]{@link module:camera.getPicture}. Applies only when the value of
* `Camera.sourceType` equals `Camera.PictureSourceType.CAMERA` and the
* `Camera.destinationType` equals `Camera.DestinationType.FILE_URI`.
*
* __Supported Platforms__
*
* - iOS
*
* @example
* navigator.camera.cleanup(onSuccess, onFail);
*
* function onSuccess() {
* console.log("Camera cleanup success.")
* }
*
* function onFail(message) {
* alert('Failed because: ' + message);
* }
*/
cameraExport.cleanup = function (successCallback, errorCallback) {
exec(successCallback, errorCallback, 'Camera', 'cleanup', []);
};
module.exports = cameraExport;
});
cordova.define("cordova-plugin-camera.Camera", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* @module Camera
*/
module.exports = {
/**
* @description
* Defines the output format of `Camera.getPicture` call.
* _Note:_ On iOS passing `DestinationType.NATIVE_URI` along with
* `PictureSourceType.PHOTOLIBRARY` or `PictureSourceType.SAVEDPHOTOALBUM` will
* disable any image modifications (resize, quality change, cropping, etc.) due
* to implementation specific.
*
* @enum {number}
*/
DestinationType: {
/** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */
DATA_URL: 0,
/** Return file uri (content://media/external/images/media/2 for Android) */
FILE_URI: 1,
/** Return native uri (eg. asset-library://... for iOS) */
NATIVE_URI: 2
},
/**
* @enum {number}
*/
EncodingType: {
/** Return JPEG encoded image */
JPEG: 0,
/** Return PNG encoded image */
PNG: 1
},
/**
* @enum {number}
*/
MediaType: {
/** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */
PICTURE: 0,
/** Allow selection of video only, ONLY RETURNS URL */
VIDEO: 1,
/** Allow selection from all media types */
ALLMEDIA: 2
},
/**
* @description
* Defines the output format of `Camera.getPicture` call.
* _Note:_ On iOS passing `PictureSourceType.PHOTOLIBRARY` or `PictureSourceType.SAVEDPHOTOALBUM`
* along with `DestinationType.NATIVE_URI` will disable any image modifications (resize, quality
* change, cropping, etc.) due to implementation specific.
*
* @enum {number}
*/
PictureSourceType: {
/** Choose image from the device's photo library (same as SAVEDPHOTOALBUM for Android) */
PHOTOLIBRARY: 0,
/** Take picture from camera */
CAMERA: 1,
/** Choose image only from the device's Camera Roll album (same as PHOTOLIBRARY for Android) */
SAVEDPHOTOALBUM: 2
},
/**
* Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover.
* @enum {number}
*/
PopoverArrowDirection: {
ARROW_UP: 1,
ARROW_DOWN: 2,
ARROW_LEFT: 4,
ARROW_RIGHT: 8,
ARROW_ANY: 15
},
/**
* @enum {number}
*/
Direction: {
/** Use the back-facing camera */
BACK: 0,
/** Use the front-facing camera */
FRONT: 1
}
};
});
cordova.define("cordova-plugin-camera.CameraPopoverHandle", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* @ignore in favour of iOS' one
* A handle to an image picker popover.
*/
var CameraPopoverHandle = function () {
this.setPosition = function (popoverOptions) {
console.log('CameraPopoverHandle.setPosition is only supported on iOS.');
};
};
module.exports = CameraPopoverHandle;
});
cordova.define("cordova-plugin-camera.CameraPopoverOptions", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var Camera = require('./Camera');
/**
* @namespace navigator
*/
/**
* iOS-only parameters that specify the anchor element location and arrow
* direction of the popover when selecting images from an iPad's library
* or album.
* Note that the size of the popover may change to adjust to the
* direction of the arrow and orientation of the screen. Make sure to
* account for orientation changes when specifying the anchor element
* location.
* @module CameraPopoverOptions
* @param {Number} [x=0] - x pixel coordinate of screen element onto which to anchor the popover.
* @param {Number} [y=32] - y pixel coordinate of screen element onto which to anchor the popover.
* @param {Number} [width=320] - width, in pixels, of the screen element onto which to anchor the popover.
* @param {Number} [height=480] - height, in pixels, of the screen element onto which to anchor the popover.
* @param {module:Camera.PopoverArrowDirection} [arrowDir=ARROW_ANY] - Direction the arrow on the popover should point.
*/
var CameraPopoverOptions = function (x, y, width, height, arrowDir) {
// information of rectangle that popover should be anchored to
this.x = x || 0;
this.y = y || 32;
this.width = width || 320;
this.height = height || 480;
this.arrowDir = arrowDir || Camera.PopoverArrowDirection.ARROW_ANY;
};
module.exports = CameraPopoverOptions;
});
cordova.define("cordova-plugin-device.device", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var argscheck = require('cordova/argscheck');
var channel = require('cordova/channel');
var utils = require('cordova/utils');
var exec = require('cordova/exec');
var cordova = require('cordova');
channel.createSticky('onCordovaInfoReady');
// Tell cordova channel to wait on the CordovaInfoReady event
channel.waitForInitialization('onCordovaInfoReady');
/**
* This represents the mobile device, and provides properties for inspecting the model, version, UUID of the
* phone, etc.
* @constructor
*/
function Device () {
this.available = false;
this.platform = null;
this.version = null;
this.uuid = null;
this.cordova = null;
this.model = null;
this.manufacturer = null;
this.isVirtual = null;
this.serial = null;
var me = this;
channel.onCordovaReady.subscribe(function () {
me.getInfo(function (info) {
// ignoring info.cordova returning from native, we should use value from cordova.version defined in cordova.js
// TODO: CB-5105 native implementations should not return info.cordova
var buildLabel = cordova.version;
me.available = true;
me.platform = info.platform;
me.version = info.version;
me.uuid = info.uuid;
me.cordova = buildLabel;
me.model = info.model;
me.isVirtual = info.isVirtual;
me.manufacturer = info.manufacturer || 'unknown';
me.serial = info.serial || 'unknown';
channel.onCordovaInfoReady.fire();
}, function (e) {
me.available = false;
utils.alert('[ERROR] Error initializing Cordova: ' + e);
});
});
}
/**
* Get device info
*
* @param {Function} successCallback The function to call when the heading data is available
* @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL)
*/
Device.prototype.getInfo = function (successCallback, errorCallback) {
argscheck.checkArgs('fF', 'Device.getInfo', arguments);
exec(successCallback, errorCallback, 'Device', 'getDeviceInfo', []);
};
module.exports = new Device();
});
cordova.define("cordova-plugin-file-opener2.FileOpener2", function(require, exports, module) {
/*jslint browser: true, devel: true, node: true, sloppy: true, plusplus: true*/
/*global require, cordova */
/*
The MIT License (MIT)
Copyright (c) 2013 pwlin - pwlin05@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
var exec = require('cordova/exec');
function FileOpener2() {}
FileOpener2.prototype.open = function (fileName, contentType, callbackContext) {
callbackContext = callbackContext || {};
exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'open', [fileName, contentType]);
};
FileOpener2.prototype.showOpenWithDialog = function (fileName, contentType, callbackContext) {
callbackContext = callbackContext || {};
exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'open', [fileName, contentType, false]);
};
FileOpener2.prototype.uninstall = function (packageId, callbackContext) {
callbackContext = callbackContext || {};
exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'uninstall', [packageId]);
};
FileOpener2.prototype.appIsInstalled = function (packageId, callbackContext) {
callbackContext = callbackContext || {};
exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'appIsInstalled', [packageId]);
};
module.exports = new FileOpener2();
});
cordova.define("cordova-plugin-file-transfer.FileTransfer", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/* global cordova, FileSystem */
var argscheck = require('cordova/argscheck'),
exec = require('cordova/exec'),
FileTransferError = require('./FileTransferError'),
ProgressEvent = require('cordova-plugin-file.ProgressEvent');
function newProgressEvent(result) {
var pe = new ProgressEvent();
pe.lengthComputable = result.lengthComputable;
pe.loaded = result.loaded;
pe.total = result.total;
return pe;
}
function getUrlCredentials(urlString) {
var credentialsPattern = /^https?\:\/\/(?:(?:(([^:@\/]*)(?::([^@\/]*))?)?@)?([^:\/?#]*)(?::(\d*))?).*$/,
credentials = credentialsPattern.exec(urlString);
return credentials && credentials[1];
}
function getBasicAuthHeader(urlString) {
var header = null;
// This is changed due to MS Windows doesn't support credentials in http uris
// so we detect them by regexp and strip off from result url
// Proof: http://social.msdn.microsoft.com/Forums/windowsapps/en-US/a327cf3c-f033-4a54-8b7f-03c56ba3203f/windows-foundation-uri-security-problem
if (window.btoa) {
var credentials = getUrlCredentials(urlString);
if (credentials) {
var authHeader = "Authorization";
var authHeaderValue = "Basic " + window.btoa(credentials);
header = {
name : authHeader,
value : authHeaderValue
};
}
}
return header;
}
function convertHeadersToArray(headers) {
var result = [];
for (var header in headers) {
if (headers.hasOwnProperty(header)) {
var headerValue = headers[header];
result.push({
name: header,
value: headerValue.toString()
});
}
}
return result;
}
var idCounter = 0;
/**
* FileTransfer uploads a file to a remote server.
* @constructor
*/
var FileTransfer = function() {
this._id = ++idCounter;
this.onprogress = null; // optional callback
};
/**
* Given an absolute file path, uploads a file on the device to a remote server
* using a multipart HTTP request.
* @param filePath {String} Full path of the file on the device
* @param server {String} URL of the server to receive the file
* @param successCallback (Function} Callback to be invoked when upload has completed
* @param errorCallback {Function} Callback to be invoked upon error
* @param options {FileUploadOptions} Optional parameters such as file name and mimetype
* @param trustAllHosts {Boolean} Optional trust all hosts (e.g. for self-signed certs), defaults to false
*/
FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, trustAllHosts) {
argscheck.checkArgs('ssFFO*', 'FileTransfer.upload', arguments);
// check for options
var fileKey = null;
var fileName = null;
var mimeType = null;
var params = null;
var chunkedMode = true;
var headers = null;
var httpMethod = null;
var basicAuthHeader = getBasicAuthHeader(server);
if (basicAuthHeader) {
server = server.replace(getUrlCredentials(server) + '@', '');
options = options || {};
options.headers = options.headers || {};
options.headers[basicAuthHeader.name] = basicAuthHeader.value;
}
if (options) {
fileKey = options.fileKey;
fileName = options.fileName;
mimeType = options.mimeType;
headers = options.headers;
httpMethod = options.httpMethod || "POST";
if (httpMethod.toUpperCase() == "PUT"){
httpMethod = "PUT";
} else {
httpMethod = "POST";
}
if (options.chunkedMode !== null || typeof options.chunkedMode != "undefined") {
chunkedMode = options.chunkedMode;
}
if (options.params) {
params = options.params;
}
else {
params = {};
}
}
if (cordova.platformId === "windowsphone") {
headers = headers && convertHeadersToArray(headers);
params = params && convertHeadersToArray(params);
}
var fail = errorCallback && function(e) {
var error = new FileTransferError(e.code, e.source, e.target, e.http_status, e.body, e.exception);
errorCallback(error);
};
var self = this;
var win = function(result) {
if (typeof result.lengthComputable != "undefined") {
if (self.onprogress) {
self.onprogress(newProgressEvent(result));
}
} else {
if (successCallback) {
successCallback(result);
}
}
};
exec(win, fail, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, trustAllHosts, chunkedMode, headers, this._id, httpMethod]);
};
/**
* Downloads a file form a given URL and saves it to the specified directory.
* @param source {String} URL of the server to receive the file
* @param target {String} Full path of the file on the device
* @param successCallback (Function} Callback to be invoked when upload has completed
* @param errorCallback {Function} Callback to be invoked upon error
* @param trustAllHosts {Boolean} Optional trust all hosts (e.g. for self-signed certs), defaults to false
* @param options {FileDownloadOptions} Optional parameters such as headers
*/
FileTransfer.prototype.download = function(source, target, successCallback, errorCallback, trustAllHosts, options) {
argscheck.checkArgs('ssFF*', 'FileTransfer.download', arguments);
var self = this;
var basicAuthHeader = getBasicAuthHeader(source);
if (basicAuthHeader) {
source = source.replace(getUrlCredentials(source) + '@', '');
options = options || {};
options.headers = options.headers || {};
options.headers[basicAuthHeader.name] = basicAuthHeader.value;
}
var headers = null;
if (options) {
headers = options.headers || null;
}
if (cordova.platformId === "windowsphone" && headers) {
headers = convertHeadersToArray(headers);
}
var win = function(result) {
if (typeof result.lengthComputable != "undefined") {
if (self.onprogress) {
return self.onprogress(newProgressEvent(result));
}
} else if (successCallback) {
var entry = null;
if (result.isDirectory) {
entry = new (require('cordova-plugin-file.DirectoryEntry'))();
}
else if (result.isFile) {
entry = new (require('cordova-plugin-file.FileEntry'))();
}
entry.isDirectory = result.isDirectory;
entry.isFile = result.isFile;
entry.name = result.name;
entry.fullPath = result.fullPath;
entry.filesystem = new FileSystem(result.filesystemName || (result.filesystem == window.PERSISTENT ? 'persistent' : 'temporary'));
entry.nativeURL = result.nativeURL;
successCallback(entry);
}
};
var fail = errorCallback && function(e) {
var error = new FileTransferError(e.code, e.source, e.target, e.http_status, e.body, e.exception);
errorCallback(error);
};
exec(win, fail, 'FileTransfer', 'download', [source, target, trustAllHosts, this._id, headers]);
};
/**
* Aborts the ongoing file transfer on this object. The original error
* callback for the file transfer will be called if necessary.
*/
FileTransfer.prototype.abort = function() {
exec(null, null, 'FileTransfer', 'abort', [this._id]);
};
module.exports = FileTransfer;
});
cordova.define("cordova-plugin-file-transfer.FileTransferError", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* FileTransferError
* @constructor
*/
var FileTransferError = function(code, source, target, status, body, exception) {
this.code = code || null;
this.source = source || null;
this.target = target || null;
this.http_status = status || null;
this.body = body || null;
this.exception = exception || null;
};
FileTransferError.FILE_NOT_FOUND_ERR = 1;
FileTransferError.INVALID_URL_ERR = 2;
FileTransferError.CONNECTION_ERR = 3;
FileTransferError.ABORT_ERR = 4;
FileTransferError.NOT_MODIFIED_ERR = 5;
module.exports = FileTransferError;
});
cordova.define("cordova-plugin-file.DirectoryEntry", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var argscheck = require('cordova/argscheck');
var utils = require('cordova/utils');
var exec = require('cordova/exec');
var Entry = require('./Entry');
var FileError = require('./FileError');
var DirectoryReader = require('./DirectoryReader');
/**
* An interface representing a directory on the file system.
*
* {boolean} isFile always false (readonly)
* {boolean} isDirectory always true (readonly)
* {DOMString} name of the directory, excluding the path leading to it (readonly)
* {DOMString} fullPath the absolute full path to the directory (readonly)
* {FileSystem} filesystem on which the directory resides (readonly)
*/
var DirectoryEntry = function (name, fullPath, fileSystem, nativeURL) {
// add trailing slash if it is missing
if ((fullPath) && !/\/$/.test(fullPath)) {
fullPath += '/';
}
// add trailing slash if it is missing
if (nativeURL && !/\/$/.test(nativeURL)) {
nativeURL += '/';
}
DirectoryEntry.__super__.constructor.call(this, false, true, name, fullPath, fileSystem, nativeURL);
};
utils.extend(DirectoryEntry, Entry);
/**
* Creates a new DirectoryReader to read entries from this directory
*/
DirectoryEntry.prototype.createReader = function () {
return new DirectoryReader(this.toInternalURL());
};
/**
* Creates or looks up a directory
*
* @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a directory
* @param {Flags} options to create or exclusively create the directory
* @param {Function} successCallback is called with the new entry
* @param {Function} errorCallback is called with a FileError
*/
DirectoryEntry.prototype.getDirectory = function (path, options, successCallback, errorCallback) {
argscheck.checkArgs('sOFF', 'DirectoryEntry.getDirectory', arguments);
var fs = this.filesystem;
var win = successCallback && function (result) {
var entry = new DirectoryEntry(result.name, result.fullPath, fs, result.nativeURL);
successCallback(entry);
};
var fail = errorCallback && function (code) {
errorCallback(new FileError(code));
};
exec(win, fail, 'File', 'getDirectory', [this.toInternalURL(), path, options]);
};
/**
* Deletes a directory and all of it's contents
*
* @param {Function} successCallback is called with no parameters
* @param {Function} errorCallback is called with a FileError
*/
DirectoryEntry.prototype.removeRecursively = function (successCallback, errorCallback) {
argscheck.checkArgs('FF', 'DirectoryEntry.removeRecursively', arguments);
var fail = errorCallback && function (code) {
errorCallback(new FileError(code));
};
exec(successCallback, fail, 'File', 'removeRecursively', [this.toInternalURL()]);
};
/**
* Creates or looks up a file
*
* @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a file
* @param {Flags} options to create or exclusively create the file
* @param {Function} successCallback is called with the new entry
* @param {Function} errorCallback is called with a FileError
*/
DirectoryEntry.prototype.getFile = function (path, options, successCallback, errorCallback) {
argscheck.checkArgs('sOFF', 'DirectoryEntry.getFile', arguments);
var fs = this.filesystem;
var win = successCallback && function (result) {
var FileEntry = require('./FileEntry');
var entry = new FileEntry(result.name, result.fullPath, fs, result.nativeURL);
successCallback(entry);
};
var fail = errorCallback && function (code) {
errorCallback(new FileError(code));
};
exec(win, fail, 'File', 'getFile', [this.toInternalURL(), path, options]);
};
module.exports = DirectoryEntry;
});
cordova.define("cordova-plugin-file.DirectoryReader", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var exec = require('cordova/exec');
var FileError = require('./FileError');
/**
* An interface that lists the files and directories in a directory.
*/
function DirectoryReader (localURL) {
this.localURL = localURL || null;
this.hasReadEntries = false;
}
/**
* Returns a list of entries from a directory.
*
* @param {Function} successCallback is called with a list of entries
* @param {Function} errorCallback is called with a FileError
*/
DirectoryReader.prototype.readEntries = function (successCallback, errorCallback) {
// If we've already read and passed on this directory's entries, return an empty list.
if (this.hasReadEntries) {
successCallback([]);
return;
}
var reader = this;
var win = typeof successCallback !== 'function' ? null : function (result) {
var retVal = [];
for (var i = 0; i < result.length; i++) {
var entry = null;
if (result[i].isDirectory) {
entry = new (require('./DirectoryEntry'))();
} else if (result[i].isFile) {
entry = new (require('./FileEntry'))();
}
entry.isDirectory = result[i].isDirectory;
entry.isFile = result[i].isFile;
entry.name = result[i].name;
entry.fullPath = result[i].fullPath;
entry.filesystem = new (require('./FileSystem'))(result[i].filesystemName);
entry.nativeURL = result[i].nativeURL;
retVal.push(entry);
}
reader.hasReadEntries = true;
successCallback(retVal);
};
var fail = typeof errorCallback !== 'function' ? null : function (code) {
errorCallback(new FileError(code));
};
exec(win, fail, 'File', 'readEntries', [this.localURL]);
};
module.exports = DirectoryReader;
});
cordova.define("cordova-plugin-file.Entry", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var argscheck = require('cordova/argscheck');
var exec = require('cordova/exec');
var FileError = require('./FileError');
var Metadata = require('./Metadata');
/**
* Represents a file or directory on the local file system.
*
* @param isFile
* {boolean} true if Entry is a file (readonly)
* @param isDirectory
* {boolean} true if Entry is a directory (readonly)
* @param name
* {DOMString} name of the file or directory, excluding the path
* leading to it (readonly)
* @param fullPath
* {DOMString} the absolute full path to the file or directory
* (readonly)
* @param fileSystem
* {FileSystem} the filesystem on which this entry resides
* (readonly)
* @param nativeURL
* {DOMString} an alternate URL which can be used by native
* webview controls, for example media players.
* (optional, readonly)
*/
function Entry (isFile, isDirectory, name, fullPath, fileSystem, nativeURL) {
this.isFile = !!isFile;
this.isDirectory = !!isDirectory;
this.name = name || '';
this.fullPath = fullPath || '';
this.filesystem = fileSystem || null;
this.nativeURL = nativeURL || null;
}
/**
* Look up the metadata of the entry.
*
* @param successCallback
* {Function} is called with a Metadata object
* @param errorCallback
* {Function} is called with a FileError
*/
Entry.prototype.getMetadata = function (successCallback, errorCallback) {
argscheck.checkArgs('FF', 'Entry.getMetadata', arguments);
var success = successCallback && function (entryMetadata) {
var metadata = new Metadata({
size: entryMetadata.size,
modificationTime: entryMetadata.lastModifiedDate
});
successCallback(metadata);
};
var fail = errorCallback && function (code) {
errorCallback(new FileError(code));
};
exec(success, fail, 'File', 'getFileMetadata', [this.toInternalURL()]);
};
/**
* Set the metadata of the entry.
*
* @param successCallback
* {Function} is called with a Metadata object
* @param errorCallback
* {Function} is called with a FileError
* @param metadataObject
* {Object} keys and values to set
*/
Entry.prototype.setMetadata = function (successCallback, errorCallback, metadataObject) {
argscheck.checkArgs('FFO', 'Entry.setMetadata', arguments);
exec(successCallback, errorCallback, 'File', 'setMetadata', [this.toInternalURL(), metadataObject]);
};
/**
* Move a file or directory to a new location.
*
* @param parent
* {DirectoryEntry} the directory to which to move this entry
* @param newName
* {DOMString} new name of the entry, defaults to the current name
* @param successCallback
* {Function} called with the new DirectoryEntry object
* @param errorCallback
* {Function} called with a FileError
*/
Entry.prototype.moveTo = function (parent, newName, successCallback, errorCallback) {
argscheck.checkArgs('oSFF', 'Entry.moveTo', arguments);
var fail = errorCallback && function (code) {
errorCallback(new FileError(code));
};
var srcURL = this.toInternalURL();
// entry name
var name = newName || this.name;
var success = function (entry) {
if (entry) {
if (successCallback) {
// create appropriate Entry object
var newFSName = entry.filesystemName || (entry.filesystem && entry.filesystem.name);
var fs = newFSName ? new FileSystem(newFSName, { name: '', fullPath: '/' }) : new FileSystem(parent.filesystem.name, { name: '', fullPath: '/' }); // eslint-disable-line no-undef
var result = (entry.isDirectory) ? new (require('./DirectoryEntry'))(entry.name, entry.fullPath, fs, entry.nativeURL) : new (require('cordova-plugin-file.FileEntry'))(entry.name, entry.fullPath, fs, entry.nativeURL);
successCallback(result);
}
} else {
// no Entry object returned
if (fail) {
fail(FileError.NOT_FOUND_ERR);
}
}
};
// copy
exec(success, fail, 'File', 'moveTo', [srcURL, parent.toInternalURL(), name]);
};
/**
* Copy a directory to a different location.
*
* @param parent
* {DirectoryEntry} the directory to which to copy the entry
* @param newName
* {DOMString} new name of the entry, defaults to the current name
* @param successCallback
* {Function} called with the new Entry object
* @param errorCallback
* {Function} called with a FileError
*/
Entry.prototype.copyTo = function (parent, newName, successCallback, errorCallback) {
argscheck.checkArgs('oSFF', 'Entry.copyTo', arguments);
var fail = errorCallback && function (code) {
errorCallback(new FileError(code));
};
var srcURL = this.toInternalURL();
// entry name
var name = newName || this.name;
// success callback
var success = function (entry) {
if (entry) {
if (successCallback) {
// create appropriate Entry object
var newFSName = entry.filesystemName || (entry.filesystem && entry.filesystem.name);
var fs = newFSName ? new FileSystem(newFSName, { name: '', fullPath: '/' }) : new FileSystem(parent.filesystem.name, { name: '', fullPath: '/' }); // eslint-disable-line no-undef
var result = (entry.isDirectory) ? new (require('./DirectoryEntry'))(entry.name, entry.fullPath, fs, entry.nativeURL) : new (require('cordova-plugin-file.FileEntry'))(entry.name, entry.fullPath, fs, entry.nativeURL);
successCallback(result);
}
} else {
// no Entry object returned
if (fail) {
fail(FileError.NOT_FOUND_ERR);
}
}
};
// copy
exec(success, fail, 'File', 'copyTo', [srcURL, parent.toInternalURL(), name]);
};
/**
* Return a URL that can be passed across the bridge to identify this entry.
*/
Entry.prototype.toInternalURL = function () {
if (this.filesystem && this.filesystem.__format__) {
return this.filesystem.__format__(this.fullPath, this.nativeURL);
}
};
/**
* Return a URL that can be used to identify this entry.
* Use a URL that can be used to as the src attribute of a <video> or
* <audio> tag. If that is not possible, construct a cdvfile:// URL.
*/
Entry.prototype.toURL = function () {
if (this.nativeURL) {
return this.nativeURL;
}
// fullPath attribute may contain the full URL in the case that
// toInternalURL fails.
return this.toInternalURL() || 'file://localhost' + this.fullPath;
};
/**
* Backwards-compatibility: In v1.0.0 - 1.0.2, .toURL would only return a
* cdvfile:// URL, and this method was necessary to obtain URLs usable by the
* webview.
* See CB-6051, CB-6106, CB-6117, CB-6152, CB-6199, CB-6201, CB-6243, CB-6249,
* and CB-6300.
*/
Entry.prototype.toNativeURL = function () {
console.log("DEPRECATED: Update your code to use 'toURL'");
return this.toURL();
};
/**
* Returns a URI that can be used to identify this entry.
*
* @param {DOMString} mimeType for a FileEntry, the mime type to be used to interpret the file, when loaded through this URI.
* @return uri
*/
Entry.prototype.toURI = function (mimeType) {
console.log("DEPRECATED: Update your code to use 'toURL'");
return this.toURL();
};
/**
* Remove a file or directory. It is an error to attempt to delete a
* directory that is not empty. It is an error to attempt to delete a
* root directory of a file system.
*
* @param successCallback {Function} called with no parameters
* @param errorCallback {Function} called with a FileError
*/
Entry.prototype.remove = function (successCallback, errorCallback) {
argscheck.checkArgs('FF', 'Entry.remove', arguments);
var fail = errorCallback && function (code) {
errorCallback(new FileError(code));
};
exec(successCallback, fail, 'File', 'remove', [this.toInternalURL()]);
};
/**
* Look up the parent DirectoryEntry of this entry.
*
* @param successCallback {Function} called with the parent DirectoryEntry object
* @param errorCallback {Function} called with a FileError
*/
Entry.prototype.getParent = function (successCallback, errorCallback) {
argscheck.checkArgs('FF', 'Entry.getParent', arguments);
var fs = this.filesystem;
var win = successCallback && function (result) {
var DirectoryEntry = require('./DirectoryEntry');
var entry = new DirectoryEntry(result.name, result.fullPath, fs, result.nativeURL);
successCallback(entry);
};
var fail = errorCallback && function (code) {
errorCallback(new FileError(code));
};
exec(win, fail, 'File', 'getParent', [this.toInternalURL()]);
};
module.exports = Entry;
});
cordova.define("cordova-plugin-file.File", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* Constructor.
* name {DOMString} name of the file, without path information
* fullPath {DOMString} the full path of the file, including the name
* type {DOMString} mime type
* lastModifiedDate {Date} last modified date
* size {Number} size of the file in bytes
*/
var File = function (name, localURL, type, lastModifiedDate, size) {
this.name = name || '';
this.localURL = localURL || null;
this.type = type || null;
this.lastModified = lastModifiedDate || null;
// For backwards compatibility, store the timestamp in lastModifiedDate as well
this.lastModifiedDate = lastModifiedDate || null;
this.size = size || 0;
// These store the absolute start and end for slicing the file.
this.start = 0;
this.end = this.size;
};
/**
* Returns a "slice" of the file. Since Cordova Files don't contain the actual
* content, this really returns a File with adjusted start and end.
* Slices of slices are supported.
* start {Number} The index at which to start the slice (inclusive).
* end {Number} The index at which to end the slice (exclusive).
*/
File.prototype.slice = function (start, end) {
var size = this.end - this.start;
var newStart = 0;
var newEnd = size;
if (arguments.length) {
if (start < 0) {
newStart = Math.max(size + start, 0);
} else {
newStart = Math.min(size, start);
}
}
if (arguments.length >= 2) {
if (end < 0) {
newEnd = Math.max(size + end, 0);
} else {
newEnd = Math.min(end, size);
}
}
var newFile = new File(this.name, this.localURL, this.type, this.lastModified, this.size);
newFile.start = this.start + newStart;
newFile.end = this.start + newEnd;
return newFile;
};
module.exports = File;
});
cordova.define("cordova-plugin-file.FileEntry", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var utils = require('cordova/utils');
var exec = require('cordova/exec');
var Entry = require('./Entry');
var FileWriter = require('./FileWriter');
var File = require('./File');
var FileError = require('./FileError');
/**
* An interface representing a file on the file system.
*
* {boolean} isFile always true (readonly)
* {boolean} isDirectory always false (readonly)
* {DOMString} name of the file, excluding the path leading to it (readonly)
* {DOMString} fullPath the absolute full path to the file (readonly)
* {FileSystem} filesystem on which the file resides (readonly)
*/
var FileEntry = function (name, fullPath, fileSystem, nativeURL) {
// remove trailing slash if it is present
if (fullPath && /\/$/.test(fullPath)) {
fullPath = fullPath.substring(0, fullPath.length - 1);
}
if (nativeURL && /\/$/.test(nativeURL)) {
nativeURL = nativeURL.substring(0, nativeURL.length - 1);
}
FileEntry.__super__.constructor.apply(this, [true, false, name, fullPath, fileSystem, nativeURL]);
};
utils.extend(FileEntry, Entry);
/**
* Creates a new FileWriter associated with the file that this FileEntry represents.
*
* @param {Function} successCallback is called with the new FileWriter
* @param {Function} errorCallback is called with a FileError
*/
FileEntry.prototype.createWriter = function (successCallback, errorCallback) {
this.file(function (filePointer) {
var writer = new FileWriter(filePointer);
if (writer.localURL === null || writer.localURL === '') {
if (errorCallback) {
errorCallback(new FileError(FileError.INVALID_STATE_ERR));
}
} else {
if (successCallback) {
successCallback(writer);
}
}
}, errorCallback);
};
/**
* Returns a File that represents the current state of the file that this FileEntry represents.
*
* @param {Function} successCallback is called with the new File object
* @param {Function} errorCallback is called with a FileError
*/
FileEntry.prototype.file = function (successCallback, errorCallback) {
var localURL = this.toInternalURL();
var win = successCallback && function (f) {
var file = new File(f.name, localURL, f.type, f.lastModifiedDate, f.size);
successCallback(file);
};
var fail = errorCallback && function (code) {
errorCallback(new FileError(code));
};
exec(win, fail, 'File', 'getFileMetadata', [localURL]);
};
module.exports = FileEntry;
});
cordova.define("cordova-plugin-file.FileError", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* FileError
*/
function FileError (error) {
this.code = error || null;
}
// File error codes
// Found in DOMException
FileError.NOT_FOUND_ERR = 1;
FileError.SECURITY_ERR = 2;
FileError.ABORT_ERR = 3;
// Added by File API specification
FileError.NOT_READABLE_ERR = 4;
FileError.ENCODING_ERR = 5;
FileError.NO_MODIFICATION_ALLOWED_ERR = 6;
FileError.INVALID_STATE_ERR = 7;
FileError.SYNTAX_ERR = 8;
FileError.INVALID_MODIFICATION_ERR = 9;
FileError.QUOTA_EXCEEDED_ERR = 10;
FileError.TYPE_MISMATCH_ERR = 11;
FileError.PATH_EXISTS_ERR = 12;
module.exports = FileError;
});
cordova.define("cordova-plugin-file.FileSystem", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var DirectoryEntry = require('./DirectoryEntry');
/**
* An interface representing a file system
*
* @constructor
* {DOMString} name the unique name of the file system (readonly)
* {DirectoryEntry} root directory of the file system (readonly)
*/
var FileSystem = function (name, root) {
this.name = name;
if (root) {
this.root = new DirectoryEntry(root.name, root.fullPath, this, root.nativeURL);
} else {
this.root = new DirectoryEntry(this.name, '/', this);
}
};
FileSystem.prototype.__format__ = function (fullPath, nativeUrl) {
return fullPath;
};
FileSystem.prototype.toJSON = function () {
return '<FileSystem: ' + this.name + '>';
};
// Use instead of encodeURI() when encoding just the path part of a URI rather than an entire URI.
FileSystem.encodeURIPath = function (path) {
// Because # is a valid filename character, it must be encoded to prevent part of the
// path from being parsed as a URI fragment.
return encodeURI(path).replace(/#/g, '%23');
};
module.exports = FileSystem;
});
cordova.define("cordova-plugin-file.FileUploadOptions", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* Options to customize the HTTP request used to upload files.
* @constructor
* @param fileKey {String} Name of file request parameter.
* @param fileName {String} Filename to be used by the server. Defaults to image.jpg.
* @param mimeType {String} Mimetype of the uploaded file. Defaults to image/jpeg.
* @param params {Object} Object with key: value params to send to the server.
* @param headers {Object} Keys are header names, values are header values. Multiple
* headers of the same name are not supported.
*/
var FileUploadOptions = function (fileKey, fileName, mimeType, params, headers, httpMethod) {
this.fileKey = fileKey || null;
this.fileName = fileName || null;
this.mimeType = mimeType || null;
this.params = params || null;
this.headers = headers || null;
this.httpMethod = httpMethod || null;
};
module.exports = FileUploadOptions;
});
cordova.define("cordova-plugin-file.FileUploadResult", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* FileUploadResult
* @constructor
*/
module.exports = function FileUploadResult (size, code, content) {
this.bytesSent = size;
this.responseCode = code;
this.response = content;
};
});
cordova.define("cordova-plugin-file.Flags", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* Supplies arguments to methods that lookup or create files and directories.
*
* @param create
* {boolean} file or directory if it doesn't exist
* @param exclusive
* {boolean} used with create; if true the command will fail if
* target path exists
*/
function Flags (create, exclusive) {
this.create = create || false;
this.exclusive = exclusive || false;
}
module.exports = Flags;
});
cordova.define("cordova-plugin-file.LocalFileSystem", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
exports.TEMPORARY = 0;
exports.PERSISTENT = 1;
});
cordova.define("cordova-plugin-file.Metadata", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* Information about the state of the file or directory
*
* {Date} modificationTime (readonly)
*/
var Metadata = function (metadata) {
if (typeof metadata === 'object') {
this.modificationTime = new Date(metadata.modificationTime);
this.size = metadata.size || 0;
} else if (typeof metadata === 'undefined') {
this.modificationTime = null;
this.size = 0;
} else {
/* Backwards compatiblity with platforms that only return a timestamp */
this.modificationTime = new Date(metadata);
}
};
module.exports = Metadata;
});
cordova.define("cordova-plugin-file.ProgressEvent", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
// If ProgressEvent exists in global context, use it already, otherwise use our own polyfill
// Feature test: See if we can instantiate a native ProgressEvent;
// if so, use that approach,
// otherwise fill-in with our own implementation.
//
// NOTE: right now we always fill in with our own. Down the road would be nice if we can use whatever is native in the webview.
var ProgressEvent = (function () {
/*
var createEvent = function(data) {
var event = document.createEvent('Events');
event.initEvent('ProgressEvent', false, false);
if (data) {
for (var i in data) {
if (data.hasOwnProperty(i)) {
event[i] = data[i];
}
}
if (data.target) {
// TODO: cannot call <some_custom_object>.dispatchEvent
// need to first figure out how to implement EventTarget
}
}
return event;
};
try {
var ev = createEvent({type:"abort",target:document});
return function ProgressEvent(type, data) {
data.type = type;
return createEvent(data);
};
} catch(e){
*/
return function ProgressEvent (type, dict) {
this.type = type;
this.bubbles = false;
this.cancelBubble = false;
this.cancelable = false;
this.lengthComputable = false;
this.loaded = dict && dict.loaded ? dict.loaded : 0;
this.total = dict && dict.total ? dict.total : 0;
this.target = dict && dict.target ? dict.target : null;
};
// }
})();
module.exports = ProgressEvent;
});
cordova.define("cordova-plugin-file.androidFileSystem", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
FILESYSTEM_PROTOCOL = 'cdvfile'; // eslint-disable-line no-undef
module.exports = {
__format__: function (fullPath, nativeUrl) {
var path;
var contentUrlMatch = /^content:\/\//.exec(nativeUrl);
if (contentUrlMatch) {
// When available, use the path from a native content URL, which was already encoded by Android.
// This is necessary because JavaScript's encodeURI() does not encode as many characters as
// Android, which can result in permission exceptions when the encoding of a content URI
// doesn't match the string for which permission was originally granted.
path = nativeUrl.substring(contentUrlMatch[0].length - 1);
} else {
path = FileSystem.encodeURIPath(fullPath); // eslint-disable-line no-undef
if (!/^\//.test(path)) {
path = '/' + path;
}
var m = /\?.*/.exec(nativeUrl);
if (m) {
path += m[0];
}
}
return FILESYSTEM_PROTOCOL + '://localhost/' + this.name + path; // eslint-disable-line no-undef
}
};
});
cordova.define("cordova-plugin-file.isChrome", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
module.exports = function () {
// window.webkitRequestFileSystem and window.webkitResolveLocalFileSystemURL are available only in Chrome and
// possibly a good flag to indicate that we're running in Chrome
return window.webkitRequestFileSystem && window.webkitResolveLocalFileSystemURL;
};
});
cordova.define("cordova-plugin-file.fileSystemPaths", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var exec = require('cordova/exec');
var channel = require('cordova/channel');
exports.file = {
// Read-only directory where the application is installed.
applicationDirectory: null,
// Root of app's private writable storage
applicationStorageDirectory: null,
// Where to put app-specific data files.
dataDirectory: null,
// Cached files that should survive app restarts.
// Apps should not rely on the OS to delete files in here.
cacheDirectory: null,
// Android: the application space on external storage.
externalApplicationStorageDirectory: null,
// Android: Where to put app-specific data files on external storage.
externalDataDirectory: null,
// Android: the application cache on external storage.
externalCacheDirectory: null,
// Android: the external storage (SD card) root.
externalRootDirectory: null,
// iOS: Temp directory that the OS can clear at will.
tempDirectory: null,
// iOS: Holds app-specific files that should be synced (e.g. to iCloud).
syncedDataDirectory: null,
// iOS: Files private to the app, but that are meaningful to other applications (e.g. Office files)
documentsDirectory: null,
// BlackBerry10: Files globally available to all apps
sharedDirectory: null
};
channel.waitForInitialization('onFileSystemPathsReady');
channel.onCordovaReady.subscribe(function () {
function after (paths) {
for (var k in paths) {
exports.file[k] = paths[k];
}
channel.initializationComplete('onFileSystemPathsReady');
}
exec(after, null, 'File', 'requestAllPaths', []);
});
});
cordova.define("cordova-plugin-file.fileSystems-roots", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
// Map of fsName -> FileSystem.
var fsMap = null;
var FileSystem = require('./FileSystem');
var exec = require('cordova/exec');
// Overridden by Android, BlackBerry 10 and iOS to populate fsMap.
require('./fileSystems').getFs = function (name, callback) {
function success (response) {
fsMap = {};
for (var i = 0; i < response.length; ++i) {
var fsRoot = response[i];
var fs = new FileSystem(fsRoot.filesystemName, fsRoot);
fsMap[fs.name] = fs;
}
callback(fsMap[name]);
}
if (fsMap) {
callback(fsMap[name]);
} else {
exec(success, null, 'File', 'requestAllFileSystems', []);
}
};
});
cordova.define("cordova-plugin-file.fileSystems", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
// Overridden by Android, BlackBerry 10 and iOS to populate fsMap.
module.exports.getFs = function (name, callback) {
callback(null);
};
});
cordova.define("cordova-plugin-file.requestFileSystem", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
(function () {
// For browser platform: not all browsers use this file.
function checkBrowser () {
if (cordova.platformId === 'browser' && require('./isChrome')()) { // eslint-disable-line no-undef
module.exports = window.requestFileSystem || window.webkitRequestFileSystem;
return true;
}
return false;
}
if (checkBrowser()) {
return;
}
var argscheck = require('cordova/argscheck');
var FileError = require('./FileError');
var FileSystem = require('./FileSystem');
var exec = require('cordova/exec');
var fileSystems = require('./fileSystems');
/**
* Request a file system in which to store application data.
* @param type local file system type
* @param size indicates how much storage space, in bytes, the application expects to need
* @param successCallback invoked with a FileSystem object
* @param errorCallback invoked if error occurs retrieving file system
*/
var requestFileSystem = function (type, size, successCallback, errorCallback) {
argscheck.checkArgs('nnFF', 'requestFileSystem', arguments);
var fail = function (code) {
if (errorCallback) {
errorCallback(new FileError(code));
}
};
if (type < 0) {
fail(FileError.SYNTAX_ERR);
} else {
// if successful, return a FileSystem object
var success = function (file_system) {
if (file_system) {
if (successCallback) {
fileSystems.getFs(file_system.name, function (fs) {
// This should happen only on platforms that haven't implemented requestAllFileSystems (windows)
if (!fs) {
fs = new FileSystem(file_system.name, file_system.root);
}
successCallback(fs);
});
}
} else {
// no FileSystem object returned
fail(FileError.NOT_FOUND_ERR);
}
};
exec(success, fail, 'File', 'requestFileSystem', [type, size]);
}
};
module.exports = requestFileSystem;
})();
});
cordova.define("cordova-plugin-file.resolveLocalFileSystemURI", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
(function () {
// For browser platform: not all browsers use overrided `resolveLocalFileSystemURL`.
function checkBrowser () {
if (cordova.platformId === 'browser' && require('./isChrome')()) { // eslint-disable-line no-undef
module.exports.resolveLocalFileSystemURL = window.resolveLocalFileSystemURL || window.webkitResolveLocalFileSystemURL;
return true;
}
return false;
}
if (checkBrowser()) {
return;
}
var argscheck = require('cordova/argscheck');
var DirectoryEntry = require('./DirectoryEntry');
var FileEntry = require('./FileEntry');
var FileError = require('./FileError');
var exec = require('cordova/exec');
var fileSystems = require('./fileSystems');
/**
* Look up file system Entry referred to by local URI.
* @param {DOMString} uri URI referring to a local file or directory
* @param successCallback invoked with Entry object corresponding to URI
* @param errorCallback invoked if error occurs retrieving file system entry
*/
module.exports.resolveLocalFileSystemURL = module.exports.resolveLocalFileSystemURL || function (uri, successCallback, errorCallback) {
argscheck.checkArgs('sFF', 'resolveLocalFileSystemURI', arguments);
// error callback
var fail = function (error) {
if (errorCallback) {
errorCallback(new FileError(error));
}
};
// sanity check for 'not:valid:filename' or '/not:valid:filename'
// file.spec.12 window.resolveLocalFileSystemURI should error (ENCODING_ERR) when resolving invalid URI with leading /.
if (!uri || uri.split(':').length > 2) {
setTimeout(function () {
fail(FileError.ENCODING_ERR);
}, 0);
return;
}
// if successful, return either a file or directory entry
var success = function (entry) {
if (entry) {
if (successCallback) {
// create appropriate Entry object
var fsName = entry.filesystemName || (entry.filesystem && entry.filesystem.name) || (entry.filesystem === window.PERSISTENT ? 'persistent' : 'temporary'); // eslint-disable-line no-undef
fileSystems.getFs(fsName, function (fs) {
// This should happen only on platforms that haven't implemented requestAllFileSystems (windows)
if (!fs) {
fs = new FileSystem(fsName, {name: '', fullPath: '/'}); // eslint-disable-line no-undef
}
var result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath, fs, entry.nativeURL) : new FileEntry(entry.name, entry.fullPath, fs, entry.nativeURL);
successCallback(result);
});
}
} else {
// no Entry object returned
fail(FileError.NOT_FOUND_ERR);
}
};
exec(success, fail, 'File', 'resolveLocalFileSystemURI', [uri]);
};
module.exports.resolveLocalFileSystemURI = function () {
console.log('resolveLocalFileSystemURI is deprecated. Please call resolveLocalFileSystemURL instead.');
module.exports.resolveLocalFileSystemURL.apply(this, arguments);
};
})();
});
cordova.define("cordova-plugin-geolocation.PositionError", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* Position error object
*
* @constructor
* @param code
* @param message
*/
var PositionError = function (code, message) {
this.code = code || null;
this.message = message || '';
};
PositionError.prototype.PERMISSION_DENIED = PositionError.PERMISSION_DENIED = 1;
PositionError.prototype.POSITION_UNAVAILABLE = PositionError.POSITION_UNAVAILABLE = 2;
PositionError.prototype.TIMEOUT = PositionError.TIMEOUT = 3;
module.exports = PositionError;
});
cordova.define("cordova-plugin-geolocation.geolocation", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var exec = cordova.require('cordova/exec'); // eslint-disable-line no-undef
var utils = require('cordova/utils');
var PositionError = require('./PositionError');
// Native watchPosition method is called async after permissions prompt.
// So we use additional map and own ids to return watch id synchronously.
var pluginToNativeWatchMap = {};
module.exports = {
getCurrentPosition: function (success, error, args) {
var win = function () {
var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation'); // eslint-disable-line no-undef
geo.getCurrentPosition(success, error, args);
};
var fail = function () {
if (error) {
error(new PositionError(PositionError.PERMISSION_DENIED, 'Illegal Access'));
}
};
exec(win, fail, 'Geolocation', 'getPermission', []);
},
watchPosition: function (success, error, args) {
var pluginWatchId = utils.createUUID();
var win = function () {
var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation'); // eslint-disable-line no-undef
pluginToNativeWatchMap[pluginWatchId] = geo.watchPosition(success, error, args);
};
var fail = function () {
if (error) {
error(new PositionError(PositionError.PERMISSION_DENIED, 'Illegal Access'));
}
};
exec(win, fail, 'Geolocation', 'getPermission', []);
return pluginWatchId;
},
clearWatch: function (pluginWatchId) {
var win = function () {
var nativeWatchId = pluginToNativeWatchMap[pluginWatchId];
var geo = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation'); // eslint-disable-line no-undef
geo.clearWatch(nativeWatchId);
};
exec(win, null, 'Geolocation', 'getPermission', []);
}
};
});
cordova.define("cordova-plugin-ionic-keyboard.keyboard", function(require, exports, module) {
var argscheck = require('cordova/argscheck'),
utils = require('cordova/utils'),
exec = require('cordova/exec'),
channel = require('cordova/channel');
var Keyboard = function () {};
Keyboard.fireOnShow = function (height) {
Keyboard.isVisible = true;
cordova.fireWindowEvent('keyboardDidShow', {
'keyboardHeight': height
});
// To support the keyboardAttach directive listening events
// inside Ionic's main bundle
cordova.fireWindowEvent('native.keyboardshow', {
'keyboardHeight': height
});
};
Keyboard.fireOnHide = function () {
Keyboard.isVisible = false;
cordova.fireWindowEvent('keyboardDidHide');
// To support the keyboardAttach directive listening events
// inside Ionic's main bundle
cordova.fireWindowEvent('native.keyboardhide');
};
Keyboard.fireOnHiding = function () {
cordova.fireWindowEvent('keyboardWillHide');
};
Keyboard.fireOnShowing = function (height) {
cordova.fireWindowEvent('keyboardWillShow', {
'keyboardHeight': height
});
};
Keyboard.hideFormAccessoryBar = Keyboard.hideKeyboardAccessoryBar = function (hide) {
exec(null, null, "Keyboard", "hideKeyboardAccessoryBar", [hide]);
};
Keyboard.hide = function () {
exec(null, null, "Keyboard", "hide", []);
};
Keyboard.show = function () {
exec(null, null, "Keyboard", "show", []);
};
Keyboard.disableScroll = function (disable) {
console.warn("Keyboard.disableScroll() was removed");
};
Keyboard.setResizeMode = function (mode) {
console.warn("Keyboard.setResizeMode() not supported in Android");
}
channel.onCordovaReady.subscribe(function () {
exec(success, null, 'Keyboard', 'init', []);
function success(msg) {
var action = msg.charAt(0);
if (action === 'S') {
var keyboardHeight = parseInt(msg.substr(1));
Keyboard.fireOnShowing(keyboardHeight);
Keyboard.fireOnShow(keyboardHeight);
} else if (action === 'H') {
Keyboard.fireOnHiding();
Keyboard.fireOnHide();
}
}
});
Keyboard.isVisible = false;
module.exports = Keyboard;
});
cordova.define("cordova-plugin-network-information.Connection", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* Network status
*/
module.exports = {
UNKNOWN: 'unknown',
ETHERNET: 'ethernet',
WIFI: 'wifi',
CELL_2G: '2g',
CELL_3G: '3g',
CELL_4G: '4g',
CELL: 'cellular',
NONE: 'none'
};
});
cordova.define("cordova-plugin-network-information.network", function(require, exports, module) {
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var exec = require('cordova/exec');
var cordova = require('cordova');
var channel = require('cordova/channel');
var utils = require('cordova/utils');
// Link the onLine property with the Cordova-supplied network info.
// This works because we clobber the navigator object with our own
// object in bootstrap.js.
// Browser platform do not need to define this property, because
// it is already supported by modern browsers
if (cordova.platformId !== 'browser' && typeof navigator !== 'undefined') {
utils.defineGetter(navigator, 'onLine', function () {
return this.connection.type !== 'none';
});
}
function NetworkConnection () {
this.type = 'unknown';
}
/**
* Get connection info
*
* @param {Function} successCallback The function to call when the Connection data is available
* @param {Function} errorCallback The function to call when there is an error getting the Connection data. (OPTIONAL)
*/
NetworkConnection.prototype.getInfo = function (successCallback, errorCallback) {
exec(successCallback, errorCallback, 'NetworkStatus', 'getConnectionInfo', []);
};
var me = new NetworkConnection();
var timerId = null;
var timeout = 500;
channel.createSticky('onCordovaConnectionReady');
channel.waitForInitialization('onCordovaConnectionReady');
channel.onCordovaReady.subscribe(function () {
me.getInfo(function (info) {
me.type = info;
if (info === 'none') {
// set a timer if still offline at the end of timer send the offline event
timerId = setTimeout(function () {
cordova.fireDocumentEvent('offline');
timerId = null;
}, timeout);
} else {
// If there is a current offline event pending clear it
if (timerId !== null) {
clearTimeout(timerId);
timerId = null;
}
cordova.fireDocumentEvent('online');
}
// should only fire this once
if (channel.onCordovaConnectionReady.state !== 2) {
channel.onCordovaConnectionReady.fire();
}
},
function (e) {
// If we can't get the network info we should still tell Cordova
// to fire the deviceready event.
if (channel.onCordovaConnectionReady.state !== 2) {
channel.onCordovaConnectionReady.fire();
}
console.log('Error initializing Network Connection: ' + e);
});
});
module.exports = me;
});
cordova.define("cordova-plugin-screen-orientation.screenorientation", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var screenOrientation = {};
if (!window.OrientationType) {
window.OrientationType = {
'portrait-primary': 0,
'portrait-secondary': 180,
'landscape-primary': 90,
'landscape-secondary': -90
};
}
if (!window.OrientationLockType) {
window.OrientationLockType = {
'portrait-primary': 1,
'portrait-secondary': 2,
'landscape-primary': 4,
'landscape-secondary': 8,
'portrait': 3, // either portrait-primary or portrait-secondary.
'landscape': 12, // either landscape-primary or landscape-secondary.
'any': 15 // All orientations are supported (unlocked orientation)
};
}
var orientationMask = 1;
screenOrientation.setOrientation = function(orientation) {
orientationMask = window.OrientationLockType[orientation];
cordova.exec(null, null, "CDVOrientation", "screenOrientation", [orientationMask, orientation]);
};
if (!screen.orientation) {
screen.orientation = {};
}
setOrientationProperties();
function addScreenOrientationApi(screenObject) {
if (screenObject.unlock || screenObject.lock) {
screenObject.nativeLock = screenObject.lock;
}
screenObject.lock = function(orientation) {
var promiseLock;
var p = new Promise(function(resolve, reject) {
if (screenObject.nativeLock) {
promiseLock = screenObject.nativeLock(orientation);
promiseLock.then(function success(res) {
resolve();
}, function error(err) {
screenObject.nativeLock = null;
resolveOrientation(orientation, resolve, reject);
});
} else {
resolveOrientation(orientation, resolve, reject);
}
});
return p;
};
screenObject.unlock = function() {
screenOrientation.setOrientation('any');
};
}
function resolveOrientation(orientation, resolve, reject) {
if (!OrientationLockType.hasOwnProperty(orientation)) {
var err = new Error();
err.name = "NotSupportedError";
reject(err); //"cannot change orientation");
} else {
screenOrientation.setOrientation(orientation);
resolve("Orientation set"); // orientation change successful
}
}
addScreenOrientationApi(screen.orientation);
var onChangeListener = null;
Object.defineProperty(screen.orientation, 'onchange', {
set: function(listener) {
if (onChangeListener) {
screen.orientation.removeEventListener('change', onChangeListener);
}
onChangeListener = listener;
if (onChangeListener) {
screen.orientation.addEventListener('change', onChangeListener);
}
},
get: function() {
return (onChangeListener ? onChangeListener : null);
},
enumerable: true,
});
var evtTarget = new XMLHttpRequest(); //document.createElement('div');
var orientationchange = function() {
setOrientationProperties();
var event = document.createEvent('Events');
event.initEvent("change", false, false);
evtTarget.dispatchEvent(event);
};
screen.orientation.addEventListener = function(a,b,c) {
return evtTarget.addEventListener(a,b,c);
};
screen.orientation.removeEventListener = function(a,b,c) {
return evtTarget.removeEventListener(a,b,c);
};
function setOrientationProperties() {
switch (window.orientation) {
case 0:
screen.orientation.type = 'portrait-primary';
break;
case 90:
screen.orientation.type = 'landscape-primary';
break;
case 180:
screen.orientation.type = 'portrait-secondary';
break;
case -90:
screen.orientation.type = 'landscape-secondary';
break;
default:
screen.orientation.type = 'portrait-primary';
break;
}
screen.orientation.angle = window.orientation || 0;
}
window.addEventListener("orientationchange", orientationchange, true);
module.exports = screenOrientation;
});
cordova.define("cordova-plugin-splashscreen.SplashScreen", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var exec = require('cordova/exec');
var splashscreen = {
show:function() {
exec(null, null, "SplashScreen", "show", []);
},
hide:function() {
exec(null, null, "SplashScreen", "hide", []);
}
};
module.exports = splashscreen;
});
cordova.define("cordova-plugin-statusbar.statusbar", function(require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/* global cordova */
var exec = require('cordova/exec');
var namedColors = {
"black": "#000000",
"darkGray": "#A9A9A9",
"lightGray": "#D3D3D3",
"white": "#FFFFFF",
"gray": "#808080",
"red": "#FF0000",
"green": "#00FF00",
"blue": "#0000FF",
"cyan": "#00FFFF",
"yellow": "#FFFF00",
"magenta": "#FF00FF",
"orange": "#FFA500",
"purple": "#800080",
"brown": "#A52A2A"
};
var StatusBar = {
isVisible: true,
overlaysWebView: function (doOverlay) {
exec(null, null, "StatusBar", "overlaysWebView", [doOverlay]);
},
styleDefault: function () {
// dark text ( to be used on a light background )
exec(null, null, "StatusBar", "styleDefault", []);
},
styleLightContent: function () {
// light text ( to be used on a dark background )
exec(null, null, "StatusBar", "styleLightContent", []);
},
styleBlackTranslucent: function () {
// #88000000 ? Apple says to use lightContent instead
exec(null, null, "StatusBar", "styleBlackTranslucent", []);
},
styleBlackOpaque: function () {
// #FF000000 ? Apple says to use lightContent instead
exec(null, null, "StatusBar", "styleBlackOpaque", []);
},
backgroundColorByName: function (colorname) {
return StatusBar.backgroundColorByHexString(namedColors[colorname]);
},
backgroundColorByHexString: function (hexString) {
if (hexString.charAt(0) !== "#") {
hexString = "#" + hexString;
}
if (hexString.length === 4) {
var split = hexString.split("");
hexString = "#" + split[1] + split[1] + split[2] + split[2] + split[3] + split[3];
}
exec(null, null, "StatusBar", "backgroundColorByHexString", [hexString]);
},
hide: function () {
exec(null, null, "StatusBar", "hide", []);
StatusBar.isVisible = false;
},
show: function () {
exec(null, null, "StatusBar", "show", []);
StatusBar.isVisible = true;
}
};
// prime it. setTimeout so that proxy gets time to init
window.setTimeout(function () {
exec(function (res) {
if (typeof res == 'object') {
if (res.type == 'tap') {
cordova.fireWindowEvent('statusTap');
}
} else {
StatusBar.isVisible = res;
}
}, null, "StatusBar", "_ready", []);
}, 0);
module.exports = StatusBar;
});
cordova.define("cordova-plugin-telerik-imagepicker.ImagePicker", function(require, exports, module) {
/*global cordova,window,console*/
/**
* An Image Picker plugin for Cordova
*
* Developed by Wymsee for Sync OnSet
*/
var ImagePicker = function() {
};
ImagePicker.prototype.OutputType = {
FILE_URI: 0,
BASE64_STRING: 1
};
ImagePicker.prototype.validateOutputType = function(options){
var outputType = options.outputType;
if(outputType){
if(outputType !== this.OutputType.FILE_URI && outputType !== this.OutputType.BASE64_STRING){
console.log('Invalid output type option entered. Defaulting to FILE_URI. Please use window.imagePicker.OutputType.FILE_URI or window.imagePicker.OutputType.BASE64_STRING');
options.outputType = this.OutputType.FILE_URI;
}
}
};
ImagePicker.prototype.hasReadPermission = function(callback) {
return cordova.exec(callback, null, "ImagePicker", "hasReadPermission", []);
};
ImagePicker.prototype.requestReadPermission = function(callback, failureCallback) {
return cordova.exec(callback, failureCallback, "ImagePicker", "requestReadPermission", []);
};
/*
* success - success callback
* fail - error callback
* options
* .maximumImagesCount - max images to be selected, defaults to 15. If this is set to 1,
* upon selection of a single image, the plugin will return it.
* .width - width to resize image to (if one of height/width is 0, will resize to fit the
* other while keeping aspect ratio, if both height and width are 0, the full size
* image will be returned)
* .height - height to resize image to
* .quality - quality of resized image, defaults to 100
* .outputType - type of output returned. defaults to file URIs.
* Please see ImagePicker.OutputType for available values.
*/
ImagePicker.prototype.getPictures = function(success, fail, options) {
if (!options) {
options = {};
}
this.validateOutputType(options);
var params = {
maximumImagesCount: options.maximumImagesCount ? options.maximumImagesCount : 15,
width: options.width ? options.width : 0,
height: options.height ? options.height : 0,
quality: options.quality ? options.quality : 100,
allow_video: options.allow_video ? options.allow_video : false,
title: options.title ? options.title : 'Select an Album', // the default is the message of the old plugin impl
message: options.message ? options.message : null, // the old plugin impl didn't have it, so passing null by default
outputType: options.outputType ? options.outputType : this.OutputType.FILE_URI,
disable_popover: options.disable_popover ? options.disable_popover : false // Disable the iOS popover as seen on iPad
};
return cordova.exec(success, fail, "ImagePicker", "getPictures", [params]);
};
window.imagePicker = new ImagePicker();
});
cordova.define("cordova-plugin-tts.tts", function(require, exports, module) {
/*
Cordova Text-to-Speech Plugin
https://github.com/vilic/cordova-plugin-tts
by VILIC VANE
https://github.com/vilic
MIT License
*/
exports.speak = function (text, onfulfilled, onrejected) {
var options = {};
if (typeof text == 'string') {
options.text = text;
} else {
options = text;
}
cordova
.exec(function () {
onfulfilled();
}, function (reason) {
onrejected(reason);
}, 'TTS', 'speak', [options]);
};
});
cordova.define("cordova-sms-plugin.Sms", function(require, exports, module) {
'use strict';
var exec = require('cordova/exec');
var sms = {};
function convertPhoneToArray(phone) {
if (typeof phone === 'string' && phone.indexOf(',') !== -1) {
phone = phone.split(',');
}
if (Object.prototype.toString.call(phone) !== '[object Array]') {
phone = [phone];
}
return phone;
}
sms.send = function(phone, message, options, success, failure) {
// parsing phone numbers
phone = convertPhoneToArray(phone);
// parsing options
var replaceLineBreaks = false;
var androidIntent = '';
if (typeof options === 'string') { // ensuring backward compatibility
window.console.warn('[DEPRECATED] Passing a string as a third argument is deprecated. Please refer to the documentation to pass the right parameter: https://github.com/cordova-sms/cordova-sms-plugin.');
androidIntent = options;
}
else if (typeof options === 'object') {
replaceLineBreaks = options.replaceLineBreaks || false;
if (options.android && typeof options.android === 'object') {
androidIntent = options.android.intent;
}
}
// fire
exec(
success,
failure,
'Sms',
'send', [phone, message, androidIntent, replaceLineBreaks]
);
};
sms.hasPermission = function(success, failure) {
// fire
exec(
success,
failure,
'Sms',
'has_permission', []
);
};
sms.requestPermission = function(success, failure) {
// fire
exec(
success,
failure,
'Sms',
'request_permission', []
);
};
module.exports = sms;
});
cordova.define("cordova.plugins.diagnostic.Diagnostic_Bluetooth", function(require, exports, module) {
/* globals cordova, require, exports, module */
/**
* Diagnostic Bluetooth plugin for Android
*
* Copyright (c) 2015 Working Edge Ltd.
* Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
**/
var Diagnostic_Bluetooth = (function(){
/***********************
*
* Internal properties
*
*********************/
var Diagnostic_Bluetooth = {};
var Diagnostic = require("cordova.plugins.diagnostic.Diagnostic");
/********************
*
* Public properties
*
********************/
Diagnostic.bluetoothState = Diagnostic_Bluetooth.bluetoothState = {
"UNKNOWN": "unknown",
"POWERED_OFF": "powered_off",
"POWERED_ON": "powered_on",
"POWERING_OFF": "powering_off",
"POWERING_ON": "powering_on"
};
/********************
*
* Internal functions
*
********************/
/*****************************
*
* Protected member functions
*
****************************/
// Placeholder listeners
Diagnostic_Bluetooth._onBluetoothStateChange = function(){};
/**********************
*
* Public API functions
*
**********************/
/**
* Checks if Bluetooth is available to the app.
* Returns true if the device has Bluetooth capabilities and if so that Bluetooth is switched on
*
* @param {Function} successCallback - The callback which will be called when the operation is successful.
* This callback function is passed a single boolean parameter which is TRUE if Bluetooth is available.
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Bluetooth.isBluetoothAvailable = function(successCallback, errorCallback) {
return cordova.exec(Diagnostic._ensureBoolean(successCallback),
errorCallback,
'Diagnostic_Bluetooth',
'isBluetoothAvailable',
[]);
};
/**
* Checks if the device setting for Bluetooth is switched on.
*
* @param {Function} successCallback - The callback which will be called when the operation is successful.
* This callback function is passed a single boolean parameter which is TRUE if Bluetooth is switched on.
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Bluetooth.isBluetoothEnabled = function(successCallback, errorCallback) {
return cordova.exec(Diagnostic._ensureBoolean(successCallback),
errorCallback,
'Diagnostic_Bluetooth',
'isBluetoothEnabled',
[]);
};
/**
* Enables/disables Bluetooth on the device.
*
* @param {Function} successCallback - function to call on successful setting of Bluetooth state
* @param {Function} errorCallback - function to call on failure to set Bluetooth state.
* This callback function is passed a single string parameter containing the error message.
* @param {Boolean} state - Bluetooth state to set: TRUE for enabled, FALSE for disabled.
*/
Diagnostic_Bluetooth.setBluetoothState = function(successCallback, errorCallback, state) {
return cordova.exec(successCallback,
errorCallback,
'Diagnostic_Bluetooth',
'setBluetoothState',
[state]);
};
/**
* Returns current state of Bluetooth hardware on the device.
*
* @param {Function} successCallback - The callback which will be called when the operation is successful.
* This callback function is passed a single string parameter defined as a constant in `cordova.plugins.diagnostic.bluetoothState`.
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Bluetooth.getBluetoothState = function(successCallback, errorCallback) {
return cordova.exec(successCallback,
errorCallback,
'Diagnostic_Bluetooth',
'getBluetoothState',
[]);
};
/**
* Registers a listener function to call when the state of Bluetooth hardware changes.
* Pass in a falsey value to de-register the currently registered function.
*
* @param {Function} successCallback - The callback which will be called when the state of Bluetooth hardware changes.
* This callback function is passed a single string parameter defined as a constant in `cordova.plugins.diagnostic.bluetoothState`.
*/
Diagnostic_Bluetooth.registerBluetoothStateChangeHandler = function(successCallback) {
Diagnostic_Bluetooth._onBluetoothStateChange = successCallback || function(){};
};
/**
* Checks if the device has Bluetooth capabilities.
* See http://developer.android.com/guide/topics/connectivity/bluetooth.html.
*
* @param {Function} successCallback - The callback which will be called when the operation is successful.
* This callback function is passed a single boolean parameter which is TRUE if device has Bluetooth capabilities.
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Bluetooth.hasBluetoothSupport = function(successCallback, errorCallback) {
return cordova.exec(Diagnostic._ensureBoolean(successCallback),
errorCallback,
'Diagnostic_Bluetooth',
'hasBluetoothSupport', []);
};
/**
* Checks if the device has Bluetooth Low Energy (LE) capabilities.
* See http://developer.android.com/guide/topics/connectivity/bluetooth-le.html.
*
* @param {Function} successCallback - The callback which will be called when the operation is successful.
* This callback function is passed a single boolean parameter which is TRUE if device has Bluetooth LE capabilities.
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Bluetooth.hasBluetoothLESupport = function(successCallback, errorCallback) {
return cordova.exec(Diagnostic._ensureBoolean(successCallback),
errorCallback,
'Diagnostic_Bluetooth',
'hasBluetoothLESupport', []);
};
/**
* Checks if the device has Bluetooth Low Energy (LE) capabilities.
* See http://developer.android.com/guide/topics/connectivity/bluetooth-le.html.
*
* @param {Function} successCallback - The callback which will be called when the operation is successful.
* This callback function is passed a single boolean parameter which is TRUE if device has Bluetooth LE capabilities.
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Bluetooth.hasBluetoothLESupport = function(successCallback, errorCallback) {
return cordova.exec(Diagnostic._ensureBoolean(successCallback),
errorCallback,
'Diagnostic_Bluetooth',
'hasBluetoothLESupport', []);
};
/**
* Checks if the device has Bluetooth Low Energy (LE) peripheral capabilities.
* See http://developer.android.com/guide/topics/connectivity/bluetooth-le.html#roles.
*
* @param {Function} successCallback - The callback which will be called when the operation is successful.
* This callback function is passed a single boolean parameter which is TRUE if device has Bluetooth LE peripheral capabilities.
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Bluetooth.hasBluetoothLEPeripheralSupport = function(successCallback, errorCallback) {
return cordova.exec(Diagnostic._ensureBoolean(successCallback),
errorCallback,
'Diagnostic_Bluetooth',
'hasBluetoothLEPeripheralSupport', []);
};
/**
* Switches to the Bluetooth page in the Settings app
*/
Diagnostic_Bluetooth.switchToBluetoothSettings = function() {
return cordova.exec(null,
null,
'Diagnostic_Bluetooth',
'switchToBluetoothSettings',
[]);
};
return Diagnostic_Bluetooth;
});
module.exports = new Diagnostic_Bluetooth();
});
cordova.define("cordova.plugins.diagnostic.Diagnostic_Calendar", function(require, exports, module) {
/* globals cordova, require, exports, module */
/**
* Diagnostic Calendar plugin for Android
*
* Copyright (c) 2015 Working Edge Ltd.
* Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
**/
var Diagnostic_Calendar = (function(){
/***********************
*
* Internal properties
*
*********************/
var Diagnostic_Calendar = {};
var Diagnostic = require("cordova.plugins.diagnostic.Diagnostic");
/********************
*
* Public properties
*
********************/
/********************
*
* Internal functions
*
********************/
/*****************************
*
* Protected member functions
*
****************************/
/**********************
*
* Public API functions
*
**********************/
/**
*Checks if the application is authorized to use calendar.
*
* @param {Function} successCallback - The callback which will be called when operation is successful.
* This callback function is passed a single boolean parameter which is TRUE if access to microphone is authorized.
* @param {Function} errorCallback - The callback which will be called when operation encounters an error.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Calendar.isCalendarAuthorized = function(successCallback, errorCallback) {
function onSuccess(status){
successCallback(status == Diagnostic.permissionStatus.GRANTED);
}
Diagnostic_Calendar.getCalendarAuthorizationStatus(onSuccess, errorCallback);
};
/**
* Returns the calendar authorization status for the application.
*
* @param {Function} successCallback - The callback which will be called when operation is successful.
* This callback function is passed a single string parameter which indicates the authorization status.
* Possible values are: "unknown", "denied", "not_determined", "authorized"
* @param {Function} errorCallback - The callback which will be called when operation encounters an error.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Calendar.getCalendarAuthorizationStatus = function(successCallback, errorCallback) {
Diagnostic.getPermissionAuthorizationStatus(successCallback, errorCallback, Diagnostic.permission.READ_CALENDAR);
};
/**
* Requests calendar 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 {Function} successCallback - The callback which will be called when authorization request is successful.
* @param {Function} errorCallback - The callback which will be called when an error occurs.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Calendar.requestCalendarAuthorization = function(successCallback, errorCallback) {
Diagnostic.requestRuntimePermission(successCallback, errorCallback, Diagnostic.permission.READ_CALENDAR);
};
return Diagnostic_Calendar;
});
module.exports = new Diagnostic_Calendar();
});
cordova.define("cordova.plugins.diagnostic.Diagnostic_Camera", function(require, exports, module) {
/* globals cordova, require, exports, module */
/**
* Diagnostic Camera plugin for Android
*
* Copyright (c) 2015 Working Edge Ltd.
* Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
**/
var Diagnostic_Camera = (function(){
/***********************
*
* Internal properties
*
*********************/
var Diagnostic_Camera = {};
var Diagnostic = require("cordova.plugins.diagnostic.Diagnostic");
/********************
*
* Public properties
*
********************/
/********************
*
* Internal functions
*
********************/
function combineCameraStatuses(statuses){
var cameraStatus = statuses[Diagnostic.permission.CAMERA],
mediaStatus = statuses[Diagnostic.permission.READ_EXTERNAL_STORAGE],
status;
if(cameraStatus == Diagnostic.permissionStatus.DENIED_ALWAYS || mediaStatus == Diagnostic.permissionStatus.DENIED_ALWAYS){
status = Diagnostic.permissionStatus.DENIED_ALWAYS;
}else if(cameraStatus == Diagnostic.permissionStatus.DENIED || mediaStatus == Diagnostic.permissionStatus.DENIED){
status = Diagnostic.permissionStatus.DENIED;
}else if(cameraStatus == Diagnostic.permissionStatus.NOT_REQUESTED || mediaStatus == Diagnostic.permissionStatus.NOT_REQUESTED){
status = Diagnostic.permissionStatus.NOT_REQUESTED;
}else{
status = Diagnostic.permissionStatus.GRANTED;
}
return status;
}
function mapFromLegacyCameraApi() {
var params;
if (typeof arguments[0] === "function") {
params = (arguments.length > 2 && typeof arguments[2] === "object") ? arguments[2] : {};
params.successCallback = arguments[0];
if(arguments.length > 1 && typeof arguments[1] === "function") {
params.errorCallback = arguments[1];
}
if(arguments.length > 2 && arguments[2] === false) {
params.externalStorage = arguments[2];
}
}else { // if (typeof arguments[0] === "object")
params = arguments[0];
}
return params;
}
function numberOfKeys(obj){
var count = 0;
for(var k in obj){
count++;
}
return count;
}
/*****************************
*
* Protected member functions
*
****************************/
/**********************
*
* Public API functions
*
**********************/
/**
* Checks if camera is usable: both present and authorised for use.
*
* @param {Object} params - (optional) parameters:
* - {Function} successCallback - The callback which will be called when the operation is successful.
* This callback function is passed a single boolean parameter which is TRUE if camera is present and authorized for use.
* - {Function} errorCallback - The callback which will be called when the operation encounters an error.
* This callback function is passed a single string parameter containing the error message.
* - {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.
*/
Diagnostic_Camera.isCameraAvailable = function(params) {
params = mapFromLegacyCameraApi.apply(this, arguments);
params.successCallback = params.successCallback || function(){};
Diagnostic_Camera.isCameraPresent(function(isPresent){
if(isPresent){
Diagnostic_Camera.isCameraAuthorized(params);
}else{
params.successCallback(!!isPresent);
}
},params.errorCallback);
};
/**
* Checks if camera hardware is present on device.
*
* @param {Function} successCallback - The callback which will be called when the operation is successful.
* This callback function is passed a single boolean parameter which is TRUE if camera is present
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Camera.isCameraPresent = function(successCallback, errorCallback) {
return cordova.exec(Diagnostic._ensureBoolean(successCallback),
errorCallback,
'Diagnostic_Camera',
'isCameraPresent',
[]);
};
/**
* Requests authorisation for runtime permissions to use the camera.
* 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 {Object} params - (optional) parameters:
* - {Function} successCallback - function to call on successful request for runtime permissions.
* This callback function is passed a single string parameter which defines the resulting authorisation status as a value in cordova.plugins.diagnostic.permissionStatus.
* - {Function} errorCallback - function to call on failure to request authorisation.
* - {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.
*/
Diagnostic_Camera.requestCameraAuthorization = function(params){
params = mapFromLegacyCameraApi.apply(this, arguments);
var permissions = [Diagnostic.permission.CAMERA];
if(params.externalStorage !== false){
permissions.push(Diagnostic.permission.READ_EXTERNAL_STORAGE);
}
params.successCallback = params.successCallback || function(){};
var onSuccess = function(statuses){
params.successCallback(numberOfKeys(statuses) > 1 ? combineCameraStatuses(statuses): statuses[Diagnostic.permission.CAMERA]);
};
Diagnostic.requestRuntimePermissions(onSuccess, params.errorCallback, permissions);
};
/**
* Returns the authorisation status for runtime permissions to use the camera.
* 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 {Object} params - (optional) parameters:
* - {Function} successCallback - function to call on successful request for runtime permissions status.
* This callback function is passed a single string parameter which defines the current authorisation status as a value in cordova.plugins.diagnostic.permissionStatus.
* - {Function} errorCallback - function to call on failure to request authorisation status.
* - {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.
*/
Diagnostic_Camera.getCameraAuthorizationStatus = function(params){
params = mapFromLegacyCameraApi.apply(this, arguments);
var permissions = [Diagnostic.permission.CAMERA];
if(params.externalStorage !== false){
permissions.push(Diagnostic.permission.READ_EXTERNAL_STORAGE);
}
params.successCallback = params.successCallback || function(){};
var onSuccess = function(statuses){
params.successCallback(numberOfKeys(statuses) > 1 ? combineCameraStatuses(statuses): statuses[Diagnostic.permission.CAMERA]);
};
Diagnostic.getPermissionsAuthorizationStatus(onSuccess, params.errorCallback, permissions);
};
/**
* Checks if the application is authorized to use the camera.
* Note: 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 {Object} params - (optional) parameters:
* - {Function} successCallback - function to call on successful request for runtime permissions status.
* This callback function is passed a single boolean parameter which is TRUE if the app currently has runtime authorisation to use location.
* - {Function} errorCallback - function to call on failure to request authorisation status.
* - {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.
*/
Diagnostic_Camera.isCameraAuthorized = function(params){
params = mapFromLegacyCameraApi.apply(this, arguments);
params.successCallback = params.successCallback || function(){};
var onSuccess = function(status){
params.successCallback(status == Diagnostic.permissionStatus.GRANTED);
};
Diagnostic_Camera.getCameraAuthorizationStatus({
successCallback: onSuccess,
errorCallback: params.errorCallback,
externalStorage: params.externalStorage
});
};
return Diagnostic_Camera;
});
module.exports = new Diagnostic_Camera();
});
cordova.define("cordova.plugins.diagnostic.Diagnostic_Contacts", function(require, exports, module) {
/* globals cordova, require, exports, module */
/**
* Diagnostic Contacts plugin for Android
*
* Copyright (c) 2015 Working Edge Ltd.
* Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
**/
var Diagnostic_Contacts = (function(){
/***********************
*
* Internal properties
*
*********************/
var Diagnostic_Contacts = {};
var Diagnostic = require("cordova.plugins.diagnostic.Diagnostic");
/********************
*
* Public properties
*
********************/
/********************
*
* Internal functions
*
********************/
/*****************************
*
* Protected member functions
*
****************************/
/**********************
*
* Public API functions
*
**********************/
/**
*Checks if the application is authorized to use contacts (address book).
*
* @param {Function} successCallback - The callback which will be called when operation is successful.
* This callback function is passed a single boolean parameter which is TRUE if access to microphone is authorized.
* @param {Function} errorCallback - The callback which will be called when operation encounters an error.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Contacts.isContactsAuthorized = function(successCallback, errorCallback) {
function onSuccess(status){
successCallback(status == Diagnostic.permissionStatus.GRANTED);
}
Diagnostic_Contacts.getContactsAuthorizationStatus(onSuccess, errorCallback);
};
/**
* Returns the contacts (address book) authorization status for the application.
*
* @param {Function} successCallback - The callback which will be called when operation is successful.
* This callback function is passed a single string parameter which indicates the authorization status.
* Possible values are: "unknown", "denied", "not_determined", "authorized"
* @param {Function} errorCallback - The callback which will be called when operation encounters an error.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Contacts.getContactsAuthorizationStatus = function(successCallback, errorCallback) {
Diagnostic.getPermissionAuthorizationStatus(successCallback, errorCallback, Diagnostic.permission.READ_CONTACTS);
};
/**
* Requests contacts (address book) 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 {Function} successCallback - The callback which will be called when authorization request is successful.
* @param {Function} errorCallback - The callback which will be called when an error occurs.
* This callback function is passed a single string parameter containing the error message.
*/
Diagnostic_Contacts.requestContactsAuthorization = function(successCallback, errorCallback) {
Diagnostic.requestRuntimePermission(successCallback, errorCallback, Diagnostic.permission.READ_CONTACTS);
};
return Diagnostic_Contacts;
});
module.exports = new Diagnostic_Contacts();
});
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment