mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-06-08 00:00:19 +08:00
Compare commits
70 Commits
v6.1.0
...
v3.1.0-rc.2
| Author | SHA1 | Date | |
|---|---|---|---|
| d36a8c8257 | |||
| 3665781b40 | |||
| 9108db7653 | |||
| 00d1ad7d3b | |||
| de51ef8a82 | |||
| 9a68ea242c | |||
| 10daa1f1dd | |||
| 38bb8410e5 | |||
| d35d176a79 | |||
| fe8a380902 | |||
| a8edd53d26 | |||
| 00a7fa547e | |||
| b393c7448b | |||
| 46f80555f7 | |||
| 0aee729e8e | |||
| 06c8c44efc | |||
| 6df3383585 | |||
| f912a452dc | |||
| ea697bd884 | |||
| 6e7b087cff | |||
| 87b5327a42 | |||
| 1b1a0e99e8 | |||
| 2828319d0a | |||
| d3c87fd95a | |||
| 964cc91548 | |||
| a2e410c4cb | |||
| 9055154781 | |||
| 822a4120c7 | |||
| bc60d0678b | |||
| 9aa7ad0221 | |||
| e965d654c5 | |||
| 82d6efac76 | |||
| de51746bfc | |||
| 157367ddb6 | |||
| 6de9697aa9 | |||
| 1dfdbaf1f0 | |||
| 1fe1cd6f75 | |||
| dcd5e3ac9f | |||
| aa44c09ec4 | |||
| 281e8b737e | |||
| b5ce8e9fbb | |||
| 0b17b253d9 | |||
| faffc76a76 | |||
| 20fbfb91ca | |||
| 4acdd41837 | |||
| 1f2dba0a3f | |||
| 76f07092df | |||
| 91a5b5bbfc | |||
| e3164c95df | |||
| 1933ec66d9 | |||
| 742df16837 | |||
| c742bdab85 | |||
| cd6d166e76 | |||
| e061219aff | |||
| 9f1ce45f06 | |||
| dd04564335 | |||
| 03254ad4b7 | |||
| f13a007a1c | |||
| 9802b7f2e4 | |||
| a2dcca3815 | |||
| 7226bcad50 | |||
| 63ab1a205e | |||
| b6ab01d100 | |||
| ecb98e2e82 | |||
| c733127134 | |||
| 0cce8e9ce7 | |||
| b773c0709f | |||
| d426b15c1c | |||
| b05627d2d6 | |||
| dbd9df41f0 |
@@ -1,5 +1,7 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
.idea
|
||||
.tmp
|
||||
aot/
|
||||
dist/
|
||||
scripts/ionic-native-bower
|
||||
|
||||
+104
@@ -1,3 +1,107 @@
|
||||
<a name="2.8.0"></a>
|
||||
# [2.8.0](https://github.com/driftyco/ionic-native/compare/v2.7.0...v2.8.0) (2017-03-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **file:** fix return types ([b458327](https://github.com/driftyco/ionic-native/commit/b458327)), closes [#1139](https://github.com/driftyco/ionic-native/issues/1139)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **app-preferences:** added cordova-plugin-app-preferences support ([#1084](https://github.com/driftyco/ionic-native/issues/1084)) ([12280dd](https://github.com/driftyco/ionic-native/commit/12280dd))
|
||||
* **health:** add wrapper for cordova-plugin-health ([#1039](https://github.com/driftyco/ionic-native/issues/1039)) ([3500d80](https://github.com/driftyco/ionic-native/commit/3500d80))
|
||||
* **photo-library:** added cordova-plugin-photo-library ([#1102](https://github.com/driftyco/ionic-native/issues/1102)) ([384dfc2](https://github.com/driftyco/ionic-native/commit/384dfc2))
|
||||
|
||||
|
||||
|
||||
<a name="2.7.0"></a>
|
||||
# [2.7.0](https://github.com/driftyco/ionic-native/compare/v2.6.0...v2.7.0) (2017-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **core:** dont check if method exists when overriding ([754c5ec](https://github.com/driftyco/ionic-native/commit/754c5ec)), closes [#1043](https://github.com/driftyco/ionic-native/issues/1043)
|
||||
* **file:** fix writeExistingFile ([47f48ba](https://github.com/driftyco/ionic-native/commit/47f48ba)), closes [#1044](https://github.com/driftyco/ionic-native/issues/1044)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **background-mode:** add missing functions ([906401b](https://github.com/driftyco/ionic-native/commit/906401b)), closes [#1078](https://github.com/driftyco/ionic-native/issues/1078)
|
||||
* **background-mode:** replace event listeners with on method ([ffdbab7](https://github.com/driftyco/ionic-native/commit/ffdbab7))
|
||||
* **diagnostic:** add new methods ([5144345](https://github.com/driftyco/ionic-native/commit/5144345)), closes [#1045](https://github.com/driftyco/ionic-native/issues/1045)
|
||||
|
||||
|
||||
|
||||
<a name="2.6.0"></a>
|
||||
# [2.6.0](https://github.com/driftyco/ionic-native/compare/v2.5.1...v2.6.0) (2017-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **apprate:** add missing Windows Store option ([#1072](https://github.com/driftyco/ionic-native/issues/1072)) ([439ccee](https://github.com/driftyco/ionic-native/commit/439ccee))
|
||||
* **background-geolocation:** configure returns a promise ([fc87992](https://github.com/driftyco/ionic-native/commit/fc87992)), closes [#1118](https://github.com/driftyco/ionic-native/issues/1118)
|
||||
* **contacts:** allow passing asterisk as contact field type ([9c5b593](https://github.com/driftyco/ionic-native/commit/9c5b593)), closes [#1093](https://github.com/driftyco/ionic-native/issues/1093)
|
||||
* **contacts:** allow passing asterisk as contact field type ([2639486](https://github.com/driftyco/ionic-native/commit/2639486))
|
||||
* **facebook:** fixes issue when not supplying default params ([#1088](https://github.com/driftyco/ionic-native/issues/1088)) ([85a3a40](https://github.com/driftyco/ionic-native/commit/85a3a40))
|
||||
* **file:** add missing exports ([#1101](https://github.com/driftyco/ionic-native/issues/1101)) ([23b97f6](https://github.com/driftyco/ionic-native/commit/23b97f6))
|
||||
* **file:** platform Browser will raise a an DOMException ([#1082](https://github.com/driftyco/ionic-native/issues/1082)) ([2fba915](https://github.com/driftyco/ionic-native/commit/2fba915))
|
||||
* **file:** remove FileError from return type ([#1086](https://github.com/driftyco/ionic-native/issues/1086)) ([c1748bb](https://github.com/driftyco/ionic-native/commit/c1748bb))
|
||||
* **imagepicker:** add outputType option ([#1098](https://github.com/driftyco/ionic-native/issues/1098)) ([b4b7cfa](https://github.com/driftyco/ionic-native/commit/b4b7cfa))
|
||||
* **media:** add missing pauseRecord and resumeRecord methods ([#1122](https://github.com/driftyco/ionic-native/issues/1122)) ([234ed6e](https://github.com/driftyco/ionic-native/commit/234ed6e))
|
||||
* **plugin:** revert changes to support stable version ([#1116](https://github.com/driftyco/ionic-native/issues/1116)) ([104532e](https://github.com/driftyco/ionic-native/commit/104532e)), closes [#1001](https://github.com/driftyco/ionic-native/issues/1001)
|
||||
* **push:** add the missing option clearBadge ([#1087](https://github.com/driftyco/ionic-native/issues/1087)) ([70847d1](https://github.com/driftyco/ionic-native/commit/70847d1))
|
||||
* **serial:** Serial.requestPermission() options are optional ([#1128](https://github.com/driftyco/ionic-native/issues/1128)) ([da72500](https://github.com/driftyco/ionic-native/commit/da72500))
|
||||
* **zip:** progress callback is optional ([#1049](https://github.com/driftyco/ionic-native/issues/1049)) ([83f57b9](https://github.com/driftyco/ionic-native/commit/83f57b9))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **alipay:** add alipay support. ([#1097](https://github.com/driftyco/ionic-native/issues/1097)) ([2eea3df](https://github.com/driftyco/ionic-native/commit/2eea3df))
|
||||
* **app-update:** add cordova-plugin-app-update support ([#1105](https://github.com/driftyco/ionic-native/issues/1105)) ([21d4088](https://github.com/driftyco/ionic-native/commit/21d4088))
|
||||
* **appodeal:** adds Appodeal SDK wrappers for iOS and Android ([#1031](https://github.com/driftyco/ionic-native/issues/1031)) ([fd8107b](https://github.com/driftyco/ionic-native/commit/fd8107b))
|
||||
* **background-fetch:** Adding Background Fetch requested in [#990](https://github.com/driftyco/ionic-native/issues/990) ([#1013](https://github.com/driftyco/ionic-native/issues/1013)) ([57e2691](https://github.com/driftyco/ionic-native/commit/57e2691))
|
||||
* **browser-tab:** add browser tab plugin ([#1126](https://github.com/driftyco/ionic-native/issues/1126)) ([8de3793](https://github.com/driftyco/ionic-native/commit/8de3793)), closes [#1115](https://github.com/driftyco/ionic-native/issues/1115)
|
||||
* **couchbase-lite:** add CouchbaseLite cordova plugin ([#1025](https://github.com/driftyco/ionic-native/issues/1025)) ([09a7dcf](https://github.com/driftyco/ionic-native/commit/09a7dcf))
|
||||
* **file:** add system paths ([f0e2195](https://github.com/driftyco/ionic-native/commit/f0e2195))
|
||||
* **google-maps:** add constant for map type ([318ad3f](https://github.com/driftyco/ionic-native/commit/318ad3f))
|
||||
* **gyroscope:** add Gyroscope plugin ([#1004](https://github.com/driftyco/ionic-native/issues/1004)) ([0378b1d](https://github.com/driftyco/ionic-native/commit/0378b1d))
|
||||
* **inappbrowser:** add interface for IAB options ([#1065](https://github.com/driftyco/ionic-native/issues/1065)) ([f4b8236](https://github.com/driftyco/ionic-native/commit/f4b8236))
|
||||
* **local-notifications:** support for icon background color ([#1079](https://github.com/driftyco/ionic-native/issues/1079)) ([2a32624](https://github.com/driftyco/ionic-native/commit/2a32624))
|
||||
* **text-to-speech:** Add stop method ([#1063](https://github.com/driftyco/ionic-native/issues/1063)) ([4f86320](https://github.com/driftyco/ionic-native/commit/4f86320))
|
||||
* **unique-device-add:** add UniqueDeviceId plugin ([#1064](https://github.com/driftyco/ionic-native/issues/1064)) ([60db10c](https://github.com/driftyco/ionic-native/commit/60db10c))
|
||||
|
||||
|
||||
|
||||
<a name="2.5.1"></a>
|
||||
## [2.5.1](https://github.com/driftyco/ionic-native/compare/v2.5.0...v2.5.1) (2017-02-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **pin-dialog:** add missing errorIndex ([b7701cd](https://github.com/driftyco/ionic-native/commit/b7701cd))
|
||||
|
||||
|
||||
|
||||
<a name="2.5.0"></a>
|
||||
# [2.5.0](https://github.com/driftyco/ionic-native/compare/v2.4.1...v2.5.0) (2017-02-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **file-transfer:** fix return type of upload method ([a5b4632](https://github.com/driftyco/ionic-native/commit/a5b4632)), closes [#1002](https://github.com/driftyco/ionic-native/issues/1002)
|
||||
* **pinterest:** fix PinterestPin interface ([a03afcf](https://github.com/driftyco/ionic-native/commit/a03afcf))
|
||||
* **safari-view-controller:** fix issue caused by calling show without options ([dc37d8f](https://github.com/driftyco/ionic-native/commit/dc37d8f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **background-geolocation:** add missing properties for Android ([f0cf860](https://github.com/driftyco/ionic-native/commit/f0cf860))
|
||||
* **barcodescanner:** add option disableSuccessBeep ([#1035](https://github.com/driftyco/ionic-native/issues/1035)) ([97489ba](https://github.com/driftyco/ionic-native/commit/97489ba))
|
||||
* **inappbrowser:** add hide function ([#1018](https://github.com/driftyco/ionic-native/issues/1018)) ([4ab87d8](https://github.com/driftyco/ionic-native/commit/4ab87d8))
|
||||
|
||||
|
||||
|
||||
<a name="2.4.1"></a>
|
||||
## [2.4.1](https://github.com/driftyco/ionic-native/compare/v2.4.0...v2.4.1) (2017-01-24)
|
||||
|
||||
|
||||
+19
-13
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "2.4.1",
|
||||
"version": "3.1.0-rc.2",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"main": "dist/es5/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
@@ -8,12 +8,13 @@
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"rxjs": "5.0.0-beta.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/compiler": "2.2.1",
|
||||
"@angular/compiler-cli": "2.2.1",
|
||||
"@angular/core": "2.2.1",
|
||||
"browserify": "^13.3.0",
|
||||
"canonical-path": "0.0.2",
|
||||
"child-process-promise": "^2.2.0",
|
||||
"conventional-changelog-cli": "^1.2.0",
|
||||
"conventional-github-releaser": "^1.1.3",
|
||||
"cpr": "^2.0.2",
|
||||
@@ -22,6 +23,8 @@
|
||||
"dgeni": "^0.4.2",
|
||||
"dgeni-packages": "^0.10.18",
|
||||
"es6-shim": "~0.35.2",
|
||||
"fs-extra": "^2.0.0",
|
||||
"fs-extra-promise": "^0.4.1",
|
||||
"glob": "^7.1.1",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-rename": "^1.2.2",
|
||||
@@ -35,27 +38,30 @@
|
||||
"karma-phantomjs-launcher": "~1.0.2",
|
||||
"lodash": "4.17.4",
|
||||
"minimist": "^1.1.3",
|
||||
"mkdirp": "^0.5.1",
|
||||
"node-html-encoder": "0.0.2",
|
||||
"q": "1.4.1",
|
||||
"queue": "^4.2.1",
|
||||
"rimraf": "^2.5.4",
|
||||
"rxjs": "5.0.1",
|
||||
"semver": "^5.3.0",
|
||||
"tsify": "~3.0.0",
|
||||
"tslint": "^3.15.1",
|
||||
"tslint-ionic-rules": "0.0.7",
|
||||
"typescript": "~2.0.10",
|
||||
"watchify": "~3.7.0"
|
||||
"typescript": "2.0.09",
|
||||
"watchify": "~3.7.0",
|
||||
"zone.js": "0.7.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "karma start",
|
||||
"test:watch": "npm test -- --watch",
|
||||
"start": "npm run test:watch",
|
||||
"lint": "gulp lint",
|
||||
"build": "npm run lint && npm run build:js && npm run build:esm && npm run build:bundle && npm run build:minify",
|
||||
"build:js": "tsc -p tsconfig-es5.json",
|
||||
"build:esm": "tsc -p tsconfig-esm.json",
|
||||
"build:bundle": "browserify dist/es5/index.js > dist/ionic.native.js",
|
||||
"build:minify": "gulp minify:dist",
|
||||
"shipit": "npm run build && npm publish && bash ./scripts/bower.sh",
|
||||
"build": "npm run clean && npm run lint && npm run build:core && npm run build:modules",
|
||||
"build:core": "ngc -p scripts/build/tsconfig-core.json",
|
||||
"build:modules": "node scripts/build/build.js",
|
||||
"clean": "rimraf dist",
|
||||
"shipit": "npm run build && gulp readmes && npm run npmpub",
|
||||
"npmpub": "node scripts/build/publish.js",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
||||
"plugin:create": "gulp plugin:create"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
// Node module dependencies
|
||||
const fs = require('fs-extra-promise').useFs(require('fs-extra')),
|
||||
queue = require('queue'),
|
||||
path = require('path'),
|
||||
exec = require('child_process').exec;
|
||||
|
||||
// Constants for the build process. Paths and JSON files templates
|
||||
const ROOT = path.resolve(path.join(__dirname, '../../')), // root ionic-native directory
|
||||
PLUGINS_PATH = path.resolve(ROOT, 'src/@ionic-native/plugins'), // path to plugins source files
|
||||
CORE_PACKAGE_JSON = require(path.resolve(__dirname, 'core-package.json')), // core package.json
|
||||
PLUGIN_PACKAGE_JSON = require(path.resolve(__dirname, 'plugin-package.json')), // plugin package.json template
|
||||
PLUGIN_TS_CONFIG = require(path.resolve(__dirname, 'tsconfig-plugin.json')), // plugin tsconfig template
|
||||
BUILD_TMP = path.resolve(ROOT, '.tmp'), // tmp directory path
|
||||
BUILD_DIST_ROOT = path.resolve(ROOT, 'dist/packages-dist/@ionic-native'), // dist directory root path
|
||||
BUILD_PLUGINS_DIST = path.resolve(BUILD_DIST_ROOT, 'plugins'), // plugins dist directory path
|
||||
BUILD_CORE_DIST = path.resolve(BUILD_DIST_ROOT, 'core'); // core dist directory path
|
||||
|
||||
|
||||
// dependency versions
|
||||
const ANGULAR_VERSION = '2.2.1',
|
||||
RXJS_VERSION = '5.0.0-beta.12',
|
||||
IONIC_NATIVE_VERSION = require(path.resolve(ROOT, 'package.json')).version;
|
||||
|
||||
// package dependencies
|
||||
const CORE_PEER_DEPS = {
|
||||
'rxjs': RXJS_VERSION
|
||||
};
|
||||
|
||||
const PLUGIN_PEER_DEPS = {
|
||||
'@ionic-native/core': IONIC_NATIVE_VERSION,
|
||||
'@angular/core': ANGULAR_VERSION,
|
||||
'rxjs': RXJS_VERSION
|
||||
};
|
||||
|
||||
// set peer dependencies for all plugins
|
||||
PLUGIN_PACKAGE_JSON.peerDependencies = PLUGIN_PEER_DEPS;
|
||||
|
||||
|
||||
// Delete dist directory and any temporary files
|
||||
console.log('Removing old TMP directory');
|
||||
fs.removeSync(BUILD_TMP);
|
||||
fs.removeSync(BUILD_PLUGINS_DIST);
|
||||
|
||||
|
||||
// Create tmp/dist directories
|
||||
console.log('Making new TMP directory');
|
||||
fs.mkdirpSync(BUILD_TMP);
|
||||
|
||||
|
||||
// Prepare and copy the core module's package.json
|
||||
console.log('Preparing core module package.json');
|
||||
CORE_PACKAGE_JSON.version = IONIC_NATIVE_VERSION;
|
||||
CORE_PACKAGE_JSON.peerDependencies = CORE_PEER_DEPS;
|
||||
fs.writeJsonSync(path.resolve(BUILD_CORE_DIST, 'package.json'), CORE_PACKAGE_JSON);
|
||||
|
||||
|
||||
// Fetch a list of the plugins
|
||||
const PLUGINS = fs.readdirSync(PLUGINS_PATH);
|
||||
|
||||
|
||||
// Create a queue to process tasks
|
||||
const QUEUE = queue({
|
||||
concurrency: require('os').cpus().length
|
||||
});
|
||||
|
||||
|
||||
// Function to process a single plugin
|
||||
const addPluginToQueue = pluginName => {
|
||||
|
||||
QUEUE.push((callback) => {
|
||||
|
||||
console.log(`Building plugin: ${pluginName}`);
|
||||
|
||||
const PLUGIN_BUILD_DIR = path.resolve(BUILD_TMP, 'plugins', pluginName),
|
||||
PLUGIN_SRC_PATH = path.resolve(PLUGINS_PATH, pluginName, 'index.ts');
|
||||
|
||||
let tsConfigPath;
|
||||
|
||||
fs.mkdirpAsync(PLUGIN_BUILD_DIR) // create tmp build dir
|
||||
.then(() => fs.mkdirpAsync(path.resolve(BUILD_PLUGINS_DIST, pluginName))) // create dist dir
|
||||
.then(() => {
|
||||
|
||||
// Write tsconfig.json
|
||||
const tsConfig = JSON.parse(JSON.stringify(PLUGIN_TS_CONFIG));
|
||||
tsConfig.files = [PLUGIN_SRC_PATH];
|
||||
// tsConfig.compilerOptions.paths['@ionic-native/core'] = [BUILD_CORE_DIST];
|
||||
|
||||
tsConfigPath = path.resolve(PLUGIN_BUILD_DIR, 'tsconfig.json');
|
||||
|
||||
return fs.writeJsonAsync(tsConfigPath, tsConfig);
|
||||
})
|
||||
.then(() => {
|
||||
// clone package.json
|
||||
const packageJson = JSON.parse(JSON.stringify(PLUGIN_PACKAGE_JSON));
|
||||
|
||||
packageJson.name = `@ionic-native/${pluginName}`;
|
||||
packageJson.version = IONIC_NATIVE_VERSION;
|
||||
|
||||
return fs.writeJsonAsync(path.resolve(BUILD_PLUGINS_DIST, pluginName, 'package.json'), packageJson);
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
// compile the plugin
|
||||
exec(`${ROOT}/node_modules/.bin/ngc -p ${tsConfigPath}`, (err, stdout, stderr) => {
|
||||
|
||||
if (err) {
|
||||
// oops! something went wrong.
|
||||
callback(`\n\nBuilding ${pluginName} failed.`);
|
||||
console.log(err);
|
||||
return;
|
||||
}
|
||||
|
||||
// we're done with this plugin!
|
||||
callback();
|
||||
|
||||
});
|
||||
|
||||
})
|
||||
.catch(callback);
|
||||
|
||||
}); // QUEUE.push end
|
||||
|
||||
};
|
||||
|
||||
PLUGINS.forEach(addPluginToQueue);
|
||||
|
||||
QUEUE.start((err) => {
|
||||
|
||||
if (err) {
|
||||
console.log('Error building plugins. ', err);
|
||||
} else {
|
||||
console.log('Done processing plugins!');
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "@ionic-native/core",
|
||||
"version": "{{VERSION}}",
|
||||
"description": "Ionic Native - Native plugins for ionic apps",
|
||||
"module": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
"author": "ionic",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/driftyco/ionic-native.git"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "@ionic-native/{{PLUGIN}}",
|
||||
"version": "{{VERSION}}",
|
||||
"description": "Ionic Native - Native plugins for ionic apps",
|
||||
"module": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
"author": "ionic",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/driftyco/ionic-native.git"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// Node module dependencies
|
||||
const fs = require('fs-extra-promise').useFs(require('fs-extra')),
|
||||
queue = require('queue'),
|
||||
path = require('path'),
|
||||
exec = require('child-process-promise').exec;
|
||||
|
||||
|
||||
const ROOT = path.resolve(path.join(__dirname, '../../')),
|
||||
DIST = path.resolve(ROOT, 'dist', 'packages-dist', '@ionic-native'),
|
||||
PLUGINS_ROOT = path.resolve(DIST, 'plugins'),
|
||||
CORE = path.resolve(DIST, 'core');
|
||||
|
||||
const FLAGS = '--access public'; // add any flags here if you want... (example: --tag alpha)
|
||||
|
||||
console.log('Publishing @ionic-native/core');
|
||||
exec(`npm publish ${CORE} ${FLAGS}`)
|
||||
.then(() => {
|
||||
|
||||
const PLUGINS = fs.readdirSync(PLUGINS_ROOT);
|
||||
|
||||
const QUEUE = queue({
|
||||
concurrency: 10
|
||||
});
|
||||
|
||||
PLUGINS.forEach(pluginName => {
|
||||
|
||||
QUEUE.push(done => {
|
||||
|
||||
console.log(`Publishing plugin ${pluginName}`);
|
||||
const pluginPath = path.resolve(PLUGINS_ROOT, pluginName);
|
||||
|
||||
exec(`npm publish ${pluginPath} ${FLAGS}`)
|
||||
.then(() => done())
|
||||
.catch(done);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
QUEUE.start((err) => {
|
||||
|
||||
if (err) {
|
||||
console.log('Error publishing ionic-native. ', err);
|
||||
} else {
|
||||
console.log('Done publishing ionic-native!');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})
|
||||
.catch(e => {
|
||||
|
||||
console.log('Publish failed');
|
||||
console.log(e);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"declaration": true,
|
||||
"stripInternal": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../dist/packages-dist/",
|
||||
"rootDir": "../../src/",
|
||||
"target": "es5",
|
||||
"skipLibCheck": true,
|
||||
"lib": ["es2015", "dom"]
|
||||
},
|
||||
"files": [
|
||||
"../../src/@ionic-native/core/index.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"declaration": true,
|
||||
"stripInternal": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../../dist/packages-dist/",
|
||||
"paths": {
|
||||
"@ionic-native/core": ["../../../dist/packages-dist/@ionic-native/core"]
|
||||
},
|
||||
"rootDir": "../../../src/",
|
||||
"target": "es5",
|
||||
"skipLibCheck": true,
|
||||
"lib": ["es2015", "dom"]
|
||||
},
|
||||
"files": [
|
||||
"../../../src/@ionic-native/plugins/{{PLUGIN}}/index.ts"
|
||||
]
|
||||
}
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"sitePath": "../ionic-site",
|
||||
"v2DocsDir": "docs/v2/native",
|
||||
"docsDest": "../ionic-site/content/docs/v2/native"
|
||||
"docsDest": "../ionic-site/content/docs/v2/native",
|
||||
"pluginDir": "dist/packages-dist/@ionic-native/plugins"
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ module.exports = function(currentVersion) {
|
||||
readTypeScriptModules.basePath = path.resolve(path.resolve(__dirname,
|
||||
'../..'));
|
||||
readTypeScriptModules.sourceFiles = [
|
||||
'src/index.ts'
|
||||
'./src/@ionic-native/plugins/**/*.ts'
|
||||
];
|
||||
})
|
||||
|
||||
@@ -148,7 +148,7 @@ module.exports = function(currentVersion) {
|
||||
|
||||
// Configure file writing
|
||||
.config(function(writeFilesProcessor) {
|
||||
writeFilesProcessor.outputFolder = config.sitePath;
|
||||
writeFilesProcessor.outputFolder = './src/@ionic-native/plugins2/';
|
||||
})
|
||||
|
||||
// Configure rendering
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
var Package = require('dgeni').Package;
|
||||
var jsdocPackage = require('dgeni-packages/jsdoc');
|
||||
var nunjucksPackage = require('dgeni-packages/nunjucks');
|
||||
var typescriptPackage = require('./typescript-package');
|
||||
var linksPackage = require('./links-package');
|
||||
var gitPackage = require('dgeni-packages/git');
|
||||
var path = require('path');
|
||||
var semver = require('semver');
|
||||
var fs = require('fs');
|
||||
var _ = require('lodash');
|
||||
var config = require('../config.json');
|
||||
var projectPackage = require('../../package.json');
|
||||
|
||||
// jscs:disable validateIndentation
|
||||
|
||||
// Define the dgeni package for generating the docs
|
||||
module.exports = function(currentVersion) {
|
||||
|
||||
return new Package('ionic-v2-docs',
|
||||
[jsdocPackage, nunjucksPackage, typescriptPackage,
|
||||
linksPackage, gitPackage])
|
||||
|
||||
// .processor(require('./processors/latest-version'))
|
||||
.processor(require('./processors/readmes'))
|
||||
.processor(require('./processors/remove-private-members'))
|
||||
.processor(require('./processors/hide-private-api'))
|
||||
.processor(require('./processors/collect-inputs-outputs'))
|
||||
|
||||
// for debugging docs
|
||||
// .processor(function test(){
|
||||
// return {
|
||||
//
|
||||
// $runBefore: ['rendering-docs'],
|
||||
// $process: function(docs){
|
||||
// docs.forEach(function(doc){
|
||||
// if (doc.name == "Camera"){
|
||||
//
|
||||
// // console.log(doc.tags);
|
||||
// // doc.tags.forEach(function(tag){
|
||||
// // if(tag.tagName == 'classes'){
|
||||
// //
|
||||
// // }
|
||||
// // });
|
||||
//
|
||||
// // doc.moduleDoc.exports.forEach(function(d,i){
|
||||
// // if(d.name === 'CameraOptions') {
|
||||
// // console.log('Name: ' + d.name);
|
||||
// // console.log('Type: ' + d.docType);
|
||||
// // console.log('First member: ', d.members[0]);
|
||||
// // }
|
||||
// // });
|
||||
//
|
||||
//
|
||||
// // var exports = doc.exportSymbol.parent.exports;
|
||||
// // for(var p in exports) {
|
||||
// // if(p == 'CameraOptions')
|
||||
// // {
|
||||
// // var x = exports[p];
|
||||
// // console.log(x.members.quality);
|
||||
// // }
|
||||
// // }
|
||||
// // doc.members.forEach(function(method){
|
||||
// // if (method.name === "getPicture") {
|
||||
// // console.log(method);
|
||||
// // }
|
||||
// // })
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
.config(function(log) {
|
||||
log.level = 'error'; //'silly', 'debug', 'info', 'warn', 'error'
|
||||
})
|
||||
|
||||
.config(function(renderDocsProcessor, computePathsProcessor, versionInfo) {
|
||||
|
||||
versions = [];
|
||||
// new version, add it to the versions list
|
||||
if (currentVersion != 'nightly' && !_.includes(versions, currentVersion)) {
|
||||
versions.unshift(currentVersion);
|
||||
}
|
||||
//First semver valid version is latest
|
||||
var latestVersion = _.find(versions, semver.valid);
|
||||
versions = versions.map(function(version) {
|
||||
// We don't separate by versions so always put the docs in the root
|
||||
var folder = '';
|
||||
return {
|
||||
href: '/' + config.v2DocsDir.replace('content/', ''),
|
||||
folder: folder,
|
||||
name: version
|
||||
};
|
||||
});
|
||||
|
||||
var versionData = {
|
||||
list: versions,
|
||||
current: _.find(versions, {name: currentVersion}),
|
||||
latest: _.find(versions, {name: latestVersion}) || _.first(versions)
|
||||
};
|
||||
|
||||
renderDocsProcessor.extraData.version = versionData;
|
||||
renderDocsProcessor.extraData.versionInfo = versionInfo;
|
||||
computePathsProcessor.pathTemplates = [{
|
||||
docTypes: ['class', 'var', 'function', 'let'],
|
||||
getOutputPath: function(doc) {
|
||||
return doc.originalModule.replace(config.pluginDir + '/', '')
|
||||
.replace('/index', '') + '/README.md';
|
||||
}
|
||||
}];
|
||||
})
|
||||
|
||||
//configure file reading
|
||||
.config(function(readFilesProcessor, readTypeScriptModules) {
|
||||
|
||||
// Don't run unwanted processors since we are not using the normal file reading processor
|
||||
readFilesProcessor.$enabled = false;
|
||||
readFilesProcessor.basePath = path.resolve(__dirname, '../..');
|
||||
|
||||
readTypeScriptModules.basePath = path.resolve(path.resolve(__dirname,
|
||||
'../..'));
|
||||
readTypeScriptModules.sourceFiles = [
|
||||
'./src/@ionic-native/plugins/**/*.ts'
|
||||
];
|
||||
})
|
||||
|
||||
.config(function(parseTagsProcessor) {
|
||||
parseTagsProcessor.tagDefinitions = parseTagsProcessor.tagDefinitions
|
||||
.concat(require('./tag-defs/tag-defs'));
|
||||
})
|
||||
|
||||
// .config(function(parseTagsProcessor) {
|
||||
// // We actually don't want to parse param docs in this package as we are
|
||||
// // getting the data out using TS
|
||||
// parseTagsProcessor.tagDefinitions.forEach(function(tagDef) {
|
||||
// console.log(tagDef);
|
||||
// if (tagDef.name === 'param') {
|
||||
// tagDef.docProperty = 'paramData';
|
||||
// tagDef.transforms = [];
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
|
||||
// Configure links
|
||||
.config(function(getLinkInfo) {
|
||||
getLinkInfo.useFirstAmbiguousLink = false;
|
||||
})
|
||||
|
||||
// Configure file writing
|
||||
.config(function(writeFilesProcessor) {
|
||||
writeFilesProcessor.outputFolder = './dist/packages-dist/';
|
||||
})
|
||||
|
||||
// Configure rendering
|
||||
.config(function(templateFinder, templateEngine) {
|
||||
|
||||
// Nunjucks and Angular conflict in their template bindings so change the Nunjucks
|
||||
// Also conflict with Jekyll
|
||||
templateEngine.config.tags = {
|
||||
variableStart: '<$',
|
||||
variableEnd: '$>',
|
||||
blockStart: '<@',
|
||||
blockEnd: '@>',
|
||||
commentStart: '<#',
|
||||
commentEnd: '#>'
|
||||
};
|
||||
|
||||
// add custom filters to nunjucks
|
||||
templateEngine.filters.push(
|
||||
require('./filters/capital'),
|
||||
require('./filters/code'),
|
||||
require('./filters/dump')
|
||||
);
|
||||
|
||||
templateFinder.templateFolders.unshift(path.resolve(__dirname, 'templates'));
|
||||
|
||||
// Specify how to match docs to templates.
|
||||
templateFinder.templatePatterns = [
|
||||
'${ doc.template }',
|
||||
'${ doc.docType }.template.md',
|
||||
'readme.template.md'
|
||||
];
|
||||
});
|
||||
|
||||
};
|
||||
@@ -7,7 +7,23 @@ module.exports = function(gulp) {
|
||||
try {
|
||||
var ionicPackage = require('./dgeni-config')(projectPackage.version);
|
||||
var dgeni = new Dgeni([ionicPackage]);
|
||||
return dgeni.generate();
|
||||
return dgeni.generate().then(function(docs) {
|
||||
console.log(docs.length + ' docs generated');
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err.stack);
|
||||
}
|
||||
});
|
||||
|
||||
gulp.task('readmes', [], function() {
|
||||
var Dgeni = require('dgeni');
|
||||
var semver = require('semver');
|
||||
try {
|
||||
var ionicPackage = require('./dgeni-readmes-config')(projectPackage.version);
|
||||
var dgeni = new Dgeni([ionicPackage]);
|
||||
return dgeni.generate().then(function(docs) {
|
||||
console.log(docs.length + ' README files generated');
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err.stack);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
module.exports = function jekyll(renderDocsProcessor) {
|
||||
return {
|
||||
name: 'readmes',
|
||||
description: 'Create jekyll includes',
|
||||
$runAfter: ['paths-computed'],
|
||||
$runBefore: ['rendering-docs'],
|
||||
$process: function(docs) {
|
||||
var currentVersion = renderDocsProcessor.extraData.version.current.name;
|
||||
|
||||
// pretty up and sort the docs object for menu generation
|
||||
docs = docs.filter(function(doc) {
|
||||
return (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page';
|
||||
});
|
||||
|
||||
docs.forEach(function(doc, i) {
|
||||
doc.npmId = doc.outputPath.replace('/README.md', '')
|
||||
.replace('src/@ionic-native/plugins/','');
|
||||
doc.outputPath = doc.outputPath.replace('src/', '');
|
||||
});
|
||||
|
||||
// returning docs will replace docs object in the next process
|
||||
return docs;
|
||||
}
|
||||
};
|
||||
};
|
||||
+1
-1
@@ -224,7 +224,7 @@ docType: "<$ doc.docType $>"
|
||||
</p>
|
||||
<@ endif @>
|
||||
|
||||
<pre><code>$ <@ if prop.install @><$ prop.install $><@ else @>ionic plugin add <$ prop.plugin $><@ endif -@></code></pre>
|
||||
<pre><code>$ <@ if prop.install @><$ prop.install $><@ else @>npm install @ionic-native/<$ prop.pluginRef $> -save<@ endif -@></code></pre>
|
||||
<p>Repo:
|
||||
<a href="<$ prop.repo $>">
|
||||
<$ prop.repo $>
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
<@- block body @>
|
||||
<@- block content @>
|
||||
<@- block header @>
|
||||
<a style="float:right;font-size:12px;" href="http://github.com/driftyco/ionic-native/edit/master/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic-native/', '')|replace('//','/') $>#L<$ doc.location.start.line $>">
|
||||
Improve this doc
|
||||
</a>
|
||||
|
||||
# <$ doc.name $>
|
||||
<!-- end header block -->
|
||||
<@ endblock -@>
|
||||
|
||||
<@- if doc.beta == true @>
|
||||
<p style="color:orange">
|
||||
This plugin is still in beta stage and may not work as expected. Please
|
||||
submit any issues to the <a target="_blank"
|
||||
href="<$ prop.repo $>/issues">plugin repo</a>.
|
||||
</p>
|
||||
<@ endif -@>
|
||||
|
||||
<@- for prop in doc.decorators[0].argumentInfo @>
|
||||
```
|
||||
$ <@ if prop.install @><$ prop.install $><@ else @>npm install @ionic-native/<$ doc.npmId $> --save<@ endif @>
|
||||
```
|
||||
|
||||
## [Usage Documentation](https://ionicframework.com/docs/v2/native/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic-native/', '')|replace('//','/')|replace('index.ts','')|replace('src/@ionic-native/plugins/','') $>)
|
||||
|
||||
Cordova Repo: [<$ prop.repo $>](<$ prop.repo $>)
|
||||
|
||||
<!-- description -->
|
||||
<@- block description @>
|
||||
<$ doc.description $>
|
||||
<@ endblock -@>
|
||||
|
||||
<@- if doc.directiveInfo @>
|
||||
## <$ doc.directiveInfo.type $>
|
||||
### <$ doc.directiveInfo.properties[0].name $>: `<$ doc.directiveInfo.properties[0].values $>`
|
||||
<@ endif -@>
|
||||
|
||||
<@- if prop.platforms @>
|
||||
<!-- @platforms tag -->
|
||||
## Supported platforms
|
||||
<@ block platforms @>
|
||||
<@ for platform in prop.platforms -@>
|
||||
- <$ platform $>
|
||||
<@ endfor @>
|
||||
<@ endblock -@>
|
||||
<!-- @platforms tag end -->
|
||||
<@ endif -@>
|
||||
<!-- end for prop in method.decorators[0].argumentInfo -->
|
||||
<@ endfor -@>
|
||||
<!-- end content block -->
|
||||
<@ endblock -@>
|
||||
<!-- end body block -->
|
||||
<@ endblock -@>
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "##### "
|
||||
echo "##### ci/deploy.sh"
|
||||
echo "##### ci/update_docs.sh"
|
||||
echo "#####"
|
||||
|
||||
|
||||
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "##### "
|
||||
echo "##### ci/update_docs.sh"
|
||||
echo "#####"
|
||||
|
||||
|
||||
function init {
|
||||
cd ../..
|
||||
}
|
||||
|
||||
function run {
|
||||
# process new docs
|
||||
./node_modules/.bin/gulp readmes
|
||||
|
||||
# if no changes, don't commit
|
||||
CHANGED=$(git diff-index --name-only HEAD --)
|
||||
if [ -z "$CHANGED" ];
|
||||
then
|
||||
echo "-- No changes detected for the following commit, docs not updated."
|
||||
echo "https://github.com/driftyco/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
|
||||
else
|
||||
git config --global user.email "hi@ionicframework.com"
|
||||
git config --global user.name "Ionitron"
|
||||
git add -A
|
||||
git commit -am "Automated build of native readmes for driftyco/$CIRCLE_PROJECT_REPONAME@$CIRCLE_SHA1"
|
||||
# in case a different commit was pushed to ionic-site during doc/demo gen,
|
||||
# try to rebase around it before pushing
|
||||
git fetch
|
||||
git rebase
|
||||
|
||||
# git push origin master || :
|
||||
|
||||
echo "-- Updated docs for $VERSION_NAME succesfully!"
|
||||
fi
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc.sh
|
||||
@@ -0,0 +1,24 @@
|
||||
declare var window;
|
||||
|
||||
export function checkReady() {
|
||||
const DEVICE_READY_TIMEOUT = 5000;
|
||||
|
||||
|
||||
// To help developers using cordova, we listen for the device ready event and
|
||||
// log an error if it didn't fire in a reasonable amount of time. Generally,
|
||||
// when this happens, developers should remove and reinstall plugins, since
|
||||
// an inconsistent plugin is often the culprit.
|
||||
const before = Date.now();
|
||||
|
||||
let didFireReady = false;
|
||||
document.addEventListener('deviceready', () => {
|
||||
console.log('DEVICE READY FIRED AFTER', (Date.now() - before), 'ms');
|
||||
didFireReady = true;
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
if (!didFireReady && window.cordova) {
|
||||
console.warn(`Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`);
|
||||
}
|
||||
}, DEVICE_READY_TIMEOUT);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './plugin';
|
||||
@@ -1,7 +1,12 @@
|
||||
import { get } from '../util';
|
||||
import { get } from './util';
|
||||
import { checkReady } from './bootstrap';
|
||||
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/fromEvent';
|
||||
|
||||
|
||||
checkReady();
|
||||
|
||||
declare var window;
|
||||
declare var Promise;
|
||||
|
||||
@@ -29,6 +34,10 @@ export interface PluginConfig {
|
||||
* Custom install command
|
||||
*/
|
||||
install?: string;
|
||||
/**
|
||||
* Available installation variables
|
||||
*/
|
||||
installVariables?: string[];
|
||||
/**
|
||||
* Supported platforms
|
||||
*/
|
||||
@@ -116,7 +125,7 @@ export const getPlugin = function(pluginRef: string): any {
|
||||
* @param method
|
||||
*/
|
||||
export const pluginWarn = function(pluginObj: any, method?: string) {
|
||||
let pluginName = pluginObj.pluginName, plugin = pluginObj.plugin;
|
||||
let pluginName = pluginObj.constructor.getPluginName(), plugin = pluginObj.constructor.getPlugin();
|
||||
if (method) {
|
||||
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
|
||||
} else {
|
||||
@@ -203,12 +212,12 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
|
||||
// to our promise resolve/reject handlers.
|
||||
args = setIndex(args, opts, resolve, reject);
|
||||
|
||||
let pluginInstance = getPlugin(pluginObj.pluginRef);
|
||||
let pluginInstance = getPlugin(pluginObj.constructor.getPluginRef());
|
||||
|
||||
if (!pluginInstance || pluginInstance[methodName] === 'undefined') {
|
||||
// Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation).
|
||||
if (!window.cordova) {
|
||||
cordovaWarn(pluginObj.pluginName, methodName);
|
||||
cordovaWarn(pluginObj.constructor.getPluginName(), methodName);
|
||||
return {
|
||||
error: 'cordova_not_available'
|
||||
};
|
||||
@@ -234,24 +243,11 @@ export function getPromise(cb) {
|
||||
cb(resolve, reject);
|
||||
});
|
||||
} else {
|
||||
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.');
|
||||
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 2 or on a recent browser.');
|
||||
}
|
||||
};
|
||||
|
||||
if (window.angular) {
|
||||
let injector = window.angular.element(document.querySelector('[ng-app]') || document.body).injector();
|
||||
if (injector) {
|
||||
let $q = injector.get('$q');
|
||||
return $q((resolve, reject) => {
|
||||
cb(resolve, reject);
|
||||
});
|
||||
} else {
|
||||
console.warn('Angular 1 was detected but $q couldn\'t be retrieved. This is usually when the app is not bootstrapped on the html or body tag. Falling back to native promises which won\'t trigger an automatic digest when promises resolve.');
|
||||
return tryNativePromise();
|
||||
}
|
||||
} else {
|
||||
return tryNativePromise();
|
||||
}
|
||||
return tryNativePromise();
|
||||
}
|
||||
|
||||
function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
||||
@@ -292,10 +288,10 @@ function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: a
|
||||
if (opts.clearWithArgs) {
|
||||
return callCordovaPlugin(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||||
}
|
||||
return get(window, pluginObj.pluginRef)[opts.clearFunction].call(pluginObj, pluginResult);
|
||||
return get(window, pluginObj.constructor.getPluginRef())[opts.clearFunction].call(pluginObj, pluginResult);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Unable to clear the previous observable watch for', pluginObj.pluginName, methodName);
|
||||
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
|
||||
console.error(e);
|
||||
}
|
||||
};
|
||||
@@ -322,7 +318,7 @@ function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) {
|
||||
}
|
||||
return pluginObj._objectInstance[opts.clearFunction].call(pluginObj, pluginResult);
|
||||
} catch (e) {
|
||||
console.warn('Unable to clear the previous observable watch for', pluginObj.pluginName, methodName);
|
||||
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
|
||||
console.error(e);
|
||||
}
|
||||
};
|
||||
@@ -360,12 +356,12 @@ function wrapEventObservable(event: string, element: any = window): Observable<a
|
||||
function overrideFunction(pluginObj: any, methodName: string, args: any[], opts: any = {}): Observable<any> {
|
||||
return new Observable(observer => {
|
||||
|
||||
let pluginInstance = getPlugin(pluginObj.pluginRef);
|
||||
let pluginInstance = getPlugin(pluginObj.constructor.getPluginRef());
|
||||
|
||||
if (!pluginInstance) {
|
||||
// Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation).
|
||||
if (!window.cordova) {
|
||||
cordovaWarn(pluginObj.pluginName, methodName);
|
||||
cordovaWarn(pluginObj.constructor.getPluginName(), methodName);
|
||||
observer.error({
|
||||
error: 'cordova_not_available'
|
||||
});
|
||||
@@ -378,14 +374,6 @@ function overrideFunction(pluginObj: any, methodName: string, args: any[], opts:
|
||||
return;
|
||||
}
|
||||
|
||||
let method = pluginInstance[methodName];
|
||||
if (!method) {
|
||||
observer.error({
|
||||
error: 'no_such_method'
|
||||
});
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
pluginInstance[methodName] = observer.next.bind(observer);
|
||||
});
|
||||
}
|
||||
@@ -461,6 +449,22 @@ export function Plugin(config: PluginConfig) {
|
||||
return true;
|
||||
};
|
||||
|
||||
cls['getPluginName'] = function() {
|
||||
return config.pluginName;
|
||||
};
|
||||
cls['getPluginRef'] = function() {
|
||||
return config.pluginRef;
|
||||
};
|
||||
cls['getPluginInstallName'] = function() {
|
||||
return config.plugin;
|
||||
};
|
||||
cls['getPluginRepo'] = function() {
|
||||
return config.repo;
|
||||
};
|
||||
cls['getSupportedPlatforms'] = function() {
|
||||
return config.platforms;
|
||||
};
|
||||
|
||||
return cls;
|
||||
};
|
||||
}
|
||||
@@ -560,3 +564,52 @@ export function CordovaFunctionOverride(opts: any = {}) {
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface CordovaFiniteObservableOptions extends CordovaOptions {
|
||||
/**
|
||||
* Function that gets a result returned from plugin's success callback, and decides whether it is last value and observable should complete.
|
||||
*/
|
||||
resultFinalPredicate?: (result: any) => boolean;
|
||||
/**
|
||||
* Function that gets called after resultFinalPredicate, and removes service data that indicates end of stream from the result.
|
||||
*/
|
||||
resultTransform?: (result: any) => any;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* Wraps method that returns an observable that can be completed. Provided opts.resultFinalPredicate dictates when the observable completes.
|
||||
*
|
||||
*/
|
||||
export function CordovaFiniteObservable(opts: CordovaFiniteObservableOptions = {}) {
|
||||
if (opts.observable === false) {
|
||||
throw new Error('CordovaFiniteObservable decorator can only be used on methods that returns observable. Please provide correct option.');
|
||||
}
|
||||
opts.observable = true;
|
||||
return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>) => {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
let wrappedObservable: Observable<any> = wrap(this, methodName, opts).apply(this, args);
|
||||
return new Observable<any>((observer) => {
|
||||
let wrappedSubscription = wrappedObservable.subscribe({
|
||||
next: (x) => {
|
||||
observer.next(opts.resultTransform ? opts.resultTransform(x) : x);
|
||||
if (opts.resultFinalPredicate && opts.resultFinalPredicate(x)) {
|
||||
observer.complete();
|
||||
}
|
||||
},
|
||||
error: (err) => { observer.error(err); },
|
||||
complete: () => { observer.complete(); }
|
||||
});
|
||||
return () => {
|
||||
wrappedSubscription.unsubscribe();
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface ActionSheetOptions {
|
||||
|
||||
@@ -53,15 +54,23 @@ export interface ActionSheetOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { ActionSheet } from 'ionic-native';
|
||||
* import { ActionSheet, ActionSheetOptions } from '@ionic-native/action-sheet';
|
||||
*
|
||||
* constructor(private actionSheet: ActionSheet) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
|
||||
* ActionSheet.show({
|
||||
* 'title': 'What do you want with this image?',
|
||||
* 'buttonLabels': buttonLabels,
|
||||
* 'addCancelButtonWithLabel': 'Cancel',
|
||||
* 'addDestructiveButtonWithLabel' : 'Delete'
|
||||
* }).then((buttonIndex: number) => {
|
||||
*
|
||||
* const options: ActionSheetOptions = {
|
||||
* title: 'What do you want with this image?',
|
||||
* buttonLabels: buttonLabels,
|
||||
* addCancelButtonWithLabel: 'Cancel',
|
||||
* addDestructiveButtonWithLabel: 'Delete'
|
||||
* };
|
||||
*
|
||||
* this.actionSheet.show(options).then((buttonIndex: number) => {
|
||||
* console.log('Button pressed: ' + buttonIndex);
|
||||
* });
|
||||
* ```
|
||||
@@ -75,6 +84,7 @@ export interface ActionSheetOptions {
|
||||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class ActionSheet {
|
||||
|
||||
/**
|
||||
@@ -84,7 +94,7 @@ export class ActionSheet {
|
||||
* button pressed (1 based, so 1, 2, 3, etc.)
|
||||
*/
|
||||
@Cordova()
|
||||
static show(options?: ActionSheetOptions): Promise<any> { return; }
|
||||
show(options?: ActionSheetOptions): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
@@ -92,6 +102,5 @@ export class ActionSheet {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves when the actionsheet is closed
|
||||
*/
|
||||
@Cordova()
|
||||
static hide(options?: any): Promise<any> { return; }
|
||||
|
||||
hide(options?: any): Promise<any> { return; }
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export type AdMobAdSize = 'SMART_BANNER' | 'BANNER' | 'MEDIUM_RECTANGLE' | 'FULL_BANNER' | 'LEADERBOARD' | 'SKYSCRAPER' | 'CUSTOM';
|
||||
export type AdSize = 'SMART_BANNER' | 'BANNER' | 'MEDIUM_RECTANGLE' | 'FULL_BANNER' | 'LEADERBOARD' | 'SKYSCRAPER' | 'CUSTOM';
|
||||
|
||||
export interface AdMobOptions {
|
||||
|
||||
@@ -13,7 +14,7 @@ export interface AdMobOptions {
|
||||
/**
|
||||
* Banner Ad Size, defaults to `SMART_BANNER`. IT can be: `SMART_BANNER`, `BANNER`, `MEDIUM_RECTANGLE`, `FULL_BANNER`, `LEADERBOARD`, `SKYSCRAPER`, or `CUSTOM`
|
||||
*/
|
||||
adSize?: AdMobAdSize;
|
||||
adSize?: AdSize;
|
||||
|
||||
/**
|
||||
* Banner width, valid when `adSize` is set to `CUSTOM`
|
||||
@@ -63,11 +64,11 @@ export interface AdMobOptions {
|
||||
/**
|
||||
* Set extra color style for Ad
|
||||
*/
|
||||
adExtras?: AdMobAdExtras;
|
||||
adExtras?: AdExtras;
|
||||
|
||||
}
|
||||
|
||||
export interface AdMobAdExtras {
|
||||
export interface AdExtras {
|
||||
|
||||
color_bg: string;
|
||||
|
||||
@@ -89,23 +90,25 @@ export interface AdMobAdExtras {
|
||||
* Plugin for Google Ads, including AdMob / DFP (doubleclick for publisher) and mediations to other Ad networks.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AdMob } from 'ionic-native';
|
||||
* import { AdMob, AdMobOptions, AdSize, AdExtras } from '@ionic-native/ad-mob';
|
||||
*
|
||||
* constructor(private admob: AdMob){}
|
||||
*
|
||||
* ionViewDidLoad() {
|
||||
* AdMob.onAdDismiss()
|
||||
* this.admob.onAdDismiss()
|
||||
* .subscribe(() => { console.log('User dismissed ad'); });
|
||||
* }
|
||||
*
|
||||
* onClick() {
|
||||
* AdMob.prepareInterstitial('YOUR_ADID')
|
||||
* .then(() => { AdMob.showInterstitial(); });
|
||||
* this.admob.prepareInterstitial('YOUR_ADID')
|
||||
* .then(() => { this.admob.showInterstitial(); });
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* AdMobOptions
|
||||
* AdMobAdExtras
|
||||
* AdExtras
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AdMob',
|
||||
@@ -114,6 +117,7 @@ export interface AdMobAdExtras {
|
||||
repo: 'https://github.com/floatinghotpot/cordova-admob-pro',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class AdMob {
|
||||
|
||||
/**
|
||||
@@ -139,7 +143,7 @@ export class AdMob {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves when the banner is created
|
||||
*/
|
||||
@Cordova()
|
||||
static createBanner(adIdOrOptions: string | AdMobOptions): Promise<any> { return; }
|
||||
createBanner(adIdOrOptions: string | AdMobOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Destroy the banner, remove it from screen.
|
||||
@@ -147,7 +151,7 @@ export class AdMob {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static removeBanner(): void { }
|
||||
removeBanner(): void { }
|
||||
|
||||
/**
|
||||
* Show banner at position
|
||||
@@ -156,7 +160,7 @@ export class AdMob {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static showBanner(position: number): void { }
|
||||
showBanner(position: number): void { }
|
||||
|
||||
/**
|
||||
* Show banner at custom position
|
||||
@@ -166,7 +170,7 @@ export class AdMob {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static showBannerAtXY(x: number, y: number): void { }
|
||||
showBannerAtXY(x: number, y: number): void { }
|
||||
|
||||
/**
|
||||
* Hide the banner, remove it from screen, but can show it later
|
||||
@@ -174,7 +178,7 @@ export class AdMob {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static hideBanner(): void { }
|
||||
hideBanner(): void { }
|
||||
|
||||
/**
|
||||
* Prepare interstitial banner
|
||||
@@ -182,7 +186,7 @@ export class AdMob {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves when interstitial is prepared
|
||||
*/
|
||||
@Cordova()
|
||||
static prepareInterstitial(adIdOrOptions: string | AdMobOptions): Promise<any> { return; }
|
||||
prepareInterstitial(adIdOrOptions: string | AdMobOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show interstitial ad when it's ready
|
||||
@@ -190,7 +194,7 @@ export class AdMob {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static showInterstitial(): void { }
|
||||
showInterstitial(): void { }
|
||||
|
||||
/**
|
||||
* Prepare a reward video ad
|
||||
@@ -198,7 +202,7 @@ export class AdMob {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves when the ad is prepared
|
||||
*/
|
||||
@Cordova()
|
||||
static prepareRewardVideoAd(adIdOrOptions: string | AdMobOptions): Promise<any> { return; }
|
||||
prepareRewardVideoAd(adIdOrOptions: string | AdMobOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show a reward video ad
|
||||
@@ -206,7 +210,7 @@ export class AdMob {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static showRewardVideoAd(): void { }
|
||||
showRewardVideoAd(): void { }
|
||||
|
||||
/**
|
||||
* Sets the values for configuration and targeting
|
||||
@@ -214,14 +218,14 @@ export class AdMob {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves when the options have been set
|
||||
*/
|
||||
@Cordova()
|
||||
static setOptions(options: AdMobOptions): Promise<any> { return; }
|
||||
setOptions(options: AdMobOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get user ad settings
|
||||
* @returns {Promise<any>} Returns a promise that resolves with the ad settings
|
||||
*/
|
||||
@Cordova()
|
||||
static getAdSettings(): Promise<any> { return; }
|
||||
getAdSettings(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Triggered when failed to receive Ad
|
||||
@@ -231,7 +235,7 @@ export class AdMob {
|
||||
eventObservable: true,
|
||||
event: 'onAdFailLoad'
|
||||
})
|
||||
static onAdFailLoad(): Observable<any> { return; }
|
||||
onAdFailLoad(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Triggered when Ad received
|
||||
@@ -241,7 +245,7 @@ export class AdMob {
|
||||
eventObservable: true,
|
||||
event: 'onAdLoaded'
|
||||
})
|
||||
static onAdLoaded(): Observable<any> { return; }
|
||||
onAdLoaded(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Triggered when Ad will be showed on screen
|
||||
@@ -251,7 +255,7 @@ export class AdMob {
|
||||
eventObservable: true,
|
||||
event: 'onAdPresent'
|
||||
})
|
||||
static onAdPresent(): Observable<any> { return; }
|
||||
onAdPresent(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Triggered when user click the Ad, and will jump out of your App
|
||||
@@ -261,7 +265,7 @@ export class AdMob {
|
||||
eventObservable: true,
|
||||
event: 'onAdLeaveApp'
|
||||
})
|
||||
static onAdLeaveApp(): Observable<any> { return; }
|
||||
onAdLeaveApp(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Triggered when dismiss the Ad and back to your App
|
||||
@@ -271,6 +275,6 @@ export class AdMob {
|
||||
eventObservable: true,
|
||||
event: 'onAdDismiss'
|
||||
})
|
||||
static onAdDismiss(): Observable<any> { return; }
|
||||
onAdDismiss(): Observable<any> { return; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
export interface AlipayOrder {
|
||||
/**
|
||||
* appId assigned by Alipay
|
||||
*/
|
||||
app_id: string;
|
||||
|
||||
/**
|
||||
* Api name.
|
||||
* Should be: alipay.trade.app.pay
|
||||
*/
|
||||
method: string;
|
||||
|
||||
/**
|
||||
* Data format
|
||||
* Default: "JSON"
|
||||
*/
|
||||
format?: string;
|
||||
|
||||
/**
|
||||
* Charset
|
||||
* Possible values: "UTF-8", "GBK"
|
||||
* Default: "UTF-8"
|
||||
*/
|
||||
charset: string;
|
||||
|
||||
/**
|
||||
* Sign method
|
||||
* Default: 'RSA'
|
||||
*/
|
||||
sign_type: string;
|
||||
|
||||
/**
|
||||
* Sign value. Should be got from server side.
|
||||
* Default: 'RSA'
|
||||
*/
|
||||
sign: string;
|
||||
|
||||
/**
|
||||
* Timestamp, formated like "yyyy-MM-dd HH:mm:ss", e.g. 2014-07-24 03:07:50
|
||||
*/
|
||||
timestamp: string;
|
||||
|
||||
/**
|
||||
* Api version. Fixed value '1.0'
|
||||
*/
|
||||
version: string;
|
||||
|
||||
/**
|
||||
* Notify url.
|
||||
*/
|
||||
notify_url: string;
|
||||
|
||||
/**
|
||||
* biz content. formated in json. see alipay doc for detail.
|
||||
*/
|
||||
biz_content: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Alipay
|
||||
* @description
|
||||
* This plugin is used for Alipay APP support. Integrated with the latest SDK.
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-alipay-base`. For more info, please see the [Alipay plugin docs](https://github.com/xueron/cordova-alipay-base).
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Alipay, AlipayOrder } from '@ionic-native/alipay';
|
||||
*
|
||||
* constructor(private alipay: Alipay) {
|
||||
*
|
||||
* // Should get from server side with sign.
|
||||
* const alipayOrder: AlipayOrder = {
|
||||
* ...
|
||||
* };
|
||||
*
|
||||
*
|
||||
* this.alipay.pay(alipayOrder)
|
||||
* .then(result => {
|
||||
* console.log(result); // Success
|
||||
* })
|
||||
* .catch(error => {
|
||||
* console.log(error); // Failed
|
||||
* });
|
||||
*
|
||||
* }
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* AlipayOrder
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Alipay',
|
||||
plugin: 'cordova-alipay-base',
|
||||
pluginRef: 'Alipay.Base',
|
||||
repo: 'https://github.com/xueron/cordova-alipay-base',
|
||||
platforms: ['Android', 'iOS'],
|
||||
install: 'ionic plugin add https://github.com/xueron/cordova-alipay-base --variable APP_ID=your_app_id'
|
||||
})
|
||||
@Injectable()
|
||||
export class Alipay {
|
||||
/**
|
||||
* Open Alipay to perform App pay
|
||||
* @param order { AlipayOrder } alipay options
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the success return, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
pay(order: AlipayOrder): Promise<any> { return; }
|
||||
}
|
||||
|
||||
+53
-39
@@ -1,6 +1,8 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface AndroidFingerprintAuthOptions {
|
||||
|
||||
export interface AFAAuthOptions {
|
||||
|
||||
/**
|
||||
* Required
|
||||
@@ -63,20 +65,56 @@ export interface AndroidFingerprintAuthOptions {
|
||||
|
||||
}
|
||||
|
||||
export interface AFADecryptOptions {
|
||||
/**
|
||||
* Biometric authentication
|
||||
*/
|
||||
withFingerprint: boolean;
|
||||
/**
|
||||
* Authentication using backup credential activity
|
||||
*/
|
||||
withBackup: boolean;
|
||||
/**
|
||||
* FingerprintAuth.CipherMode.DECRYPT
|
||||
* Decrypted password
|
||||
*/
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface AFAEncryptResponse {
|
||||
/**
|
||||
* Biometric authentication
|
||||
*/
|
||||
withFingerprint: boolean;
|
||||
/**
|
||||
* Authentication using backup credential activity
|
||||
*/
|
||||
withBackup: boolean;
|
||||
/**
|
||||
* base64encoded string representation of user credentials
|
||||
*/
|
||||
token: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Android Fingerprint Auth
|
||||
* @description
|
||||
* This plugin will open a native dialog fragment prompting the user to authenticate using their fingerprint. If the device has a secure lockscreen (pattern, PIN, or password), the user may opt to authenticate using that method as a backup.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AndroidFingerprintAuth } from 'ionic-native';
|
||||
* import { AndroidFingerprintAuth, AFAAuthOptions } from '@ionic-native/android-fingerprint-auth';
|
||||
*
|
||||
* AndroidFingerprintAuth.isAvailable()
|
||||
* constructor(private androidFingerprintAuth: AndroidFingerprintAuth) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.androidFingerprintAuth.isAvailable()
|
||||
* .then((result)=> {
|
||||
* if(result.isAvailable){
|
||||
* // it is available
|
||||
*
|
||||
* AndroidFingerprintAuth.encrypt({ clientId: "myAppName", username: "myUsername", password: "myPassword" })
|
||||
* this.androidFingerprintAuth.encrypt({ clientId: "myAppName", username: "myUsername", password: "myPassword" })
|
||||
* .then(result => {
|
||||
* if (result.withFingerprint) {
|
||||
* console.log("Successfully encrypted credentials.");
|
||||
@@ -98,7 +136,9 @@ export interface AndroidFingerprintAuthOptions {
|
||||
* .catch(error => console.error(error));
|
||||
* ```
|
||||
* @interfaces
|
||||
* AndroidFingerprintAuthOptions
|
||||
* AFAAuthOptions
|
||||
* AFAEncryptResponse
|
||||
* AFADecryptOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AndroidFingerprintAuth',
|
||||
@@ -106,62 +146,36 @@ export interface AndroidFingerprintAuthOptions {
|
||||
pluginRef: 'FingerprintAuth',
|
||||
repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth'
|
||||
})
|
||||
@Injectable()
|
||||
export class AndroidFingerprintAuth {
|
||||
|
||||
/**
|
||||
* Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
|
||||
* @param options {AndroidFingerprintAuthOptions} Options
|
||||
* @param options {AFAAuthOptions} Options
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static encrypt(options: AndroidFingerprintAuthOptions): Promise<{
|
||||
/**
|
||||
* Biometric authentication
|
||||
*/
|
||||
withFingerprint: boolean;
|
||||
/**
|
||||
* Authentication using backup credential activity
|
||||
*/
|
||||
withBackup: boolean;
|
||||
/**
|
||||
* base64encoded string representation of user credentials
|
||||
*/
|
||||
token: string;
|
||||
}> {return; }
|
||||
encrypt(options: AFAAuthOptions): Promise<AFAEncryptResponse> {return; }
|
||||
|
||||
/**
|
||||
* Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
|
||||
* @param options {AndroidFingerprintAuthOptions} Options
|
||||
* @param options {AFAAuthOptions} Options
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static decrypt(options: AndroidFingerprintAuthOptions): Promise<{
|
||||
/**
|
||||
* Biometric authentication
|
||||
*/
|
||||
withFingerprint: boolean;
|
||||
/**
|
||||
* Authentication using backup credential activity
|
||||
*/
|
||||
withBackup: boolean;
|
||||
/**
|
||||
* FingerprintAuth.CipherMode.DECRYPT
|
||||
* Decrypted password
|
||||
*/
|
||||
password: string;
|
||||
}> {return; }
|
||||
decrypt(options: AFAAuthOptions): Promise<AFADecryptOptions> {return; }
|
||||
|
||||
/**
|
||||
* Check if service is available
|
||||
* @returns {Promise<any>} Returns a Promise that resolves if fingerprint auth is available on the device
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<{isAvailable: boolean}> { return; }
|
||||
isAvailable(): Promise<{isAvailable: boolean}> { return; }
|
||||
|
||||
/**
|
||||
* Delete the cipher used for encryption and decryption by username
|
||||
* @returns {Promise<any>} Returns a Promise that resolves if the cipher was successfully deleted
|
||||
*/
|
||||
@Cordova()
|
||||
static delete(options: {clientId: string; username: string; }): Promise<{deleted: boolean}> { return; }
|
||||
delete(options: {clientId: string; username: string; }): Promise<{deleted: boolean}> { return; }
|
||||
}
|
||||
+12
-6
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name App Availability
|
||||
@@ -9,18 +10,22 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AppAvailability, Device } from 'ionic-native';
|
||||
* import { AppAvailability } from '@ionic-native/app-availability';
|
||||
* import { Platform } from 'ionic-angular';
|
||||
*
|
||||
* constructor(private appAvailability: AppAvailability, private platform: Platform) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let app;
|
||||
*
|
||||
* if (Device.platform === 'iOS') {
|
||||
* if (this.platform.is('ios')) {
|
||||
* app = 'twitter://';
|
||||
* } else if (Device.platform === 'Android') {
|
||||
* } else if (this.platform.is('android')) {
|
||||
* app = 'com.twitter.android';
|
||||
* }
|
||||
*
|
||||
* AppAvailability.check(app)
|
||||
* this.appAvailability.check(app)
|
||||
* .then(
|
||||
* (yes: string) => console.log(app + ' is available'),
|
||||
* (no: string) => console.log(app + ' is NOT available')
|
||||
@@ -34,6 +39,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
repo: 'https://github.com/ohh2ahh/AppAvailability',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class AppAvailability {
|
||||
|
||||
/**
|
||||
@@ -42,6 +48,6 @@ export class AppAvailability {
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static check(app: string): Promise<boolean> { return; }
|
||||
check(app: string): Promise<boolean> { return; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/**
|
||||
* @name App Preferences
|
||||
* @description
|
||||
* This plugin allows you to read and write app preferences
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AppPreferences } from '@ionic-native/app-preferences';
|
||||
*
|
||||
* constructor(private appPreferences: AppPreferences) {
|
||||
*
|
||||
* this.appPreferences.fetch('key').then((res) => { console.log(res); });
|
||||
*
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AppPreferences',
|
||||
plugin: 'cordova-plugin-app-preferences', // npm package name, example: cordova-plugin-camera
|
||||
pluginRef: 'plugins.appPreferences', // the variable reference to call the plugin, example: navigator.geolocation
|
||||
repo: 'https://github.com/apla/me.apla.cordova.app-preferences', // the github repository URL for the plugin
|
||||
})
|
||||
@Injectable()
|
||||
export class AppPreferences {
|
||||
|
||||
/**
|
||||
* Get a preference value
|
||||
*
|
||||
* @param {string} dict Dictionary for key (OPTIONAL)
|
||||
* @param {string} key Key
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true,
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
fetch(dict: string, key?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set a preference value
|
||||
*
|
||||
* @param {string} dict Dictionary for key (OPTIONAL)
|
||||
* @param {string} key Key
|
||||
* @param {string} value Value
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
store(dict: string, key: string, value?: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove value from preferences
|
||||
*
|
||||
* @param {string} dict Dictionary for key (OPTIONAL)
|
||||
* @param {string} key Key
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
remove(dict: string, key?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Clear preferences
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
clearAll(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show native preferences interface
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
show(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show native preferences interface
|
||||
*
|
||||
* @param {boolean} subscribe true value to subscribe, false - unsubscribe
|
||||
* @return {Observable<any>} Returns an observable
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
watch(subscribe: boolean): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Return named configuration context
|
||||
* In iOS you'll get a suite configuration, on Android — named file
|
||||
* Supports: Android, iOS
|
||||
* @param {string} suiteName suite name
|
||||
* @returns {Object} Custom object, bound to that suite
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
suite(suiteName: string): Object { return; }
|
||||
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
iosSuite(suiteName: string): Object { return; }
|
||||
|
||||
/**
|
||||
* Return cloud synchronized configuration context
|
||||
* Currently supports Windows and iOS/macOS
|
||||
* @returns {Object} Custom object, bound to that suite
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows', 'Windows Phone 8']
|
||||
})
|
||||
cloudSync(): Object { return; }
|
||||
|
||||
/**
|
||||
* Return default configuration context
|
||||
* Currently supports Windows and iOS/macOS
|
||||
* @returns {Object} Custom Object, bound to that suite
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows', 'Windows Phone 8']
|
||||
})
|
||||
defaults(): Object { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, Plugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
declare var window;
|
||||
|
||||
@@ -47,7 +49,7 @@ export interface AppRatePreferences {
|
||||
/**
|
||||
* App Store URLS
|
||||
*/
|
||||
storeAppURL?: AppRateStoreAppUrls;
|
||||
storeAppURL?: AppUrls;
|
||||
|
||||
}
|
||||
|
||||
@@ -65,7 +67,7 @@ export interface AppRateCallbacks {
|
||||
|
||||
}
|
||||
|
||||
export interface AppRateStoreAppUrls {
|
||||
export interface AppUrls {
|
||||
|
||||
/**
|
||||
* application id in AppStore
|
||||
@@ -77,6 +79,11 @@ export interface AppRateStoreAppUrls {
|
||||
*/
|
||||
android?: string;
|
||||
|
||||
/**
|
||||
* application URL in Windows Store
|
||||
*/
|
||||
windows?: string;
|
||||
|
||||
/**
|
||||
* application URL in AppWorld
|
||||
*/
|
||||
@@ -98,19 +105,24 @@ export interface AppRateStoreAppUrls {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AppRate } from 'ionic-native';
|
||||
* import { AppRate } from '@ionic-native/app-rate';
|
||||
*
|
||||
* AppRate.preferences.storeAppURL = {
|
||||
* constructor(private appRate: AppRate) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.appRate.preferences.storeAppURL = {
|
||||
* ios: '<my_app_id>',
|
||||
* android: 'market://details?id=<package_name>',
|
||||
* windows: 'ms-windows-store://review/?ProductId=<Store_ID>'
|
||||
* };
|
||||
*
|
||||
* AppRate.promptForRating(false);
|
||||
* this.appRate.promptForRating(false);
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* AppRatePreferences
|
||||
* AppRateStoreAppUrls
|
||||
* AppUrls
|
||||
* AppRateCallbacks
|
||||
*
|
||||
*/
|
||||
@@ -119,8 +131,9 @@ export interface AppRateStoreAppUrls {
|
||||
plugin: 'cordova-plugin-apprate',
|
||||
pluginRef: 'AppRate',
|
||||
repo: 'https://github.com/pushandplay/cordova-plugin-apprate',
|
||||
platforms: ['Android', 'iOS']
|
||||
platforms: ['Android', 'iOS', 'Windows (experimental)']
|
||||
})
|
||||
@Injectable()
|
||||
export class AppRate {
|
||||
|
||||
/**
|
||||
@@ -128,13 +141,13 @@ export class AppRate {
|
||||
* See table below for options
|
||||
*/
|
||||
@CordovaProperty
|
||||
static preferences: AppRatePreferences;
|
||||
preferences: AppRatePreferences;
|
||||
|
||||
/**
|
||||
* Prompts the user for rating
|
||||
* @param {boolean} immediately Show the rating prompt immediately.
|
||||
*/
|
||||
@Cordova()
|
||||
static promptForRating(immediately: boolean): void { };
|
||||
promptForRating(immediately: boolean): void { };
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/**
|
||||
* @name App Update
|
||||
* @description
|
||||
* This plugin does self-update for android
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* You should first host an XML file on your server with the following data in it:
|
||||
* ```xml
|
||||
* <update>
|
||||
* <version>302048</version>
|
||||
* <name>APK Name</name>
|
||||
* <url>https://your-remote-api.com/YourApp.apk</url>
|
||||
* </update>
|
||||
* ```
|
||||
*
|
||||
* Then use the following code:
|
||||
*
|
||||
* ```
|
||||
* import { AppUpdate } from '@ionic-native/app-update';
|
||||
*
|
||||
* constructor(private appUpdate: AppUpdate) {
|
||||
*
|
||||
* const updateUrl = 'http://your-remote-api.com/update.xml';
|
||||
* this.appUpdate.checkAppUpdate(updateUrl);
|
||||
*
|
||||
* }
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* The plugin will compare the app version and update it automatically if the API has a newer version to install.
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AppUpdate',
|
||||
plugin: 'cordova-plugin-app-update',
|
||||
pluginRef: 'AppUpdate',
|
||||
repo: 'https://github.com/vaenow/cordova-plugin-app-update',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class AppUpdate {
|
||||
/**
|
||||
* Check and update
|
||||
* @param updateUrl {string} update api url
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
checkAppUpdate(updateUrl: string): Promise<any> { return; }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @name App Version
|
||||
@@ -9,13 +12,18 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AppVersion } from 'ionic-native';
|
||||
* import { AppVersion } from '@ionic-native/app-version';
|
||||
*
|
||||
* constructor(private appVersion: AppVersion) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* AppVersion.getAppName();
|
||||
* AppVersion.getPackageName();
|
||||
* AppVersion.getVersionCode();
|
||||
* AppVersion.getVersionNumber();
|
||||
* this.appVersion.getAppName();
|
||||
* this.appVersion.getPackageName();
|
||||
* this.appVersion.getVersionCode();
|
||||
* this.appVersion.getVersionNumber();
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -25,6 +33,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
repo: 'https://github.com/whiteoctober/cordova-plugin-app-version',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class AppVersion {
|
||||
|
||||
/**
|
||||
@@ -32,27 +41,27 @@ export class AppVersion {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getAppName(): Promise<any> { return; }
|
||||
getAppName(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the package name of the app
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getPackageName(): Promise<any> { return; }
|
||||
getPackageName(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the build identifier of the app
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getVersionCode(): Promise<any> { return; }
|
||||
getVersionCode(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the version of the app
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getVersionNumber(): Promise<any> { return; }
|
||||
getVersionNumber(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,519 @@
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/**
|
||||
* @name Appodeal
|
||||
* @description
|
||||
* Plugin to serve ads through native Appodeal SDKs
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Appodeal } from '@ionic-native/appodeal';
|
||||
*
|
||||
* constructor(private appodeal: Appodeal) {
|
||||
*
|
||||
* const appKey = '<your app key>';
|
||||
* appodeal.initialize(appKey, appodeal.AD_TYPES.REWARDED_VIDEO);
|
||||
* appodeal.show(appodeal.AD_TYPES.REWARDED_VIDEO);
|
||||
*
|
||||
* }
|
||||
*
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Appodeal',
|
||||
plugin: 'https://github.com/appodeal/appodeal-cordova-plugin',
|
||||
pluginRef: 'Appodeal',
|
||||
repo: 'https://github.com/appodeal/appodeal-cordova-plugin.git',
|
||||
platforms: [ 'ios', 'android' ]
|
||||
})
|
||||
@Injectable()
|
||||
export class Appodeal {
|
||||
// available types of advertisements
|
||||
readonly AD_TYPES = {
|
||||
INTERSTITIAL: 1,
|
||||
SKIPPABLE_VIDEO: 2,
|
||||
BANNER: 4,
|
||||
BANNER_BOTTOM: 8,
|
||||
BANNER_TOP: 16,
|
||||
REWARDED_VIDEO: 128,
|
||||
NON_SKIPPABLE_VIDEO: 256
|
||||
};
|
||||
|
||||
/**
|
||||
* initialize Appodeal SDK
|
||||
* @param {string} appKey
|
||||
* @param {number} adType
|
||||
*/
|
||||
@Cordova()
|
||||
initialize(appKey: string, adType: number): void {};
|
||||
|
||||
/**
|
||||
* check if SDK has been initialized
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
isInitialized(): Promise<any> { return; };
|
||||
|
||||
/**
|
||||
* show ad of specified type
|
||||
* @param {number} adType
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
show(adType: number): Promise<any> { return; };
|
||||
|
||||
/**
|
||||
* show ad of specified type with placement options
|
||||
* @param {number} adType
|
||||
* @param {any} placement
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
showWithPlacement(
|
||||
adType: number,
|
||||
placement: any
|
||||
): Promise<any> { return; };
|
||||
|
||||
/**
|
||||
* hide ad of specified type
|
||||
* @param {number} adType
|
||||
*/
|
||||
@Cordova()
|
||||
hide(adType: number): void {};
|
||||
|
||||
/**
|
||||
* confirm use of ads of specified type
|
||||
* @param {number} adType
|
||||
*/
|
||||
@Cordova()
|
||||
confirm(adType: number): void {};
|
||||
|
||||
/**
|
||||
* check if ad of specified type has been loaded
|
||||
* @param {number} adType
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
isLoaded(adType: number): Promise<any> { return; };
|
||||
|
||||
/**
|
||||
* check if ad of specified
|
||||
* @param {number} adType
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
isPrecache(adType: number): Promise<any> { return; };
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} adType
|
||||
* @param autoCache
|
||||
*/
|
||||
@Cordova()
|
||||
setAutoCache(adType: number, autoCache: any): void {};
|
||||
|
||||
/**
|
||||
* forcefully cache an ad by type
|
||||
* @param {number} adType
|
||||
*/
|
||||
@Cordova()
|
||||
cache(adType: number): void {};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {boolean} set
|
||||
*/
|
||||
@Cordova()
|
||||
setOnLoadedTriggerBoth(set: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable or disable Smart Banners
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
setSmartBanners(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable or disable banner backgrounds
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
setBannerBackground(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable or disable banner animations
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
setBannerAnimation(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
@Cordova()
|
||||
set728x90Banners(value: any): void {};
|
||||
|
||||
/**
|
||||
* enable or disable logging
|
||||
* @param {boolean} logging
|
||||
*/
|
||||
@Cordova()
|
||||
setLogging(logging: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable or disable testing mode
|
||||
* @param {boolean} testing
|
||||
*/
|
||||
@Cordova()
|
||||
setTesting(testing: boolean): void {};
|
||||
|
||||
/**
|
||||
* reset device ID
|
||||
*/
|
||||
@Cordova()
|
||||
resetUUID(): void {};
|
||||
|
||||
/**
|
||||
* get version of Appdeal SDK
|
||||
*/
|
||||
@Cordova()
|
||||
getVersion(): Promise<any> { return; };
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} network
|
||||
* @param {number} adType
|
||||
*/
|
||||
@Cordova()
|
||||
disableNetwork(network?: string, adType?: number): void {};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} network
|
||||
* @param {number} adType
|
||||
*/
|
||||
@Cordova()
|
||||
disableNetworkType(network?: string, adType?: number): void {};
|
||||
|
||||
/**
|
||||
* disable Location permissions for Appodeal SDK
|
||||
*/
|
||||
@Cordova()
|
||||
disableLocationPermissionCheck(): void {};
|
||||
|
||||
/**
|
||||
* disable Storage permissions for Appodeal SDK
|
||||
*/
|
||||
@Cordova()
|
||||
disableWriteExternalStoragePermissionCheck(): void {};
|
||||
|
||||
/**
|
||||
* enable event listeners
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
enableInterstitialCallbacks(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable event listeners
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
enableSkippableVideoCallbacks(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable event listeners
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
enableNonSkippableVideoCallbacks(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable event listeners
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
enableBannerCallbacks(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable event listeners
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
enableRewardedVideoCallbacks(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} name - name of rule
|
||||
* @param {boolean} value
|
||||
*/
|
||||
@Cordova()
|
||||
setCustomBooleanRule(name: string, value: boolean): void {};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} name - name of rule
|
||||
* @param {number} value
|
||||
*/
|
||||
@Cordova()
|
||||
setCustomIntegerRule(name: string, value: number): void {};
|
||||
|
||||
/**
|
||||
* set rule with float value
|
||||
* @param {string} name
|
||||
* @param {number} value
|
||||
*/
|
||||
@Cordova()
|
||||
setCustomDoubleRule(name: string, value: number): void {};
|
||||
|
||||
/**
|
||||
* set rule with string value
|
||||
* @param {string} name - name of rule
|
||||
* @param {string} value
|
||||
*/
|
||||
@Cordova()
|
||||
setCustomStringRule(name: string, value: string): void {};
|
||||
|
||||
/**
|
||||
* set ID preference in Appodeal for current user
|
||||
* @param id
|
||||
*/
|
||||
@Cordova()
|
||||
setUserId(id: any): void {};
|
||||
|
||||
/**
|
||||
* set Email preference in Appodeal for current user
|
||||
* @param email
|
||||
*/
|
||||
@Cordova()
|
||||
setEmail(email: any): void {};
|
||||
|
||||
/**
|
||||
* set Birthday preference in Appodeal for current user
|
||||
* @param birthday
|
||||
*/
|
||||
@Cordova()
|
||||
setBirthday(birthday: any): void {};
|
||||
|
||||
/**
|
||||
* et Age preference in Appodeal for current user
|
||||
* @param age
|
||||
*/
|
||||
@Cordova()
|
||||
setAge(age: any): void {};
|
||||
|
||||
/**
|
||||
* set Gender preference in Appodeal for current user
|
||||
* @param gender
|
||||
*/
|
||||
@Cordova()
|
||||
setGender(gender: any): void {};
|
||||
|
||||
/**
|
||||
* set Occupation preference in Appodeal for current user
|
||||
* @param occupation
|
||||
*/
|
||||
@Cordova()
|
||||
setOccupation(occupation: any): void {};
|
||||
|
||||
/**
|
||||
* set Relation preference in Appodeal for current user
|
||||
* @param relation
|
||||
*/
|
||||
@Cordova()
|
||||
setRelation(relation: any): void {};
|
||||
|
||||
/**
|
||||
* set Smoking preference in Appodeal for current user
|
||||
* @param smoking
|
||||
*/
|
||||
@Cordova()
|
||||
setSmoking(smoking: any): void {};
|
||||
|
||||
/**
|
||||
* set Alcohol preference in Appodeal for current user
|
||||
* @param alcohol
|
||||
*/
|
||||
@Cordova()
|
||||
setAlcohol(alcohol: any): void {};
|
||||
|
||||
/**
|
||||
* set Interests preference in Appodeal for current user
|
||||
* @param interests
|
||||
*/
|
||||
@Cordova()
|
||||
setInterests(interests: any): void {};
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onInterstitialLoaded',
|
||||
element: document
|
||||
})
|
||||
onInterstitialLoaded(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onInterstitialFailedToLoad',
|
||||
element: document
|
||||
})
|
||||
onInterstitialFailedToLoad(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onInterstitialShown',
|
||||
element: document
|
||||
})
|
||||
onInterstitialShown(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onInterstitialClicked',
|
||||
element: document
|
||||
})
|
||||
onInterstitialClicked(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onInterstitialClosed',
|
||||
element: document
|
||||
})
|
||||
onInterstitialClosed(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onSkippableVideoLoaded',
|
||||
element: document
|
||||
})
|
||||
onSkippableVideoLoaded(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onSkippableVideoFailedToLoad',
|
||||
element: document
|
||||
})
|
||||
onSkippableVideoFailedToLoad(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onSkippableVideoShown',
|
||||
element: document
|
||||
})
|
||||
onSkippableVideoShown(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onSkippableVideoFinished',
|
||||
element: document
|
||||
})
|
||||
onSkippableVideoFinished(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onSkippableVideoClosed',
|
||||
element: document
|
||||
})
|
||||
onSkippableVideoClosed(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onRewardedVideoLoaded',
|
||||
element: document
|
||||
})
|
||||
onRewardedVideoLoaded(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onRewardedVideoFailedToLoad',
|
||||
element: document
|
||||
})
|
||||
onRewardedVideoFailedToLoad(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onRewardedVideoShown',
|
||||
element: document
|
||||
})
|
||||
onRewardedVideoShown(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onRewardedVideoFinished',
|
||||
element: document
|
||||
})
|
||||
onRewardedVideoFinished(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onRewardedVideoClosed',
|
||||
element: document
|
||||
})
|
||||
onRewardedVideoClosed(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onNonSkippableVideoLoaded',
|
||||
element: document
|
||||
})
|
||||
onNonSkippableVideoLoaded(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onNonSkippableVideoFailedToLoad',
|
||||
element: document
|
||||
})
|
||||
onNonSkippableVideoFailedToLoad(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onNonSkippableVideoShown',
|
||||
element: document
|
||||
})
|
||||
onNonSkippableVideoShown(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onNonSkippableVideoFinished',
|
||||
element: document
|
||||
})
|
||||
onNonSkippableVideoFinished(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onNonSkippableVideoClosed',
|
||||
element: document
|
||||
})
|
||||
onNonSkippableVideoClosed(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onBannerClicked',
|
||||
element: document
|
||||
})
|
||||
onBannerClicked(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onBannerFailedToLoad',
|
||||
element: document
|
||||
})
|
||||
onBannerFailedToLoad(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onBannerLoaded',
|
||||
element: document
|
||||
})
|
||||
onBannerLoaded(): Observable<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onBannerShown',
|
||||
element: document
|
||||
})
|
||||
onBannerShown(): Observable<any> { return; }
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
declare var window;
|
||||
|
||||
|
||||
export interface BackgroundFetchConfig {
|
||||
|
||||
/**
|
||||
* Set true to cease background-fetch from operating after user "closes" the app. Defaults to true.
|
||||
*/
|
||||
stopOnTerminate?: boolean;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name Background Fetch
|
||||
* @description
|
||||
* iOS Background Fetch Implementation. See: https://developer.apple.com/reference/uikit/uiapplication#1657399
|
||||
* iOS Background Fetch is basically an API which wakes up your app about every 15 minutes (during the user's prime-time hours) and provides your app exactly 30s of background running-time. This plugin will execute your provided callbackFn whenever a background-fetch event occurs. There is no way to increase the rate which a fetch-event occurs and this plugin sets the rate to the most frequent possible value of UIApplicationBackgroundFetchIntervalMinimum -- iOS determines the rate automatically based upon device usage and time-of-day (ie: fetch-rate is about ~15min during prime-time hours; less frequently when the user is presumed to be sleeping, at 3am for example).
|
||||
* For more detail, please see https://github.com/transistorsoft/cordova-plugin-background-fetch
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```typescript
|
||||
* import { BackgroundFetch, BackgroundFetchConfig } from '@ionic-native/background-fetch';
|
||||
*
|
||||
*
|
||||
* constructor(private backgroundFetch: BackgroundFetch) {
|
||||
*
|
||||
* const config: BackgroundFetchConfig = {
|
||||
* stopOnTerminate: false, // Set true to cease background-fetch from operating after user "closes" the app. Defaults to true.
|
||||
* };
|
||||
*
|
||||
* backgroundFetch.configure(config)
|
||||
* .then(() => {
|
||||
* console.log('Background Fetch initialized');
|
||||
*
|
||||
* this.backgroundFetch.finish();
|
||||
*
|
||||
* })
|
||||
* .catch(e => console.log('Error initializing background fetch', e));
|
||||
*
|
||||
* // Start the background-fetch API. Your callbackFn provided to #configure will be executed each time a background-fetch event occurs. NOTE the #configure method automatically calls #start. You do not have to call this method after you #configure the plugin
|
||||
* backgroundFetch.start();
|
||||
*
|
||||
* // Stop the background-fetch API from firing fetch events. Your callbackFn provided to #configure will no longer be executed.
|
||||
* backgroundFetch.stop();
|
||||
*
|
||||
*
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* BackgroundFetchConfig
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BackgroundFetch',
|
||||
plugin: 'cordova-plugin-background-fetch',
|
||||
pluginRef: 'BackgroundFetch',
|
||||
repo: 'https://github.com/transistorsoft/cordova-plugin-background-fetch',
|
||||
platforms: ['iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class BackgroundFetch {
|
||||
|
||||
|
||||
/**
|
||||
* Configures the plugin's fetch callbackFn
|
||||
*
|
||||
* @param {BackgroundFetchConfig} config Configuration for plugin
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
configure(config: BackgroundFetchConfig): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start the background-fetch API.
|
||||
* Your callbackFn provided to #configure will be executed each time a background-fetch event occurs. NOTE the #configure method automatically calls #start. You do not have to call this method after you #configure the plugin
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
start(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop the background-fetch API from firing fetch events. Your callbackFn provided to #configure will no longer be executed.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
stop(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* You MUST call this method in your fetch callbackFn provided to #configure in order to signal to iOS that your fetch action is complete. iOS provides only 30s of background-time for a fetch-event -- if you exceed this 30s, iOS will kill your app.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
finish(): void { }
|
||||
|
||||
}
|
||||
+90
-74
@@ -1,4 +1,7 @@
|
||||
import {Cordova, Plugin} from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
declare var window;
|
||||
|
||||
@@ -261,16 +264,16 @@ export interface BackgroundGeolocationConfig {
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
|
||||
*
|
||||
* ```typescript
|
||||
* import { BackgroundGeolocation } from 'ionic-native';
|
||||
* import { BackgroundGeolocation, BackgroundGeolocationConfig } from '@ionic-native/background-geolocation';
|
||||
*
|
||||
* constructor(private backgroundGeolocation: BackgroundGeolocation) { }
|
||||
*
|
||||
* // When device is ready :
|
||||
* platform.ready().then(() => {
|
||||
* // IMPORTANT: BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
|
||||
* ...
|
||||
*
|
||||
* // BackgroundGeolocation is highly configurable. See platform specific configuration options
|
||||
* let config = {
|
||||
* const config: BackgroundGeolocationConfig = {
|
||||
* desiredAccuracy: 10,
|
||||
* stationaryRadius: 20,
|
||||
* distanceFilter: 30,
|
||||
@@ -278,24 +281,23 @@ export interface BackgroundGeolocationConfig {
|
||||
* stopOnTerminate: false, // enable this to clear background location settings when the app terminates
|
||||
* };
|
||||
*
|
||||
* BackgroundGeolocation.configure((location) => {
|
||||
console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
|
||||
|
||||
// IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
|
||||
// and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
|
||||
// IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
|
||||
BackgroundGeolocation.finish(); // FOR IOS ONLY
|
||||
|
||||
* }, (error) => {
|
||||
* console.log('BackgroundGeolocation error');
|
||||
* }, config);
|
||||
* this.backgroundGeolocation.configure(config)
|
||||
* .subscribe((location: BackgroundGeolocationResponse) => {
|
||||
*
|
||||
* // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
|
||||
* BackgroundGeolocation.start();
|
||||
* })
|
||||
* console.log(location);
|
||||
*
|
||||
* // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
|
||||
* // and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
|
||||
* // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
|
||||
* BackgroundGeolocation.finish(); // FOR IOS ONLY
|
||||
*
|
||||
* });
|
||||
*
|
||||
* // start recording location
|
||||
* this.backgroundGeolocation.start();
|
||||
*
|
||||
* // If you wish to turn OFF background-tracking, call the #stop method.
|
||||
* BackgroundGeolocation.stop();
|
||||
* this.backgroundGeolocation.stop();
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
@@ -309,6 +311,7 @@ export interface BackgroundGeolocationConfig {
|
||||
repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation',
|
||||
platforms: ['iOS', 'Android', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class BackgroundGeolocation {
|
||||
|
||||
/**
|
||||
@@ -362,17 +365,14 @@ export class BackgroundGeolocation {
|
||||
/**
|
||||
* Configure the plugin.
|
||||
*
|
||||
* @param {Function} callback callback will be called when background location is determined.
|
||||
* @param {Function} errorCallback callback to be executed every time a geolocation error occurs.
|
||||
* @param {Config} options An object of type Config
|
||||
* @return Location object, which tries to mimic w3c Coordinates interface.
|
||||
* See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface
|
||||
* Callback to be executed every time a geolocation is recorded in the background.
|
||||
* @param options {BackgroundGeolocationConfig} options An object of type Config
|
||||
* @return {Observable<BackgroundGeolocationResponse>}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
callbackOrder: 'reverse',
|
||||
observable: true
|
||||
})
|
||||
static configure(callback: Function, errorCallback: Function, options: BackgroundGeolocationConfig): any { return; }
|
||||
configure(options: BackgroundGeolocationConfig): Observable<BackgroundGeolocationResponse> { return; }
|
||||
|
||||
/**
|
||||
* Turn ON the background-geolocation system.
|
||||
@@ -380,91 +380,103 @@ export class BackgroundGeolocation {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static start(): Promise<any> { return; }
|
||||
start(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Turn OFF background-tracking
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stop(): Promise<any> { return; }
|
||||
stop(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Inform the native plugin that you're finished, the background-task may be completed
|
||||
* NOTE: IOS, WP only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static finish() { }
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows Phone']
|
||||
})
|
||||
finish(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Force the plugin to enter "moving" or "stationary" state
|
||||
* NOTE: IOS, WP only
|
||||
* @param isMoving {boolean}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static changePace(isMoving: boolean) { }
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows Phone']
|
||||
})
|
||||
changePace(isMoving: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Setup configuration
|
||||
* @param options {BackgroundGeolocationConfig}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static setConfig(options: BackgroundGeolocationConfig): Promise<any> { return; }
|
||||
setConfig(options: BackgroundGeolocationConfig): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns current stationaryLocation if available. null if not
|
||||
* NOTE: IOS, WP only
|
||||
* @returns {Promise<Location>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getStationaryLocation(): Promise<BackgroundGeolocationResponse> { return; }
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows Phone']
|
||||
})
|
||||
getStationaryLocation(): Promise<BackgroundGeolocationResponse> { return; }
|
||||
|
||||
/**
|
||||
* Add a stationary-region listener. Whenever the devices enters "stationary-mode",
|
||||
* your #success callback will be executed with #location param containing #radius of region
|
||||
* NOTE: IOS, WP only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static onStationary(): Promise<any> { return; }
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows Phone']
|
||||
})
|
||||
onStationary(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Check if location is enabled on the device
|
||||
* @returns {Promise<number>} Returns a promise with int argument that takes values 0, 1 (true).
|
||||
* NOTE: ANDROID only
|
||||
*/
|
||||
@Cordova()
|
||||
static isLocationEnabled(): Promise<number> { return; }
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
isLocationEnabled(): Promise<number> { return; }
|
||||
|
||||
/**
|
||||
* Display app settings to change permissions
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static showAppSettings(): void { }
|
||||
showAppSettings(): void { }
|
||||
|
||||
/**
|
||||
* Display device location settings
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static showLocationSettings(): void { }
|
||||
showLocationSettings(): void { }
|
||||
|
||||
/**
|
||||
* Method can be used to detect user changes in location services settings.
|
||||
* If user enable or disable location services then success callback will be executed.
|
||||
* In case or error (SettingNotFoundException) fail callback will be executed.
|
||||
* NOTE: ANDROID only
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static watchLocationMode(): Promise<boolean> { return; }
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
watchLocationMode(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Stop watching for location mode changes.
|
||||
* NOTE: ANDROID only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopWatchingLocationMode() { }
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
stopWatchingLocationMode(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Method will return all stored locations.
|
||||
@@ -473,34 +485,38 @@ export class BackgroundGeolocation {
|
||||
* by the system
|
||||
* or
|
||||
* - option.debug is true
|
||||
* NOTE: ANDROID only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getLocations(): Promise<any> { return; }
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
getLocations(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Method will return locations, which has not been yet posted to server. NOTE: Locations does contain locationId.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getValidLocations(): Promise<any> { return; }
|
||||
getValidLocations(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Delete stored location by given locationId.
|
||||
* NOTE: ANDROID only
|
||||
* @param locationId {number}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static deleteLocation(locationId: number): Promise<any> { return; }
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
deleteLocation(locationId: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Delete all stored locations.
|
||||
* NOTE: ANDROID only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static deleteAllLocations(): Promise<any> { return; }
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
deleteAllLocations(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Normally plugin will handle switching between BACKGROUND and FOREGROUND mode itself.
|
||||
@@ -511,23 +527,23 @@ export class BackgroundGeolocation {
|
||||
*
|
||||
* BackgroundGeolocation.Mode.FOREGROUND
|
||||
* BackgroundGeolocation.Mode.BACKGROUND
|
||||
*
|
||||
* NOTE: iOS only
|
||||
*
|
||||
* @param {number} See above.
|
||||
**
|
||||
* @param modeId {number}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static switchMode(modeId: number): Promise<any> { return; }
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
switchMode(modeId: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Return all logged events. Useful for plugin debugging. Parameter limit limits number of returned entries.
|
||||
* @see https://github.com/mauron85/cordova-plugin-background-geolocation/tree/v2.2.1#debugging for more information.
|
||||
*
|
||||
* @param {number} Limits the number of entries
|
||||
* @param limit {number} Limits the number of entries
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getLogEntries(limit: number): Promise<any> { return; }
|
||||
getLogEntries(limit: number): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
/**
|
||||
* Configurations items that can be updated.
|
||||
*/
|
||||
export interface BackgroundModeConfiguration {
|
||||
|
||||
/**
|
||||
* Title of the background task
|
||||
*/
|
||||
title?: String;
|
||||
|
||||
/**
|
||||
* The text that scrolls itself on statusbar
|
||||
*/
|
||||
ticker?: String;
|
||||
|
||||
/**
|
||||
* Description of background task
|
||||
*/
|
||||
text?: String;
|
||||
|
||||
/**
|
||||
* if true plugin will not display a notification. Default is false.
|
||||
*/
|
||||
silent?: boolean;
|
||||
|
||||
/**
|
||||
* By default the app will come to foreground when taping on the notification. If false, plugin wont come to foreground when tapped.
|
||||
*/
|
||||
resume?: boolean;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Background Mode
|
||||
* @description
|
||||
* Cordova plugin to prevent the app from going to sleep while in background.
|
||||
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode
|
||||
*@usage
|
||||
* ```typescript
|
||||
* import { BackgroundMode } from '@ionic-native/background-mode';
|
||||
*
|
||||
* constructor(private backgroundMode: BackgroundMode) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.backgroundMode.enable();
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* BackgroundModeConfiguration
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BackgroundMode',
|
||||
plugin: 'cordova-plugin-background-mode',
|
||||
pluginRef: 'cordova.plugins.backgroundMode',
|
||||
repo: 'https://github.com/katzer/cordova-plugin-background-mode',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class BackgroundMode {
|
||||
|
||||
/**
|
||||
* Enable the background mode.
|
||||
* Once called, prevents the app from being paused while in background.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
enable(): void { }
|
||||
|
||||
/**
|
||||
* Disable the background mode.
|
||||
* Once the background mode has been disabled, the app will be paused when in background.
|
||||
*/
|
||||
@Cordova()
|
||||
disable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if background mode is enabled or not.
|
||||
* @returns {boolean} returns a boolean that indicates if the background mode is enabled.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
isEnabled(): boolean { return; }
|
||||
|
||||
/**
|
||||
* Can be used to get the information if the background mode is active.
|
||||
* @returns {boolean} returns a boolean that indicates if the background mode is active.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
isActive(): boolean { return; }
|
||||
|
||||
/**
|
||||
* Override the default title, ticker and text.
|
||||
* Available only for Android platform.
|
||||
* @param {Configure} options List of option to configure. See table below
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
setDefaults(options?: BackgroundModeConfiguration): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Modify the displayed information.
|
||||
* Available only for Android platform.
|
||||
* @param {Configure} options Any options you want to update. See table below.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
configure(options?: BackgroundModeConfiguration): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Listen for events that the plugin fires. Available events are `enable`, `disable`, `activate`, `deactivate` and `failure`.
|
||||
* @param event {string} Event name
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'un',
|
||||
clearWithArgs: true
|
||||
})
|
||||
on(event: string): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Override the back button on Android to go to background instead of closing the app.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
overrideBackButton(): void {}
|
||||
|
||||
/**
|
||||
* Exclude the app from the recent task list works on Android 5.0+.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
excludeFromTaskList(): void {}
|
||||
|
||||
/**
|
||||
* The method works async instead of isActive() or isEnabled().
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
isScreenOff(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Turn screen on
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
wakeUp(): void {}
|
||||
|
||||
/**
|
||||
* Turn screen on and show app even locked
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
unlock(): void {}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
|
||||
|
||||
/**
|
||||
* @beta
|
||||
@@ -8,13 +10,17 @@ import { Plugin, Cordova } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Backlight } from 'ionic-native';
|
||||
* import { Backlight } from '@ionic-native/backlight';
|
||||
*
|
||||
* constructor(private backlight: Backlight) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Turn backlight on
|
||||
* Backlight.on().then(() => console.log('backlight on'));
|
||||
* this.backlight.on().then(() => console.log('backlight on'));
|
||||
*
|
||||
* // Turn backlight off
|
||||
* Backlight.off().then(() => console.log('backlight off'));
|
||||
* this.backlight.off().then(() => console.log('backlight off'));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@@ -25,6 +31,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
repo: 'https://github.com/mebibou/cordova-plugin-backlight',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class Backlight {
|
||||
|
||||
/**
|
||||
@@ -32,13 +39,13 @@ export class Backlight {
|
||||
* @return {Promise<any>} Returns a promise that resolves when the backlight is on
|
||||
*/
|
||||
@Cordova()
|
||||
static on(): Promise<any> { return; }
|
||||
on(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* This function turns backlight off
|
||||
* @return {Promise<any>} Returns a promise that resolves when the backlight is off
|
||||
*/
|
||||
@Cordova()
|
||||
static off(): Promise<any> { return; }
|
||||
off(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
/**
|
||||
* @name Badge
|
||||
@@ -9,12 +11,15 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Badge } from 'ionic-native';
|
||||
* import { Badge } from '@ionic-native/badge';
|
||||
*
|
||||
* constructor(private badge: Badge) { }
|
||||
*
|
||||
* Badge.set(10);
|
||||
* Badge.increase();
|
||||
* Badge.clear();
|
||||
* ...
|
||||
*
|
||||
* this.badge.set(10);
|
||||
* this.badge.increase(1);
|
||||
* this.badge.clear();
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -24,6 +29,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
repo: 'https://github.com/katzer/cordova-plugin-badge',
|
||||
platforms: ['Android', 'iOS', 'Browser', 'Windows', 'Amazon FireOS', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class Badge {
|
||||
|
||||
/**
|
||||
@@ -31,7 +37,7 @@ export class Badge {
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static clear(): Promise<boolean> { return; }
|
||||
clear(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Set the badge of the app icon.
|
||||
@@ -39,14 +45,14 @@ export class Badge {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static set(badgeNumber: number): Promise<any> { return; }
|
||||
set(badgeNumber: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get the badge of the app icon.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static get(): Promise<any> { return; }
|
||||
get(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Increase the badge number.
|
||||
@@ -54,7 +60,7 @@ export class Badge {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static increase(increaseBy: number): Promise<any> { return; }
|
||||
increase(increaseBy: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Decrease the badge number.
|
||||
@@ -62,20 +68,20 @@ export class Badge {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static decrease(decreaseBy: number): Promise<any> { return; }
|
||||
decrease(decreaseBy: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Determine if the app has permission to show badges.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static hasPermission(): Promise<any> { return; }
|
||||
hasPermission(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Register permission to set badge notifications
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static registerPermission(): Promise<any> { return; }
|
||||
registerPermission(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
export interface BarcodeScannerOptions {
|
||||
|
||||
@@ -63,10 +65,14 @@ export interface BarcodeScannerOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { BarcodeScanner } from 'ionic-native';
|
||||
* import { BarcodeScanner } from '@ionic-native/barcode-scanner';
|
||||
*
|
||||
* constructor(private barcodeScanner: BarcodeScanner) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* BarcodeScanner.scan().then((barcodeData) => {
|
||||
* this.barcodeScanner.scan().then((barcodeData) => {
|
||||
* // Success! Barcode data is here
|
||||
* }, (err) => {
|
||||
* // An error occurred
|
||||
@@ -82,6 +88,7 @@ export interface BarcodeScannerOptions {
|
||||
repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows 10', 'Windows 8', 'BlackBerry 10', 'Browser']
|
||||
})
|
||||
@Injectable()
|
||||
export class BarcodeScanner {
|
||||
|
||||
/**
|
||||
@@ -102,7 +109,7 @@ export class BarcodeScanner {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static scan(options?: BarcodeScannerOptions): Promise<any> { return; }
|
||||
scan(options?: BarcodeScannerOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Encodes data into a barcode.
|
||||
@@ -112,6 +119,6 @@ export class BarcodeScanner {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static encode(type: string, data: any): Promise<any> { return; }
|
||||
encode(type: string, data: any): Promise<any> { return; }
|
||||
|
||||
}
|
||||
+11
-4
@@ -1,14 +1,20 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Base64 To Gallery
|
||||
* @description This plugin allows you to save base64 data as a png image into the device
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Base64ToGallery } from 'ionic-native';
|
||||
* import { Base64ToGallery } from '@ionic-native/base64-to-gallery';
|
||||
*
|
||||
* constructor(private base64ToGallery: Base64ToGallery) { }
|
||||
*
|
||||
*
|
||||
* Base64ToGallery.base64ToGallery(base64Data, 'img_').then(
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.base64ToGallery.base64ToGallery(base64Data, { prefix: '_img' }).then(
|
||||
* res => console.log('Saved image to gallery ', res),
|
||||
* err => console.log('Error saving image to gallery ', err)
|
||||
* );
|
||||
@@ -21,6 +27,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
repo: 'https://github.com/Nexxa/cordova-base64-to-gallery',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class Base64ToGallery {
|
||||
|
||||
/**
|
||||
@@ -33,7 +40,7 @@ export class Base64ToGallery {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
static base64ToGallery(data: string, options?: {prefix?: string; mediaScanner?: boolean}): Promise<any> {
|
||||
base64ToGallery(data: string, options?: {prefix?: string; mediaScanner?: boolean}): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export interface BatteryStatusResponse {
|
||||
@@ -22,11 +23,15 @@ export interface BatteryStatusResponse {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { BatteryStatus } from 'ionic-native';
|
||||
* import { BatteryStatus } from '@ionic-native/battery-status';
|
||||
*
|
||||
* constructor(private batteryStatus: BatteryStatus) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // watch change in battery status
|
||||
* let subscription = BatteryStatus.onChange().subscribe(
|
||||
* let subscription = this.batteryStatus.onChange().subscribe(
|
||||
* (status: StatusObject) => {
|
||||
* console.log(status.level, status.isPlugged);
|
||||
* }
|
||||
@@ -46,6 +51,7 @@ export interface BatteryStatusResponse {
|
||||
repo: 'https://github.com/apache/cordova-plugin-battery-status',
|
||||
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
|
||||
})
|
||||
@Injectable()
|
||||
export class BatteryStatus {
|
||||
|
||||
/**
|
||||
@@ -56,7 +62,7 @@ export class BatteryStatus {
|
||||
eventObservable: true,
|
||||
event: 'batterystatus'
|
||||
})
|
||||
static onChange(): Observable<BatteryStatusResponse> { return; }
|
||||
onChange(): Observable<BatteryStatusResponse> { return; }
|
||||
|
||||
/**
|
||||
* Watch when the battery level goes low
|
||||
@@ -66,7 +72,7 @@ export class BatteryStatus {
|
||||
eventObservable: true,
|
||||
event: 'batterylow'
|
||||
})
|
||||
static onLow(): Observable<BatteryStatusResponse> { return; }
|
||||
onLow(): Observable<BatteryStatusResponse> { return; }
|
||||
|
||||
/**
|
||||
* Watch when the battery level goes to critial
|
||||
@@ -76,6 +82,6 @@ export class BatteryStatus {
|
||||
eventObservable: true,
|
||||
event: 'batterycritical'
|
||||
})
|
||||
static onCritical(): Observable<BatteryStatusResponse> { return; }
|
||||
onCritical(): Observable<BatteryStatusResponse> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
@@ -20,6 +21,14 @@ import { Observable } from 'rxjs/Observable';
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```typescript
|
||||
*
|
||||
* import { BLE } from '@ionic-native/ble';
|
||||
*
|
||||
* constructor(private ble: BLE) { }
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* ## Peripheral Data
|
||||
*
|
||||
* Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning.
|
||||
@@ -166,6 +175,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
repo: 'https://github.com/don/cordova-plugin-ble-central',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class BLE {
|
||||
|
||||
/**
|
||||
@@ -184,7 +194,7 @@ export class BLE {
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
static scan(services: string[], seconds: number): Observable<any> { return; }
|
||||
scan(services: string[], seconds: number): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Scan and discover BLE peripherals until `stopScan` is called.
|
||||
@@ -207,7 +217,7 @@ export class BLE {
|
||||
clearFunction: 'stopScan',
|
||||
clearWithArgs: false
|
||||
})
|
||||
static startScan(services: string[]): Observable<any> { return; }
|
||||
startScan(services: string[]): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Scans for BLE devices. This function operates similarly to the `startScan` function, but allows you to specify extra options (like allowing duplicate device reports).
|
||||
@@ -220,7 +230,7 @@ export class BLE {
|
||||
clearFunction: 'stopScan',
|
||||
clearWithArgs: false
|
||||
})
|
||||
static startScanWithOptions(services: string[], options: {reportDuplicates?: boolean} | any): Observable<any> { return; }
|
||||
startScanWithOptions(services: string[], options: {reportDuplicates?: boolean} | any): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop a scan started by `startScan`.
|
||||
@@ -237,7 +247,7 @@ export class BLE {
|
||||
* @return returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static stopScan(): Promise<any> { return; }
|
||||
stopScan(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Connect to a peripheral.
|
||||
@@ -258,7 +268,7 @@ export class BLE {
|
||||
clearFunction: 'disconnect',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static connect(deviceId: string): Observable<any> { return; }
|
||||
connect(deviceId: string): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Disconnect from a peripheral.
|
||||
@@ -272,7 +282,7 @@ export class BLE {
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static disconnect(deviceId: string): Promise<any> { return; }
|
||||
disconnect(deviceId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Read the value of a characteristic.
|
||||
@@ -283,7 +293,7 @@ export class BLE {
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static read(
|
||||
read(
|
||||
deviceId: string,
|
||||
serviceUUID: string,
|
||||
characteristicUUID: string
|
||||
@@ -318,7 +328,7 @@ export class BLE {
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static write(
|
||||
write(
|
||||
deviceId: string,
|
||||
serviceUUID: string,
|
||||
characteristicUUID: string,
|
||||
@@ -335,7 +345,7 @@ export class BLE {
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static writeWithoutResponse(
|
||||
writeWithoutResponse(
|
||||
deviceId: string,
|
||||
serviceUUID: string,
|
||||
characteristicUUID: string,
|
||||
@@ -362,7 +372,7 @@ export class BLE {
|
||||
clearFunction: 'stopNotification',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static startNotification(
|
||||
startNotification(
|
||||
deviceId: string,
|
||||
serviceUUID: string,
|
||||
characteristicUUID: string
|
||||
@@ -377,7 +387,7 @@ export class BLE {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopNotification(
|
||||
stopNotification(
|
||||
deviceId: string,
|
||||
serviceUUID: string,
|
||||
characteristicUUID: string
|
||||
@@ -397,7 +407,7 @@ export class BLE {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isConnected(deviceId: string): Promise<any> { return; }
|
||||
isConnected(deviceId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Report if bluetooth is enabled.
|
||||
@@ -405,7 +415,7 @@ export class BLE {
|
||||
* @returns {Promise<void>} Returns a Promise that resolves if Bluetooth is enabled, and rejects if disabled.
|
||||
*/
|
||||
@Cordova()
|
||||
static isEnabled(): Promise<void> { return; }
|
||||
isEnabled(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Open System Bluetooth settings (Android only).
|
||||
@@ -413,7 +423,7 @@ export class BLE {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static showBluetoothSettings(): Promise<any> { return; }
|
||||
showBluetoothSettings(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enable Bluetooth on the device (Android only).
|
||||
@@ -421,6 +431,6 @@ export class BLE {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static enable(): Promise<any> { return; }
|
||||
enable(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
+29
-25
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
@@ -6,14 +7,16 @@ import { Observable } from 'rxjs/Observable';
|
||||
* @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { BluetoothSerial } from 'ionic-native';
|
||||
* import { BluetoothSerial } from '@ionic-native/bluetooth-serial';
|
||||
*
|
||||
* constructor(private bluetoothSerial: BluetoothSerial) { }
|
||||
*
|
||||
*
|
||||
* // Write a string
|
||||
* BluetoothSerial.write("hello world").then(success, failure);
|
||||
* this.bluetoothSerial.write("hello world").then(success, failure);
|
||||
*
|
||||
* // Array of int or bytes
|
||||
* BluetoothSerial.write([186, 220, 222]).then(success, failure);
|
||||
* this.bluetoothSerial.write([186, 220, 222]).then(success, failure);
|
||||
*
|
||||
* // Typed Array
|
||||
* var data = new Uint8Array(4);
|
||||
@@ -21,10 +24,10 @@ import { Observable } from 'rxjs/Observable';
|
||||
* data[1] = 0x42;
|
||||
* data[2] = 0x43;
|
||||
* data[3] = 0x44;
|
||||
* BluetoothSerial.write(data).then(success, failure);
|
||||
* this.bluetoothSerial.write(data).then(success, failure);
|
||||
*
|
||||
* // Array Buffer
|
||||
* BluetoothSerial.write(data.buffer).then(success, failure);
|
||||
* this.bluetoothSerial.write(data.buffer).then(success, failure);
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -34,6 +37,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
pluginRef: 'bluetoothSerial',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone', 'Browser']
|
||||
})
|
||||
@Injectable()
|
||||
export class BluetoothSerial {
|
||||
|
||||
/**
|
||||
@@ -46,7 +50,7 @@ export class BluetoothSerial {
|
||||
observable: true,
|
||||
clearFunction: 'disconnect'
|
||||
})
|
||||
static connect(macAddress_or_uuid: string): Observable<any> { return; }
|
||||
connect(macAddress_or_uuid: string): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Connect insecurely to a Bluetooth device
|
||||
@@ -58,7 +62,7 @@ export class BluetoothSerial {
|
||||
observable: true,
|
||||
clearFunction: 'disconnect'
|
||||
})
|
||||
static connectInsecure(macAddress: string): Observable<any> { return; }
|
||||
connectInsecure(macAddress: string): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Writes data to the serial port
|
||||
@@ -68,7 +72,7 @@ export class BluetoothSerial {
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
})
|
||||
static write(data: any): Promise<any> { return; }
|
||||
write(data: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Gets the number of bytes of data available
|
||||
@@ -76,7 +80,7 @@ export class BluetoothSerial {
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
}) static available(): Promise<any> { return; }
|
||||
}) available(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Reads data from the buffer
|
||||
@@ -85,7 +89,7 @@ export class BluetoothSerial {
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
})
|
||||
static read(): Promise<any> { return; }
|
||||
read(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Reads data from the buffer until it reaches a delimiter
|
||||
@@ -95,7 +99,7 @@ export class BluetoothSerial {
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
})
|
||||
static readUntil(delimiter: string): Promise<any> { return; }
|
||||
readUntil(delimiter: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Subscribe to be notified when data is received
|
||||
@@ -107,7 +111,7 @@ export class BluetoothSerial {
|
||||
observable: true,
|
||||
clearFunction: 'unsubscribe'
|
||||
})
|
||||
static subscribe(delimiter: string): Observable<any> { return; }
|
||||
subscribe(delimiter: string): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Subscribe to be notified when data is received
|
||||
@@ -118,7 +122,7 @@ export class BluetoothSerial {
|
||||
observable: true,
|
||||
clearFunction: 'unsubscribeRawData'
|
||||
})
|
||||
static subscribeRawData(): Observable<any> { return; }
|
||||
subscribeRawData(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Clears data in buffer
|
||||
@@ -127,7 +131,7 @@ export class BluetoothSerial {
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
})
|
||||
static clear(): Promise<any> { return; }
|
||||
clear(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Lists bonded devices
|
||||
@@ -136,7 +140,7 @@ export class BluetoothSerial {
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
})
|
||||
static list(): Promise<any> { return; }
|
||||
list(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Reports if bluetooth is enabled
|
||||
@@ -145,7 +149,7 @@ export class BluetoothSerial {
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
})
|
||||
static isEnabled(): Promise<any> { return; }
|
||||
isEnabled(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Reports the connection status
|
||||
@@ -154,7 +158,7 @@ export class BluetoothSerial {
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
})
|
||||
static isConnected(): Promise<any> { return; }
|
||||
isConnected(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Reads the RSSI from the connected peripheral
|
||||
@@ -163,7 +167,7 @@ export class BluetoothSerial {
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
})
|
||||
static readRSSI(): Promise<any> { return; }
|
||||
readRSSI(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show the Bluetooth settings on the device
|
||||
@@ -172,7 +176,7 @@ export class BluetoothSerial {
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
})
|
||||
static showBluetoothSettings(): Promise<any> { return; }
|
||||
showBluetoothSettings(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enable Bluetooth on the device
|
||||
@@ -181,7 +185,7 @@ export class BluetoothSerial {
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
})
|
||||
static enable(): Promise<any> { return; }
|
||||
enable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Discover unpaired devices
|
||||
@@ -190,7 +194,7 @@ export class BluetoothSerial {
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
})
|
||||
static discoverUnpaired(): Promise<any> { return; }
|
||||
discoverUnpaired(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function.
|
||||
@@ -201,7 +205,7 @@ export class BluetoothSerial {
|
||||
observable: true,
|
||||
clearFunction: 'clearDeviceDiscoveredListener'
|
||||
})
|
||||
static setDeviceDiscoveredListener(): Observable<any> { return; }
|
||||
setDeviceDiscoveredListener(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Sets the human readable device name that is broadcasted to other devices
|
||||
@@ -211,7 +215,7 @@ export class BluetoothSerial {
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
static setName(newName: string): void { }
|
||||
setName(newName: string): void { }
|
||||
|
||||
/**
|
||||
* Makes the device discoverable by other devices
|
||||
@@ -221,6 +225,6 @@ export class BluetoothSerial {
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
static setDiscoverable(discoverableDuration: number): void { }
|
||||
setDiscoverable(discoverableDuration: number): void { }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Brightness
|
||||
@@ -9,11 +10,14 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Brightness } from 'ionic-native';
|
||||
* import { Brightness } from '@ionic-native/brightness';
|
||||
*
|
||||
* constructor(private brightness: Brightness) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let brightnessValue: number = 0.8;
|
||||
* Brightness.setBrightness(brightnessValue);
|
||||
* this.brightness.setBrightness(brightnessValue);
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
@@ -24,6 +28,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
repo: 'https://github.com/mgcrea/cordova-plugin-brightness',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Brightness {
|
||||
|
||||
/**
|
||||
@@ -33,7 +38,7 @@ export class Brightness {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves if setting brightness was successful.
|
||||
*/
|
||||
@Cordova()
|
||||
static setBrightness(value: number): Promise<any> { return; }
|
||||
setBrightness(value: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Reads the current brightness of the device display.
|
||||
@@ -42,12 +47,12 @@ export class Brightness {
|
||||
* brightness value of the device display (floating number between 0 and 1).
|
||||
*/
|
||||
@Cordova()
|
||||
static getBrightness(): Promise<any> { return; }
|
||||
getBrightness(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Keeps the screen on. Prevents the device from setting the screen to sleep.
|
||||
*/
|
||||
@Cordova()
|
||||
static setKeepScreenOn(value: boolean): void { }
|
||||
setKeepScreenOn(value: boolean): void { }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
@@ -8,13 +9,17 @@ import { Observable } from 'rxjs/Observable';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Broadcaster } from 'ionic-native';
|
||||
* import { Broadcaster } from '@ionic-native/broadcaster';
|
||||
*
|
||||
* constructor(private broadcaster: Broadcaster) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Listen to events from Native
|
||||
* Broadcaster.addEventListener('eventName').then((event) => console.log(event));
|
||||
* this.broadcaster.addEventListener('eventName').then((event) => console.log(event));
|
||||
*
|
||||
* // Send event to Native
|
||||
* Broadcaster.fireNativeEvent('eventName', {}).then(() => console.log('success'));
|
||||
* this.broadcaster.fireNativeEvent('eventName', {}).then(() => console.log('success'));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@@ -25,6 +30,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
repo: 'https://github.com/bsorrentino/cordova-broadcaster',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Broadcaster {
|
||||
|
||||
/**
|
||||
@@ -37,7 +43,7 @@ export class Broadcaster {
|
||||
clearFunction: 'removeEventListener',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static addEventListener(eventName: string): Observable<any> { return; }
|
||||
addEventListener(eventName: string): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* This function sends data to the native code
|
||||
@@ -46,6 +52,6 @@ export class Broadcaster {
|
||||
* @return {Promise<any>} Returns a promise that resolves when an event is successfully fired
|
||||
*/
|
||||
@Cordova()
|
||||
static fireNativeEvent(eventName: string, eventData: any): Promise<any> { return; }
|
||||
fireNativeEvent(eventName: string, eventData: any): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/**
|
||||
* @name BrowserTab
|
||||
* @description
|
||||
* This plugin provides an interface to in-app browser tabs that exist on some mobile platforms, specifically [Custom Tabs](http://developer.android.com/tools/support-library/features.html#custom-tabs) on Android (including the [Chrome Custom Tabs](https://developer.chrome.com/multidevice/android/customtabs) implementation), and [SFSafariViewController](https://developer.apple.com/library/ios/documentation/SafariServices/Reference/SFSafariViewController_Ref/) on iOS.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { BrowserTab } from '@ionic-native/browser-tab';
|
||||
*
|
||||
* constructor(private browserTab: BrowserTab) {
|
||||
*
|
||||
* browserTab.isAvailable()
|
||||
* .then((isAvailable: boolean) => {
|
||||
*
|
||||
* if (isAvailable) {
|
||||
*
|
||||
* browserTab.open('https://ionic.io');
|
||||
*
|
||||
* } else {
|
||||
*
|
||||
* // open URL with InAppBrowser instead or SafariViewController
|
||||
*
|
||||
* }
|
||||
*
|
||||
* });
|
||||
*
|
||||
*
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BrowserTab',
|
||||
plugin: 'cordova-plugin-browsertab',
|
||||
pluginRef: 'cordova.plugins.browsertab',
|
||||
repo: 'https://github.com/google/cordova-plugin-browsertab',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class BrowserTab {
|
||||
|
||||
/**
|
||||
* Check if BrowserTab option is available
|
||||
* @return {Promise<any>} Returns a promise that resolves when check is successful and returns true or false
|
||||
*/
|
||||
@Cordova()
|
||||
isAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Opens the provided URL using a browser tab
|
||||
* @param {string} url The URL you want to open
|
||||
* @return {Promise<any>} Returns a promise that resolves when check open was successful
|
||||
*/
|
||||
@Cordova()
|
||||
openUrl(url: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Closes browser tab
|
||||
* @return {Promise<any>} Returns a promise that resolves when close was finished
|
||||
*/
|
||||
@Cordova()
|
||||
close(): Promise<any> { return; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -62,11 +63,12 @@ export interface CalendarOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Calendar} from 'ionic-native';
|
||||
* import {Calendar} from '@ionic-native/calendar';
|
||||
*
|
||||
* constructor(private calendar: Calendar) { }
|
||||
*
|
||||
*
|
||||
*
|
||||
* Calendar.createCalendar('MyCalendar').then(
|
||||
* this.calendar.createCalendar('MyCalendar').then(
|
||||
* (msg) => { console.log(msg); },
|
||||
* (err) => { console.log(err); }
|
||||
* );
|
||||
@@ -81,6 +83,7 @@ export interface CalendarOptions {
|
||||
repo: 'https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Calendar {
|
||||
|
||||
/**
|
||||
@@ -95,42 +98,42 @@ export class Calendar {
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static hasReadWritePermission(): Promise<boolean> { return; }
|
||||
hasReadWritePermission(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Check if we have read permission
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static hasReadPermission(): Promise<boolean> { return; }
|
||||
hasReadPermission(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Check if we have write permission
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static hasWritePermission(): Promise<boolean> { return; }
|
||||
hasWritePermission(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Request write permission
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static requestWritePermission(): Promise<any> { return; }
|
||||
requestWritePermission(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Request read permission
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static requestReadPermission(): Promise<any> { return; }
|
||||
requestReadPermission(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests read/write permissions
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static requestReadWritePermission(): Promise<any> { return; }
|
||||
requestReadWritePermission(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Create a calendar. (iOS only)
|
||||
@@ -139,7 +142,7 @@ export class Calendar {
|
||||
* @returns {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static createCalendar(nameOrOptions: string | any): Promise<any> { return; }
|
||||
createCalendar(nameOrOptions: string | any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Delete a calendar. (iOS only)
|
||||
@@ -147,7 +150,7 @@ export class Calendar {
|
||||
* @returns {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static deleteCalendar(name: string): Promise<any> { return; }
|
||||
deleteCalendar(name: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the default calendar options.
|
||||
@@ -157,7 +160,7 @@ export class Calendar {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static getCalendarOptions(): CalendarOptions { return; }
|
||||
getCalendarOptions(): CalendarOptions { return; }
|
||||
|
||||
/**
|
||||
* Silently create an event.
|
||||
@@ -169,7 +172,7 @@ export class Calendar {
|
||||
* @returns {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static createEvent(
|
||||
createEvent(
|
||||
title?: string,
|
||||
location?: string,
|
||||
notes?: string,
|
||||
@@ -189,7 +192,7 @@ export class Calendar {
|
||||
* @returns {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static createEventWithOptions(
|
||||
createEventWithOptions(
|
||||
title?: string,
|
||||
location?: string,
|
||||
notes?: string,
|
||||
@@ -209,7 +212,7 @@ export class Calendar {
|
||||
* @returns {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static createEventInteractively(
|
||||
createEventInteractively(
|
||||
title?: string,
|
||||
location?: string,
|
||||
notes?: string,
|
||||
@@ -229,7 +232,7 @@ export class Calendar {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static createEventInteractivelyWithOptions(
|
||||
createEventInteractivelyWithOptions(
|
||||
title?: string,
|
||||
location?: string,
|
||||
notes?: string,
|
||||
@@ -240,7 +243,7 @@ export class Calendar {
|
||||
|
||||
// deprecated
|
||||
// @Cordova()
|
||||
// static createEventInNamedCalendar(
|
||||
// createEventInNamedCalendar(
|
||||
// title?: string,
|
||||
// location?: string,
|
||||
// notes?: string,
|
||||
@@ -260,7 +263,7 @@ export class Calendar {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static findEvent(
|
||||
findEvent(
|
||||
title?: string,
|
||||
location?: string,
|
||||
notes?: string,
|
||||
@@ -279,7 +282,7 @@ export class Calendar {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the event, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
static findEventWithOptions(
|
||||
findEventWithOptions(
|
||||
title?: string,
|
||||
location?: string,
|
||||
notes?: string,
|
||||
@@ -298,14 +301,14 @@ export class Calendar {
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static listEventsInRange(startDate: Date, endDate: Date): Promise<any> { return; }
|
||||
listEventsInRange(startDate: Date, endDate: Date): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get a list of all calendars.
|
||||
* @returns {Promise<any>} A Promise that resolves with the list of calendars, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
static listCalendars(): Promise<any> { return; }
|
||||
listCalendars(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get a list of all future events in the specified calendar. (iOS only)
|
||||
@@ -314,7 +317,7 @@ export class Calendar {
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static findAllEventsInNamedCalendar(calendarName: string): Promise<any> { return; }
|
||||
findAllEventsInNamedCalendar(calendarName: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Modify an event. (iOS only)
|
||||
@@ -334,7 +337,7 @@ export class Calendar {
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static modifyEvent(
|
||||
modifyEvent(
|
||||
title?: string,
|
||||
location?: string,
|
||||
notes?: string,
|
||||
@@ -367,7 +370,7 @@ export class Calendar {
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static modifyEventWithOptions(
|
||||
modifyEventWithOptions(
|
||||
title?: string,
|
||||
location?: string,
|
||||
notes?: string,
|
||||
@@ -393,7 +396,7 @@ export class Calendar {
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static deleteEvent(
|
||||
deleteEvent(
|
||||
title?: string,
|
||||
location?: string,
|
||||
notes?: string,
|
||||
@@ -415,7 +418,7 @@ export class Calendar {
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static deleteEventFromNamedCalendar(
|
||||
deleteEventFromNamedCalendar(
|
||||
title?: string,
|
||||
location?: string,
|
||||
notes?: string,
|
||||
@@ -430,6 +433,6 @@ export class Calendar {
|
||||
* @return {Promise<any>} Promise returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
static openCalendar(date: Date): Promise<any> { return; }
|
||||
openCalendar(date: Date): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
/**
|
||||
* @name CallNumber
|
||||
* @description
|
||||
@@ -7,9 +7,14 @@ import { Plugin, Cordova } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {CallNumber} from 'ionic-native';
|
||||
* import {CallNumber} from '@ionic-native/call-number';
|
||||
*
|
||||
* CallNumber.callNumber(18001010101, true)
|
||||
* constructor(private callNumber: CallNumber) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.callNumber.callNumber(18001010101, true)
|
||||
* .then(() => console.log('Launched dialer!'))
|
||||
* .catch(() => console.log('Error launching dialer'));
|
||||
*
|
||||
@@ -22,6 +27,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
repo: 'https://github.com/Rohfosho/CordovaCallNumberPlugin',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class CallNumber {
|
||||
|
||||
/**
|
||||
@@ -33,7 +39,7 @@ export class CallNumber {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static callNumber(numberToCall: string, bypassAppChooser: boolean): Promise<any> {
|
||||
callNumber(numberToCall: string, bypassAppChooser: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export interface CameraPreviewRect {
|
||||
|
||||
x: number;
|
||||
@@ -31,7 +31,11 @@ export interface CameraPreviewSize {
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { CameraPreview, CameraPreviewRect } from 'ionic-native';
|
||||
* import { CameraPreview, CameraPreviewRect } from '@ionic-native/camera-preview';
|
||||
*
|
||||
* constructor(private cameraPreview: CameraPreview) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // camera options (Size and location)
|
||||
* let cameraRect: CameraPreviewRect = {
|
||||
@@ -43,7 +47,7 @@ export interface CameraPreviewSize {
|
||||
*
|
||||
*
|
||||
* // start camera
|
||||
* CameraPreview.startCamera(
|
||||
* this.cameraPreview.startCamera(
|
||||
* cameraRect, // position and size of preview
|
||||
* 'front', // default camera
|
||||
* true, // tap to take picture
|
||||
@@ -53,26 +57,26 @@ export interface CameraPreviewSize {
|
||||
* );
|
||||
*
|
||||
* // Set the handler to run every time we take a picture
|
||||
* CameraPreview.setOnPictureTakenHandler().subscribe((result) => {
|
||||
* this.cameraPreview.setOnPictureTakenHandler().subscribe((result) => {
|
||||
* console.log(result);
|
||||
* // do something with the result
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // take a picture
|
||||
* CameraPreview.takePicture({
|
||||
* this.cameraPreview.takePicture({
|
||||
* maxWidth: 640,
|
||||
* maxHeight: 640
|
||||
* });
|
||||
*
|
||||
* // Switch camera
|
||||
* CameraPreview.switchCamera();
|
||||
* this.cameraPreview.switchCamera();
|
||||
*
|
||||
* // set color effect to negative
|
||||
* CameraPreview.setColorEffect('negative');
|
||||
* this.cameraPreview.setColorEffect('negative');
|
||||
*
|
||||
* // Stop the camera preview
|
||||
* CameraPreview.stopCamera();
|
||||
* this.cameraPreview.stopCamera();
|
||||
*
|
||||
* ```
|
||||
*
|
||||
@@ -87,6 +91,7 @@ export interface CameraPreviewSize {
|
||||
repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class CameraPreview {
|
||||
|
||||
/**
|
||||
@@ -101,7 +106,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { }
|
||||
startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { }
|
||||
|
||||
/**
|
||||
* Stops the camera preview instance.
|
||||
@@ -109,7 +114,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static stopCamera(): void { }
|
||||
stopCamera(): void { }
|
||||
|
||||
/**
|
||||
* Take the picture, the parameter size is optional
|
||||
@@ -118,7 +123,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static takePicture(size?: CameraPreviewSize): void { }
|
||||
takePicture(size?: CameraPreviewSize): void { }
|
||||
|
||||
/**
|
||||
* Register a callback function that receives the original picture and the image captured from the preview box.
|
||||
@@ -127,7 +132,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
static setOnPictureTakenHandler(): Observable<any> { return; }
|
||||
setOnPictureTakenHandler(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Switch from the rear camera and front camera, if available.
|
||||
@@ -135,7 +140,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static switchCamera(): void { }
|
||||
switchCamera(): void { }
|
||||
|
||||
/**
|
||||
* Show the camera preview box.
|
||||
@@ -143,7 +148,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static show(): void { }
|
||||
show(): void { }
|
||||
|
||||
/**
|
||||
* Hide the camera preview box.
|
||||
@@ -151,7 +156,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static hide(): void { }
|
||||
hide(): void { }
|
||||
|
||||
/**
|
||||
* Disables the camera preview
|
||||
@@ -159,7 +164,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static disable(): void { }
|
||||
disable(): void { }
|
||||
|
||||
/**
|
||||
* Set camera color effect.
|
||||
@@ -167,6 +172,6 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static setColorEffect(effect: string): void { }
|
||||
setColorEffect(effect: string): void { }
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface CameraOptions {
|
||||
/** Picture quality in range 0-100. Default is 50 */
|
||||
@@ -94,10 +94,14 @@ export interface CameraPopoverOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Camera } from 'ionic-native';
|
||||
* import { Camera } from '@ionic-native/camera';
|
||||
*
|
||||
* constructor(private camera: Camera) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* Camera.getPicture(options).then((imageData) => {
|
||||
* this.camera.getPicture(options).then((imageData) => {
|
||||
* // imageData is either a base64 encoded string or a file URI
|
||||
* // If it's base64:
|
||||
* let base64Image = 'data:image/jpeg;base64,' + imageData;
|
||||
@@ -109,6 +113,7 @@ export interface CameraPopoverOptions {
|
||||
* CameraOptions
|
||||
* CameraPopoverOptions
|
||||
*/
|
||||
@Injectable()
|
||||
@Plugin({
|
||||
pluginName: 'Camera',
|
||||
plugin: 'cordova-plugin-camera',
|
||||
@@ -199,7 +204,7 @@ export class Camera {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getPicture(options?: CameraOptions): Promise<any> { return; }
|
||||
getPicture(options?: CameraOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.
|
||||
@@ -209,6 +214,6 @@ export class Camera {
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static cleanup(): Promise<any> { return; };
|
||||
cleanup(): Promise<any> { return; };
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface CardIOOptions {
|
||||
|
||||
@@ -134,10 +134,14 @@ export interface CardIOResponse {
|
||||
* @description
|
||||
* @usage
|
||||
* ```
|
||||
* import { CardIO } from 'ionic-native';
|
||||
* import { CardIO } from '@ionic-native/card-io';
|
||||
*
|
||||
* constructor(private cardIO: CardIO) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* CardIO.canScan()
|
||||
* this.cardIO.canScan()
|
||||
* .then(
|
||||
* (res: boolean) => {
|
||||
* if(res){
|
||||
@@ -162,6 +166,7 @@ export interface CardIOResponse {
|
||||
repo: 'https://github.com/card-io/card.io-Cordova-Plugin',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class CardIO {
|
||||
|
||||
/**
|
||||
@@ -171,7 +176,7 @@ export class CardIO {
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static canScan(): Promise<boolean> { return; }
|
||||
canScan(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Scan a credit card with card.io.
|
||||
@@ -179,13 +184,13 @@ export class CardIO {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static scan(options?: CardIOOptions): Promise<CardIOResponse> { return; }
|
||||
scan(options?: CardIOOptions): Promise<CardIOResponse> { return; }
|
||||
|
||||
/**
|
||||
* Retrieve the version of the card.io library. Useful when contacting support.
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
static version(): Promise<string> { return; }
|
||||
version(): Promise<string> { return; }
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
/**
|
||||
* @name Clipboard
|
||||
* @description
|
||||
@@ -10,20 +10,23 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Clipboard } from 'ionic-native';
|
||||
* import { Clipboard } from '@ionic-native/clipboard';
|
||||
*
|
||||
* constructor(private clipboard: Clipboard) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* Clipboard.copy('Hello world');
|
||||
* this.clipboard.copy('Hello world');
|
||||
*
|
||||
* Clipboard.paste().then(
|
||||
* this.clipboard.paste().then(
|
||||
* (resolve: string) => {
|
||||
* alert(resolve);
|
||||
* alert(resolve);
|
||||
* },
|
||||
* (reject: string) => {
|
||||
* alert('Error: ' + reject);
|
||||
* alert('Error: ' + reject);
|
||||
* }
|
||||
* );
|
||||
* );
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -33,6 +36,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
repo: 'https://github.com/VersoSolutions/CordovaClipboard',
|
||||
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
|
||||
})
|
||||
@Injectable()
|
||||
export class Clipboard {
|
||||
|
||||
/**
|
||||
@@ -41,13 +45,13 @@ export class Clipboard {
|
||||
* @returns {Promise<any>} Returns a promise after the text has been copied
|
||||
*/
|
||||
@Cordova()
|
||||
static copy(text: string): Promise<any> { return; }
|
||||
copy(text: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Pastes the text stored in clipboard
|
||||
* @returns {Promise<any>} Returns a promise after the text has been pasted
|
||||
*/
|
||||
@Cordova()
|
||||
static paste(): Promise<any> { return; }
|
||||
paste(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
namespace Http {
|
||||
export const enum Verb {
|
||||
GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH
|
||||
@@ -404,14 +404,18 @@ export interface DownloadProgress {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { CodePush } from 'ionic-native';
|
||||
* import { CodePush } from '@ionic-native/code-push';
|
||||
*
|
||||
* constructor(private codePush: CodePush) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // note - mostly error & completed methods of observable will not fire
|
||||
* // as syncStatus will contain the current state of the update
|
||||
* CodePush.sync().subscribe((syncStatus) => console.log(syncStatus));
|
||||
* this.codePush.sync().subscribe((syncStatus) => console.log(syncStatus));
|
||||
*
|
||||
* const downloadProgress = (progress) => { console.log(`Downloaded ${progress.receivedBytes} of ${progress.totalBytes}`); }
|
||||
* CodePush.sync({}, downloadProgress).subscribe((syncStatus) => console.log(syncStatus));
|
||||
* this.codePush.sync({}, downloadProgress).subscribe((syncStatus) => console.log(syncStatus));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@@ -422,6 +426,7 @@ export interface DownloadProgress {
|
||||
repo: 'https://github.com/Microsoft/cordova-plugin-code-push',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class CodePush {
|
||||
|
||||
/**
|
||||
@@ -432,7 +437,7 @@ export class CodePush {
|
||||
* @returns {Promise<ILocalPackage>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getCurrentPackage(): Promise<ILocalPackage> {
|
||||
getCurrentPackage(): Promise<ILocalPackage> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -442,7 +447,7 @@ export class CodePush {
|
||||
* @returns {Promise<ILocalPackage>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getPendingPackage(): Promise<ILocalPackage> {
|
||||
getPendingPackage(): Promise<ILocalPackage> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -459,7 +464,7 @@ export class CodePush {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static checkForUpdate(deploymentKey?: string): Promise<IRemotePackage> {
|
||||
checkForUpdate(deploymentKey?: string): Promise<IRemotePackage> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -473,7 +478,7 @@ export class CodePush {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static notifyApplicationReady(): Promise<void> {
|
||||
notifyApplicationReady(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -483,7 +488,7 @@ export class CodePush {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static restartApplication(): Promise<void> {
|
||||
restartApplication(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -513,7 +518,7 @@ export class CodePush {
|
||||
successIndex: 0,
|
||||
errorIndex: 3 // we don't need this, so we set it to a value higher than # of args
|
||||
})
|
||||
static sync(syncOptions?: SyncOptions, downloadProgress?: SuccessCallback<DownloadProgress>): Observable<SyncStatus> {
|
||||
sync(syncOptions?: SyncOptions, downloadProgress?: SuccessCallback<DownloadProgress>): Observable<SyncStatus> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { CordovaInstance, InstanceProperty, Plugin, getPromise } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, InstanceProperty, Plugin, getPromise } from '@ionic-native/core';
|
||||
|
||||
declare var window: any,
|
||||
navigator: any;
|
||||
|
||||
export type ContactFieldType = 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
|
||||
export type ContactFieldType = '*' | 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -259,10 +260,11 @@ export class ContactFindOptions implements IContactFindOptions {
|
||||
* @usage
|
||||
*
|
||||
* ```typescript
|
||||
* import { Contacts, Contact, ContactField, ContactName } from 'ionic-native';
|
||||
* import { Contacts, Contact, ContactField, ContactName } from '@ionic-native/contacts';
|
||||
*
|
||||
* constructor(private contacts: Contacts) { }
|
||||
*
|
||||
* let contact: Contact = Contacts.create();
|
||||
* let contact: Contact = this.contacts.create();
|
||||
*
|
||||
* contact.name = new ContactName(null, 'Smith', 'John');
|
||||
* contact.phoneNumbers = [new ContactField('mobile', '6471234567')];
|
||||
@@ -287,13 +289,14 @@ export class ContactFindOptions implements IContactFindOptions {
|
||||
pluginRef: 'navigator.contacts',
|
||||
repo: 'https://github.com/apache/cordova-plugin-contacts'
|
||||
})
|
||||
@Injectable()
|
||||
export class Contacts {
|
||||
|
||||
/**
|
||||
* Create a single contact.
|
||||
* @returns {Contact} Returns a Contact object
|
||||
*/
|
||||
static create(): Contact {
|
||||
create(): Contact {
|
||||
return new Contact();
|
||||
}
|
||||
|
||||
@@ -303,7 +306,7 @@ export class Contacts {
|
||||
* @param options {IContactFindOptions} Optional options for the query
|
||||
* @returns {Promise<Contact[]>} Returns a Promise that resolves with the search results (an array of Contact objects)
|
||||
*/
|
||||
static find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
|
||||
find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
|
||||
return getPromise((resolve, reject) => {
|
||||
navigator.contacts.find(fields, (contacts) => {
|
||||
resolve(contacts.map(processContact));
|
||||
@@ -315,7 +318,7 @@ export class Contacts {
|
||||
* Select a single Contact.
|
||||
* @returns {Promise<Contact>} Returns a Promise that resolves with the selected Contact
|
||||
*/
|
||||
static pickContact(): Promise<Contact> {
|
||||
pickContact(): Promise<Contact> {
|
||||
return getPromise((resolve, reject) => {
|
||||
navigator.contacts.pickContact((contact) => resolve(processContact(contact)), reject);
|
||||
});
|
||||
@@ -0,0 +1,42 @@
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
|
||||
/**
|
||||
* @name Couchbase Lite
|
||||
* @description
|
||||
* Plugin to install Couchbase Lite in your PhoneGap app on iOS or Android
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { CouchbaseLite } from '@ionic-native/couchbase-lite';
|
||||
*
|
||||
* constructor(private couchbase: CouchbaseLite) {
|
||||
*
|
||||
* couchbase.getURL()
|
||||
* .then(url => console.log(url))
|
||||
* .catch(error => console.error(error));
|
||||
*
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'CouchbaseLite',
|
||||
plugin: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin',
|
||||
pluginRef: 'cblite',
|
||||
repo: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin',
|
||||
})
|
||||
@Injectable()
|
||||
export class CouchbaseLite {
|
||||
|
||||
/**
|
||||
* Get the database url
|
||||
* @return {Promise<any>} Returns a promise that resolves with the local database url
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
})
|
||||
getURL(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,15 +1,18 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Crop
|
||||
* @description Crops images
|
||||
* @usage
|
||||
* ```
|
||||
* import {Crop} from 'ionic-native';
|
||||
* import {Crop} from '@ionic-native/crop';
|
||||
*
|
||||
* constructor(private crop: Crop) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* Crop.crop('path/to/image.jpg', {quality: 75})
|
||||
* this.crop.crop('path/to/image.jpg', {quality: 75})
|
||||
* .then(
|
||||
* newImage => console.log("new image path is: " + newImage),
|
||||
* error => console.error("Error cropping image", error)
|
||||
@@ -22,6 +25,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
pluginRef: 'plugins',
|
||||
repo: 'https://github.com/jeduan/cordova-plugin-crop'
|
||||
})
|
||||
@Injectable()
|
||||
export class Crop {
|
||||
|
||||
/**
|
||||
@@ -33,6 +37,6 @@ export class Crop {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static crop(pathToImage: string, options?: {quality: number}): Promise<string> { return; }
|
||||
crop(pathToImage: string, options?: {quality: number}): Promise<string> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import {Cordova, Plugin} from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import {Cordova, Plugin} from '@ionic-native/core';
|
||||
|
||||
export interface DatePickerOptions {
|
||||
/**
|
||||
@@ -125,10 +126,15 @@ export interface DatePickerOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { DatePicker } from 'ionic-native';
|
||||
* import { DatePicker } from '@ionic-native/date-picker';
|
||||
*
|
||||
* constructor(private datePicker: DatePicker) { }
|
||||
*
|
||||
*
|
||||
* DatePicker.show({
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.datePicker.show({
|
||||
* date: new Date(),
|
||||
* mode: 'date'
|
||||
* }).then(
|
||||
@@ -146,6 +152,7 @@ export interface DatePickerOptions {
|
||||
repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker',
|
||||
platforms: ['Android', 'iOS', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
export class DatePicker {
|
||||
|
||||
/**
|
||||
@@ -165,7 +172,7 @@ export class DatePicker {
|
||||
* @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
static show(options: DatePickerOptions): Promise<Date> {
|
||||
show(options: DatePickerOptions): Promise<Date> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
@@ -6,16 +7,20 @@ import { Observable } from 'rxjs/Observable';
|
||||
* @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { DBMeter } from 'ionic-native';
|
||||
* import { DBMeter } from '@ionic-native/db-meter';
|
||||
*
|
||||
* constructor(private dbMeter: DBMeter) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Start listening
|
||||
* let subscription = DBMeter.start().subscribe(
|
||||
* let subscription = this.dbMeter.start().subscribe(
|
||||
* data => console.log(data)
|
||||
* );
|
||||
*
|
||||
* // Check if we are listening
|
||||
* DBMeter.isListening().then(
|
||||
* this.dbMeter.isListening().then(
|
||||
* (isListening: boolean) => console.log(isListening)
|
||||
* );
|
||||
*
|
||||
@@ -23,7 +28,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
* subscription.unsubscribe();
|
||||
*
|
||||
* // Delete DBMeter instance from memory
|
||||
* DBMeter.delete().then(
|
||||
* this.dbMeter.delete().then(
|
||||
* () => console.log('Deleted DB Meter instance'),
|
||||
* error => console.log('Error occurred while deleting DB Meter instance')
|
||||
* );
|
||||
@@ -36,6 +41,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
repo: 'https://github.com/akofman/cordova-plugin-dbmeter',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class DBMeter {
|
||||
|
||||
/**
|
||||
@@ -46,27 +52,27 @@ export class DBMeter {
|
||||
observable: true,
|
||||
clearFunction: 'stop'
|
||||
})
|
||||
static start(): Observable<any> { return; }
|
||||
start(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stops listening
|
||||
* @private
|
||||
*/
|
||||
@Cordova()
|
||||
static stop(): Promise<any> { return; }
|
||||
stop(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Check if the DB Meter is listening
|
||||
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening
|
||||
*/
|
||||
@Cordova()
|
||||
static isListening(): Promise<boolean> { return; }
|
||||
isListening(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Delete the DB Meter instance
|
||||
* @returns {Promise<any>} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.
|
||||
*/
|
||||
@Cordova()
|
||||
static delete(): Promise<any> { return; }
|
||||
delete(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export interface DeeplinkMatch {
|
||||
@@ -29,39 +30,41 @@ export interface DeeplinkMatch {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Deeplinks } from 'ionic-native';
|
||||
* import { Deeplinks } from '@ionic-native/deeplinks';
|
||||
*
|
||||
* Deeplinks.route({
|
||||
'/about-us': AboutPage,
|
||||
'/universal-links-test': AboutPage,
|
||||
'/products/:productId': ProductPage
|
||||
}).subscribe((match) => {
|
||||
// match.$route - the route we matched, which is the matched entry from the arguments to route()
|
||||
// match.$args - the args passed in the link
|
||||
// match.$link - the full link data
|
||||
console.log('Successfully matched route', match);
|
||||
}, (nomatch) => {
|
||||
// nomatch.$link - the full link data
|
||||
console.error('Got a deeplink that didn\'t match', nomatch);
|
||||
});
|
||||
* constructor(private deepLinks: DeepLinks) { }
|
||||
*
|
||||
* this.deepLinks.route({
|
||||
* '/about-us': AboutPage,
|
||||
* '/universal-links-test': AboutPage,
|
||||
* '/products/:productId': ProductPage
|
||||
* }).subscribe((match) => {
|
||||
* // match.$route - the route we matched, which is the matched entry from the arguments to route()
|
||||
* // match.$args - the args passed in the link
|
||||
* // match.$link - the full link data
|
||||
* console.log('Successfully matched route', match);
|
||||
* }, (nomatch) => {
|
||||
* // nomatch.$link - the full link data
|
||||
* console.error('Got a deeplink that didn\'t match', nomatch);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Alternatively, if you're using Ionic 2, there's a convenience method that takes a reference to a `NavController` and handles
|
||||
* the actual navigation for you:
|
||||
*
|
||||
* ```typescript
|
||||
* Deeplinks.routeWithNavController(this.navController, {
|
||||
'/about-us': AboutPage,
|
||||
'/products/:productId': ProductPage
|
||||
}).subscribe((match) => {
|
||||
// match.$route - the route we matched, which is the matched entry from the arguments to route()
|
||||
// match.$args - the args passed in the link
|
||||
// match.$link - the full link data
|
||||
console.log('Successfully matched route', match);
|
||||
}, (nomatch) => {
|
||||
// nomatch.$link - the full link data
|
||||
console.error('Got a deeplink that didn\'t match', nomatch);
|
||||
});
|
||||
* this.deepLinks.routeWithNavController(this.navController, {
|
||||
* '/about-us': AboutPage,
|
||||
* '/products/:productId': ProductPage
|
||||
* }).subscribe((match) => {
|
||||
* // match.$route - the route we matched, which is the matched entry from the arguments to route()
|
||||
* // match.$args - the args passed in the link
|
||||
* // match.$link - the full link data
|
||||
* console.log('Successfully matched route', match);
|
||||
* }, (nomatch) => {
|
||||
* // nomatch.$link - the full link data
|
||||
* console.error('Got a deeplink that didn\'t match', nomatch);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* See the [Ionic 2 Deeplinks Demo](https://github.com/driftyco/ionic2-deeplinks-demo/blob/master/app/app.ts) for an example of how to
|
||||
@@ -76,8 +79,10 @@ export interface DeeplinkMatch {
|
||||
pluginRef: 'IonicDeeplink',
|
||||
repo: 'https://github.com/driftyco/ionic-plugin-deeplinks',
|
||||
platforms: ['iOS', 'Android'],
|
||||
install: 'ionic plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/'
|
||||
install: 'ionic plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/',
|
||||
installVariables: ['URL_SCHEME', 'DEEPLINK_SCHEME', 'DEEPLINK_HOST', 'ANDROID_PATH_PREFIX']
|
||||
})
|
||||
@Injectable()
|
||||
export class Deeplinks {
|
||||
|
||||
/**
|
||||
@@ -93,7 +98,7 @@ export class Deeplinks {
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
static route(paths): Observable<DeeplinkMatch> { return; }
|
||||
route(paths): Observable<DeeplinkMatch> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -116,6 +121,6 @@ export class Deeplinks {
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
static routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
|
||||
routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
|
||||
|
||||
}
|
||||
@@ -1,5 +1,25 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Device Accounts
|
||||
* @description
|
||||
* Gets the Google accounts associated with the Android device
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { DeviceAccounts } from '@ionic-native/device-accounts';
|
||||
*
|
||||
* constructor(private deviceAccounts: DeviceAccounts) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.deviceAccounts.get()
|
||||
* .then(accounts => console.log(accounts))
|
||||
* .catch(error => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'DeviceAccounts',
|
||||
plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git',
|
||||
@@ -7,6 +27,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
repo: 'https://github.com/loicknuchel/cordova-device-accounts',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class DeviceAccounts {
|
||||
|
||||
/**
|
||||
@@ -14,27 +35,27 @@ export class DeviceAccounts {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static get(): Promise<any> { return; }
|
||||
get(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get all accounts registered on Android device for requested type
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getByType(type: string): Promise<any> { return; }
|
||||
getByType(type: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get all emails registered on Android device (accounts with 'com.google' type)
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getEmails(): Promise<any> { return; }
|
||||
getEmails(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get the first email registered on Android device
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getEmail(): Promise<any> { return; }
|
||||
getEmail(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
+15
-8
@@ -1,4 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
/**
|
||||
* @name DeviceFeedback
|
||||
* @description
|
||||
@@ -7,13 +8,18 @@ import { Plugin, Cordova } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { DeviceFeedback } from 'ionic-native';
|
||||
* import { DeviceFeedback } from '@ionic-native/device-feedback';
|
||||
*
|
||||
* DeviceFeedback.acoustic();
|
||||
* constructor(private deviceFeedback: DeviceFeedback) { }
|
||||
*
|
||||
* DeviceFeedback.haptic(0);
|
||||
* ...
|
||||
*
|
||||
* DeviceFeedback.isFeedbackEnabled()
|
||||
*
|
||||
* this.deviceFeedback.acoustic();
|
||||
*
|
||||
* this.deviceFeedback.haptic(0);
|
||||
*
|
||||
* this.deviceFeedback.isFeedbackEnabled()
|
||||
* .then((feedback) => {
|
||||
* console.log(feedback);
|
||||
* // {
|
||||
@@ -31,26 +37,27 @@ import { Plugin, Cordova } from './plugin';
|
||||
repo: 'https://github.com/VVelda/device-feedback',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class DeviceFeedback {
|
||||
|
||||
/**
|
||||
* Provide sound feedback to user, nevertheless respect user's settings and current active device profile as native feedback do.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static acoustic(): void { }
|
||||
acoustic(): void { }
|
||||
|
||||
/**
|
||||
* Provide vibrate feedback to user, nevertheless respect user's tactile feedback setting as native feedback do.
|
||||
* @param type {Number} Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static haptic(type: number): void { }
|
||||
haptic(type: number): void { }
|
||||
|
||||
/**
|
||||
* Check if haptic and acoustic feedback is enabled by user settings.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isFeedbackEnabled(): Promise<{ haptic: boolean; acoustic: boolean; }> { return; }
|
||||
isFeedbackEnabled(): Promise<{ haptic: boolean; acoustic: boolean; }> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export interface DeviceMotionAccelerationData {
|
||||
@@ -41,17 +42,16 @@ export interface DeviceMotionAccelerometerOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { DeviceMotion } from 'ionic-native';
|
||||
*
|
||||
* import { DeviceMotion, DeviceMotionAccelerationData } from '@ionic-native/device-motion';
|
||||
*
|
||||
* // Get the device current acceleration
|
||||
* DeviceMotion.getCurrentAcceleration().then(
|
||||
* (acceleration: AccelerationData) => console.log(acceleration),
|
||||
* (acceleration: DeviceMotionAccelerationData) => console.log(acceleration),
|
||||
* (error: any) => console.log(error)
|
||||
* );
|
||||
*
|
||||
* // Watch device acceleration
|
||||
* var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: AccelerationData) => {
|
||||
* var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: DeviceMotionAccelerationData) => {
|
||||
* console.log(acceleration);
|
||||
* });
|
||||
*
|
||||
@@ -69,6 +69,7 @@ export interface DeviceMotionAccelerometerOptions {
|
||||
pluginRef: 'navigator.accelerometer',
|
||||
repo: 'https://github.com/apache/cordova-plugin-device-motion'
|
||||
})
|
||||
@Injectable()
|
||||
export class DeviceMotion {
|
||||
|
||||
/**
|
||||
@@ -76,7 +77,7 @@ export class DeviceMotion {
|
||||
* @returns {Promise<DeviceMotionAccelerationData>} Returns object with x, y, z, and timestamp properties
|
||||
*/
|
||||
@Cordova()
|
||||
static getCurrentAcceleration(): Promise<DeviceMotionAccelerationData> { return; }
|
||||
getCurrentAcceleration(): Promise<DeviceMotionAccelerationData> { return; }
|
||||
|
||||
/**
|
||||
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
|
||||
@@ -88,6 +89,6 @@ export class DeviceMotion {
|
||||
observable: true,
|
||||
clearFunction: 'clearWatch'
|
||||
})
|
||||
static watchAcceleration(options?: DeviceMotionAccelerometerOptions): Observable<DeviceMotionAccelerationData> { return; }
|
||||
watchAcceleration(options?: DeviceMotionAccelerometerOptions): Observable<DeviceMotionAccelerationData> { return; }
|
||||
|
||||
}
|
||||
+9
-7
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export interface DeviceOrientationCompassHeading {
|
||||
@@ -46,19 +47,19 @@ export interface DeviceOrientationCompassOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* // CompassHeading is an interface for compass
|
||||
* import { DeviceOrientation, CompassHeading } from 'ionic-native';
|
||||
* // DeviceOrientationCompassHeading is an interface for compass
|
||||
* import { DeviceOrientation, DeviceOrientationCompassHeading } from '@ionic-native/device-orientation';
|
||||
*
|
||||
*
|
||||
* // Get the device current compass heading
|
||||
* DeviceOrientation.getCurrentHeading().then(
|
||||
* (data: CompassHeading) => console.log(data),
|
||||
* (data: DeviceOrientationCompassHeading) => console.log(data),
|
||||
* (error: any) => console.log(error)
|
||||
* );
|
||||
*
|
||||
* // Watch the device compass heading change
|
||||
* var subscription = DeviceOrientation.watchHeading().subscribe(
|
||||
* (data: CompassHeading) => console.log(data)
|
||||
* (data: DeviceOrientationCompassHeading) => console.log(data)
|
||||
* );
|
||||
*
|
||||
* // Stop watching heading change
|
||||
@@ -74,6 +75,7 @@ export interface DeviceOrientationCompassOptions {
|
||||
pluginRef: 'navigator.compass',
|
||||
repo: 'https://github.com/apache/cordova-plugin-device-orientation'
|
||||
})
|
||||
@Injectable()
|
||||
export class DeviceOrientation {
|
||||
|
||||
/**
|
||||
@@ -81,7 +83,7 @@ export class DeviceOrientation {
|
||||
* @returns {Promise<DeviceOrientationCompassHeading>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getCurrentHeading(): Promise<DeviceOrientationCompassHeading> { return; }
|
||||
getCurrentHeading(): Promise<DeviceOrientationCompassHeading> { return; }
|
||||
|
||||
/**
|
||||
* Get the device current heading at a regular interval
|
||||
@@ -95,6 +97,6 @@ export class DeviceOrientation {
|
||||
observable: true,
|
||||
clearFunction: 'clearWatch'
|
||||
})
|
||||
static watchHeading(options?: DeviceOrientationCompassOptions): Observable<DeviceOrientationCompassHeading> { return; }
|
||||
watchHeading(options?: DeviceOrientationCompassOptions): Observable<DeviceOrientationCompassHeading> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { CordovaProperty, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaProperty, Plugin } from '@ionic-native/core';
|
||||
|
||||
declare var window: any;
|
||||
|
||||
@@ -9,10 +10,13 @@ declare var window: any;
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Device } from 'ionic-native';
|
||||
* import { Device } from '@ionic-native/device';
|
||||
*
|
||||
* constructor(private device: Device) { }
|
||||
*
|
||||
* console.log('Device UUID is: ' + Device.uuid);
|
||||
* ...
|
||||
*
|
||||
* console.log('Device UUID is: ' + this.device.uuid);
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -21,41 +25,42 @@ declare var window: any;
|
||||
pluginRef: 'device',
|
||||
repo: 'https://github.com/apache/cordova-plugin-device'
|
||||
})
|
||||
@Injectable()
|
||||
export class Device {
|
||||
|
||||
/** Get the version of Cordova running on the device. */
|
||||
@CordovaProperty
|
||||
static cordova: string;
|
||||
cordova: string;
|
||||
|
||||
/**
|
||||
* The device.model returns the name of the device's model or product. The value is set
|
||||
* by the device manufacturer and may be different across versions of the same product.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static model: string;
|
||||
model: string;
|
||||
|
||||
/** Get the device's operating system name. */
|
||||
@CordovaProperty
|
||||
static platform: string;
|
||||
platform: string;
|
||||
|
||||
/** Get the device's Universally Unique Identifier (UUID). */
|
||||
@CordovaProperty
|
||||
static uuid: string;
|
||||
uuid: string;
|
||||
|
||||
/** Get the operating system version. */
|
||||
@CordovaProperty
|
||||
static version: string;
|
||||
version: string;
|
||||
|
||||
/** Get the device's manufacturer. */
|
||||
@CordovaProperty
|
||||
static manufacturer: string;
|
||||
manufacturer: string;
|
||||
|
||||
/** Whether the device is running on a simulator. */
|
||||
@CordovaProperty
|
||||
static isVirtual: boolean;
|
||||
isVirtual: boolean;
|
||||
|
||||
/** Get the device hardware serial number. */
|
||||
@CordovaProperty
|
||||
static serial: string;
|
||||
serial: string;
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import {Cordova, Plugin, CordovaProperty} from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import {Cordova, Plugin, CordovaProperty} from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Diagnostic
|
||||
@@ -7,7 +8,7 @@ import {Cordova, Plugin, CordovaProperty} from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Diagnostic } from 'ionic-native';
|
||||
* import { Diagnostic } from '@ionic-native/diagnostic';
|
||||
*
|
||||
* let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); };
|
||||
* let errorCallback = (e) => console.error(e);
|
||||
@@ -35,6 +36,7 @@ import {Cordova, Plugin, CordovaProperty} from './plugin';
|
||||
pluginRef: 'cordova.plugins.diagnostic',
|
||||
repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin'
|
||||
})
|
||||
@Injectable()
|
||||
export class Diagnostic {
|
||||
|
||||
static permission = {
|
||||
@@ -109,13 +111,22 @@ export class Diagnostic {
|
||||
POWERING_ON: 'powering_on'
|
||||
};
|
||||
|
||||
@CordovaProperty
|
||||
static NFCState: {
|
||||
UNKNOWN: string;
|
||||
POWERED_OFF: string;
|
||||
POWERED_ON: string;
|
||||
POWERING_ON: string;
|
||||
POWERING_OFF: string;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Checks if app is able to access device location.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isLocationAvailable(): Promise<any> { return; }
|
||||
isLocationAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
|
||||
@@ -123,7 +134,7 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isWifiAvailable(): Promise<any> { return; }
|
||||
isWifiAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
|
||||
@@ -131,7 +142,7 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isCameraAvailable(): Promise<any> { return; }
|
||||
isCameraAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
|
||||
@@ -139,38 +150,38 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isBluetoothAvailable(): Promise<any> { return; }
|
||||
isBluetoothAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Displays the device location settings to allow user to enable location services/change location mode.
|
||||
*/
|
||||
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
|
||||
static switchToLocationSettings(): void { }
|
||||
switchToLocationSettings(): void { }
|
||||
|
||||
/**
|
||||
* Displays mobile settings to allow user to enable mobile data.
|
||||
*/
|
||||
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
|
||||
static switchToMobileDataSettings(): void { }
|
||||
switchToMobileDataSettings(): void { }
|
||||
|
||||
/**
|
||||
* Displays Bluetooth settings to allow user to enable Bluetooth.
|
||||
*/
|
||||
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
|
||||
static switchToBluetoothSettings(): void { }
|
||||
switchToBluetoothSettings(): void { }
|
||||
|
||||
/**
|
||||
* Displays WiFi settings to allow user to enable WiFi.
|
||||
*/
|
||||
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
|
||||
static switchToWifiSettings(): void { }
|
||||
switchToWifiSettings(): void { }
|
||||
|
||||
/**
|
||||
* Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()`
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'Windows 10'] })
|
||||
static isWifiEnabled(): Promise<boolean> { return; }
|
||||
isWifiEnabled(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Enables/disables WiFi on the device.
|
||||
@@ -179,7 +190,7 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
|
||||
static setWifiState(state: boolean): Promise<any> { return; }
|
||||
setWifiState(state: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enables/disables Bluetooth on the device.
|
||||
@@ -188,14 +199,17 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
|
||||
static setBluetoothState(state: boolean): Promise<any> { return; }
|
||||
setBluetoothState(state: boolean): Promise<any> { return; }
|
||||
|
||||
|
||||
// ANDROID AND IOS ONLY
|
||||
|
||||
/**
|
||||
* Returns true if the device setting for location is on. On Android this returns true if Location Mode is switched on. On iOS this returns true if Location Services is switched on.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static isLocationEnabled(): Promise<boolean> { return; }
|
||||
isLocationEnabled(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use location.
|
||||
@@ -203,14 +217,14 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isLocationAuthorized(): Promise<any> { return; }
|
||||
isLocationAuthorized(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the location authorization status for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static getLocationAuthorizationStatus(): Promise<any> { return; }
|
||||
getLocationAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the location authorization status for the application.
|
||||
@@ -220,14 +234,14 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
|
||||
static requestLocationAuthorization(mode?: string): Promise<any> { return; }
|
||||
requestLocationAuthorization(mode?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if camera hardware is present on device.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static isCameraPresent(): Promise<any> { return; }
|
||||
isCameraPresent(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use the camera.
|
||||
@@ -235,63 +249,63 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static isCameraAuthorized(): Promise<any> { return; }
|
||||
isCameraAuthorized(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the camera authorization status for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static getCameraAuthorizationStatus(): Promise<any> { return; }
|
||||
getCameraAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests camera authorization for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static requestCameraAuthorization(): Promise<any> { return; }
|
||||
requestCameraAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use the microphone.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static isMicrophoneAuthorized(): Promise<boolean> { return; }
|
||||
isMicrophoneAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Returns the microphone authorization status for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static getMicrophoneAuthorizationStatus(): Promise<any> { return; }
|
||||
getMicrophoneAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests microphone authorization for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static requestMicrophoneAuthorization(): Promise<any> { return; }
|
||||
requestMicrophoneAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use contacts (address book).
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static isContactsAuthorized(): Promise<boolean> { return; }
|
||||
isContactsAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Returns the contacts authorization status for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static getContactsAuthorizationStatus(): Promise<any> { return; }
|
||||
getContactsAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests contacts authorization for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static requestContactsAuthorization(): Promise<any> { return; }
|
||||
requestContactsAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use the calendar.
|
||||
@@ -304,7 +318,7 @@ export class Diagnostic {
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static isCalendarAuthorized(): Promise<boolean> { return; }
|
||||
isCalendarAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Returns the calendar authorization status for the application.
|
||||
@@ -318,7 +332,7 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static getCalendarAuthorizationStatus(): Promise<any> { return; }
|
||||
getCalendarAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests calendar authorization for the application.
|
||||
@@ -335,7 +349,7 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static requestCalendarAuthorization(): Promise<any> { return; }
|
||||
requestCalendarAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Opens settings page for this app.
|
||||
@@ -344,28 +358,31 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static switchToSettings(): Promise<any> { return; }
|
||||
switchToSettings(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the state of Bluetooth on the device.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static getBluetoothState(): Promise<any> { return; }
|
||||
getBluetoothState(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a change in Bluetooth state occurs.
|
||||
* @param handler
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
|
||||
static registerBluetoothStateChangeHandler(handler: Function): void { }
|
||||
registerBluetoothStateChangeHandler(handler: Function): void { }
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a change in Location state occurs.
|
||||
* @param handler
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
|
||||
static registerLocationStateChangeHandler(handler: Function): void { }
|
||||
registerLocationStateChangeHandler(handler: Function): void { }
|
||||
|
||||
|
||||
// ANDROID ONLY
|
||||
|
||||
/**
|
||||
* Checks if high-accuracy locations are available to the app from GPS hardware.
|
||||
@@ -373,7 +390,7 @@ export class Diagnostic {
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isGpsLocationAvailable(): Promise<boolean> { return; }
|
||||
isGpsLocationAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
|
||||
@@ -383,7 +400,7 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isGpsLocationEnabled(): Promise<any> { return; }
|
||||
isGpsLocationEnabled(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points.
|
||||
@@ -391,7 +408,7 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isNetworkLocationAvailable(): Promise<any> { return; }
|
||||
isNetworkLocationAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points.
|
||||
@@ -401,14 +418,14 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isNetworkLocationEnabled(): Promise<any> { return; }
|
||||
isNetworkLocationEnabled(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the current location mode setting for the device.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static getLocationMode(): Promise<any> { return; }
|
||||
getLocationMode(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the current authorisation status for a given permission.
|
||||
@@ -417,7 +434,7 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
|
||||
static getPermissionAuthorizationStatus(permission: any): Promise<any> { return; }
|
||||
getPermissionAuthorizationStatus(permission: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the current authorisation status for multiple permissions.
|
||||
@@ -426,7 +443,7 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
|
||||
static getPermissionsAuthorizationStatus(permissions: any[]): Promise<any> { return; }
|
||||
getPermissionsAuthorizationStatus(permissions: any[]): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests app to be granted authorisation for a runtime permission.
|
||||
@@ -435,7 +452,7 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
|
||||
static requestRuntimePermission(permission: any): Promise<any> { return; }
|
||||
requestRuntimePermission(permission: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests app to be granted authorisation for multiple runtime permissions.
|
||||
@@ -444,7 +461,7 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
|
||||
static requestRuntimePermissions(permissions: any[]): Promise<any> { return; }
|
||||
requestRuntimePermissions(permissions: any[]): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Indicates if the plugin is currently requesting a runtime permission via the native API.
|
||||
@@ -454,7 +471,7 @@ export class Diagnostic {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static isRequestingPermission(): boolean { return; }
|
||||
isRequestingPermission(): boolean { return; }
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a runtime permission request has completed.
|
||||
@@ -462,7 +479,7 @@ export class Diagnostic {
|
||||
* @param handler {Function}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static registerPermissionRequestCompleteHandler(handler: Function): void { return; }
|
||||
registerPermissionRequestCompleteHandler(handler: Function): void { return; }
|
||||
|
||||
/**
|
||||
* Checks if the device setting for Bluetooth is switched on.
|
||||
@@ -470,42 +487,132 @@ export class Diagnostic {
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isBluetoothEnabled(): Promise<boolean> { return; }
|
||||
isBluetoothEnabled(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the device has Bluetooth capabilities.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static hasBluetoothSupport(): Promise<boolean> { return; }
|
||||
hasBluetoothSupport(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the device has Bluetooth Low Energy (LE) capabilities.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static hasBluetoothLESupport(): Promise<boolean> { return; }
|
||||
hasBluetoothLESupport(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static hasBluetoothLEPeripheralSupport(): Promise<boolean> { return; }
|
||||
hasBluetoothLEPeripheralSupport(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use external storage.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isExternalStorageAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* CReturns the external storage authorization status for the application.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static getExternalStorageAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests external storage authorization for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static requestExternalStorageAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns details of external SD card(s): absolute path, is writable, free space.
|
||||
*
|
||||
* The intention of this method is to return the location and details of removable external SD cards.
|
||||
* This differs from the "external directories" returned by cordova-plugin-file which return mount points relating to non-removable (internal) storage.
|
||||
*
|
||||
* Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#getexternalsdcarddetails)
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static getExternalSdCardDetails(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Switches to the wireless settings page in the Settings app. Allows configuration of wireless controls such as Wi-Fi, Bluetooth and Mobile networks.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
switchToWirelessSettings(): void { }
|
||||
|
||||
/**
|
||||
* Displays NFC settings to allow user to enable NFC.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
switchToNFCSettings(): void { }
|
||||
|
||||
/**
|
||||
* Checks if NFC hardware is present on device.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isNFCPresent(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the device setting for NFC is switched on.
|
||||
* Note: this operation does not require NFC permission in the manifest.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isNFCEnabled(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if NFC is available to the app. Returns true if the device has NFC capabilities AND if NFC setting is switched on.
|
||||
* Note: this operation does not require NFC permission in the manifest.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isNFCAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a change in NFC state occurs. Pass in a falsey value to de-register the currently registered function.
|
||||
* @param hander {Function} callback function to be called when NFC state changes
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
registerNFCStateChangeHandler(handler: Function): void { }
|
||||
|
||||
|
||||
|
||||
// IOS ONLY
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use the Camera Roll in Photos app.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static isCameraRollAuthorized(): Promise<boolean> { return; }
|
||||
isCameraRollAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Returns the authorization status for the application to use the Camera Roll in Photos app.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static getCameraRollAuthorizationStatus(): Promise<boolean> { return; }
|
||||
getCameraRollAuthorizationStatus(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Requests camera roll authorization for the application.
|
||||
@@ -514,21 +621,21 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static requestCameraRollAuthorization(): Promise<any> { return; }
|
||||
requestCameraRollAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if remote (push) notifications are enabled.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static isRemoteNotificationsEnabled(): Promise<boolean> { return; }
|
||||
isRemoteNotificationsEnabled(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Indicates if the app is registered for remote (push) notifications on the device.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static isRegisteredForRemoteNotifications(): Promise<boolean> { return; }
|
||||
isRegisteredForRemoteNotifications(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Indicates the current setting of notification types for the app in the Settings app.
|
||||
@@ -536,41 +643,77 @@ export class Diagnostic {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static getRemoteNotificationTypes(): Promise<any> { return; }
|
||||
getRemoteNotificationTypes(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use reminders.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static isRemindersAuthorized(): Promise<boolean> { return; }
|
||||
isRemindersAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Returns the reminders authorization status for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static getRemindersAuthorizationStatus(): Promise<any> { return; }
|
||||
getRemindersAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests reminders authorization for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static requestRemindersAuthorization(): Promise<any> { return; }
|
||||
requestRemindersAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized for background refresh.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static isBackgroundRefreshAuthorized(): Promise<boolean> { return; }
|
||||
isBackgroundRefreshAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Returns the background refresh authorization status for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static getBackgroundRefreshStatus(): Promise<any> { return; }
|
||||
getBackgroundRefreshStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests Bluetooth authorization for the application.
|
||||
*
|
||||
* Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#requestbluetoothauthorization)
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static requestBluetoothAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if motion tracking is available on the current device.
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static isMotionAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if it's possible to determine the outcome of a motion authorization request on the current device.
|
||||
* There's no direct way to determine if authorization was granted or denied, so the Pedometer API must be used to indirectly determine this:
|
||||
* therefore, if the device supports motion tracking but not Pedometer Event Tracking, the outcome of requesting motion detection cannot be determined.
|
||||
*
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static isMotionRequestOutcomeAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Requests and checks motion authorization for the application: there is no way to independently request only or check only, so both must be done in one operation.
|
||||
*
|
||||
* Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#requestandcheckmotionauthorization)
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static requestAndCheckMotionAuthorization(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
export interface DialogsPromptCallback {
|
||||
@@ -25,7 +26,7 @@ export interface DialogsPromptCallback {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Dialogs } from 'ionic-native';
|
||||
* import { Dialogs } from '@ionic-native/dialogs';
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -40,6 +41,7 @@ export interface DialogsPromptCallback {
|
||||
pluginRef: 'navigator.notification',
|
||||
repo: 'https://github.com/apache/cordova-plugin-dialogs.git'
|
||||
})
|
||||
@Injectable()
|
||||
export class Dialogs {
|
||||
|
||||
/**
|
||||
@@ -53,7 +55,7 @@ export class Dialogs {
|
||||
successIndex: 1,
|
||||
errorIndex: 4
|
||||
})
|
||||
static alert(
|
||||
alert(
|
||||
message,
|
||||
title: string = 'Alert',
|
||||
buttonName: string = 'OK'
|
||||
@@ -70,7 +72,7 @@ export class Dialogs {
|
||||
successIndex: 1,
|
||||
errorIndex: 4
|
||||
})
|
||||
static confirm(
|
||||
confirm(
|
||||
message,
|
||||
title: string = 'Confirm',
|
||||
buttonLabels: Array<string> = ['OK', 'Cancel']
|
||||
@@ -88,7 +90,7 @@ export class Dialogs {
|
||||
successIndex: 1,
|
||||
errorIndex: 5
|
||||
})
|
||||
static prompt(
|
||||
prompt(
|
||||
message?: string,
|
||||
title: string = 'Prompt',
|
||||
buttonLabels: Array<string> = ['OK', 'Cancel'],
|
||||
@@ -103,6 +105,6 @@ export class Dialogs {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static beep(times: number): void { }
|
||||
beep(times: number): void { }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
declare var cordova: any;
|
||||
|
||||
@@ -35,7 +36,7 @@ export interface EmailComposerOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { EmailComposer } from 'ionic-native';
|
||||
* import { EmailComposer } from '@ionic-native/email-composer';
|
||||
*
|
||||
*
|
||||
* EmailComposer.isAvailable().then((available: boolean) =>{
|
||||
@@ -73,6 +74,7 @@ export interface EmailComposerOptions {
|
||||
repo: 'https://github.com/hypery2k/cordova-email-plugin',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class EmailComposer {
|
||||
|
||||
/**
|
||||
@@ -81,7 +83,7 @@ export class EmailComposer {
|
||||
* @param app {string?} An optional app id or uri scheme.
|
||||
* @returns {Promise<any>} Resolves if available, rejects if not available
|
||||
*/
|
||||
static isAvailable(app?: string): Promise<any> {
|
||||
isAvailable(app?: string): Promise<any> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
if (app) {
|
||||
cordova.plugins.email.isAvailable(app, (isAvailable) => {
|
||||
@@ -110,7 +112,7 @@ export class EmailComposer {
|
||||
* @param packageName {string} The package name
|
||||
*/
|
||||
@Cordova()
|
||||
static addAlias(alias: string, packageName: string): void { }
|
||||
addAlias(alias: string, packageName: string): void { }
|
||||
|
||||
/**
|
||||
* Displays the email composer pre-filled with data.
|
||||
@@ -123,6 +125,6 @@ export class EmailComposer {
|
||||
successIndex: 1,
|
||||
errorIndex: 3
|
||||
})
|
||||
static open(options: EmailComposerOptions, scope?: any): Promise<any> { return; }
|
||||
open(options: EmailComposerOptions, scope?: any): Promise<any> { return; }
|
||||
|
||||
}
|
||||
+27
-25
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export interface EstimoteBeaconRegion {
|
||||
@@ -31,6 +32,7 @@ export interface EstimoteBeaconRegion {
|
||||
repo: 'https://github.com/evothings/phonegap-estimotebeacons',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class EstimoteBeacons {
|
||||
|
||||
/** Proximity value */
|
||||
@@ -108,7 +110,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static requestWhenInUseAuthorization(): Promise<any> { return; }
|
||||
requestWhenInUseAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Ask the user for permission to use location services
|
||||
@@ -129,7 +131,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static requestAlwaysAuthorization(): Promise<any> { return; }
|
||||
requestAlwaysAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get the current location authorization status.
|
||||
@@ -148,7 +150,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static authorizationStatus(): Promise<any> { return; }
|
||||
authorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start advertising as a beacon.
|
||||
@@ -170,7 +172,7 @@ export class EstimoteBeacons {
|
||||
@Cordova({
|
||||
clearFunction: 'stopAdvertisingAsBeacon'
|
||||
})
|
||||
static startAdvertisingAsBeacon(uuid: string, major: number, minor: number, regionId: string): Promise<any> { return; }
|
||||
startAdvertisingAsBeacon(uuid: string, major: number, minor: number, regionId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop advertising as a beacon.
|
||||
@@ -186,7 +188,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopAdvertisingAsBeacon(): Promise<any> { return; }
|
||||
stopAdvertisingAsBeacon(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enable analytics.
|
||||
@@ -201,7 +203,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static enableAnalytics(enable: boolean): Promise<any> { return; }
|
||||
enableAnalytics(enable: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Test if analytics is enabled.
|
||||
@@ -215,7 +217,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAnalyticsEnabled(): Promise<any> { return; }
|
||||
isAnalyticsEnabled(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Test if App ID and App Token is set.
|
||||
@@ -229,7 +231,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAuthorized(): Promise<any> { return; }
|
||||
isAuthorized(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set App ID and App Token.
|
||||
@@ -245,7 +247,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setupAppIDAndAppToken(appID: string, appToken: string): Promise<any> { return; }
|
||||
setupAppIDAndAppToken(appID: string, appToken: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start scanning for all nearby beacons using CoreBluetooth (no region object is used).
|
||||
@@ -266,7 +268,7 @@ export class EstimoteBeacons {
|
||||
observable: true,
|
||||
clearFunction: 'stopEstimoteBeaconDiscovery'
|
||||
})
|
||||
static startEstimoteBeaconDiscovery(): Observable<any> { return; }
|
||||
startEstimoteBeaconDiscovery(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop CoreBluetooth scan. Available on iOS.
|
||||
@@ -283,7 +285,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopEstimoteBeaconDiscovery(): Promise<any> { return; }
|
||||
stopEstimoteBeaconDiscovery(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start ranging beacons. Available on iOS and Android.
|
||||
@@ -306,7 +308,7 @@ export class EstimoteBeacons {
|
||||
clearFunction: 'stopRangingBeaconsInRegion',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static startRangingBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
|
||||
startRangingBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop ranging beacons. Available on iOS and Android.
|
||||
@@ -325,7 +327,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopRangingBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
stopRangingBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start ranging secure beacons. Available on iOS.
|
||||
@@ -340,7 +342,7 @@ export class EstimoteBeacons {
|
||||
clearFunction: 'stopRangingSecureBeaconsInRegion',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static startRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
|
||||
startRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop ranging secure beacons. Available on iOS.
|
||||
@@ -349,7 +351,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
stopRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start monitoring beacons. Available on iOS and Android.
|
||||
@@ -375,7 +377,7 @@ export class EstimoteBeacons {
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static startMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
|
||||
startMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop monitoring beacons. Available on iOS and Android.
|
||||
@@ -389,7 +391,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
stopMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start monitoring secure beacons. Available on iOS.
|
||||
@@ -409,7 +411,7 @@ export class EstimoteBeacons {
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static startSecureMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
|
||||
startSecureMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop monitoring secure beacons. Available on iOS.
|
||||
@@ -419,7 +421,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopSecureMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
stopSecureMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Connect to Estimote Beacon. Available on Android.
|
||||
@@ -439,7 +441,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static connectToBeacon(beacon: any): Promise<any> { return; }
|
||||
connectToBeacon(beacon: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Disconnect from connected Estimote Beacon. Available on Android.
|
||||
@@ -451,7 +453,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static disconnectConnectedBeacon(): Promise<any> { return; }
|
||||
disconnectConnectedBeacon(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Write proximity UUID to connected Estimote Beacon. Available on Android.
|
||||
@@ -465,7 +467,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static writeConnectedProximityUUID(uuid: any): Promise<any> { return; }
|
||||
writeConnectedProximityUUID(uuid: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Write major to connected Estimote Beacon. Available on Android.
|
||||
@@ -479,7 +481,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static writeConnectedMajor(major: number): Promise<any> { return; }
|
||||
writeConnectedMajor(major: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Write minor to connected Estimote Beacon. Available on Android.
|
||||
@@ -493,7 +495,7 @@ export class EstimoteBeacons {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static writeConnectedMinor(minor: number): Promise<any> { return; }
|
||||
writeConnectedMinor(minor: number): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface FacebookLoginResponse {
|
||||
|
||||
@@ -92,7 +93,7 @@ export interface FacebookLoginResponse {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Facebook } from 'ionic-native';
|
||||
* import { Facebook } from '@ionic-native/facebook';
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -104,8 +105,10 @@ export interface FacebookLoginResponse {
|
||||
plugin: 'cordova-plugin-facebook4',
|
||||
pluginRef: 'facebookConnectPlugin',
|
||||
repo: 'https://github.com/jeduan/cordova-plugin-facebook4',
|
||||
install: 'ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"'
|
||||
install: 'ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"',
|
||||
installVariables: ['APP_ID', 'APP_NAME']
|
||||
})
|
||||
@Injectable()
|
||||
export class Facebook {
|
||||
|
||||
/**
|
||||
@@ -115,7 +118,7 @@ export class Facebook {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static browserInit(appId: number, version?: string): Promise<any> {
|
||||
browserInit(appId: number, version?: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -140,7 +143,7 @@ export class Facebook {
|
||||
* @returns {Promise<FacebookLoginResponse>} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
|
||||
*/
|
||||
@Cordova()
|
||||
static login(permissions: string[]): Promise<FacebookLoginResponse> { return; }
|
||||
login(permissions: string[]): Promise<FacebookLoginResponse> { return; }
|
||||
|
||||
/**
|
||||
* Logout of Facebook.
|
||||
@@ -149,7 +152,7 @@ export class Facebook {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves on a successful logout, and rejects if logout fails.
|
||||
*/
|
||||
@Cordova()
|
||||
static logout(): Promise<any> { return; }
|
||||
logout(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user:
|
||||
@@ -178,7 +181,7 @@ export class Facebook {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with a status, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static getLoginStatus(): Promise<any> { return; }
|
||||
getLoginStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get a Facebook access token for using Facebook services.
|
||||
@@ -186,7 +189,7 @@ export class Facebook {
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with an access token, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static getAccessToken(): Promise<string> { return; }
|
||||
getAccessToken(): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* Show one of various Facebook dialogs. Example of options for a Share dialog:
|
||||
@@ -206,7 +209,7 @@ export class Facebook {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with success data, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static showDialog(options: any): Promise<any> { return; }
|
||||
showDialog(options: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login.
|
||||
@@ -222,7 +225,7 @@ export class Facebook {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the result of the request, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static api(requestPath: string, permissions: string[]): Promise<any> { return; }
|
||||
api(requestPath: string, permissions: string[]): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Log an event. For more information see the Events section above.
|
||||
@@ -232,8 +235,11 @@ export class Facebook {
|
||||
* @param {number} [valueToSum] any value to be added to added to a sum on each event
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static logEvent(
|
||||
@Cordova({
|
||||
successIndex: 3,
|
||||
errorIndex: 4
|
||||
})
|
||||
logEvent(
|
||||
name: string,
|
||||
params?: Object,
|
||||
valueToSum?: number
|
||||
@@ -247,7 +253,7 @@ export class Facebook {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static logPurchase(value: number, currency: string): Promise<any> { return; }
|
||||
logPurchase(value: number, currency: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Open App Invite dialog. Does not require login.
|
||||
@@ -265,7 +271,7 @@ export class Facebook {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the result data, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static appInvite(options: {
|
||||
appInvite(options: {
|
||||
url: string,
|
||||
picture: string
|
||||
}): Promise<any> { return; }
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name FileChooser
|
||||
@@ -8,10 +9,10 @@ import { Plugin, Cordova } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {FileChooser} from 'ionic-native';
|
||||
* import {FileChooser} from '@ionic-native/file';
|
||||
*
|
||||
* FileChooser.open()
|
||||
* .then(uri => console.log(uri));
|
||||
* .then(uri => console.log(uri))
|
||||
* .catch(e => console.log(e));
|
||||
*
|
||||
* ```
|
||||
@@ -23,6 +24,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
repo: 'https://github.com/don/cordova-filechooser',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class FileChooser {
|
||||
|
||||
/**
|
||||
@@ -30,6 +32,6 @@ export class FileChooser {
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
static open(): Promise<string> { return; }
|
||||
open(): Promise<string> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name FileOpener
|
||||
@@ -7,7 +8,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {FileOpener} from 'ionic-native';
|
||||
* import {FileOpener} from '@ionic-native/file-opener';
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -19,6 +20,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
pluginRef: 'cordova.plugins.fileOpener2',
|
||||
repo: 'https://github.com/pwlin/cordova-plugin-file-opener2'
|
||||
})
|
||||
@Injectable()
|
||||
export class FileOpener {
|
||||
|
||||
/**
|
||||
@@ -32,7 +34,7 @@ export class FileOpener {
|
||||
successName: 'success',
|
||||
errorName: 'error'
|
||||
})
|
||||
static open(filePath: string, fileMIMEType: string): Promise<any> {return; }
|
||||
open(filePath: string, fileMIMEType: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Uninstalls a package
|
||||
@@ -44,7 +46,7 @@ export class FileOpener {
|
||||
successName: 'success',
|
||||
errorName: 'error'
|
||||
})
|
||||
static uninstall(packageId: string): Promise<any> {return; }
|
||||
uninstall(packageId: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Check if an app is already installed
|
||||
@@ -56,6 +58,6 @@ export class FileOpener {
|
||||
successName: 'success',
|
||||
errorName: 'error'
|
||||
})
|
||||
static appIsInstalled(packageId: string): Promise<any> {return; }
|
||||
appIsInstalled(packageId: string): Promise<any> {return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Plugin, pluginWarn } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaProperty, Plugin, pluginWarn } from '@ionic-native/core';
|
||||
|
||||
declare var window: any;
|
||||
declare var cordova: any;
|
||||
@@ -171,7 +172,6 @@ export interface Flags {
|
||||
}
|
||||
|
||||
export interface WriteOptions {
|
||||
create?: boolean;
|
||||
replace?: boolean;
|
||||
append?: boolean;
|
||||
truncate?: number; // if present, number of bytes to truncate file to before writing
|
||||
@@ -267,7 +267,7 @@ export interface FileWriter extends FileSaver {
|
||||
* Write the supplied data to the file at position.
|
||||
* @param {Blob} data The blob to write.
|
||||
*/
|
||||
write(data: Blob | string): void;
|
||||
write(data: ArrayBuffer | Blob | string): void;
|
||||
/**
|
||||
* The file position at which the next write will occur.
|
||||
* @param offset If nonnegative, an absolute byte offset into the file.
|
||||
@@ -283,7 +283,7 @@ export interface FileWriter extends FileSaver {
|
||||
}
|
||||
|
||||
/* FileWriter states */
|
||||
declare var FileWriter: {
|
||||
export declare var FileWriter: {
|
||||
INIT: number;
|
||||
WRITING: number;
|
||||
DONE: number
|
||||
@@ -308,7 +308,7 @@ export interface FileReader {
|
||||
readAsArrayBuffer(fe: File | Blob): void;
|
||||
}
|
||||
|
||||
declare var FileReader: {
|
||||
export declare var FileReader: {
|
||||
EMPTY: number;
|
||||
LOADING: number;
|
||||
DONE: number;
|
||||
@@ -322,7 +322,7 @@ export interface FileError {
|
||||
message: string;
|
||||
}
|
||||
|
||||
declare var FileError: {
|
||||
export declare var FileError: {
|
||||
new (code: number): FileError;
|
||||
NOT_FOUND_ERR: number;
|
||||
SECURITY_ERR: number;
|
||||
@@ -348,11 +348,9 @@ declare var FileError: {
|
||||
*
|
||||
* Example:
|
||||
* ```
|
||||
* import { File } from 'ionic-native';
|
||||
* import { File } from '@ionic-native/file';
|
||||
*
|
||||
* declare var cordova: any;
|
||||
* const fs:string = cordova.file.dataDirectory;
|
||||
* File.checkDir(this.fs, 'mydir').then(_ => console.log('yay')).catch(err => console.log('boooh'));
|
||||
* this.file.checkDir(this.file.dataDirectory, 'mydir').then(_ => console.log('Directory exists')).catch(err => console.log('Directory doesnt exist'));
|
||||
* ```
|
||||
*
|
||||
* This plugin is based on several specs, including : The HTML5 File API http://www.w3.org/TR/FileAPI/
|
||||
@@ -366,8 +364,83 @@ declare var FileError: {
|
||||
pluginRef: 'cordova.file',
|
||||
repo: 'https://github.com/apache/cordova-plugin-file'
|
||||
})
|
||||
@Injectable()
|
||||
export class File {
|
||||
static cordovaFileError: {} = {
|
||||
|
||||
/**
|
||||
* Read-only directory where the application is installed.
|
||||
*/
|
||||
@CordovaProperty
|
||||
applicationDirectory: string;
|
||||
|
||||
/**
|
||||
* Read-only directory where the application is installed.
|
||||
*/
|
||||
@CordovaProperty
|
||||
applicationStorageDirectory: string;
|
||||
|
||||
/**
|
||||
* Where to put app-specific data files.
|
||||
*/
|
||||
@CordovaProperty
|
||||
dataDirectory: string;
|
||||
|
||||
/**
|
||||
* Cached files that should survive app restarts.
|
||||
* Apps should not rely on the OS to delete files in here.
|
||||
*/
|
||||
@CordovaProperty
|
||||
cacheDirectory: string;
|
||||
|
||||
/**
|
||||
* Android: the application space on external storage.
|
||||
*/
|
||||
@CordovaProperty
|
||||
externalApplicationStorageDirectory: string;
|
||||
|
||||
/**
|
||||
* Android: Where to put app-specific data files on external storage.
|
||||
*/
|
||||
@CordovaProperty
|
||||
externalDataDirectory: string;
|
||||
|
||||
/**
|
||||
* Android: the application cache on external storage.
|
||||
*/
|
||||
@CordovaProperty
|
||||
externalCacheDirectory: string;
|
||||
|
||||
/**
|
||||
* Android: the external storage (SD card) root.
|
||||
*/
|
||||
@CordovaProperty
|
||||
externalRootDirectory: string;
|
||||
|
||||
/**
|
||||
* iOS: Temp directory that the OS can clear at will.
|
||||
*/
|
||||
@CordovaProperty
|
||||
tempDirectory: string;
|
||||
|
||||
/**
|
||||
* iOS: Holds app-specific files that should be synced (e.g. to iCloud).
|
||||
*/
|
||||
@CordovaProperty
|
||||
syncedDataDirectory: string;
|
||||
|
||||
/**
|
||||
* iOS: Files private to the app, but that are meaningful to other applications (e.g. Office files)
|
||||
*/
|
||||
@CordovaProperty
|
||||
documentsDirectory: string;
|
||||
|
||||
/**
|
||||
* BlackBerry10: Files globally available to all apps
|
||||
*/
|
||||
@CordovaProperty
|
||||
sharedDirectory: string;
|
||||
|
||||
cordovaFileError: {} = {
|
||||
1: 'NOT_FOUND_ERR',
|
||||
2: 'SECURITY_ERR',
|
||||
3: 'ABORT_ERR',
|
||||
@@ -388,7 +461,7 @@ export class File {
|
||||
* Get free disk space in Bytes
|
||||
* @returns {Promise<number>} Returns a promise that resolves with the remaining free disk space in Bytes
|
||||
*/
|
||||
static getFreeDiskSpace(): Promise<number> {
|
||||
getFreeDiskSpace(): Promise<number> {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
if (!cordova || !cordova.exec) {
|
||||
pluginWarn({
|
||||
@@ -407,17 +480,17 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} dir Name of directory to check
|
||||
* @returns {Promise<boolean|FileError>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
|
||||
* @returns {Promise<boolean>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
|
||||
*/
|
||||
static checkDir(path: string, dir: string): Promise<boolean|FileError> {
|
||||
checkDir(path: string, dir: string): Promise<boolean> {
|
||||
if ((/^\//.test(dir))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
let fullpath = path + dir;
|
||||
return File.resolveDirectoryUrl(fullpath)
|
||||
return this.resolveDirectoryUrl(fullpath)
|
||||
.then(() => {
|
||||
return true;
|
||||
});
|
||||
@@ -431,13 +504,13 @@ export class File {
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} dirName Name of directory to create
|
||||
* @param {boolean} replace If true, replaces file with same name. If false returns error
|
||||
* @returns {Promise<DirectoryEntry|FileError>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
|
||||
* @returns {Promise<DirectoryEntry>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
|
||||
*/
|
||||
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry|FileError> {
|
||||
createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
let options: Flags = {
|
||||
@@ -448,9 +521,9 @@ export class File {
|
||||
options.exclusive = true;
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
return this.resolveDirectoryUrl(path)
|
||||
.then((fse) => {
|
||||
return File.getDirectory(fse, dirName, options);
|
||||
return this.getDirectory(fse, dirName, options);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -459,21 +532,21 @@ export class File {
|
||||
*
|
||||
* @param {string} path The path to the directory
|
||||
* @param {string} dirName The directory name
|
||||
* @returns {Promise<RemoveResult|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
* @returns {Promise<RemoveResult>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
*/
|
||||
static removeDir(path: string, dirName: string): Promise<RemoveResult|FileError> {
|
||||
removeDir(path: string, dirName: string): Promise<RemoveResult> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
return this.resolveDirectoryUrl(path)
|
||||
.then((fse) => {
|
||||
return File.getDirectory(fse, dirName, {create: false});
|
||||
return this.getDirectory(fse, dirName, {create: false});
|
||||
})
|
||||
.then((de) => {
|
||||
return File.remove(de);
|
||||
return this.remove(de);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -484,15 +557,15 @@ export class File {
|
||||
* @param {string} dirName The source directory name
|
||||
* @param {string} newPath The destionation path to the directory
|
||||
* @param {string} newDirName The destination directory name
|
||||
* @returns {Promise<DirectoryEntry|Entry|FileError>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
|
||||
* @returns {Promise<DirectoryEntry|Entry>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
|
||||
*/
|
||||
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry|FileError> {
|
||||
moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry> {
|
||||
newDirName = newDirName || dirName;
|
||||
|
||||
if ((/^\//.test(newDirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
@@ -502,7 +575,7 @@ export class File {
|
||||
.then((srcde) => {
|
||||
return this.resolveDirectoryUrl(newPath)
|
||||
.then((deste) => {
|
||||
return File.move(srcde, deste, newDirName);
|
||||
return this.move(srcde, deste, newDirName);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -514,13 +587,13 @@ export class File {
|
||||
* @param {string} dirName Name of directory to copy
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newDirName New name of directory to copy to (leave blank to remain the same)
|
||||
* @returns {Promise<Entry|FileError>} Returns a Promise that resolves to the new Entry object or rejects with an error.
|
||||
* @returns {Promise<Entry>} Returns a Promise that resolves to the new Entry object or rejects with an error.
|
||||
*/
|
||||
static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<Entry|FileError> {
|
||||
copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<Entry> {
|
||||
if ((/^\//.test(newDirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
@@ -530,7 +603,7 @@ export class File {
|
||||
.then((srcde) => {
|
||||
return this.resolveDirectoryUrl(newPath)
|
||||
.then((deste) => {
|
||||
return File.copy(srcde, deste, newDirName);
|
||||
return this.copy(srcde, deste, newDirName);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -542,20 +615,20 @@ export class File {
|
||||
* @param {string} dirName Name of directory
|
||||
* @returns {Promise<Entry[]>} Returns a Promise that resolves to an array of Entry objects or rejects with an error.
|
||||
*/
|
||||
static listDir(path: string, dirName: string): Promise<Entry[]> {
|
||||
listDir(path: string, dirName: string): Promise<Entry[]> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<Entry[]>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
return this.resolveDirectoryUrl(path)
|
||||
.then((fse) => {
|
||||
return File.getDirectory(fse, dirName, {create: false, exclusive: false});
|
||||
return this.getDirectory(fse, dirName, {create: false, exclusive: false});
|
||||
})
|
||||
.then((de) => {
|
||||
let reader = de.createReader();
|
||||
return File.readEntries(reader);
|
||||
return this.readEntries(reader);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -566,19 +639,19 @@ export class File {
|
||||
* @param {string} dirName Name of directory
|
||||
* @returns {Promise<RemoveResult>} Returns a Promise that resolves with a RemoveResult or rejects with an error.
|
||||
*/
|
||||
static removeRecursively(path: string, dirName: string): Promise<RemoveResult> {
|
||||
removeRecursively(path: string, dirName: string): Promise<RemoveResult> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<RemoveResult>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
return this.resolveDirectoryUrl(path)
|
||||
.then((fse) => {
|
||||
return File.getDirectory(fse, dirName, {create: false});
|
||||
return this.getDirectory(fse, dirName, {create: false});
|
||||
})
|
||||
.then((de) => {
|
||||
return File.rimraf(de);
|
||||
return this.rimraf(de);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -587,16 +660,16 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file to check
|
||||
* @returns {Promise<boolean|FileError>} Returns a Promise that resolves with a boolean or rejects with an error.
|
||||
* @returns {Promise<boolean>} Returns a Promise that resolves with a boolean or rejects with an error.
|
||||
*/
|
||||
static checkFile(path: string, file: string): Promise<boolean|FileError> {
|
||||
checkFile(path: string, file: string): Promise<boolean> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveLocalFilesystemUrl(path + file)
|
||||
return this.resolveLocalFilesystemUrl(path + file)
|
||||
.then((fse) => {
|
||||
if (fse.isFile) {
|
||||
return true;
|
||||
@@ -616,13 +689,13 @@ export class File {
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} fileName Name of file to create
|
||||
* @param {boolean} replace If true, replaces file with same name. If false returns error
|
||||
* @returns {Promise<FileEntry|FileError>} Returns a Promise that resolves to a FileEntry or rejects with an error.
|
||||
* @returns {Promise<FileEntry>} Returns a Promise that resolves to a FileEntry or rejects with an error.
|
||||
*/
|
||||
static createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry|FileError> {
|
||||
createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
let options: Flags = {
|
||||
@@ -633,9 +706,9 @@ export class File {
|
||||
options.exclusive = true;
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
return this.resolveDirectoryUrl(path)
|
||||
.then((fse) => {
|
||||
return File.getFile(fse, fileName, options);
|
||||
return this.getFile(fse, fileName, options);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -644,21 +717,21 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} fileName Name of file to remove
|
||||
* @returns {Promise<RemoveResult|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
* @returns {Promise<RemoveResult>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
*/
|
||||
static removeFile(path: string, fileName: string): Promise<RemoveResult|FileError> {
|
||||
removeFile(path: string, fileName: string): Promise<RemoveResult> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
return this.resolveDirectoryUrl(path)
|
||||
.then((fse) => {
|
||||
return File.getFile(fse, fileName, {create: false});
|
||||
return this.getFile(fse, fileName, {create: false});
|
||||
})
|
||||
.then((fe) => {
|
||||
return File.remove(fe);
|
||||
return this.remove(fe);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -670,8 +743,8 @@ export class File {
|
||||
* @param {WriteOptions} options replace file if set to true. See WriteOptions for more information.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves to updated file entry or rejects with an error.
|
||||
*/
|
||||
static writeFile(path: string, fileName: string,
|
||||
text: string | Blob, options: WriteOptions = {}): Promise<any> {
|
||||
writeFile(path: string, fileName: string,
|
||||
text: string | Blob | ArrayBuffer, options: WriteOptions = {}): Promise<any> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
const err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
@@ -683,12 +756,12 @@ export class File {
|
||||
exclusive: !options.replace
|
||||
};
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
.then((fse) => {
|
||||
return File.getFile(fse, fileName, getFileOpts);
|
||||
return this.resolveDirectoryUrl(path)
|
||||
.then((directoryEntry: DirectoryEntry) => {
|
||||
return this.getFile(directoryEntry, fileName, getFileOpts);
|
||||
})
|
||||
.then((fe) => {
|
||||
return File.writeFileEntry(fe, text, options);
|
||||
.then((fileEntry: FileEntry) => {
|
||||
return this.writeFileEntry(fileEntry, text, options);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -700,8 +773,8 @@ export class File {
|
||||
* @param {WriteOptions} options replace file if set to true. See WriteOptions for more information.
|
||||
* @returns {Promise<FileEntry>} Returns a Promise that resolves to updated file entry or rejects with an error.
|
||||
*/
|
||||
private static writeFileEntry(fe: FileEntry, text: string | Blob, options: WriteOptions) {
|
||||
return File.createWriter(fe)
|
||||
private writeFileEntry(fe: FileEntry, text: string | Blob | ArrayBuffer, options: WriteOptions) {
|
||||
return this.createWriter(fe)
|
||||
.then((writer) => {
|
||||
if (options.append) {
|
||||
writer.seek(writer.length);
|
||||
@@ -711,7 +784,7 @@ export class File {
|
||||
writer.truncate(options.truncate);
|
||||
}
|
||||
|
||||
return File.write(writer, text);
|
||||
return this.write(writer, text);
|
||||
})
|
||||
.then(() => fe);
|
||||
}
|
||||
@@ -724,8 +797,8 @@ export class File {
|
||||
* @param {string | Blob} text content or blob to write
|
||||
* @returns {Promise<void>} Returns a Promise that resolves or rejects with an error.
|
||||
*/
|
||||
static writeExistingFile(path: string, fileName: string, text: string | Blob): Promise<void> {
|
||||
return File.writeFile(path, fileName, text, { create: false });
|
||||
writeExistingFile(path: string, fileName: string, text: string | Blob): Promise<void> {
|
||||
return this.writeFile(path, fileName, text, { replace: true });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -733,20 +806,20 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
|
||||
*/
|
||||
static readAsText(path: string, file: string): Promise<string|FileError> {
|
||||
readAsText(path: string, file: string): Promise<string> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
.then((fse) => {
|
||||
return File.getFile(fse, file, {create: false});
|
||||
return this.resolveDirectoryUrl(path)
|
||||
.then((directoryEntry: DirectoryEntry) => {
|
||||
return this.getFile(directoryEntry, file, {create: false});
|
||||
})
|
||||
.then((fe) => {
|
||||
.then((fileEntry: FileEntry) => {
|
||||
let reader = new FileReader();
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
reader.onloadend = () => {
|
||||
@@ -758,7 +831,7 @@ export class File {
|
||||
reject({code: null, message: 'READER_ONLOADEND_ERR'});
|
||||
}
|
||||
};
|
||||
fe.file(file => {
|
||||
fileEntry.file(file => {
|
||||
reader.readAsText(file);
|
||||
}, error => {
|
||||
reject(error);
|
||||
@@ -774,20 +847,20 @@ export class File {
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
|
||||
*/
|
||||
static readAsDataURL(path: string, file: string): Promise<string|FileError> {
|
||||
readAsDataURL(path: string, file: string): Promise<string> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
.then((fse) => {
|
||||
return File.getFile(fse, file, {create: false});
|
||||
return this.resolveDirectoryUrl(path)
|
||||
.then((directoryEntry: DirectoryEntry) => {
|
||||
return this.getFile(directoryEntry, file, {create: false});
|
||||
})
|
||||
.then((fe) => {
|
||||
.then((fileEntry: FileEntry) => {
|
||||
let reader = new FileReader();
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
reader.onloadend = () => {
|
||||
@@ -802,7 +875,7 @@ export class File {
|
||||
|
||||
|
||||
|
||||
fe.file(file => {
|
||||
fileEntry.file(file => {
|
||||
reader.readAsDataURL(file);
|
||||
}, error => {
|
||||
reject(error);
|
||||
@@ -816,20 +889,20 @@ export class File {
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
|
||||
*/
|
||||
static readAsBinaryString(path: string, file: string): Promise<string|FileError> {
|
||||
readAsBinaryString(path: string, file: string): Promise<string> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
.then((fse) => {
|
||||
return File.getFile(fse, file, {create: false});
|
||||
return this.resolveDirectoryUrl(path)
|
||||
.then((directoryEntry: DirectoryEntry) => {
|
||||
return this.getFile(directoryEntry, file, {create: false});
|
||||
})
|
||||
.then((fe) => {
|
||||
.then((fileEntry: FileEntry) => {
|
||||
let reader = new FileReader();
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
reader.onloadend = () => {
|
||||
@@ -842,7 +915,7 @@ export class File {
|
||||
}
|
||||
};
|
||||
|
||||
fe.file(file => {
|
||||
fileEntry.file(file => {
|
||||
reader.readAsBinaryString(file);
|
||||
}, error => {
|
||||
reject(error);
|
||||
@@ -857,20 +930,20 @@ export class File {
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<ArrayBuffer|FileError>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
|
||||
* @returns {Promise<ArrayBuffer>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
|
||||
*/
|
||||
static readAsArrayBuffer(path: string, file: string): Promise<ArrayBuffer|FileError> {
|
||||
readAsArrayBuffer(path: string, file: string): Promise<ArrayBuffer> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
.then((fse) => {
|
||||
return File.getFile(fse, file, {create: false});
|
||||
return this.resolveDirectoryUrl(path)
|
||||
.then((directoryEntry: DirectoryEntry) => {
|
||||
return this.getFile(directoryEntry, file, {create: false});
|
||||
})
|
||||
.then((fe) => {
|
||||
.then((fileEntry: FileEntry) => {
|
||||
let reader = new FileReader();
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
reader.onloadend = () => {
|
||||
@@ -883,7 +956,7 @@ export class File {
|
||||
}
|
||||
};
|
||||
|
||||
fe.file(file => {
|
||||
fileEntry.file(file => {
|
||||
reader.readAsArrayBuffer(file);
|
||||
}, error => {
|
||||
reject(error);
|
||||
@@ -900,15 +973,15 @@ export class File {
|
||||
* @param {string} fileName Name of file to move
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newFileName New name of file to move to (leave blank to remain the same)
|
||||
* @returns {Promise<Entry|FileError>} Returns a Promise that resolves to the new Entry or rejects with an error.
|
||||
* @returns {Promise<Entry>} Returns a Promise that resolves to the new Entry or rejects with an error.
|
||||
*/
|
||||
static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry|FileError> {
|
||||
moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> {
|
||||
newFileName = newFileName || fileName;
|
||||
|
||||
if ((/^\//.test(newFileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
@@ -918,7 +991,7 @@ export class File {
|
||||
.then((srcfe) => {
|
||||
return this.resolveDirectoryUrl(newPath)
|
||||
.then((deste) => {
|
||||
return File.move(srcfe, deste, newFileName);
|
||||
return this.move(srcfe, deste, newFileName);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -930,15 +1003,15 @@ export class File {
|
||||
* @param {string} fileName Name of file to copy
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newFileName New name of file to copy to (leave blank to remain the same)
|
||||
* @returns {Promise<Entry|FileError>} Returns a Promise that resolves to an Entry or rejects with an error.
|
||||
* @returns {Promise<Entry>} Returns a Promise that resolves to an Entry or rejects with an error.
|
||||
*/
|
||||
static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry|FileError> {
|
||||
copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> {
|
||||
newFileName = newFileName || fileName;
|
||||
|
||||
if ((/^\//.test(newFileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
@@ -948,19 +1021,18 @@ export class File {
|
||||
.then((srcfe) => {
|
||||
return this.resolveDirectoryUrl(newPath)
|
||||
.then((deste) => {
|
||||
return File.copy(srcfe, deste, newFileName);
|
||||
return this.copy(srcfe, deste, newFileName);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// these private methods help avoid cascading error handling
|
||||
// in the public ones, primarily simply wrapping callback
|
||||
// operations to return Promises that can then be chained.
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private static fillErrorMessage(err: FileError): void {
|
||||
err.message = File.cordovaFileError[err.code];
|
||||
private fillErrorMessage(err: FileError): void {
|
||||
try {
|
||||
err.message = this.cordovaFileError[err.code];
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -968,17 +1040,17 @@ export class File {
|
||||
* @param fileUrl {string} file system url
|
||||
* @returns {Promise<Entry>}
|
||||
*/
|
||||
static resolveLocalFilesystemUrl(fileUrl: string): Promise<Entry> {
|
||||
resolveLocalFilesystemUrl(fileUrl: string): Promise<Entry> {
|
||||
return new Promise<Entry>((resolve, reject) => {
|
||||
try {
|
||||
window.resolveLocalFileSystemURL(fileUrl, (entry) => {
|
||||
resolve(entry);
|
||||
}, (err) => {
|
||||
File.fillErrorMessage(err);
|
||||
this.fillErrorMessage(err);
|
||||
reject(err);
|
||||
});
|
||||
} catch (xc) {
|
||||
File.fillErrorMessage(xc);
|
||||
this.fillErrorMessage(xc);
|
||||
reject(xc);
|
||||
}
|
||||
});
|
||||
@@ -989,8 +1061,8 @@ export class File {
|
||||
* @param directoryUrl {string} directory system url
|
||||
* @returns {Promise<DirectoryEntry>}
|
||||
*/
|
||||
static resolveDirectoryUrl(directoryUrl: string): Promise<DirectoryEntry> {
|
||||
return File.resolveLocalFilesystemUrl(directoryUrl)
|
||||
resolveDirectoryUrl(directoryUrl: string): Promise<DirectoryEntry> {
|
||||
return this.resolveLocalFilesystemUrl(directoryUrl)
|
||||
.then((de) => {
|
||||
if (de.isDirectory) {
|
||||
return <DirectoryEntry>de;
|
||||
@@ -1009,17 +1081,17 @@ export class File {
|
||||
* @param flags {Flags} Options
|
||||
* @returns {Promise<DirectoryEntry>}
|
||||
*/
|
||||
static getDirectory(directoryEntry: DirectoryEntry, directoryName: string, flags: Flags): Promise<DirectoryEntry> {
|
||||
getDirectory(directoryEntry: DirectoryEntry, directoryName: string, flags: Flags): Promise<DirectoryEntry> {
|
||||
return new Promise<DirectoryEntry>((resolve, reject) => {
|
||||
try {
|
||||
directoryEntry.getDirectory(directoryName, flags, (de) => {
|
||||
resolve(de);
|
||||
}, (err) => {
|
||||
File.fillErrorMessage(err);
|
||||
this.fillErrorMessage(err);
|
||||
reject(err);
|
||||
});
|
||||
} catch (xc) {
|
||||
File.fillErrorMessage(xc);
|
||||
this.fillErrorMessage(xc);
|
||||
reject(xc);
|
||||
}
|
||||
});
|
||||
@@ -1032,15 +1104,15 @@ export class File {
|
||||
* @param flags {Flags} Options
|
||||
* @returns {Promise<FileEntry>}
|
||||
*/
|
||||
static getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise<FileEntry> {
|
||||
getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise<FileEntry> {
|
||||
return new Promise<FileEntry>((resolve, reject) => {
|
||||
try {
|
||||
directoryEntry.getFile(fileName, flags, resolve, (err) => {
|
||||
File.fillErrorMessage(err);
|
||||
this.fillErrorMessage(err);
|
||||
reject(err);
|
||||
});
|
||||
} catch (xc) {
|
||||
File.fillErrorMessage(xc);
|
||||
this.fillErrorMessage(xc);
|
||||
reject(xc);
|
||||
}
|
||||
});
|
||||
@@ -1049,12 +1121,12 @@ export class File {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private static remove(fe: Entry): Promise<RemoveResult> {
|
||||
private remove(fe: Entry): Promise<RemoveResult> {
|
||||
return new Promise<RemoveResult>((resolve, reject) => {
|
||||
fe.remove(() => {
|
||||
resolve({success: true, fileRemoved: fe});
|
||||
}, (err) => {
|
||||
File.fillErrorMessage(err);
|
||||
this.fillErrorMessage(err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
@@ -1063,12 +1135,12 @@ export class File {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private static move(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
|
||||
private move(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
|
||||
return new Promise<Entry>((resolve, reject) => {
|
||||
srce.moveTo(destdir, newName, (deste) => {
|
||||
resolve(deste);
|
||||
}, (err) => {
|
||||
File.fillErrorMessage(err);
|
||||
this.fillErrorMessage(err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
@@ -1077,12 +1149,12 @@ export class File {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private static copy(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
|
||||
private copy(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
|
||||
return new Promise<Entry>((resolve, reject) => {
|
||||
srce.copyTo(destdir, newName, (deste) => {
|
||||
resolve(deste);
|
||||
}, (err) => {
|
||||
File.fillErrorMessage(err);
|
||||
this.fillErrorMessage(err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
@@ -1091,12 +1163,12 @@ export class File {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private static readEntries(dr: DirectoryReader): Promise<Entry[]> {
|
||||
private readEntries(dr: DirectoryReader): Promise<Entry[]> {
|
||||
return new Promise<Entry[]>((resolve, reject) => {
|
||||
dr.readEntries((entries) => {
|
||||
resolve(entries);
|
||||
}, (err) => {
|
||||
File.fillErrorMessage(err);
|
||||
this.fillErrorMessage(err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
@@ -1105,12 +1177,12 @@ export class File {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private static rimraf(de: DirectoryEntry): Promise<RemoveResult> {
|
||||
private rimraf(de: DirectoryEntry): Promise<RemoveResult> {
|
||||
return new Promise<RemoveResult>((resolve, reject) => {
|
||||
de.removeRecursively(() => {
|
||||
resolve({success: true, fileRemoved: de});
|
||||
}, (err) => {
|
||||
File.fillErrorMessage(err);
|
||||
this.fillErrorMessage(err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
@@ -1119,12 +1191,12 @@ export class File {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private static createWriter(fe: FileEntry): Promise<FileWriter> {
|
||||
private createWriter(fe: FileEntry): Promise<FileWriter> {
|
||||
return new Promise<FileWriter>((resolve, reject) => {
|
||||
fe.createWriter((writer) => {
|
||||
resolve(writer);
|
||||
}, (err) => {
|
||||
File.fillErrorMessage(err);
|
||||
this.fillErrorMessage(err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
@@ -1133,7 +1205,7 @@ export class File {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private static write(writer: FileWriter, gu: string | Blob): Promise<any> {
|
||||
private write(writer: FileWriter, gu: string | Blob | ArrayBuffer): Promise<any> {
|
||||
if (gu instanceof Blob) {
|
||||
return this.writeFileInChunks(writer, gu);
|
||||
}
|
||||
@@ -1153,7 +1225,7 @@ export class File {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private static writeFileInChunks(writer: FileWriter, file: Blob) {
|
||||
private writeFileInChunks(writer: FileWriter, file: Blob) {
|
||||
const BLOCK_SIZE = 1024 * 1024;
|
||||
let writtenSize = 0;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
|
||||
declare var window: any;
|
||||
|
||||
@@ -10,7 +11,7 @@ declare var window: any;
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {FilePath} from 'ionic-native';
|
||||
* import {FilePath} from '@ionic-native/filepath';
|
||||
*
|
||||
* FilePath.resolveNativePath(path)
|
||||
* .then(filePath => console.log(filePath);
|
||||
@@ -25,6 +26,7 @@ declare var window: any;
|
||||
repo: 'https://github.com/hiddentao/cordova-plugin-filepath',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class FilePath {
|
||||
|
||||
/**
|
||||
@@ -33,6 +35,6 @@ export class FilePath {
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
static resolveNativePath(path: string): Promise<string> {return; }
|
||||
resolveNativePath(path: string): Promise<string> {return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
|
||||
|
||||
export interface FingerprintOptions {
|
||||
@@ -22,7 +23,7 @@ export interface FingerprintOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FingerprintAIO } from 'ionic-native';
|
||||
* import { FingerprintAIO } from '@ionic-native/fingerprint-aio';
|
||||
*
|
||||
* FingerprintAIO.show({
|
||||
* clientId: "Fingerprint-Demo",
|
||||
@@ -42,6 +43,7 @@ export interface FingerprintOptions {
|
||||
repo: 'https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class FingerprintAIO {
|
||||
|
||||
/**
|
||||
@@ -49,7 +51,7 @@ export class FingerprintAIO {
|
||||
* @return {Promise<any>} Returns a promise with result
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<any> { return; }
|
||||
isAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show authentication dialogue
|
||||
@@ -57,6 +59,6 @@ export class FingerprintAIO {
|
||||
* @return {Promise<any>} Returns a promise that resolves when authentication was successfull
|
||||
*/
|
||||
@Cordova()
|
||||
static show(options: FingerprintOptions): Promise<any> { return; }
|
||||
show(options: FingerprintOptions): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
@@ -8,7 +9,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Firebase } from 'ionic-native';
|
||||
* import { Firebase } from '@ionic-native/firebase';
|
||||
*
|
||||
* Firebase.getToken()
|
||||
* .then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device
|
||||
@@ -26,6 +27,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
repo: 'https://github.com/arnesson/cordova-plugin-firebase',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Firebase {
|
||||
|
||||
/**
|
||||
@@ -33,7 +35,7 @@ export class Firebase {
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getToken(): Promise<any> { return; }
|
||||
getToken(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get notified when a token is refreshed
|
||||
@@ -42,7 +44,7 @@ export class Firebase {
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
static onTokenRefresh(): Observable<any> { return; }
|
||||
onTokenRefresh(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Get notified when the user opens a notification
|
||||
@@ -51,7 +53,7 @@ export class Firebase {
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
static onNotificationOpen(): Observable<any> { return; }
|
||||
onNotificationOpen(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Grant permission to recieve push notifications
|
||||
@@ -60,7 +62,16 @@ export class Firebase {
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static grantPermission(): Promise<any> { return; }
|
||||
grantPermission(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Check permission to recieve push notifications
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static hasPermission(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set icon badge number. Set to 0 to clear the badge.
|
||||
@@ -68,14 +79,14 @@ export class Firebase {
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setBadgeNumber(badgeNumber: number): Promise<any> { return; }
|
||||
setBadgeNumber(badgeNumber: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get icon badge number
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getBadgeNumber(): Promise<any> { return; }
|
||||
getBadgeNumber(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Subscribe to a topic
|
||||
@@ -83,7 +94,7 @@ export class Firebase {
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static subscribe(topic: string): Promise<any> { return; }
|
||||
subscribe(topic: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Unsubscribe from a topic
|
||||
@@ -91,7 +102,7 @@ export class Firebase {
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static unsubscribe(topic: string): Promise<any> { return; }
|
||||
unsubscribe(topic: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Log an event using Analytics
|
||||
@@ -100,7 +111,7 @@ export class Firebase {
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static logEvent(type: string, data: any): Promise<any> { return; }
|
||||
logEvent(type: string, data: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set a user id for use in Analytics
|
||||
@@ -108,7 +119,7 @@ export class Firebase {
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setUserId(userId: string): Promise<any> { return; }
|
||||
setUserId(userId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set a user property for use in Analytics
|
||||
@@ -117,7 +128,7 @@ export class Firebase {
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setUserProperty(name: string, value: string): Promise<any> { return; }
|
||||
setUserProperty(name: string, value: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Fetch Remote Config parameter values for your app
|
||||
@@ -129,7 +140,7 @@ export class Firebase {
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static fetch(cacheExpirationSeconds?: number): Promise<any> { return; }
|
||||
fetch(cacheExpirationSeconds?: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Activate the Remote Config fetched config
|
||||
@@ -138,7 +149,7 @@ export class Firebase {
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static activateFetched(): Promise<any> { return; }
|
||||
activateFetched(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Retrieve a Remote Config value
|
||||
@@ -151,7 +162,7 @@ export class Firebase {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
static getValue(key: string, namespace?: string): Promise<any> { return; }
|
||||
getValue(key: string, namespace?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Retrieve a Remote Config byte array
|
||||
@@ -164,7 +175,7 @@ export class Firebase {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
static getByteArray(key: string, namespace?: string): Promise<any> { return; }
|
||||
getByteArray(key: string, namespace?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get the current state of the FirebaseRemoteConfig singleton object
|
||||
@@ -173,7 +184,7 @@ export class Firebase {
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static getInfo(): Promise<any> { return; }
|
||||
getInfo(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Change the settings for the FirebaseRemoteConfig object's operations
|
||||
@@ -183,7 +194,7 @@ export class Firebase {
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static setConfigSettings(settings: any): Promise<any> { return; }
|
||||
setConfigSettings(settings: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set defaults in the Remote Config
|
||||
@@ -196,6 +207,6 @@ export class Firebase {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
static setDefaults(defaults: any, namespace: string): Promise<any> { return; }
|
||||
setDefaults(defaults: any, namespace: string): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Flashlight
|
||||
@@ -8,7 +9,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Flashlight } from 'ionic-native';
|
||||
* import { Flashlight } from '@ionic-native/flashlight';
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -20,6 +21,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
pluginRef: 'window.plugins.flashlight',
|
||||
repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git'
|
||||
})
|
||||
@Injectable()
|
||||
export class Flashlight {
|
||||
|
||||
/**
|
||||
@@ -27,28 +29,28 @@ export class Flashlight {
|
||||
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean stating if the flashlight is available.
|
||||
*/
|
||||
@Cordova()
|
||||
static available(): Promise<boolean> { return; }
|
||||
available(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Switches the flashlight on
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static switchOn(): Promise<boolean> { return; }
|
||||
switchOn(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Switches the flashlight off
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static switchOff(): Promise<boolean> { return; }
|
||||
switchOff(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Toggles the flashlight
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static toggle(): Promise<any> { return; }
|
||||
toggle(): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
@@ -58,6 +60,6 @@ export class Flashlight {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static isSwitchedOn(): boolean { return; }
|
||||
isSwitchedOn(): boolean { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window: any;
|
||||
@@ -9,7 +10,7 @@ declare var window: any;
|
||||
* Geofences persist after device reboot. Geofences will be monitored even when the app is not running.
|
||||
* @usage
|
||||
* ```
|
||||
* import { Geofence } from 'ionic-native';
|
||||
* import { Geofence } from '@ionic-native/geofence';
|
||||
* import { Platform } from 'ionic-angular'
|
||||
* ...
|
||||
*
|
||||
@@ -82,6 +83,7 @@ declare var window: any;
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows Phone']
|
||||
})
|
||||
|
||||
@Injectable()
|
||||
export class Geofence {
|
||||
|
||||
public static TransitionType = {
|
||||
@@ -98,7 +100,7 @@ export class Geofence {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static initialize(): Promise<void> { return; };
|
||||
initialize(): Promise<void> { return; };
|
||||
|
||||
/**
|
||||
* Adds a new geofence or array of geofences. For geofence object, see above.
|
||||
@@ -106,7 +108,7 @@ export class Geofence {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static addOrUpdate(geofences: Object | Array<Object>): Promise<void> { return; };
|
||||
addOrUpdate(geofences: Object | Array<Object>): Promise<void> { return; };
|
||||
|
||||
/**
|
||||
* Removes a geofence or array of geofences. `geofenceID` corresponds to one or more IDs specified when the
|
||||
@@ -115,7 +117,7 @@ export class Geofence {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static remove(geofenceId: string | Array<string>): Promise<void> { return; };
|
||||
remove(geofenceId: string | Array<string>): Promise<void> { return; };
|
||||
|
||||
/**
|
||||
* Removes all geofences.
|
||||
@@ -123,7 +125,7 @@ export class Geofence {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static removeAll(): Promise<void> { return; };
|
||||
removeAll(): Promise<void> { return; };
|
||||
|
||||
/**
|
||||
* Returns an array of geofences currently being monitored.
|
||||
@@ -131,14 +133,14 @@ export class Geofence {
|
||||
* @returns {Promise<Array<string>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getWatched(): Promise<string> { return; };
|
||||
getWatched(): Promise<string> { return; };
|
||||
|
||||
/**
|
||||
* Called when a geofence is crossed in the direction specified by `TransitType`.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
static onTransitionReceived(): Observable<any> {
|
||||
onTransitionReceived(): Observable<any> {
|
||||
|
||||
return new Observable<any>((observer) => {
|
||||
window && window.geofence && (window.geofence.onTransitionReceived = observer.next.bind(observer));
|
||||
@@ -152,7 +154,7 @@ export class Geofence {
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
static onNotificationClicked(): Observable<any> {
|
||||
onNotificationClicked(): Observable<any> {
|
||||
|
||||
return new Observable<any>((observer) => {
|
||||
window && window.geofence && (window.geofence.onNotificationClicked = observer.next.bind(observer));
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var navigator: any;
|
||||
@@ -119,7 +120,7 @@ export interface GeolocationOptions {
|
||||
* @usage
|
||||
*
|
||||
* ```typescript
|
||||
* import { Geolocation } from 'ionic-native';
|
||||
* import { Geolocation } from '@ionic-native/geolocation';
|
||||
*
|
||||
*
|
||||
* Geolocation.getCurrentPosition().then((resp) => {
|
||||
@@ -148,6 +149,7 @@ export interface GeolocationOptions {
|
||||
pluginRef: 'navigator.geolocation',
|
||||
repo: 'https://github.com/apache/cordova-plugin-geolocation'
|
||||
})
|
||||
@Injectable()
|
||||
export class Geolocation {
|
||||
|
||||
/**
|
||||
@@ -159,7 +161,7 @@ export class Geolocation {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getCurrentPosition(options?: GeolocationOptions): Promise<Geoposition> { return; }
|
||||
getCurrentPosition(options?: GeolocationOptions): Promise<Geoposition> { return; }
|
||||
|
||||
/**
|
||||
* Watch the current device's position. Clear the watch by unsubscribing from
|
||||
@@ -179,7 +181,7 @@ export class Geolocation {
|
||||
* @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions).
|
||||
* @returns {Observable<Geoposition>} Returns an Observable that notifies with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or errors.
|
||||
*/
|
||||
static watchPosition(options?: GeolocationOptions): Observable<Geoposition> {
|
||||
watchPosition(options?: GeolocationOptions): Observable<Geoposition> {
|
||||
return new Observable<Geoposition>(
|
||||
(observer: any) => {
|
||||
let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.next.bind(observer), options);
|
||||
@@ -1,11 +1,12 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Globalization
|
||||
* @description
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Globalization } from 'ionic-native';
|
||||
* import { Globalization } from '@ionic-native/globalization';
|
||||
*
|
||||
*
|
||||
* ```
|
||||
@@ -17,6 +18,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
repo: 'https://github.com/apache/cordova-plugin-globalization',
|
||||
platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Firefox OS', 'iOS', 'Windows Phone 8', 'Widnows', 'Browser']
|
||||
})
|
||||
@Injectable()
|
||||
export class Globalization {
|
||||
|
||||
/**
|
||||
@@ -24,14 +26,14 @@ export class Globalization {
|
||||
* @returns {Promise<{value: string}>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getPreferredLanguage(): Promise<{ value: string }> { return; }
|
||||
getPreferredLanguage(): Promise<{ value: string }> { return; }
|
||||
|
||||
/**
|
||||
* Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter.
|
||||
* @returns {Promise<{value: string}>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getLocaleName(): Promise<{ value: string }> { return; }
|
||||
getLocaleName(): Promise<{ value: string }> { return; }
|
||||
|
||||
/**
|
||||
* Converts date to string
|
||||
@@ -43,7 +45,7 @@ export class Globalization {
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static dateToString(date: Date, options: { formatLength: string, selector: string }): Promise<{ value: string }> { return; }
|
||||
dateToString(date: Date, options: { formatLength: string, selector: string }): Promise<{ value: string }> { return; }
|
||||
|
||||
/**
|
||||
* Parses a date formatted as a string, according to the client's user preferences and calendar using the time zone of the client, and returns the corresponding date object.
|
||||
@@ -55,7 +57,7 @@ export class Globalization {
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static stringToDate(dateString: string, options: { formatLength: string, selector: string }): Promise<{ year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number }> { return; }
|
||||
stringToDate(dateString: string, options: { formatLength: string, selector: string }): Promise<{ year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number }> { return; }
|
||||
|
||||
/**
|
||||
* Returns a pattern string to format and parse dates according to the client's user preferences.
|
||||
@@ -65,7 +67,7 @@ export class Globalization {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getDatePattern(options: { formatLength: string, selector: string }): Promise<{ pattern: string }> { return; }
|
||||
getDatePattern(options: { formatLength: string, selector: string }): Promise<{ pattern: string }> { return; }
|
||||
|
||||
/**
|
||||
* Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
|
||||
@@ -75,7 +77,7 @@ export class Globalization {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getDateNames(options: { type: string, item: string }): Promise<{ value: Array<string> }> { return; }
|
||||
getDateNames(options: { type: string, item: string }): Promise<{ value: Array<string> }> { return; }
|
||||
|
||||
/**
|
||||
* Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
|
||||
@@ -83,14 +85,14 @@ export class Globalization {
|
||||
* @returns {Promise<{dst: string}>} reutrns a promise with the value
|
||||
*/
|
||||
@Cordova()
|
||||
static isDayLightSavingsTime(date: Date): Promise<{ dst: string }> { return; }
|
||||
isDayLightSavingsTime(date: Date): Promise<{ dst: string }> { return; }
|
||||
|
||||
/**
|
||||
* Returns the first day of the week according to the client's user preferences and calendar.
|
||||
* @returns {Promise<{value: string}>} returns a promise with the value
|
||||
*/
|
||||
@Cordova()
|
||||
static getFirstDayOfWeek(): Promise<{ value: string }> { return; }
|
||||
getFirstDayOfWeek(): Promise<{ value: string }> { return; }
|
||||
|
||||
/**
|
||||
* Returns a number formatted as a string according to the client's user preferences.
|
||||
@@ -101,7 +103,7 @@ export class Globalization {
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static numberToString(numberToConvert: number, options: { type: string }): Promise<{ value: string }> { return; }
|
||||
numberToString(numberToConvert: number, options: { type: string }): Promise<{ value: string }> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -113,7 +115,7 @@ export class Globalization {
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static stringToNumber(stringToConvert: string, options: { type: string }): Promise<{ value: number | string }> { return; }
|
||||
stringToNumber(stringToConvert: string, options: { type: string }): Promise<{ value: number | string }> { return; }
|
||||
|
||||
/**
|
||||
* Returns a pattern string to format and parse numbers according to the client's user preferences.
|
||||
@@ -123,7 +125,7 @@ export class Globalization {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getNumberPattern(options: { type: string }): Promise<{ pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string }> { return; }
|
||||
getNumberPattern(options: { type: string }): Promise<{ pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string }> { return; }
|
||||
|
||||
/**
|
||||
* Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
|
||||
@@ -131,6 +133,6 @@ export class Globalization {
|
||||
* @returns {Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getCurrencyPattern(currencyCode: string): Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }> { return; }
|
||||
getCurrencyPattern(currencyCode: string): Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }> { return; }
|
||||
|
||||
}
|
||||
+21
-19
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
declare var window;
|
||||
|
||||
@@ -12,7 +13,7 @@ declare var window;
|
||||
* - (Android) Google Play Services SDK installed via [Android SDK Manager](https://developer.android.com/sdk/installing/adding-packages.html)
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { GoogleAnalytics } from 'ionic-native';
|
||||
* import { GoogleAnalytics } from '@ionic-native/google-analytics';
|
||||
*
|
||||
* GoogleAnalytics.startTrackerWithId('YOUR_TRACKER_ID')
|
||||
* .then(() => {
|
||||
@@ -32,6 +33,7 @@ declare var window;
|
||||
repo: 'https://github.com/danwilson/google-analytics-plugin',
|
||||
platforms: ['Android', 'iOS', 'Browser']
|
||||
})
|
||||
@Injectable()
|
||||
export class GoogleAnalytics {
|
||||
|
||||
/**
|
||||
@@ -45,7 +47,7 @@ export class GoogleAnalytics {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
static startTrackerWithId(id: string, interval?: number): Promise<any> { return; }
|
||||
startTrackerWithId(id: string, interval?: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
|
||||
@@ -53,7 +55,7 @@ export class GoogleAnalytics {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setAllowIDFACollection(allow: boolean): Promise<any> { return; }
|
||||
setAllowIDFACollection(allow: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set a UserId
|
||||
@@ -62,7 +64,7 @@ export class GoogleAnalytics {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setUserId(id: string): Promise<any> { return; }
|
||||
setUserId(id: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set a anonymize Ip address
|
||||
@@ -70,7 +72,7 @@ export class GoogleAnalytics {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setAnonymizeIp(anonymize: boolean): Promise<any> { return; }
|
||||
setAnonymizeIp(anonymize: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Sets the app version
|
||||
@@ -78,7 +80,7 @@ export class GoogleAnalytics {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setAppVersion(appVersion: string): Promise<any> { return; }
|
||||
setAppVersion(appVersion: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set OptOut
|
||||
@@ -86,14 +88,14 @@ export class GoogleAnalytics {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setOptOut(optout: boolean): Promise<any> { return; }
|
||||
setOptOut(optout: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enable verbose logging
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static debugMode(): Promise<any> { return; }
|
||||
debugMode(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track custom metric
|
||||
@@ -105,7 +107,7 @@ export class GoogleAnalytics {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
static trackMetric(key: string, value?: any): Promise<any> { return; }
|
||||
trackMetric(key: string, value?: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track a screen
|
||||
@@ -120,17 +122,17 @@ export class GoogleAnalytics {
|
||||
successIndex: 3,
|
||||
errorIndex: 4
|
||||
})
|
||||
static trackView(title: string, campaignUrl?: string, newSession?: boolean): Promise<any> { return; }
|
||||
trackView(title: string, campaignUrl?: string, newSession?: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Add a Custom Dimension
|
||||
* https://developers.google.com/analytics/devguides/platform/customdimsmets
|
||||
* @param key {string}
|
||||
* @param key {number}
|
||||
* @param value {string}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static addCustomDimension(key: number, value: string): Promise<any> { return; }
|
||||
addCustomDimension(key: number, value: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track an event
|
||||
@@ -146,7 +148,7 @@ export class GoogleAnalytics {
|
||||
successIndex: 5,
|
||||
errorIndex: 6
|
||||
})
|
||||
static trackEvent(category: string, action: string, label?: string, value?: number, newSession?: boolean): Promise<any> { return; }
|
||||
trackEvent(category: string, action: string, label?: string, value?: number, newSession?: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track an exception
|
||||
@@ -155,7 +157,7 @@ export class GoogleAnalytics {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static trackException(description: string, fatal: boolean): Promise<any> { return; }
|
||||
trackException(description: string, fatal: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track User Timing (App Speed)
|
||||
@@ -166,7 +168,7 @@ export class GoogleAnalytics {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise<any> { return; }
|
||||
trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Add a Transaction (Ecommerce)
|
||||
@@ -180,7 +182,7 @@ export class GoogleAnalytics {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise<any> { return; }
|
||||
addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Add a Transaction Item (Ecommerce)
|
||||
@@ -195,7 +197,7 @@ export class GoogleAnalytics {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise<any> { return; }
|
||||
addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enable/disable automatic reporting of uncaught exceptions
|
||||
@@ -203,6 +205,6 @@ export class GoogleAnalytics {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise<any> { return; }
|
||||
enableUncaughtExceptionReporting(shouldEnable: boolean): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, CordovaInstance, Plugin, InstanceProperty, getPlugin, pluginWarn } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaInstance, Plugin, InstanceProperty, getPlugin, pluginWarn } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/fromEvent';
|
||||
|
||||
@@ -38,77 +39,20 @@ export const GoogleMapsAnimation = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @name Google Maps
|
||||
* @description This plugin uses the native Google Maps SDK
|
||||
* @usage
|
||||
* ```
|
||||
* import {
|
||||
* GoogleMap,
|
||||
* GoogleMapsEvent,
|
||||
* GoogleMapsLatLng,
|
||||
* CameraPosition,
|
||||
* GoogleMapsMarkerOptions,
|
||||
* GoogleMapsMarker
|
||||
* } from 'ionic-native';
|
||||
*
|
||||
* export class MapPage {
|
||||
* constructor() {}
|
||||
*
|
||||
* // Load map only after view is initialize
|
||||
* ngAfterViewInit() {
|
||||
* this.loadMap();
|
||||
* }
|
||||
*
|
||||
* loadMap() {
|
||||
* // make sure to create following structure in your view.html file
|
||||
* // and add a height (for example 100%) to it, else the map won't be visible
|
||||
* // <ion-content>
|
||||
* // <div #map id="map" style="height:100%;"></div>
|
||||
* // </ion-content>
|
||||
*
|
||||
* // create a new map by passing HTMLElement
|
||||
* let element: HTMLElement = document.getElementById('map');
|
||||
*
|
||||
* let map = new GoogleMap(element);
|
||||
*
|
||||
* // listen to MAP_READY event
|
||||
* map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!'));
|
||||
*
|
||||
* // create LatLng object
|
||||
* let ionic: GoogleMapsLatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);
|
||||
*
|
||||
* // create CameraPosition
|
||||
* let position: CameraPosition = {
|
||||
* target: ionic,
|
||||
* zoom: 18,
|
||||
* tilt: 30
|
||||
* };
|
||||
*
|
||||
* // move the map's camera to position
|
||||
* map.moveCamera(position);
|
||||
*
|
||||
* // create new marker
|
||||
* let markerOptions: GoogleMapsMarkerOptions = {
|
||||
* position: ionic,
|
||||
* title: 'Ionic'
|
||||
* };
|
||||
*
|
||||
* map.addMarker(markerOptions)
|
||||
* .then((marker: GoogleMapsMarker) => {
|
||||
* marker.showInfoWindow();
|
||||
* });
|
||||
* }
|
||||
*
|
||||
* }
|
||||
* ```
|
||||
* @private
|
||||
*/
|
||||
export const GoogleMapsMapTypeId = {
|
||||
HYBRID: 'MAP_TYPE_HYBRID',
|
||||
NONE: 'MAP_TYPE_NONE',
|
||||
NORMAL: 'MAP_TYPE_NORMAL',
|
||||
ROADMAP: 'MAP_TYPE_ROADMAP',
|
||||
SATELLITE: 'MAP_TYPE_SATELLITE',
|
||||
TERAIN: 'MAP_TYPE_TERRAIN'
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'GoogleMap',
|
||||
pluginRef: 'plugin.google.maps.Map',
|
||||
plugin: 'cordova-plugin-googlemaps',
|
||||
repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps',
|
||||
install: 'ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"'
|
||||
})
|
||||
export class GoogleMap {
|
||||
_objectInstance: any;
|
||||
|
||||
@@ -118,7 +62,7 @@ export class GoogleMap {
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<boolean> { return; }
|
||||
isAvailable(): Promise<boolean> { return; }
|
||||
|
||||
constructor(element: string | HTMLElement, options?: any) {
|
||||
if (!!getPlugin('plugin.google.maps.Map')) {
|
||||
@@ -252,13 +196,13 @@ export class GoogleMap {
|
||||
getLicenseInfo(): Promise<string> { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setCenter(latLng: GoogleMapsLatLng): void { }
|
||||
setCenter(latLng: LatLng): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setZoom(zoomLevel: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setMapTypeId(typeId: string): void { }
|
||||
setMapTypeId(mapTypeId: string): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setTilt(tiltLevel: number): void { }
|
||||
@@ -291,17 +235,17 @@ export class GoogleMap {
|
||||
setAllGesturesEnabled(enabled: boolean): void { }
|
||||
|
||||
/**
|
||||
* @returns {Promise<GoogleMapsMarker | any>}
|
||||
* @returns {Promise<Marker | any>}
|
||||
*/
|
||||
addMarker(options: GoogleMapsMarkerOptions): Promise<GoogleMapsMarker | any> {
|
||||
addMarker(options: MarkerOptions): Promise<Marker | any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<GoogleMapsMarker>(
|
||||
return new Promise<Marker>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addMarker(options, (marker: any) => {
|
||||
if (marker) {
|
||||
resolve(new GoogleMapsMarker(marker));
|
||||
resolve(new Marker(marker));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
@@ -311,17 +255,17 @@ export class GoogleMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<GoogleMapsCircle | any>}
|
||||
* @returns {Promise<Circle | any>}
|
||||
*/
|
||||
addCircle(options: GoogleMapsCircleOptions): Promise<GoogleMapsCircle | any> {
|
||||
addCircle(options: CircleOptions): Promise<Circle | any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<GoogleMapsCircle>(
|
||||
return new Promise<Circle>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addCircle(options, (circle: any) => {
|
||||
if (circle) {
|
||||
resolve(new GoogleMapsCircle(circle));
|
||||
resolve(new Circle(circle));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
@@ -331,17 +275,17 @@ export class GoogleMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<GoogleMapsPolygon | any>}
|
||||
* @returns {Promise<Polygon | any>}
|
||||
*/
|
||||
addPolygon(options: GoogleMapsPolygonOptions): Promise<GoogleMapsPolygon | any> {
|
||||
addPolygon(options: PolygonOptions): Promise<Polygon | any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<GoogleMapsPolygon>(
|
||||
return new Promise<Polygon>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addPolygon(options, (polygon: any) => {
|
||||
if (polygon) {
|
||||
resolve(new GoogleMapsPolygon(polygon));
|
||||
resolve(new Polygon(polygon));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
@@ -351,17 +295,17 @@ export class GoogleMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<GoogleMapsPolyline | any>}
|
||||
* @returns {Promise<Polyline | any>}
|
||||
*/
|
||||
addPolyline(options: GoogleMapsPolylineOptions): Promise<GoogleMapsPolyline | any> {
|
||||
addPolyline(options: PolylineOptions): Promise<Polyline | any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<GoogleMapsPolyline>(
|
||||
return new Promise<Polyline>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addPolyline(options, (polyline: any) => {
|
||||
if (polyline) {
|
||||
resolve(new GoogleMapsPolyline(polyline));
|
||||
resolve(new Polyline(polyline));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
@@ -371,17 +315,17 @@ export class GoogleMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<GoogleMapsTileOverlay | any>}
|
||||
* @returns {Promise<TileOverlay | any>}
|
||||
*/
|
||||
addTileOverlay(options: GoogleMapsTileOverlayOptions): Promise<GoogleMapsTileOverlay | any> {
|
||||
addTileOverlay(options: TileOverlayOptions): Promise<TileOverlay | any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<GoogleMapsTileOverlay>(
|
||||
return new Promise<TileOverlay>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addTileOverlay(options, (tileOverlay: any) => {
|
||||
if (tileOverlay) {
|
||||
resolve(new GoogleMapsTileOverlay(tileOverlay));
|
||||
resolve(new TileOverlay(tileOverlay));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
@@ -391,17 +335,17 @@ export class GoogleMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<GoogleMapsGroundOverlay | any>}
|
||||
* @returns {Promise<GroundOverlay | any>}
|
||||
*/
|
||||
addGroundOverlay(options: GoogleMapsGroundOverlayOptions): Promise<GoogleMapsGroundOverlay | any> {
|
||||
addGroundOverlay(options: GroundOverlayOptions): Promise<GroundOverlay | any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<GoogleMapsGroundOverlay>(
|
||||
return new Promise<GroundOverlay>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addGroundOverlay(options, (groundOverlay: any) => {
|
||||
if (groundOverlay) {
|
||||
resolve(new GoogleMapsGroundOverlay(groundOverlay));
|
||||
resolve(new GroundOverlay(groundOverlay));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
@@ -411,17 +355,17 @@ export class GoogleMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<GoogleMapsKmlOverlay | any>}
|
||||
* @returns {Promise<KmlOverlay | any>}
|
||||
*/
|
||||
addKmlOverlay(options: GoogleMapsKmlOverlayOptions): Promise<GoogleMapsKmlOverlay | any> {
|
||||
addKmlOverlay(options: KmlOverlayOptions): Promise<KmlOverlay | any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<GoogleMapsKmlOverlay>(
|
||||
return new Promise<KmlOverlay>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addKmlOverlay(options, (kmlOverlay: any) => {
|
||||
if (kmlOverlay) {
|
||||
resolve(new GoogleMapsKmlOverlay(kmlOverlay));
|
||||
resolve(new KmlOverlay(kmlOverlay));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
@@ -455,13 +399,13 @@ export class GoogleMap {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
fromLatLngToPoint(latLng: GoogleMapsLatLng, point: any): Promise<any> { return; }
|
||||
fromLatLngToPoint(latLng: LatLng, point: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<GoogleMapsLatLng>}
|
||||
* @returns {Promise<LatLng>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
fromPointToLatLng(point: any, latLng: GoogleMapsLatLng): Promise<GoogleMapsLatLng> { return; }
|
||||
fromPointToLatLng(point: any, latLng: LatLng): Promise<LatLng> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<any>}
|
||||
@@ -474,6 +418,97 @@ export class GoogleMap {
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
panBy(): void { }
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Google Maps
|
||||
* @description This plugin uses the native Google Maps SDK
|
||||
* @usage
|
||||
* ```
|
||||
* import {
|
||||
* GoogleMaps,
|
||||
* GoogleMap,
|
||||
* GoogleMapsEvent,
|
||||
* LatLng,
|
||||
* CameraPosition,
|
||||
* MarkerOptions,
|
||||
* Marker
|
||||
* } from '@ionic-native/google-maps';
|
||||
*
|
||||
* export class MapPage {
|
||||
* constructor(private googleMaps: GoogleMaps) {}
|
||||
*
|
||||
* // Load map only after view is initialize
|
||||
* ngAfterViewInit() {
|
||||
* this.loadMap();
|
||||
* }
|
||||
*
|
||||
* loadMap() {
|
||||
* // make sure to create following structure in your view.html file
|
||||
* // and add a height (for example 100%) to it, else the map won't be visible
|
||||
* // <ion-content>
|
||||
* // <div #map id="map" style="height:100%;"></div>
|
||||
* // </ion-content>
|
||||
*
|
||||
* // create a new map by passing HTMLElement
|
||||
* let element: HTMLElement = document.getElementById('map');
|
||||
*
|
||||
* let map: GoogleMap = GoogleMaps.create(element);
|
||||
*
|
||||
* // listen to MAP_READY event
|
||||
* // You must wait for this event to fire before adding something to the map or modifying it in anyway
|
||||
* map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!'));
|
||||
*
|
||||
* // create LatLng object
|
||||
* let ionic: LatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);
|
||||
*
|
||||
* // create CameraPosition
|
||||
* let position: CameraPosition = {
|
||||
* target: ionic,
|
||||
* zoom: 18,
|
||||
* tilt: 30
|
||||
* };
|
||||
*
|
||||
* // move the map's camera to position
|
||||
* map.moveCamera(position);
|
||||
*
|
||||
* // create new marker
|
||||
* let markerOptions: MarkerOptions = {
|
||||
* position: ionic,
|
||||
* title: 'Ionic'
|
||||
* };
|
||||
*
|
||||
* const marker: Marker = map.addMarker(markerOptions)
|
||||
* .then((marker: Marker) => {
|
||||
* marker.showInfoWindow();
|
||||
* });
|
||||
* }
|
||||
*
|
||||
* }
|
||||
* ```
|
||||
* @classes
|
||||
* GoogleMap
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'GoogleMaps',
|
||||
pluginRef: 'plugin.google.maps.Map',
|
||||
plugin: 'cordova-plugin-googlemaps',
|
||||
repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps',
|
||||
install: 'ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"',
|
||||
installVariables: ['API_KEY_FOR_ANDROID', 'API_KEY_FOR_IOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class GoogleMaps {
|
||||
|
||||
/**
|
||||
* Creates a new GoogleMap instance
|
||||
* @param element {string | HTMLElement} Element ID or reference to attach the map to
|
||||
* @param options {any} Options
|
||||
* @returns {GoogleMap}
|
||||
*/
|
||||
create(element: string | HTMLElement, options?: any): GoogleMap {
|
||||
return new GoogleMap(element, options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -481,7 +516,7 @@ export class GoogleMap {
|
||||
* @private
|
||||
*/
|
||||
export interface AnimateCameraOptions {
|
||||
target?: GoogleMapsLatLng | Array<GoogleMapsMarker> | GoogleMapsLatLngBounds;
|
||||
target?: LatLng | Array<Marker> | LatLngBounds;
|
||||
tilt?: number;
|
||||
zoom?: number;
|
||||
bearing?: number;
|
||||
@@ -492,7 +527,7 @@ export interface AnimateCameraOptions {
|
||||
* @private
|
||||
*/
|
||||
export interface CameraPosition {
|
||||
target?: GoogleMapsLatLng | GoogleMapsLatLngBounds | GoogleMapsLatLng[];
|
||||
target?: LatLng | LatLngBounds | LatLng[];
|
||||
zoom?: number;
|
||||
tilt?: number;
|
||||
bearing?: number;
|
||||
@@ -502,7 +537,7 @@ export interface CameraPosition {
|
||||
* @private
|
||||
*/
|
||||
export interface MyLocation {
|
||||
latLng?: GoogleMapsLatLng;
|
||||
latLng?: LatLng;
|
||||
speed?: number;
|
||||
time?: string;
|
||||
bearing?: number;
|
||||
@@ -526,7 +561,7 @@ export interface VisibleRegion {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface GoogleMapsMarkerOptions {
|
||||
export interface MarkerOptions {
|
||||
/**
|
||||
* The icon image url or properties. Also you can specify HTML Color values. Alternatively you can specify the image as Base64
|
||||
*/
|
||||
@@ -545,7 +580,7 @@ export interface GoogleMapsMarkerOptions {
|
||||
/**
|
||||
* The position of the marker.
|
||||
*/
|
||||
position?: GoogleMapsLatLng;
|
||||
position?: LatLng;
|
||||
|
||||
/**
|
||||
* Specify the anchor of the InfoWindow
|
||||
@@ -606,7 +641,7 @@ export interface GoogleMapsMarkerOptions {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface GoogleMapsMarkerIcon {
|
||||
export interface MarkerIcon {
|
||||
url?: string;
|
||||
size?: {
|
||||
width?: number;
|
||||
@@ -617,7 +652,7 @@ export interface GoogleMapsMarkerIcon {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class GoogleMapsMarker {
|
||||
export class Marker {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
@@ -788,7 +823,7 @@ export class GoogleMapsMarker {
|
||||
* @param icon
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setIcon(icon: GoogleMapsMarkerIcon): void { return; }
|
||||
setIcon(icon: MarkerIcon): void { return; }
|
||||
|
||||
/**
|
||||
* Change title of the infoWindow.
|
||||
@@ -851,14 +886,14 @@ export class GoogleMapsMarker {
|
||||
* @param latLng {GoogleMapLatLng}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setPosition(latLng: GoogleMapsLatLng): void { return; }
|
||||
setPosition(latLng: LatLng): void { return; }
|
||||
|
||||
/**
|
||||
* Return the marker position.
|
||||
* @return {Promise<GoogleMapLatLng>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getPosition(): Promise<GoogleMapsLatLng> { return; }
|
||||
getPosition(): Promise<LatLng> { return; }
|
||||
|
||||
/**
|
||||
* Return the map instance.
|
||||
@@ -879,8 +914,8 @@ export class GoogleMapsMarker {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface GoogleMapsCircleOptions {
|
||||
center?: GoogleMapsLatLng;
|
||||
export interface CircleOptions {
|
||||
center?: LatLng;
|
||||
radius?: number;
|
||||
strokeColor?: string;
|
||||
strokeWidth?: number;
|
||||
@@ -892,7 +927,8 @@ export interface GoogleMapsCircleOptions {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class GoogleMapsCircle {
|
||||
|
||||
export class Circle {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
@@ -975,7 +1011,7 @@ export class GoogleMapsCircle {
|
||||
empty(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getCenter(): GoogleMapsLatLng { return; }
|
||||
getCenter(): LatLng { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getRadius(): number { return; }
|
||||
@@ -993,7 +1029,7 @@ export class GoogleMapsCircle {
|
||||
remove(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setCenter(latLng: GoogleMapsLatLng): void { }
|
||||
setCenter(latLng: LatLng): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setFillColor(fillColor: string): void { }
|
||||
@@ -1020,8 +1056,8 @@ export class GoogleMapsCircle {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface GoogleMapsPolylineOptions {
|
||||
points?: Array<GoogleMapsLatLng>;
|
||||
export interface PolylineOptions {
|
||||
points?: Array<LatLng>;
|
||||
visible?: boolean;
|
||||
geodesic?: boolean;
|
||||
color?: string;
|
||||
@@ -1032,7 +1068,8 @@ export interface GoogleMapsPolylineOptions {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class GoogleMapsPolyline {
|
||||
|
||||
export class Polyline {
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
/**
|
||||
@@ -1114,7 +1151,7 @@ export class GoogleMapsPolyline {
|
||||
empty(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getPoints(): Array<GoogleMapsLatLng> { return; }
|
||||
getPoints(): Array<LatLng> { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getCOlor(): string { return; }
|
||||
@@ -1132,7 +1169,7 @@ export class GoogleMapsPolyline {
|
||||
remove(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setPoints(points: Array<GoogleMapsLatLng>): void { }
|
||||
setPoints(points: Array<LatLng>): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setColor(color: string): void { }
|
||||
@@ -1157,21 +1194,22 @@ export class GoogleMapsPolyline {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface GoogleMapsPolygonOptions {
|
||||
points?: Array<GoogleMapsLatLng>;
|
||||
export interface PolygonOptions {
|
||||
points?: Array<LatLng>;
|
||||
geodesic?: boolean;
|
||||
strokeColor?: string;
|
||||
strokeWidth?: number;
|
||||
fillColor?: string;
|
||||
visible?: boolean;
|
||||
zIndex?: number;
|
||||
addHole?: Array<GoogleMapsLatLng>;
|
||||
addHole?: Array<LatLng>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class GoogleMapsPolygon {
|
||||
|
||||
export class Polygon {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
@@ -1254,7 +1292,7 @@ export class GoogleMapsPolygon {
|
||||
empty(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getPoints(): Array<GoogleMapsLatLng> { return; }
|
||||
getPoints(): Array<LatLng> { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getStrokeColor(): string { return; }
|
||||
@@ -1278,7 +1316,7 @@ export class GoogleMapsPolygon {
|
||||
remove(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setPoints(points: Array<GoogleMapsLatLng>): void { }
|
||||
setPoints(points: Array<LatLng>): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setStrokeColor(strokeColor: string): void { }
|
||||
@@ -1302,7 +1340,7 @@ export class GoogleMapsPolygon {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface GoogleMapsTileOverlayOptions {
|
||||
export interface TileOverlayOptions {
|
||||
tileUrlFormat?: string;
|
||||
visible?: boolean;
|
||||
zIndex?: number;
|
||||
@@ -1313,7 +1351,7 @@ export interface GoogleMapsTileOverlayOptions {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class GoogleMapsTileOverlay {
|
||||
export class TileOverlay {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
@@ -1430,9 +1468,9 @@ export class GoogleMapsTileOverlay {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface GoogleMapsGroundOverlayOptions {
|
||||
export interface GroundOverlayOptions {
|
||||
url?: string;
|
||||
bounds?: Array<GoogleMapsLatLng>;
|
||||
bounds?: Array<LatLng>;
|
||||
visible?: boolean;
|
||||
opacity?: number;
|
||||
bearing?: number;
|
||||
@@ -1442,7 +1480,7 @@ export interface GoogleMapsGroundOverlayOptions {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class GoogleMapsGroundOverlay {
|
||||
export class GroundOverlay {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
@@ -1553,7 +1591,7 @@ export class GoogleMapsGroundOverlay {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface GoogleMapsKmlOverlayOptions {
|
||||
export interface KmlOverlayOptions {
|
||||
url?: string;
|
||||
preserveViewport?: boolean;
|
||||
animation?: boolean;
|
||||
@@ -1562,7 +1600,7 @@ export interface GoogleMapsKmlOverlayOptions {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class GoogleMapsKmlOverlay {
|
||||
export class KmlOverlay {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
@@ -1648,20 +1686,20 @@ export class GoogleMapsKmlOverlay {
|
||||
remove(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getOverlays(): Array<GoogleMapsPolyline | GoogleMapsPolygon | GoogleMapsMarker> { return; }
|
||||
getOverlays(): Array<Polyline | Polygon | Marker> { return; }
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class GoogleMapsLatLngBounds {
|
||||
export class LatLngBounds {
|
||||
private _objectInstance: any;
|
||||
|
||||
@InstanceProperty northeast: GoogleMapsLatLng;
|
||||
@InstanceProperty southwest: GoogleMapsLatLng;
|
||||
@InstanceProperty northeast: LatLng;
|
||||
@InstanceProperty southwest: LatLng;
|
||||
@InstanceProperty type: string;
|
||||
|
||||
constructor(southwestOrArrayOfLatLng: GoogleMapsLatLng | GoogleMapsLatLng[], northeast?: GoogleMapsLatLng) {
|
||||
constructor(southwestOrArrayOfLatLng: LatLng | LatLng[], northeast?: LatLng) {
|
||||
let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng;
|
||||
this._objectInstance = new plugin.google.maps.LatLngBounds(args);
|
||||
}
|
||||
@@ -1673,19 +1711,20 @@ export class GoogleMapsLatLngBounds {
|
||||
toUrlValue(precision?: number): string { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
extend(LatLng: GoogleMapsLatLng): void { }
|
||||
extend(LatLng: LatLng): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
contains(LatLng: GoogleMapsLatLng): boolean { return; }
|
||||
contains(LatLng: LatLng): boolean { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getCenter(): GoogleMapsLatLng { return; }
|
||||
getCenter(): LatLng { return; }
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class GoogleMapsLatLng {
|
||||
|
||||
export class LatLng {
|
||||
|
||||
lat: number;
|
||||
lng: number;
|
||||
@@ -1695,7 +1734,7 @@ export class GoogleMapsLatLng {
|
||||
this.lng = lng;
|
||||
}
|
||||
|
||||
equals(other: GoogleMapsLatLng): boolean {
|
||||
equals(other: LatLng): boolean {
|
||||
return this.lat === other.lat && this.lng === other.lng;
|
||||
}
|
||||
|
||||
@@ -1714,7 +1753,7 @@ export class GoogleMapsLatLng {
|
||||
*/
|
||||
export interface GeocoderRequest {
|
||||
address?: string;
|
||||
bounds?: GoogleMapsLatLng[];
|
||||
bounds?: LatLng[];
|
||||
position?: { lat: number; lng: number };
|
||||
}
|
||||
/**
|
||||
@@ -1,11 +1,12 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Google Plus
|
||||
* @description
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { GooglePlus } from 'ionic-native';
|
||||
* import { GooglePlus } from '@ionic-native/google-plus';
|
||||
*
|
||||
* GooglePlus.login()
|
||||
* .then(res => console.log(res))
|
||||
@@ -19,8 +20,10 @@ import { Cordova, Plugin } from './plugin';
|
||||
pluginRef: 'window.plugins.googleplus',
|
||||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-googleplus',
|
||||
platforms: ['Web', 'Android', 'iOS'],
|
||||
install: 'ionic plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid'
|
||||
install: 'ionic plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid',
|
||||
installVariables: ['REVERSED_CLIENT_ID']
|
||||
})
|
||||
@Injectable()
|
||||
export class GooglePlus {
|
||||
|
||||
/**
|
||||
@@ -32,7 +35,7 @@ export class GooglePlus {
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static login(options?: any): Promise<any> { return; }
|
||||
login(options?: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* You can call trySilentLogin to check if they're already signed in to the app and sign them in silently if they are.
|
||||
@@ -40,20 +43,20 @@ export class GooglePlus {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static trySilentLogin(options?: any): Promise<any> { return; }
|
||||
trySilentLogin(options?: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* This will clear the OAuth2 token.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static logout(): Promise<any> { return; }
|
||||
logout(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* This will clear the OAuth2 token, forget which account was used to login, and disconnect that account from the app. This will require the user to allow the app access again next time they sign in. Be aware that this effect is not always instantaneous. It can take time to completely disconnect.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static disconnect(): Promise<any> { return; }
|
||||
disconnect(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
declare var navigator: any;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface GyroscopeOrientation {
|
||||
/**
|
||||
* Represent x-axis
|
||||
*/
|
||||
x: number;
|
||||
|
||||
/**
|
||||
* Represent y-axis
|
||||
*/
|
||||
y: number;
|
||||
|
||||
/**
|
||||
* Represent z-axis
|
||||
*/
|
||||
z: number;
|
||||
|
||||
/**
|
||||
* Represent timestamp of sensor read. Default is 10000ms
|
||||
*/
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface GyroscopeOptions {
|
||||
/**
|
||||
* Represent how often (in milliseconds) sensor should be read. Default is 10000 ms
|
||||
*/
|
||||
frequency: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Gyroscope
|
||||
* @description Read Gyroscope sensor data
|
||||
* @usage
|
||||
* ```
|
||||
* import { Gyroscope, GyroscopeOrientation, GyroscopeOptions } from '@ionic-native/gyroscope';
|
||||
*
|
||||
*
|
||||
* constructor(private gyroscope: Gyroscope) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* let options: GyroscopeOptions = {
|
||||
* frequency: 1000
|
||||
* };
|
||||
*
|
||||
* this.gyroscope.getCurrent(options)
|
||||
* .then((orientation: GyroscopeOrientation) => {
|
||||
* console.log(orientation.x, orientation.y, orientation.z, orientation.timestamp);
|
||||
* })
|
||||
* .catch()
|
||||
*
|
||||
*
|
||||
* this.gyroscope.watch()
|
||||
* .subscribe((orientation: GyroscopeOrientation) => {
|
||||
* console.log(orientation.x, orientation.y, orientation.z, orientation.timestamp);
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* GyroscopeOrientation
|
||||
* GyroscopeOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Gyroscope',
|
||||
plugin: 'cordova-plugin-gyroscope',
|
||||
pluginRef: 'navigator.gyroscope',
|
||||
repo: 'https://github.com/NeoLSN/cordova-plugin-gyroscope',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Gyroscope {
|
||||
|
||||
/**
|
||||
* Watching for gyroscope sensor changes
|
||||
* @param options {GyroscopeOptions} (optional)
|
||||
* @return {Observable<GyroscopeOrientation>} Returns an Observable that resolves GyroscopeOrientation
|
||||
*/
|
||||
watch(options?: GyroscopeOptions): Observable<GyroscopeOrientation> {
|
||||
return new Observable<GyroscopeOrientation> (
|
||||
(observer: any) => {
|
||||
let watchId = navigator.gyroscope.watch(observer.next.bind(observer), observer.next.bind(observer), options);
|
||||
return () => navigator.gyroscope.clearWatch(watchId);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current data from gyroscope sensor
|
||||
* @param options {GyroscopeOptions} (optional)
|
||||
* @return {Promise<GyroscopeOrientation>} Returns a promise that resolves GyroscopeOrientation
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
getCurrent(options?: GyroscopeOptions): Promise<GyroscopeOrientation> { return; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name HeaderColor
|
||||
@@ -7,7 +8,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { HeaderColor } from 'ionic-native';
|
||||
* import { HeaderColor } from '@ionic-native/header-color';
|
||||
*
|
||||
* HeaderColor.tint("#becb29");
|
||||
* ```
|
||||
@@ -19,6 +20,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
repo: 'https://github.com/tomloprod/cordova-plugin-headercolor',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class HeaderColor {
|
||||
|
||||
/**
|
||||
@@ -31,6 +33,6 @@ export class HeaderColor {
|
||||
successName: 'success',
|
||||
errorName: 'failure'
|
||||
})
|
||||
static tint(color: string): Promise<any> { return; }
|
||||
tint(color: string): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface HealthQueryOptions {
|
||||
/**
|
||||
* Start date from which to get data
|
||||
*/
|
||||
startDate: Date;
|
||||
|
||||
/**
|
||||
* End date from which to get data
|
||||
*/
|
||||
endDate: Date;
|
||||
|
||||
/**
|
||||
* Datatype to be queried (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
|
||||
*/
|
||||
dataType: string;
|
||||
|
||||
/**
|
||||
* Optional limit the number of values returned. Defaults to 1000
|
||||
*/
|
||||
limit?: number;
|
||||
|
||||
/**
|
||||
* Optional indicator to sort values ascending or descending
|
||||
*/
|
||||
ascending?: boolean;
|
||||
|
||||
/**
|
||||
* In Android, it is possible to query for "raw" steps or to select those as filtered by the Google Fit app.
|
||||
* In the latter case the query object must contain the field filtered: true.
|
||||
*/
|
||||
filtered?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface HealthQueryOptionsAggregated {
|
||||
/**
|
||||
* Start date from which to get data
|
||||
*/
|
||||
startDate: Date;
|
||||
|
||||
/**
|
||||
* End date from which to get data
|
||||
*/
|
||||
endDate: Date;
|
||||
|
||||
/**
|
||||
* Datatype to be queried (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
|
||||
*/
|
||||
dataType: string;
|
||||
|
||||
/**
|
||||
* if specified, aggregation is grouped an array of "buckets" (windows of time),
|
||||
* supported values are: 'hour', 'day', 'week', 'month', 'year'.
|
||||
*/
|
||||
bucket: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface HealthStoreOptions {
|
||||
/**
|
||||
* Start date from which to get data
|
||||
*/
|
||||
startDate: Date;
|
||||
|
||||
/**
|
||||
* End date from which to get data
|
||||
*/
|
||||
endDate: Date;
|
||||
|
||||
/**
|
||||
* Datatype to be queried (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
|
||||
*/
|
||||
dataType: string;
|
||||
|
||||
/**
|
||||
* Value of corresponding Datatype (see "Overview of valid datatypes")
|
||||
*/
|
||||
value: string;
|
||||
|
||||
/*
|
||||
* The source that produced this data. In iOS this is ignored and
|
||||
* set automatically to the name of your app.
|
||||
*/
|
||||
sourceName: string;
|
||||
|
||||
/*
|
||||
* The complete package of the source that produced this data.
|
||||
* In Android, if not specified, it's assigned to the package of the App. In iOS this is ignored and
|
||||
* set automatically to the bunde id of the app.
|
||||
*/
|
||||
sourceBundleId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface HealthData {
|
||||
/**
|
||||
* Start date from which to get data
|
||||
*/
|
||||
startDate: Date;
|
||||
|
||||
/**
|
||||
* End date from which to get data
|
||||
*/
|
||||
endDate: Date;
|
||||
|
||||
/**
|
||||
* Value of corresponding Datatype (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
|
||||
*/
|
||||
value: string;
|
||||
|
||||
/**
|
||||
* Unit of corresponding value of Datatype (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
|
||||
*/
|
||||
unit: string;
|
||||
|
||||
/**
|
||||
* The source that produced this data. In iOS this is ignored and
|
||||
* set automatically to the name of your app.
|
||||
*/
|
||||
sourceName: string;
|
||||
|
||||
/**
|
||||
* The complete package of the source that produced this data.
|
||||
* In Android, if not specified, it's assigned to the package of the App. In iOS this is ignored and
|
||||
* set automatically to the bunde id of the app.
|
||||
*/
|
||||
sourceBundleId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Health
|
||||
* @description
|
||||
* A plugin that abstracts fitness and health repositories like Apple HealthKit or Google Fit.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Health } from '@ionic-native/health';
|
||||
*
|
||||
*
|
||||
* constructor(private health: Health) { }
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* See description at https://github.com/dariosalvi78/cordova-plugin-health for a full list of Datatypes and see examples.
|
||||
*
|
||||
* @interfaces
|
||||
* HealthQueryOptions
|
||||
* HealthQueryOptionsAggregated
|
||||
* HealthStoreOptions
|
||||
* HealthData
|
||||
*/
|
||||
@Injectable()
|
||||
@Plugin({
|
||||
pluginName: 'Health',
|
||||
plugin: 'cordova-plugin-health',
|
||||
pluginRef: 'navigator.health',
|
||||
repo: 'https://github.com/dariosalvi78/cordova-plugin-health'
|
||||
})
|
||||
export class Health {
|
||||
|
||||
/**
|
||||
* Tells if either Google Fit or HealthKit are available.
|
||||
*
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
isAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if recent Google Play Services and Google Fit are installed. If the play services are not installed,
|
||||
* or are obsolete, it will show a pop-up suggesting to download them. If Google Fit is not installed,
|
||||
* it will open the Play Store at the location of the Google Fit app.
|
||||
* The plugin does not wait until the missing packages are installed, it will return immediately.
|
||||
* If both Play Services and Google Fit are available, this function just returns without any visible effect.
|
||||
*
|
||||
* This function is only available on Android.
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
promptInstallFit(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests read and write access to a set of data types. It is recommendable to always explain why the app
|
||||
* needs access to the data before asking the user to authorize it.
|
||||
* This function must be called before using the query and store functions, even if the authorization has already
|
||||
* been given at some point in the past.
|
||||
*
|
||||
* Quirks of requestAuthorization()
|
||||
|
||||
* In Android, it will try to get authorization from the Google Fit APIs.
|
||||
* It is necessary that the app's package name and the signing key are registered in the Google API console.
|
||||
* In Android, be aware that if the activity is destroyed (e.g. after a rotation) or is put in background,
|
||||
* the connection to Google Fit may be lost without any callback. Going through the authorization will ensure that
|
||||
* the app is connected again.
|
||||
* In Android 6 and over, this function will also ask for some dynamic permissions if needed
|
||||
* (e.g. in the case of "distance", it will need access to ACCESS_FINE_LOCATION).
|
||||
*
|
||||
* @param {Array<String>} datatypes a list of data types you want to be granted access to
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
requestAuthorization(datatypes: Array<string>): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Check if the app has authorization to read/write a set of datatypes.
|
||||
* This function is similar to requestAuthorization() and has similar quirks.
|
||||
*
|
||||
* @param {Array<String>} datatypes a list of data types you want to be granted access to
|
||||
* @return {Promise<boolean>} Returns a promise that resolves with a boolean that indicates the authorization status
|
||||
*/
|
||||
@Cordova()
|
||||
isAuthorized(datatypes: Array<string>): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Gets all the data points of a certain data type within a certain time window.
|
||||
* Warning: if the time span is big, it can generate long arrays!
|
||||
*
|
||||
* Quirks of query()
|
||||
*
|
||||
* In iOS, the amount of datapoints is limited to 1000 by default.
|
||||
* You can override this by adding a limit: xxx to your query object.
|
||||
* In iOS, datapoints are ordered in an descending fashion (from newer to older).
|
||||
* You can revert this behaviour by adding ascending: true to your query object.
|
||||
* In Android, it is possible to query for "raw" steps or to select those as filtered by the Google Fit app.
|
||||
* In the latter case the query object must contain the field filtered: true.
|
||||
* In Google Fit, calories.basal is returned as an average per day, and usually is not available in all days.
|
||||
* In Google Fit, calories.active is computed by subtracting the basal calories from the total.
|
||||
* As basal energy expenditure, an average is computed from the week before endDate.
|
||||
* While Google Fit calculates basal and active calories automatically,
|
||||
* HealthKit needs an explicit input from some app.
|
||||
* When querying for activities, Google Fit is able to determine some activities automatically
|
||||
* (still, walking, running, biking, in vehicle), while HealthKit only relies on the input of
|
||||
* the user or of some external app.
|
||||
* When querying for activities, calories and distance are also provided in HealthKit (units are kcal and meters) and
|
||||
* never in Google Fit.
|
||||
* When querying for nutrition, Google Fit always returns all the nutrition elements it has,
|
||||
* while HealthKit returns only those that are stored as correlation. To be sure to get all stored the quantities
|
||||
* (regardless of they are stored as correlation or not), it's better to query single nutrients.
|
||||
* nutrition.vitamin_a is given in micrograms in HealthKit and International Unit in Google Fit.
|
||||
* Automatic conversion is not trivial and depends on the actual substance.
|
||||
*
|
||||
* @param queryOptions {HealthQueryOptions}
|
||||
* @return {Promise<HealthData>}
|
||||
*/
|
||||
@Cordova()
|
||||
query(queryOptions: HealthQueryOptions): Promise<HealthData> { return; }
|
||||
|
||||
/**
|
||||
* Gets aggregated data in a certain time window. Usually the sum is returned for the given quantity.
|
||||
*
|
||||
* Quirks of queryAggregated()
|
||||
* In Android, to query for steps as filtered by the Google Fit app, the flag filtered:
|
||||
* true must be added into the query object.
|
||||
* When querying for activities, calories and distance are provided
|
||||
* when available in HealthKit and never in Google Fit.
|
||||
* In Android, the start and end dates returned are the date of the first and the last available samples.
|
||||
* If no samples are found, start and end may not be set.
|
||||
* When bucketing, buckets will include the whole hour / day / month / week / year where start and end times
|
||||
* fall into. For example, if your start time is 2016-10-21 10:53:34,
|
||||
* the first daily bucket will start at 2016-10-21 00:00:00.
|
||||
* Weeks start on Monday.
|
||||
* When querying for nutrition, HealthKit returns only those that are stored as correlation.
|
||||
* To be sure to get all the stored quantities, it's better to query single nutrients.
|
||||
* nutrition.vitamin_a is given in micrograms in HealthKit and International Unit in Google Fit.
|
||||
*
|
||||
* @param queryOptionsAggregated
|
||||
* @return {Promise<HealthData>}
|
||||
*/
|
||||
@Cordova()
|
||||
queryAggregated(queryOptionsAggregated: HealthQueryOptionsAggregated): Promise<HealthData> { return; }
|
||||
|
||||
/**
|
||||
* Stores a data point.
|
||||
*
|
||||
* Quirks of store()
|
||||
*
|
||||
* Google Fit doesn't allow you to overwrite data points that overlap with others already stored of the same type (see here). At the moment there is no support for update nor delete.
|
||||
* In iOS you cannot store the total calories, you need to specify either basal or active. If you use total calories, the active ones will be stored.
|
||||
* In Android you can only store active calories, as the basal are estimated automatically. If you store total calories, these will be treated as active.
|
||||
* In iOS distance is assumed to be of type WalkingRunning, if you want to explicitly set it to Cycling you need to add the field cycling: true.
|
||||
* In iOS storing the sleep activities is not supported at the moment.
|
||||
* Storing of nutrients is not supported at the moment.
|
||||
* @param storeOptions
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
store(storeOptions: HealthStoreOptions): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface HotspotConnectionInfo {
|
||||
|
||||
@@ -108,7 +109,7 @@ export interface HotspotDevice {
|
||||
* @description
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Hotspot, Network } from 'ionic-native';
|
||||
* import { Hotspot, Network } from '@ionic-native/hotspot';
|
||||
*
|
||||
*
|
||||
* Hotspot.scanWifi().then((networks: Array<Network>) => {
|
||||
@@ -129,19 +130,20 @@ export interface HotspotDevice {
|
||||
repo: 'https://github.com/hypery2k/cordova-hotspot-plugin',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class Hotspot {
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<boolean> { return; }
|
||||
isAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static toggleWifi(): Promise<boolean> { return; }
|
||||
toggleWifi(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Configures and starts hotspot with SSID and Password
|
||||
@@ -153,7 +155,7 @@ export class Hotspot {
|
||||
* @returns {Promise<void>} - Promise to call once hotspot is started, or reject upon failure
|
||||
*/
|
||||
@Cordova()
|
||||
static createHotspot(ssid: string, mode: string, password: string): Promise<void> { return; }
|
||||
createHotspot(ssid: string, mode: string, password: string): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Turns on Access Point
|
||||
@@ -161,7 +163,7 @@ export class Hotspot {
|
||||
* @returns {Promise<boolean>} - true if AP is started
|
||||
*/
|
||||
@Cordova()
|
||||
static startHotspot(): Promise<boolean> { return; }
|
||||
startHotspot(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Configures hotspot with SSID and Password
|
||||
@@ -173,7 +175,7 @@ export class Hotspot {
|
||||
* @returns {Promise<void>} - Promise to call when hotspot is configured, or reject upon failure
|
||||
*/
|
||||
@Cordova()
|
||||
static configureHotspot(ssid: string, mode: string, password: string): Promise<void> { return; }
|
||||
configureHotspot(ssid: string, mode: string, password: string): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Turns off Access Point
|
||||
@@ -181,7 +183,7 @@ export class Hotspot {
|
||||
* @returns {Promise<boolean>} - Promise to turn off the hotspot, true on success, false on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static stopHotspot(): Promise<boolean> { return; }
|
||||
stopHotspot(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if hotspot is enabled
|
||||
@@ -189,13 +191,13 @@ export class Hotspot {
|
||||
* @returns {Promise<void>} - Promise that hotspot is enabled, rejected if it is not enabled
|
||||
*/
|
||||
@Cordova()
|
||||
static isHotspotEnabled(): Promise<void> { return; }
|
||||
isHotspotEnabled(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<Array<HotspotDevice>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getAllHotspotDevices(): Promise<Array<HotspotDevice>> { return; }
|
||||
getAllHotspotDevices(): Promise<Array<HotspotDevice>> { return; }
|
||||
|
||||
/**
|
||||
* Connect to a WiFi network
|
||||
@@ -209,7 +211,7 @@ export class Hotspot {
|
||||
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
|
||||
*/
|
||||
@Cordova()
|
||||
static connectToWifi(ssid: string, password: string): Promise<void> { return; }
|
||||
connectToWifi(ssid: string, password: string): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Connect to a WiFi network
|
||||
@@ -227,7 +229,7 @@ export class Hotspot {
|
||||
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
|
||||
*/
|
||||
@Cordova()
|
||||
static connectToWifiAuthEncrypt(ssid: string, password: string, authentication: string, encryption: Array<string>): Promise<void> { return; }
|
||||
connectToWifiAuthEncrypt(ssid: string, password: string, authentication: string, encryption: Array<string>): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Add a WiFi network
|
||||
@@ -243,7 +245,7 @@ export class Hotspot {
|
||||
* Promise that adding the WiFi network was successfull, rejected if unsuccessful
|
||||
*/
|
||||
@Cordova()
|
||||
static addWifiNetwork(ssid: string, mode: string, password: string): Promise<void> { return; }
|
||||
addWifiNetwork(ssid: string, mode: string, password: string): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Remove a WiFi network
|
||||
@@ -255,79 +257,79 @@ export class Hotspot {
|
||||
* Promise that removing the WiFi network was successfull, rejected if unsuccessful
|
||||
*/
|
||||
@Cordova()
|
||||
static removeWifiNetwork(ssid: string): Promise<void> { return; }
|
||||
removeWifiNetwork(ssid: string): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isConnectedToInternet(): Promise<boolean> { return; }
|
||||
isConnectedToInternet(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isConnectedToInternetViaWifi(): Promise<boolean> { return; }
|
||||
isConnectedToInternetViaWifi(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isWifiOn(): Promise<boolean> { return; }
|
||||
isWifiOn(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isWifiSupported(): Promise<boolean> { return; }
|
||||
isWifiSupported(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isWifiDirectSupported(): Promise<boolean> { return; }
|
||||
isWifiDirectSupported(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<Array<HotspotNetwork>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static scanWifi(): Promise<Array<HotspotNetwork>> { return; }
|
||||
scanWifi(): Promise<Array<HotspotNetwork>> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<Array<HotspotNetwork>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static scanWifiByLevel(): Promise<Array<HotspotNetwork>> { return; }
|
||||
scanWifiByLevel(): Promise<Array<HotspotNetwork>> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static startWifiPeriodicallyScan(interval: number, duration: number): Promise<any> { return; }
|
||||
startWifiPeriodicallyScan(interval: number, duration: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopWifiPeriodicallyScan(): Promise<any> { return; }
|
||||
stopWifiPeriodicallyScan(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<HotspotNetworkConfig>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getNetConfig(): Promise<HotspotNetworkConfig> { return; }
|
||||
getNetConfig(): Promise<HotspotNetworkConfig> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<HotspotConnectionInfo>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getConnectionInfo(): Promise<HotspotConnectionInfo> { return; }
|
||||
getConnectionInfo(): Promise<HotspotConnectionInfo> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
static pingHost(ip: string): Promise<string> { return; }
|
||||
pingHost(ip: string): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* Gets MAC Address associated with IP Address from ARP File
|
||||
@@ -337,7 +339,7 @@ export class Hotspot {
|
||||
* @returns {Promise<string>} - A Promise for the MAC Address
|
||||
*/
|
||||
@Cordova()
|
||||
static getMacAddressOfHost(ip: string): Promise<string> { return; }
|
||||
getMacAddressOfHost(ip: string): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* Checks if IP is live using DNS
|
||||
@@ -347,7 +349,7 @@ export class Hotspot {
|
||||
* @returns {Promise<boolean>} - A Promise for whether the IP Address is reachable
|
||||
*/
|
||||
@Cordova()
|
||||
static isDnsLive(ip: string): Promise<boolean> { return; }
|
||||
isDnsLive(ip: string): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if IP is live using socket And PORT
|
||||
@@ -357,7 +359,7 @@ export class Hotspot {
|
||||
* @returns {Promise<boolean>} - A Promise for whether the IP Address is reachable
|
||||
*/
|
||||
@Cordova()
|
||||
static isPortLive(ip: string): Promise<boolean> { return; }
|
||||
isPortLive(ip: string): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if device is rooted
|
||||
@@ -365,6 +367,6 @@ export class Hotspot {
|
||||
* @returns {Promise<boolean>} - A Promise for whether the device is rooted
|
||||
*/
|
||||
@Cordova()
|
||||
static isRooted(): Promise<boolean> { return; }
|
||||
isRooted(): Promise<boolean> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
|
||||
export interface HTTPResponse {
|
||||
/**
|
||||
@@ -30,7 +31,7 @@ export interface HTTPResponse {
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { HTTP } from 'ionic-native';
|
||||
* import { HTTP } from '@ionic-native/http';
|
||||
*
|
||||
* HTTP.get('http://ionic.io', {}, {})
|
||||
* .then(data => {
|
||||
@@ -59,6 +60,7 @@ export interface HTTPResponse {
|
||||
repo: 'https://github.com/wymsee/cordova-HTTP',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class HTTP {
|
||||
|
||||
/**
|
||||
@@ -68,7 +70,7 @@ export class HTTP {
|
||||
* @returns {Object} an object representing a basic HTTP Authorization header of the form {'Authorization': 'Basic base64encodedusernameandpassword'}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static getBasicAuthHeader(username: string, password: string): { Authorization: string; } { return; }
|
||||
getBasicAuthHeader(username: string, password: string): { Authorization: string; } { return; }
|
||||
|
||||
/**
|
||||
* This sets up all future requests to use Basic HTTP authentication with the given username and password.
|
||||
@@ -76,7 +78,7 @@ export class HTTP {
|
||||
* @param password {string} Password
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static useBasicAuth(username: string, password: string): void { }
|
||||
useBasicAuth(username: string, password: string): void { }
|
||||
|
||||
/**
|
||||
* Set a header for all future requests. Takes a header and a value.
|
||||
@@ -84,7 +86,7 @@ export class HTTP {
|
||||
* @param value {string} The value of the header
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static setHeader(header: string, value: string): void { }
|
||||
setHeader(header: string, value: string): void { }
|
||||
|
||||
/**
|
||||
* Enable or disable SSL Pinning. This defaults to false.
|
||||
@@ -96,7 +98,7 @@ export class HTTP {
|
||||
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static enableSSLPinning(enable: boolean): Promise<void> { return; }
|
||||
enableSSLPinning(enable: boolean): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Accept all SSL certificates. Or disabled accepting all certificates. Defaults to false.
|
||||
@@ -104,7 +106,7 @@ export class HTTP {
|
||||
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static acceptAllCerts(accept: boolean): Promise<void> { return; }
|
||||
acceptAllCerts(accept: boolean): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Whether or not to validate the domain name in the certificate. This defaults to true.
|
||||
@@ -112,7 +114,7 @@ export class HTTP {
|
||||
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static validateDomainName(validate: boolean): Promise<void> { return; }
|
||||
validateDomainName(validate: boolean): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Make a POST request
|
||||
@@ -122,7 +124,7 @@ export class HTTP {
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static post(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
post(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -132,7 +134,7 @@ export class HTTP {
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static get(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
get(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -144,7 +146,7 @@ export class HTTP {
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static uploadFile(url: string, body: any, headers: any, filePath: string, name: string): Promise<HTTPResponse> { return; }
|
||||
uploadFile(url: string, body: any, headers: any, filePath: string, name: string): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -155,5 +157,5 @@ export class HTTP {
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static downloadFile(url: string, body: any, headers: any, filePath: string): Promise<HTTPResponse> { return; }
|
||||
downloadFile(url: string, body: any, headers: any, filePath: string): Promise<HTTPResponse> { return; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export interface HttpdOptions {
|
||||
@@ -25,7 +26,7 @@ export interface HttpdOptions {
|
||||
* Embedded httpd for Cordova apps. Light weight HTTP server.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {Httpd, HttpdOptions} from 'ionic-native';
|
||||
* import {Httpd, HttpdOptions} from '@ionic-native/httpd';
|
||||
*
|
||||
* let options: HttpdOptions = {
|
||||
* www_root: 'httpd_root', // relative path to app's www directory
|
||||
@@ -48,6 +49,7 @@ export interface HttpdOptions {
|
||||
repo: 'https://github.com/floatinghotpot/cordova-httpd',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class Httpd {
|
||||
|
||||
/**
|
||||
@@ -59,21 +61,20 @@ export class Httpd {
|
||||
observable: true,
|
||||
clearFunction: 'stopServer'
|
||||
})
|
||||
static startServer(options?: HttpdOptions): Observable<string> { return; }
|
||||
startServer(options?: HttpdOptions): Observable<string> { return; }
|
||||
|
||||
/**
|
||||
* Gets the URL of the running server
|
||||
* @returns {Promise<string>} Returns a promise that resolves with the URL of the web server.
|
||||
*/
|
||||
@Cordova()
|
||||
static getUrl(): Promise<string> { return; }
|
||||
getUrl(): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* Get the local path of the running webserver
|
||||
* @returns {Promise<string>} Returns a promise that resolves with the local path of the web server.
|
||||
*/
|
||||
@Cordova()
|
||||
static getLocalPath(): Promise<string> { return; }
|
||||
getLocalPath(): Promise<string> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var cordova: any;
|
||||
@@ -231,7 +232,7 @@ export interface IBeaconDelegate {
|
||||
* @usage
|
||||
*
|
||||
* ```typescript
|
||||
* import { IBeacon } from 'ionic-native';
|
||||
* import { IBeacon } from '@ionic-native/ibeacon';
|
||||
*
|
||||
*
|
||||
* // Request permission to use location on iOS
|
||||
@@ -280,6 +281,7 @@ export interface IBeaconDelegate {
|
||||
repo: 'https://github.com/petermetz/cordova-plugin-ibeacon',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class IBeacon {
|
||||
|
||||
/**
|
||||
@@ -288,7 +290,7 @@ export class IBeacon {
|
||||
*
|
||||
* @returns {IBeaconDelegate} An instance of the type {@type Delegate}.
|
||||
*/
|
||||
static Delegate(): IBeaconDelegate {
|
||||
Delegate(): IBeaconDelegate {
|
||||
let delegate = new cordova.plugins.locationManager.Delegate();
|
||||
|
||||
delegate.didChangeAuthorizationStatus = (pluginResult?: IBeaconPluginResult) => {
|
||||
@@ -388,7 +390,7 @@ export class IBeacon {
|
||||
*
|
||||
* @returns {BeaconRegion} Returns the BeaconRegion that was created
|
||||
*/
|
||||
static BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
|
||||
BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
|
||||
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
|
||||
}
|
||||
|
||||
@@ -396,7 +398,7 @@ export class IBeacon {
|
||||
* @returns {IBeaconDelegate} Returns the IBeaconDelegate
|
||||
*/
|
||||
@Cordova()
|
||||
static getDelegate(): IBeaconDelegate { return; }
|
||||
getDelegate(): IBeaconDelegate { return; }
|
||||
|
||||
/**
|
||||
* @param {IBeaconDelegate} delegate An instance of a delegate to register with the native layer.
|
||||
@@ -404,7 +406,7 @@ export class IBeacon {
|
||||
* @returns {IBeaconDelegate} Returns the IBeaconDelegate
|
||||
*/
|
||||
@Cordova()
|
||||
static setDelegate(delegate: IBeaconDelegate): IBeaconDelegate { return; }
|
||||
setDelegate(delegate: IBeaconDelegate): IBeaconDelegate { return; }
|
||||
|
||||
/**
|
||||
* Signals the native layer that the client side is ready to consume messages.
|
||||
@@ -427,7 +429,7 @@ export class IBeacon {
|
||||
* native layer acknowledged the request and started to send events.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static onDomDelegateReady(): Promise<void> { return; }
|
||||
onDomDelegateReady(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Determines if bluetooth is switched on, according to the native layer.
|
||||
@@ -435,7 +437,7 @@ export class IBeacon {
|
||||
* indicating whether bluetooth is active.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static isBluetoothEnabled(): Promise<boolean> { return; }
|
||||
isBluetoothEnabled(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Enables Bluetooth using the native Layer. (ANDROID ONLY)
|
||||
@@ -444,7 +446,7 @@ export class IBeacon {
|
||||
* could be enabled. If not, the promise will be rejected with an error.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static enableBluetooth(): Promise<void> { return; }
|
||||
enableBluetooth(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Disables Bluetooth using the native Layer. (ANDROID ONLY)
|
||||
@@ -453,7 +455,7 @@ export class IBeacon {
|
||||
* could be enabled. If not, the promise will be rejected with an error.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static disableBluetooth(): Promise<void> { return; }
|
||||
disableBluetooth(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Start monitoring the specified region.
|
||||
@@ -473,7 +475,7 @@ export class IBeacon {
|
||||
* native layer acknowledged the dispatch of the monitoring request.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static startMonitoringForRegion(region: BeaconRegion): Promise<string> { return; }
|
||||
startMonitoringForRegion(region: BeaconRegion): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* Stop monitoring the specified region. It is valid to call
|
||||
@@ -490,7 +492,7 @@ export class IBeacon {
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static stopMonitoringForRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
stopMonitoringForRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Request state the for specified region. When result is ready
|
||||
@@ -506,7 +508,7 @@ export class IBeacon {
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static requestStateForRegion(region: Region): Promise<void> { return; }
|
||||
requestStateForRegion(region: Region): Promise<void> { return; }
|
||||
|
||||
|
||||
/**
|
||||
@@ -524,7 +526,7 @@ export class IBeacon {
|
||||
* native layer acknowledged the dispatch of the monitoring request.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static startRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
startRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Stop ranging the specified region. It is valid to call
|
||||
@@ -541,16 +543,16 @@ export class IBeacon {
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static stopRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
stopRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Queries the native layer to determine the current authorization in effect.
|
||||
*
|
||||
* @returns {Promise<any>} Returns a promise which is resolved with the
|
||||
* @returns {Promise<IBeaconPluginResult>} Returns a promise which is resolved with the
|
||||
* requested authorization status.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static getAuthorizationStatus(): Promise<any> { return; }
|
||||
getAuthorizationStatus(): Promise<IBeaconPluginResult> { return; }
|
||||
|
||||
/**
|
||||
* For iOS 8 and above only. The permission model has changed by Apple in iOS 8, making it necessary for apps to
|
||||
@@ -562,17 +564,17 @@ export class IBeacon {
|
||||
* @returns {Promise<void>} Returns a promise that is resolved when the request dialog is shown.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static requestWhenInUseAuthorization(): Promise<void> { return; }
|
||||
requestWhenInUseAuthorization(): Promise<void> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* See the docuemntation of {@code requestWhenInUseAuthorization} for further details.
|
||||
* See the documentation of {@code requestWhenInUseAuthorization} for further details.
|
||||
*
|
||||
* @returns {Promise<void>} Returns a promise which is resolved when the native layer
|
||||
* shows the request dialog.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static requestAlwaysAuthorization(): Promise<void> { return; }
|
||||
requestAlwaysAuthorization(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -580,7 +582,7 @@ export class IBeacon {
|
||||
* of {Region} instances that are being monitored by the native layer.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static getMonitoredRegions(): Promise<Region[]> { return; }
|
||||
getMonitoredRegions(): Promise<Region[]> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -588,7 +590,7 @@ export class IBeacon {
|
||||
* of {Region} instances that are being ranged by the native layer.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static getRangedRegions(): Promise<Region[]> { return; }
|
||||
getRangedRegions(): Promise<Region[]> { return; }
|
||||
|
||||
/**
|
||||
* Determines if ranging is available or not, according to the native layer.
|
||||
@@ -596,7 +598,7 @@ export class IBeacon {
|
||||
* indicating whether ranging is available or not.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static isRangingAvailable(): Promise<boolean> { return; }
|
||||
isRangingAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Determines if region type is supported or not, according to the native layer.
|
||||
@@ -608,7 +610,7 @@ export class IBeacon {
|
||||
* indicating whether the region type is supported or not.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static isMonitoringAvailableForClass(region: Region): Promise<boolean> { return; }
|
||||
isMonitoringAvailableForClass(region: Region): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Start advertising the specified region.
|
||||
@@ -628,7 +630,7 @@ export class IBeacon {
|
||||
* native layer acknowledged the dispatch of the advertising request.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static startAdvertising(region: Region, measuredPower: number): Promise<void> { return; }
|
||||
startAdvertising(region: Region, measuredPower: number): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Stop advertising as a beacon.
|
||||
@@ -639,7 +641,7 @@ export class IBeacon {
|
||||
* native layer acknowledged the dispatch of the request to stop advertising.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static stopAdvertising(region: Region): Promise<void> { return; }
|
||||
stopAdvertising(region: Region): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Determines if advertising is available or not, according to the native layer.
|
||||
@@ -647,7 +649,7 @@ export class IBeacon {
|
||||
* indicating whether advertising is available or not.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static isAdvertisingAvailable(): Promise<boolean> { return; }
|
||||
isAdvertisingAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Determines if advertising is currently active, according to the native layer.
|
||||
@@ -655,7 +657,7 @@ export class IBeacon {
|
||||
* indicating whether advertising is active.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static isAdvertising(): Promise<boolean> { return; }
|
||||
isAdvertising(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Disables debug logging in the native layer. Use this method if you want
|
||||
@@ -665,7 +667,7 @@ export class IBeacon {
|
||||
* native layer has set the logging level accordingly.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static disableDebugLogs(): Promise<void> { return; }
|
||||
disableDebugLogs(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Enables the posting of debug notifications in the native layer. Use this method if you want
|
||||
@@ -676,7 +678,7 @@ export class IBeacon {
|
||||
* native layer has set the flag to enabled.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static enableDebugNotifications(): Promise<void> { return; }
|
||||
enableDebugNotifications(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Disables the posting of debug notifications in the native layer. Use this method if you want
|
||||
@@ -686,7 +688,7 @@ export class IBeacon {
|
||||
* native layer has set the flag to disabled.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static disableDebugNotifications(): Promise<void> { return; }
|
||||
disableDebugNotifications(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Enables debug logging in the native layer. Use this method if you want
|
||||
@@ -696,7 +698,7 @@ export class IBeacon {
|
||||
* native layer has set the logging level accordingly.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static enableDebugLogs(): Promise<void> { return; }
|
||||
enableDebugLogs(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Appends the provided [message] to the device logs.
|
||||
@@ -709,6 +711,6 @@ export class IBeacon {
|
||||
* is expected to be equivalent to the one provided in the original call.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static appendToDeviceLog(message: string): Promise<void> { return; }
|
||||
appendToDeviceLog(message: string): Promise<void> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
export interface ImagePickerOptions {
|
||||
@@ -20,6 +21,11 @@ export interface ImagePickerOptions {
|
||||
* Quality of images, defaults to 100
|
||||
*/
|
||||
quality?: number;
|
||||
|
||||
/**
|
||||
* Output type, defaults to 0 (FILE_URI).
|
||||
*/
|
||||
outputType?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +38,7 @@ export interface ImagePickerOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { ImagePicker } from 'ionic-native';
|
||||
* import { ImagePicker } from '@ionic-native/image-picker';
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -51,6 +57,7 @@ export interface ImagePickerOptions {
|
||||
pluginRef: 'window.imagePicker',
|
||||
repo: 'https://github.com/Telerik-Verified-Plugins/ImagePicker'
|
||||
})
|
||||
@Injectable()
|
||||
export class ImagePicker {
|
||||
/**
|
||||
* Pick pictures from the library.
|
||||
@@ -61,7 +68,7 @@ export class ImagePicker {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getPictures(options: ImagePickerOptions): Promise<any> { return; }
|
||||
getPictures(options: ImagePickerOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Check if we have permission to read images
|
||||
@@ -70,7 +77,7 @@ export class ImagePicker {
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static hasReadPermission(): Promise<boolean> { return; }
|
||||
hasReadPermission(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Request permission to read images
|
||||
@@ -79,6 +86,6 @@ export class ImagePicker {
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static requestReadPermission(): Promise<any> { return; }
|
||||
requestReadPermission(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface ImageResizerOptions {
|
||||
/**
|
||||
@@ -48,7 +49,7 @@ export interface ImageResizerOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { ImageResizer, ImageResizerOptions } from 'ionic-native';
|
||||
* import { ImageResizer, ImageResizerOptions } from '@ionic-native/image-resizer';
|
||||
*
|
||||
* let options = {
|
||||
* uri: uri,
|
||||
@@ -74,10 +75,11 @@ export interface ImageResizerOptions {
|
||||
pluginRef: 'ImageResizer',
|
||||
repo: 'https://github.com/protonet/cordova-plugin-image-resizer'
|
||||
})
|
||||
@Injectable()
|
||||
export class ImageResizer {
|
||||
/**
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static resize(options: ImageResizerOptions): Promise<any> { return; }
|
||||
resize(options: ImageResizerOptions): Promise<any> { return; }
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, CordovaInstance } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/fromEvent';
|
||||
|
||||
declare var cordova: any;
|
||||
|
||||
export interface InAppBrowserOptions {
|
||||
/** Set to yes or no to ruen the InAppBrowser's location bar on or off. */
|
||||
location?: 'yes' | 'no';
|
||||
/** Set to yes to create the browser and load the page, but not show it. The loadstop event fires when loading is complete.
|
||||
* Omit or set to no (default) to have the browser open and load normally. */
|
||||
hidden?: 'yes' | 'no';
|
||||
/** Set to yes to have the browser's cookie cache cleared before the new window is opened. */
|
||||
clearcache?: 'yes';
|
||||
/** Set to yes to have the session cookie cache cleared before the new window is opened. */
|
||||
clearsessioncache?: 'yes';
|
||||
/** (Android Only) set to yes to show Android browser's zoom controls, set to no to hide them. Default value is yes. */
|
||||
zoom?: 'yes' | 'no';
|
||||
/** Set to yes to use the hardware back button to navigate backwards through the InAppBrowser's history.
|
||||
* If there is no previous page, the InAppBrowser will close. The default value is yes, so you must set it to no if you want the back button to simply close the InAppBrowser. */
|
||||
hardwareback?: 'yes' | 'no';
|
||||
/** Set to yes to prevent HTML5 audio or video from autoplaying (defaults to no). */
|
||||
mediaPlaybackRequiresUserAction?: 'yes' | 'no';
|
||||
/** (Android Only) Set to yes to make InAppBrowser WebView to pause/resume with the app to stop background audio (this may be required to avoid Google Play issues) */
|
||||
shouldPauseOnSuspend?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to a string to use as the Done button's caption. Note that you need to localize this value yourself. */
|
||||
closebuttoncaption?: string;
|
||||
/** (iOS Only) Set to yes or no (default is no). Turns on/off the UIWebViewBounce property. */
|
||||
disallowoverscroll?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to turn the toolbar on or off for the InAppBrowser (defaults to yes) */
|
||||
toolbar?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to prevent viewport scaling through a meta tag (defaults to no). */
|
||||
enableViewportScale?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface.
|
||||
* The HTML's video element must also include the webkit-playsinline attribute (defaults to no) */
|
||||
allowInlineMediaPlayback?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to open the keyboard when form elements receive focus via JavaScript's focus() call (defaults to yes). */
|
||||
keyboardDisplayRequiresUserAction?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to wait until all new view content is received before being rendered (defaults to no). */
|
||||
suppressesIncrementalRendering?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to pagesheet, formsheet or fullscreen to set the presentation style (defaults to fullscreen). */
|
||||
presentationstyle?: 'pagesheet' | 'formsheet' | 'fullscreen';
|
||||
/** (iOS Only) Set to fliphorizontal, crossdissolve or coververtical to set the transition style (defaults to coververtical). */
|
||||
transitionstyle?: 'fliphorizontal' | 'crossdissolve' | 'coververtical';
|
||||
/** (iOS Only) Set to top or bottom (default is bottom). Causes the toolbar to be at the top or bottom of the window. */
|
||||
toolbarposition?: 'top' | 'bottom';
|
||||
/** (Windows only) Set to yes to create the browser control without a border around it.
|
||||
* Please note that if location=no is also specified, there will be no control presented to user to close IAB window. */
|
||||
fullscreen?: 'yes';
|
||||
}
|
||||
export interface InAppBrowserEvent extends Event {
|
||||
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
|
||||
type: string;
|
||||
/** the URL that was loaded. */
|
||||
url: string;
|
||||
/** the error code, only in the case of loaderror. */
|
||||
code: number;
|
||||
/** the error message, only in the case of loaderror. */
|
||||
message: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class InAppBrowserObject {
|
||||
|
||||
private _objectInstance: any;
|
||||
|
||||
/**
|
||||
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
|
||||
* @param url The URL to load.
|
||||
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
|
||||
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
|
||||
* The options string must not contain any blank space, and each feature's
|
||||
* name/value pairs must be separated by a comma. Feature names are case insensitive.
|
||||
*/
|
||||
constructor(url: string, target?: string, options?: string | InAppBrowserOptions) {
|
||||
try {
|
||||
if (options && typeof options !== 'string')
|
||||
options = Object.keys(options).map(key => `${key}=${options[key]}`).join(',');
|
||||
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
|
||||
} catch (e) {
|
||||
window.open(url);
|
||||
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
|
||||
* if the InAppBrowser was already visible.
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
show(): void { }
|
||||
|
||||
/**
|
||||
* Closes the InAppBrowser window.
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
close(): void { }
|
||||
|
||||
/**
|
||||
* Hides an InAppBrowser window that is currently shown. Calling this has no effect
|
||||
* if the InAppBrowser was already hidden.
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
hide(): void { }
|
||||
|
||||
/**
|
||||
* Injects JavaScript code into the InAppBrowser window.
|
||||
* @param script {Object} Details of the script to run, specifying either a file or code key.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
executeScript(script: { file?: string, code?: string }): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Injects CSS into the InAppBrowser window.
|
||||
* @param css {Object} Details of the script to run, specifying either a file or code key.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
insertCSS(css: { file?: string, code?: string }): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* A method that allows you to listen to events happening in the browser.
|
||||
* @param event {string} Name of the event
|
||||
* @returns {Observable<InAppBrowserEvent>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
|
||||
*/
|
||||
on(event: string): Observable<InAppBrowserEvent> {
|
||||
return Observable.fromEvent(this._objectInstance, event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name InAppBrowser
|
||||
* @description Launches in app Browser
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {InAppBrowser} from '@ionic-native/in-app-browser';
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* let browser = new InAppBrowser('https://ionic.io', '_system');
|
||||
* browser.executeScript(...);
|
||||
* browser.insertCSS(...);
|
||||
* browser.close();
|
||||
* ```
|
||||
* @classes
|
||||
* InAppBrowserObject
|
||||
* @interfaces
|
||||
* InAppBrowserEvent
|
||||
* InAppBrowserOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'InAppBrowser',
|
||||
plugin: 'cordova-plugin-inappbrowser',
|
||||
pluginRef: 'cordova.InAppBrowser',
|
||||
repo: 'https://github.com/apache/cordova-plugin-inappbrowser'
|
||||
})
|
||||
@Injectable()
|
||||
export class InAppBrowser {
|
||||
|
||||
/**
|
||||
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
|
||||
* @param url {string} The URL to load.
|
||||
* @param target {string} The target in which to load the URL, an optional parameter that defaults to _self.
|
||||
* @param options {string} Options for the InAppBrowser. Optional, defaulting to: location=yes.
|
||||
* The options string must not contain any blank space, and each feature's
|
||||
* name/value pairs must be separated by a comma. Feature names are case insensitive.
|
||||
* @returns {InAppBrowserObject}
|
||||
*/
|
||||
create(url: string, target?: string, options?: string | InAppBrowserOptions): InAppBrowserObject {
|
||||
return new InAppBrowserObject(url, target, options);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
|
||||
|
||||
/**
|
||||
@@ -8,7 +9,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {InAppPurchase} from 'ionic-native';
|
||||
* import {InAppPurchase} from '@ionic-native/in-app-purchase';
|
||||
*
|
||||
* InAppPurchase
|
||||
* .getProducts(['com.yourapp.prod1', 'com.yourapp.prod2', ...])
|
||||
@@ -57,6 +58,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
platforms: ['Android', 'iOS'],
|
||||
repo: 'https://github.com/AlexDisler/cordova-plugin-inapppurchase'
|
||||
})
|
||||
@Injectable()
|
||||
export class InAppPurchase {
|
||||
|
||||
/**
|
||||
@@ -67,7 +69,7 @@ export class InAppPurchase {
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
static getProducts(productId: string[]): Promise<any> { return; }
|
||||
getProducts(productId: string[]): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Buy a product that matches the productId.
|
||||
@@ -77,7 +79,7 @@ export class InAppPurchase {
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
static buy(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; }
|
||||
buy(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; }
|
||||
|
||||
/**
|
||||
* Same as buy, but for subscription based products.
|
||||
@@ -87,7 +89,7 @@ export class InAppPurchase {
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
static subscribe(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; }
|
||||
subscribe(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; }
|
||||
|
||||
/**
|
||||
* Call this function after purchasing a "consumable" product to mark it as consumed. On Android, you must consume products that you want to let the user purchase multiple times. If you will not consume the product after a purchase, the next time you will attempt to purchase it you will get the error message:
|
||||
@@ -99,7 +101,7 @@ export class InAppPurchase {
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
static consume(productType: string, receipt: string, signature: string): Promise<any> { return; }
|
||||
consume(productType: string, receipt: string, signature: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Restore all purchases from the store
|
||||
@@ -108,7 +110,7 @@ export class InAppPurchase {
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
static restorePurchases(): Promise<any> { return; }
|
||||
restorePurchases(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get the receipt.
|
||||
@@ -118,6 +120,6 @@ export class InAppPurchase {
|
||||
otherPromise: true,
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static getReceipt(): Promise<string> { return; }
|
||||
getReceipt(): Promise<string> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
/**
|
||||
@@ -8,7 +9,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Insomnia } from 'ionic-native';
|
||||
* import { Insomnia } from '@ionic-native/insomnia';
|
||||
*
|
||||
*
|
||||
* Insomnia.keepAwake()
|
||||
@@ -32,6 +33,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
repo: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class Insomnia {
|
||||
|
||||
/**
|
||||
@@ -39,13 +41,13 @@ export class Insomnia {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static keepAwake(): Promise<any> { return; }
|
||||
keepAwake(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Allows the application to sleep again
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static allowSleepAgain(): Promise<any> { return; }
|
||||
allowSleepAgain(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Instagram
|
||||
@@ -6,7 +7,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Instagram} from 'ionic-native';
|
||||
* import {Instagram} from '@ionic-native/instagram';
|
||||
*
|
||||
* Instagram.share('data:image/png;uhduhf3hfif33', 'Caption')
|
||||
* .then(() => console.log('Shared!'))
|
||||
@@ -20,6 +21,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
pluginRef: 'Instagram',
|
||||
repo: 'https://github.com/vstirbu/InstagramPlugin'
|
||||
})
|
||||
@Injectable()
|
||||
export class Instagram {
|
||||
|
||||
/**
|
||||
@@ -30,7 +32,7 @@ export class Instagram {
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
})
|
||||
static isInstalled(): Promise<boolean|string> { return; }
|
||||
isInstalled(): Promise<boolean|string> { return; }
|
||||
|
||||
/**
|
||||
* Share an image on Instagram
|
||||
@@ -43,7 +45,7 @@ export class Instagram {
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
})
|
||||
static share(canvasIdOrDataUrl: string, caption?: string): Promise<any> { return; }
|
||||
share(canvasIdOrDataUrl: string, caption?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Share a library asset or video
|
||||
@@ -53,6 +55,6 @@ export class Instagram {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static shareAsset(assetLocalIdentifier: string): Promise<any> { return; }
|
||||
shareAsset(assetLocalIdentifier: string): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name IsDebug
|
||||
@@ -8,7 +9,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {IsDebug} from 'ionic-native';
|
||||
* import {IsDebug} from '@ionic-native/is-debug';
|
||||
*
|
||||
* IsDebug.getIsDebug()
|
||||
* .then((isDebug: boolean) => console.log('Is debug:', isDebug))
|
||||
@@ -22,6 +23,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
pluginRef: 'cordova.plugins.IsDebug',
|
||||
repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug'
|
||||
})
|
||||
@Injectable()
|
||||
export class IsDebug {
|
||||
|
||||
/**
|
||||
@@ -29,7 +31,7 @@ export class IsDebug {
|
||||
* @returns {Promise<boolean>} Returns a promise that resolves with true if the app was installed via xcode / eclipse / the ionic CLI etc. It will resolve to false if the app was downloaded from the app / play store by the end user.
|
||||
*/
|
||||
@Cordova()
|
||||
static getIsDebug(): Promise<boolean> {
|
||||
getIsDebug(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
@@ -7,7 +8,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
* @description
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Keyboard } from 'ionic-native';
|
||||
* import { Keyboard } from '@ionic-native/keyboard';
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -19,6 +20,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
pluginRef: 'cordova.plugins.Keyboard',
|
||||
repo: 'https://github.com/driftyco/ionic-plugin-keyboard'
|
||||
})
|
||||
@Injectable()
|
||||
export class Keyboard {
|
||||
|
||||
/**
|
||||
@@ -26,7 +28,7 @@ export class Keyboard {
|
||||
* @param hide {boolean}
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static hideKeyboardAccessoryBar(hide: boolean): void { }
|
||||
hideKeyboardAccessoryBar(hide: boolean): void { }
|
||||
|
||||
/**
|
||||
* Force keyboard to be shown.
|
||||
@@ -35,7 +37,7 @@ export class Keyboard {
|
||||
sync: true,
|
||||
platforms: ['Android', 'BlackBerry 10', 'Windows']
|
||||
})
|
||||
static show(): void { }
|
||||
show(): void { }
|
||||
|
||||
/**
|
||||
* Close the keyboard if open.
|
||||
@@ -44,7 +46,7 @@ export class Keyboard {
|
||||
sync: true,
|
||||
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
|
||||
})
|
||||
static close(): void { }
|
||||
close(): void { }
|
||||
|
||||
/**
|
||||
* Prevents the native UIScrollView from moving when an input is focused.
|
||||
@@ -54,7 +56,7 @@ export class Keyboard {
|
||||
sync: true,
|
||||
platforms: ['iOS', 'Windows']
|
||||
})
|
||||
static disableScroll(disable: boolean): void { }
|
||||
disableScroll(disable: boolean): void { }
|
||||
|
||||
/**
|
||||
* Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch.
|
||||
@@ -65,7 +67,7 @@ export class Keyboard {
|
||||
event: 'native.keyboardshow',
|
||||
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
|
||||
})
|
||||
static onKeyboardShow(): Observable<any> { return; }
|
||||
onKeyboardShow(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch.
|
||||
@@ -76,6 +78,6 @@ export class Keyboard {
|
||||
event: 'native.keyboardhide',
|
||||
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
|
||||
})
|
||||
static onKeyboardHide(): Observable<any> { return; }
|
||||
onKeyboardHide(): Observable<any> { return; }
|
||||
|
||||
}
|
||||
+16
-14
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface LaunchNavigatorOptions {
|
||||
|
||||
@@ -66,7 +67,7 @@ export interface LaunchNavigatorOptions {
|
||||
* Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper.
|
||||
*
|
||||
* ```typescript
|
||||
* import { LaunchNavigator, LaunchNavigatorOptions } from 'ionic-native';
|
||||
* import { LaunchNavigator, LaunchNavigatorOptions } from '@ionic-native/launch-navigator';
|
||||
*
|
||||
* let options: LaunchNavigatorOptions = {
|
||||
* start: 'London, ON',
|
||||
@@ -88,6 +89,7 @@ export interface LaunchNavigatorOptions {
|
||||
pluginRef: 'launchnavigator',
|
||||
repo: 'https://github.com/dpa99c/phonegap-launch-navigator.git'
|
||||
})
|
||||
@Injectable()
|
||||
export class LaunchNavigator {
|
||||
|
||||
/**
|
||||
@@ -100,7 +102,7 @@ export class LaunchNavigator {
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static navigate(
|
||||
navigate(
|
||||
destination: string | number[],
|
||||
options?: LaunchNavigatorOptions
|
||||
): Promise<any> { return; }
|
||||
@@ -111,14 +113,14 @@ export class LaunchNavigator {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAppAvailable(app: string): Promise<any> { return; }
|
||||
isAppAvailable(app: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns a list indicating which apps are installed and available on the current device.
|
||||
* @returns {Promise<string[]>}
|
||||
*/
|
||||
@Cordova()
|
||||
static availableApps(): Promise<string[]> { return; }
|
||||
availableApps(): Promise<string[]> { return; }
|
||||
|
||||
/**
|
||||
* Returns the display name of the specified app.
|
||||
@@ -126,7 +128,7 @@ export class LaunchNavigator {
|
||||
* @returns {string}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static getAppDisplayName(app: string): string { return; }
|
||||
getAppDisplayName(app: string): string { return; }
|
||||
|
||||
/**
|
||||
* Returns list of supported apps on a given platform.
|
||||
@@ -134,7 +136,7 @@ export class LaunchNavigator {
|
||||
* @returns {string[]}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static getAppsForPlatform(platform: string): string[] { return; }
|
||||
getAppsForPlatform(platform: string): string[] { return; }
|
||||
|
||||
/**
|
||||
* Indicates if an app on a given platform supports specification of transport mode.
|
||||
@@ -143,7 +145,7 @@ export class LaunchNavigator {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static supportsTransportMode(app: string, platform: string): boolean { return; }
|
||||
supportsTransportMode(app: string, platform: string): boolean { return; }
|
||||
|
||||
/**
|
||||
* Returns the list of transport modes supported by an app on a given platform.
|
||||
@@ -152,7 +154,7 @@ export class LaunchNavigator {
|
||||
* @returns {string[]}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static getTransportModes(app: string, platform: string): string[] { return; }
|
||||
getTransportModes(app: string, platform: string): string[] { return; }
|
||||
|
||||
/**
|
||||
* Indicates if an app on a given platform supports specification of launch mode.
|
||||
@@ -162,7 +164,7 @@ export class LaunchNavigator {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static supportsLaunchMode(app: string, platform: string): boolean { return; }
|
||||
supportsLaunchMode(app: string, platform: string): boolean { return; }
|
||||
|
||||
/**
|
||||
* Indicates if an app on a given platform supports specification of start location.
|
||||
@@ -171,7 +173,7 @@ export class LaunchNavigator {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static supportsStart(app: string, platform: string): boolean { return; }
|
||||
supportsStart(app: string, platform: string): boolean { return; }
|
||||
|
||||
/**
|
||||
* @param app {string}
|
||||
@@ -179,7 +181,7 @@ export class LaunchNavigator {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static supportsStartName(app: string, platform: string): boolean { return; }
|
||||
supportsStartName(app: string, platform: string): boolean { return; }
|
||||
|
||||
/**
|
||||
* @param app {string}
|
||||
@@ -187,14 +189,14 @@ export class LaunchNavigator {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static supportsDestName(app: string, platform: string): boolean { return; }
|
||||
supportsDestName(app: string, platform: string): boolean { return; }
|
||||
|
||||
/**
|
||||
* @param destination {string | number[]}
|
||||
* @param options {LaunchNavigatorOptions}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static userSelect(destination: string | number[], options: LaunchNavigatorOptions): void { }
|
||||
userSelect(destination: string | number[], options: LaunchNavigatorOptions): void { }
|
||||
|
||||
static APP: any = {
|
||||
USER_SELECT: 'user_select',
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name LaunchReview
|
||||
@@ -10,7 +11,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { LaunchReview } from 'ionic-native';
|
||||
* import { LaunchReview } from '@ionic-native/launch-review';
|
||||
*
|
||||
* const appId: string = 'yourAppId';
|
||||
* LaunchReview.launch(appId)
|
||||
@@ -24,6 +25,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
repo: 'https://github.com/dpa99c/cordova-launch-review',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class LaunchReview {
|
||||
|
||||
/**
|
||||
@@ -31,6 +33,6 @@ export class LaunchReview {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static launch(appId: string): Promise<void> { return; }
|
||||
launch(appId: string): Promise<void> { return; }
|
||||
|
||||
}
|
||||
+32
-23
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface ILocalNotification {
|
||||
|
||||
@@ -65,6 +66,13 @@ export interface ILocalNotification {
|
||||
*/
|
||||
smallIcon?: string;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* RGB value for the background color of the smallIcon.
|
||||
* Default: Androids COLOR_DEFAULT, which will vary based on Android version.
|
||||
*/
|
||||
color?: string;
|
||||
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
@@ -90,7 +98,7 @@ export interface ILocalNotification {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { LocalNotifications } from 'ionic-native';
|
||||
* import { LocalNotifications } from '@ionic-native/local-notifications';
|
||||
*
|
||||
*
|
||||
* // Schedule a single notification
|
||||
@@ -133,6 +141,7 @@ export interface ILocalNotification {
|
||||
pluginRef: 'cordova.plugins.notification.local',
|
||||
repo: 'https://github.com/katzer/cordova-plugin-local-notifications'
|
||||
})
|
||||
@Injectable()
|
||||
export class LocalNotifications {
|
||||
|
||||
/**
|
||||
@@ -142,7 +151,7 @@ export class LocalNotifications {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static schedule(options?: ILocalNotification | Array<ILocalNotification>): void { }
|
||||
schedule(options?: ILocalNotification | Array<ILocalNotification>): void { }
|
||||
|
||||
/**
|
||||
* Updates a previously scheduled notification. Must include the id in the options parameter.
|
||||
@@ -151,7 +160,7 @@ export class LocalNotifications {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static update(options?: ILocalNotification): void { }
|
||||
update(options?: ILocalNotification): void { }
|
||||
|
||||
/**
|
||||
* Clears single or multiple notifications
|
||||
@@ -159,7 +168,7 @@ export class LocalNotifications {
|
||||
* @returns {Promise<any>} Returns a promise when the notification had been cleared
|
||||
*/
|
||||
@Cordova()
|
||||
static clear(notificationId: any): Promise<any> { return; }
|
||||
clear(notificationId: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Clears all notifications
|
||||
@@ -169,7 +178,7 @@ export class LocalNotifications {
|
||||
successIndex: 0,
|
||||
errorIndex: 2
|
||||
})
|
||||
static clearAll(): Promise<any> { return; }
|
||||
clearAll(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Cancels single or multiple notifications
|
||||
@@ -177,7 +186,7 @@ export class LocalNotifications {
|
||||
* @returns {Promise<any>} Returns a promise when the notification is canceled
|
||||
*/
|
||||
@Cordova()
|
||||
static cancel(notificationId: any): Promise<any> { return; }
|
||||
cancel(notificationId: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Cancels all notifications
|
||||
@@ -187,7 +196,7 @@ export class LocalNotifications {
|
||||
successIndex: 0,
|
||||
errorIndex: 2
|
||||
})
|
||||
static cancelAll(): Promise<any> { return; }
|
||||
cancelAll(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks presence of a notification
|
||||
@@ -195,7 +204,7 @@ export class LocalNotifications {
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isPresent(notificationId: number): Promise<boolean> { return; }
|
||||
isPresent(notificationId: number): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks is a notification is scheduled
|
||||
@@ -203,7 +212,7 @@ export class LocalNotifications {
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isScheduled(notificationId: number): Promise<boolean> { return; }
|
||||
isScheduled(notificationId: number): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if a notification is triggered
|
||||
@@ -211,28 +220,28 @@ export class LocalNotifications {
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isTriggered(notificationId: number): Promise<boolean> { return; }
|
||||
isTriggered(notificationId: number): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Get all the notification ids
|
||||
* @returns {Promise<Array<number>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getAllIds(): Promise<Array<number>> { return; }
|
||||
getAllIds(): Promise<Array<number>> { return; }
|
||||
|
||||
/**
|
||||
* Get the ids of triggered notifications
|
||||
* @returns {Promise<Array<number>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getTriggeredIds(): Promise<Array<number>> { return; }
|
||||
getTriggeredIds(): Promise<Array<number>> { return; }
|
||||
|
||||
/**
|
||||
* Get the ids of scheduled notifications
|
||||
* @returns {Promise<Array<number>>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
static getScheduledIds(): Promise<Array<number>> { return; }
|
||||
getScheduledIds(): Promise<Array<number>> { return; }
|
||||
|
||||
/**
|
||||
* Get a notification object
|
||||
@@ -240,7 +249,7 @@ export class LocalNotifications {
|
||||
* @returns {Promise<ILocalNotification>}
|
||||
*/
|
||||
@Cordova()
|
||||
static get(notificationId: any): Promise<ILocalNotification> { return; }
|
||||
get(notificationId: any): Promise<ILocalNotification> { return; }
|
||||
|
||||
/**
|
||||
* Get a scheduled notification object
|
||||
@@ -248,7 +257,7 @@ export class LocalNotifications {
|
||||
* @returns {Promise<ILocalNotification>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getScheduled(notificationId: any): Promise<ILocalNotification> { return; }
|
||||
getScheduled(notificationId: any): Promise<ILocalNotification> { return; }
|
||||
|
||||
/**
|
||||
* Get a triggered notification object
|
||||
@@ -256,42 +265,42 @@ export class LocalNotifications {
|
||||
* @returns {Promise<ILocalNotification>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getTriggered(notificationId: any): Promise<ILocalNotification> { return; }
|
||||
getTriggered(notificationId: any): Promise<ILocalNotification> { return; }
|
||||
|
||||
/**
|
||||
* Get all notification objects
|
||||
* @returns {Promise<Array<ILocalNotification>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getAll(): Promise<Array<ILocalNotification>> { return; }
|
||||
getAll(): Promise<Array<ILocalNotification>> { return; }
|
||||
|
||||
/**
|
||||
* Get all scheduled notification objects
|
||||
* @returns {Promise<Array<ILocalNotification>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getAllScheduled(): Promise<Array<ILocalNotification>> { return; }
|
||||
getAllScheduled(): Promise<Array<ILocalNotification>> { return; }
|
||||
|
||||
/**
|
||||
* Get all triggered notification objects
|
||||
* @returns {Promise<Array<ILocalNotification>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getAllTriggered(): Promise<Array<ILocalNotification>> { return; }
|
||||
getAllTriggered(): Promise<Array<ILocalNotification>> { return; }
|
||||
|
||||
/**
|
||||
* Register permission to show notifications if not already granted.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static registerPermission(): Promise<boolean> { return; }
|
||||
registerPermission(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Informs if the app has the permission to show notifications.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static hasPermission(): Promise<boolean> { return; }
|
||||
hasPermission(): Promise<boolean> { return; }
|
||||
|
||||
|
||||
/**
|
||||
@@ -302,7 +311,7 @@ export class LocalNotifications {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static on(eventName: string, callback: any): void { }
|
||||
on(eventName: string, callback: any): void { }
|
||||
|
||||
|
||||
}
|
||||
+7
-5
@@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Injectable } from '@angular/core';
|
||||
import {Plugin, Cordova} from '@ionic-native/core';
|
||||
/**
|
||||
* @name LocationAccuracy
|
||||
* @description
|
||||
@@ -6,7 +7,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { LocationAccuracy } from 'ionic-native';
|
||||
* import { LocationAccuracy } from '@ionic-native/location-accuracy';
|
||||
*
|
||||
* LocationAccuracy.canRequest().then((canRequest: boolean) => {
|
||||
*
|
||||
@@ -28,20 +29,21 @@ import {Plugin, Cordova} from './plugin';
|
||||
pluginRef: 'cordova.plugins.locationAccuracy',
|
||||
repo: 'https://github.com/dpa99c/cordova-plugin-request-location-accuracy'
|
||||
})
|
||||
@Injectable()
|
||||
export class LocationAccuracy {
|
||||
/**
|
||||
* Indicates if you can request accurate location
|
||||
* @returns {Promise<boolean>} Returns a promise that resovles with a boolean that indicates if you can request accurate location
|
||||
*/
|
||||
@Cordova()
|
||||
static canRequest(): Promise<boolean> { return; }
|
||||
canRequest(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Indicates if a request is currently in progress
|
||||
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean that indicates if a request is currently in progress
|
||||
*/
|
||||
@Cordova()
|
||||
static isRequesting(): Promise<boolean> { return; }
|
||||
isRequesting(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Requests accurate location
|
||||
@@ -49,7 +51,7 @@ export class LocationAccuracy {
|
||||
* @returns {Promise<any>} Returns a promise that resolves on success and rejects if an error occurred
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse' })
|
||||
static request(accuracy: number): Promise<any> { return; }
|
||||
request(accuracy: number): Promise<any> { return; }
|
||||
|
||||
static REQUEST_PRIORITY_NO_POWER = 0;
|
||||
static REQUEST_PRIORITY_LOW_POWER = 1;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user