mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-16 00:00:02 +08:00
Compare commits
92 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0fd19fd33 | ||
|
|
f2c4f380f8 | ||
|
|
c96ae3db0d | ||
|
|
c2a6198576 | ||
|
|
2b3d4c9090 | ||
|
|
dbb17d801e | ||
|
|
0b1e4e6e84 | ||
|
|
8c82c87811 | ||
|
|
9997caf506 | ||
|
|
c8f53d2dc3 | ||
|
|
a10d763a41 | ||
|
|
e44fdb6730 | ||
|
|
bb8973a0ea | ||
|
|
6031a240a2 | ||
|
|
2bd244a536 | ||
|
|
64bff1bbed | ||
|
|
da5266cd65 | ||
|
|
c1082b1c14 | ||
|
|
2cf132ee88 | ||
|
|
e411146e8f | ||
|
|
5f63493bdc | ||
|
|
999c288b23 | ||
|
|
2e83ade978 | ||
|
|
08bf57f488 | ||
|
|
6f6392ea5c | ||
|
|
0b2227d35a | ||
|
|
4bfceadb65 | ||
|
|
61c73eaa4e | ||
|
|
c0c0c5cec5 | ||
|
|
5b82d82d75 | ||
|
|
36be795623 | ||
|
|
0996264483 | ||
|
|
2245bb8050 | ||
|
|
e14e00edba | ||
|
|
22102a7e4a | ||
|
|
6416c2544c | ||
|
|
73a510f9c2 | ||
|
|
b8b605db5e | ||
|
|
12168d991a | ||
|
|
93a119bf4b | ||
|
|
a7c62de389 | ||
|
|
8aca6718e1 | ||
|
|
1ec4bdef8f | ||
|
|
d6ed87d7cc | ||
|
|
55f3f37760 | ||
|
|
4f547dae30 | ||
|
|
3cb83831c1 | ||
|
|
ca7659378f | ||
|
|
4333bc950d | ||
|
|
ee4b61e405 | ||
|
|
975a65d619 | ||
|
|
d68618f878 | ||
|
|
e5aff0f5f0 | ||
|
|
e596825ee9 | ||
|
|
991f2f04d4 | ||
|
|
ecdff8c0e5 | ||
|
|
55071c0d65 | ||
|
|
7d63e808ad | ||
|
|
84551cac67 | ||
|
|
92ef4f0c33 | ||
|
|
d8eb621da4 | ||
|
|
6534283a6f | ||
|
|
5145395dd7 | ||
|
|
dfd0514a43 | ||
|
|
d5919d1736 | ||
|
|
71f7051997 | ||
|
|
2858b4bad7 | ||
|
|
4c8deb2bed | ||
|
|
277b2b15e6 | ||
|
|
ebf402864b | ||
|
|
6b702973ec | ||
|
|
31983d8317 | ||
|
|
8c842b00b6 | ||
|
|
c6feaafcca | ||
|
|
a7f7b26a76 | ||
|
|
d0dec7a17d | ||
|
|
7487293d33 | ||
|
|
4f6ec0cfcd | ||
|
|
b35417a017 | ||
|
|
adf9c5a323 | ||
|
|
7c797123f5 | ||
|
|
bd1794d7f5 | ||
|
|
46502cb864 | ||
|
|
02cc615c21 | ||
|
|
749fd8af43 | ||
|
|
e2acde5332 | ||
|
|
5203d026d4 | ||
|
|
362ae4422b | ||
|
|
965a90c52c | ||
|
|
a28de660bc | ||
|
|
fec19b734c | ||
|
|
6773ed341c |
28
.github/ISSUE_TEMPLATE.md
vendored
Normal file
28
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
**I'm submitting a ...** (check one with "x")
|
||||
[ ] bug report
|
||||
[ ] feature request
|
||||
<!-- Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://ionicworldwide.herokuapp.com/ -->
|
||||
|
||||
**Current behavior:**
|
||||
<!-- Describe how the bug manifests. -->
|
||||
|
||||
**Expected behavior:**
|
||||
<!-- Describe what the behavior would be without the bug. -->
|
||||
|
||||
**Steps to reproduce:**
|
||||
<!-- If you are able to illustrate the bug or feature request with an example, please provide steps to reproduce. -->
|
||||
|
||||
**Related code:**
|
||||
|
||||
```
|
||||
insert any relevant code here
|
||||
```
|
||||
|
||||
**Other information:**
|
||||
<!-- List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to fix, Stack Overflow links, forum links, etc. -->
|
||||
|
||||
**package.json info:**
|
||||
|
||||
```json
|
||||
insert the content here
|
||||
```
|
||||
95
CHANGELOG.md
95
CHANGELOG.md
@@ -1,3 +1,98 @@
|
||||
<a name="3.10.2"></a>
|
||||
## [3.10.2](https://github.com/driftyco/ionic-native/compare/v3.10.1...v3.10.2) (2017-05-20)
|
||||
|
||||
|
||||
|
||||
<a name="3.10.1"></a>
|
||||
## [3.10.1](https://github.com/driftyco/ionic-native/compare/v3.10.0...v3.10.1) (2017-05-20)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **core:** add getSupportedPlatforms method ([c8f53d2](https://github.com/driftyco/ionic-native/commit/c8f53d2))
|
||||
|
||||
|
||||
|
||||
<a name="3.10.0"></a>
|
||||
# [3.10.0](https://github.com/driftyco/ionic-native/compare/v3.9.2...v3.10.0) (2017-05-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **admob-free:** use otherPromise to fix browser development ([2bd244a](https://github.com/driftyco/ionic-native/commit/2bd244a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **native-keyboard:** add native keyboard plugin (#1588) ([6031a24](https://github.com/driftyco/ionic-native/commit/6031a24))
|
||||
* **user-agent:** add User-Agent plugin (#1582) ([6f6392e](https://github.com/driftyco/ionic-native/commit/6f6392e))
|
||||
|
||||
|
||||
|
||||
<a name="3.9.2"></a>
|
||||
## [3.9.2](https://github.com/driftyco/ionic-native/compare/v3.9.1...v3.9.2) (2017-05-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **action-sheet:** destructiveButtonLast is optional ([6416c25](https://github.com/driftyco/ionic-native/commit/6416c25))
|
||||
* **core:** decorators should define enumerable properties ([22102a7](https://github.com/driftyco/ionic-native/commit/22102a7))
|
||||
|
||||
|
||||
|
||||
<a name="3.9.1"></a>
|
||||
## [3.9.1](https://github.com/driftyco/ionic-native/compare/v3.9.0...v3.9.1) (2017-05-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **core:** fix issues when clearing observables ([93a119b](https://github.com/driftyco/ionic-native/commit/93a119b))
|
||||
|
||||
|
||||
|
||||
<a name="3.9.0"></a>
|
||||
# [3.9.0](https://github.com/driftyco/ionic-native/compare/v3.8.1...v3.9.0) (2017-05-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **android-permissions:** fix PERMISSION property and add requestPermission ([ebf4028](https://github.com/driftyco/ionic-native/commit/ebf4028)), closes [#1574](https://github.com/driftyco/ionic-native/issues/1574)
|
||||
* **app-preferences:** suite is sync ([3cb8383](https://github.com/driftyco/ionic-native/commit/3cb8383)), closes [#1321](https://github.com/driftyco/ionic-native/issues/1321)
|
||||
* **background-mode:** configure doesn't return anything ([92ef4f0](https://github.com/driftyco/ionic-native/commit/92ef4f0)), closes [#1457](https://github.com/driftyco/ionic-native/issues/1457)
|
||||
* **in-app-browser:** fix on method ([975a65d](https://github.com/driftyco/ionic-native/commit/975a65d)), closes [#1446](https://github.com/driftyco/ionic-native/issues/1446)
|
||||
* **media:** create should return null if plugin is not available ([d68618f](https://github.com/driftyco/ionic-native/commit/d68618f))
|
||||
* **media:** create will always return MediaObject even if plugin doesnt exist ([ee4b61e](https://github.com/driftyco/ionic-native/commit/ee4b61e))
|
||||
* **printer:** fix implementation and add pick method ([55071c0](https://github.com/driftyco/ionic-native/commit/55071c0))
|
||||
* **push:** fix types ([ca76593](https://github.com/driftyco/ionic-native/commit/ca76593)), closes [#1331](https://github.com/driftyco/ionic-native/issues/1331)
|
||||
* **secure-storage:** reject the promise if the plugin doesn't exist (#1562) ([d5919d1](https://github.com/driftyco/ionic-native/commit/d5919d1))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **linkedin:** add getActiveSession method ([4c8deb2](https://github.com/driftyco/ionic-native/commit/4c8deb2)), closes [#1570](https://github.com/driftyco/ionic-native/issues/1570)
|
||||
* **printer:** add check method ([991f2f0](https://github.com/driftyco/ionic-native/commit/991f2f0))
|
||||
|
||||
|
||||
|
||||
<a name="3.8.1"></a>
|
||||
## [3.8.1](https://github.com/driftyco/ionic-native/compare/v3.8.0...v3.8.1) (2017-05-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **document-viewer:** fix params and docs for canViewDocument (#1568) ([b35417a](https://github.com/driftyco/ionic-native/commit/b35417a)), closes [#1568](https://github.com/driftyco/ionic-native/issues/1568)
|
||||
* **file:** add toInternalURL (#1561) ([7c79712](https://github.com/driftyco/ionic-native/commit/7c79712)), closes [#1560](https://github.com/driftyco/ionic-native/issues/1560)
|
||||
* **file:** fix repo link (#1566) ([adf9c5a](https://github.com/driftyco/ionic-native/commit/adf9c5a)), closes [#1566](https://github.com/driftyco/ionic-native/issues/1566)
|
||||
* **file:** various fixes ([d0dec7a](https://github.com/driftyco/ionic-native/commit/d0dec7a)), closes [#1564](https://github.com/driftyco/ionic-native/issues/1564)
|
||||
* **sqlite:** fix implementation and improve typings ([fec19b7](https://github.com/driftyco/ionic-native/commit/fec19b7))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **mix-panel:** add timeEvent (#1536) ([965a90c](https://github.com/driftyco/ionic-native/commit/965a90c))
|
||||
|
||||
|
||||
|
||||
<a name="3.8.0"></a>
|
||||
# [3.8.0](https://github.com/driftyco/ionic-native/compare/v3.7.0...v3.8.0) (2017-05-14)
|
||||
|
||||
|
||||
16
circle.yml
16
circle.yml
@@ -7,12 +7,15 @@ jobs:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: ionic-site
|
||||
key: ionic-site-{{ .Branch }}
|
||||
- run:
|
||||
name: Prepare ionic-site repo
|
||||
command: ./scripts/docs/prepare.sh
|
||||
command: |
|
||||
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
||||
./scripts/docs/prepare.sh
|
||||
fi
|
||||
- save_cache:
|
||||
key: ionic-site
|
||||
key: ionic-site-{{ .Branch }}
|
||||
paths:
|
||||
- ~/ionic-site/
|
||||
- restore_cache:
|
||||
@@ -27,6 +30,13 @@ jobs:
|
||||
- run:
|
||||
name: Run tslint
|
||||
command: npm run lint
|
||||
- run: bash ./scripts/git/config.sh
|
||||
- run:
|
||||
name: Build changed plugins
|
||||
command: node scripts/ci-tests.js
|
||||
- run:
|
||||
name: Run tests
|
||||
command: npm test
|
||||
- add_ssh_keys
|
||||
- deploy:
|
||||
name: Update docs
|
||||
|
||||
55
karma.conf.js
Normal file
55
karma.conf.js
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = config => {
|
||||
|
||||
const conf = {
|
||||
frameworks: [
|
||||
'jasmine',
|
||||
'karma-typescript'
|
||||
],
|
||||
|
||||
plugins: [
|
||||
'karma-typescript',
|
||||
'karma-jasmine',
|
||||
'karma-phantomjs-launcher'
|
||||
],
|
||||
|
||||
preprocessors: {
|
||||
'src/**/*.ts': ['karma-typescript']
|
||||
},
|
||||
|
||||
karmaTypescriptConfig: {
|
||||
bundlerOptions: {
|
||||
entrypoints: /\.spec\.ts$/,
|
||||
transforms: [
|
||||
require("karma-typescript-es6-transform")()
|
||||
]
|
||||
},
|
||||
compilerOptions: {
|
||||
lib: ['es2015', 'dom'],
|
||||
paths: {
|
||||
"@ionic-native/core": ["./src/@ionic-native/core"]
|
||||
},
|
||||
baseUrl: '.'
|
||||
}
|
||||
},
|
||||
|
||||
files: [
|
||||
{ pattern: 'src/**/*.ts', included: true, watched: true }
|
||||
],
|
||||
|
||||
reporters: ['progress'],
|
||||
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.INFO,
|
||||
autoWatch: true,
|
||||
browsers: [
|
||||
'PhantomJS'
|
||||
],
|
||||
singleRun: false
|
||||
};
|
||||
|
||||
config.set(conf);
|
||||
|
||||
};
|
||||
15
package.json
15
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "3.8.0",
|
||||
"version": "3.10.2",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
@@ -8,6 +8,8 @@
|
||||
"@angular/compiler-cli": "4.1.2",
|
||||
"@angular/core": "4.1.2",
|
||||
"@types/cordova": "0.0.34",
|
||||
"@types/jasmine": "^2.5.47",
|
||||
"@types/node": "^7.0.18",
|
||||
"canonical-path": "0.0.2",
|
||||
"child-process-promise": "2.2.0",
|
||||
"conventional-changelog-cli": "1.2.0",
|
||||
@@ -22,6 +24,13 @@
|
||||
"gulp-rename": "1.2.2",
|
||||
"gulp-replace": "0.5.4",
|
||||
"gulp-tslint": "6.1.2",
|
||||
"jasmine-core": "^2.6.1",
|
||||
"karma": "^1.7.0",
|
||||
"karma-cli": "^1.0.1",
|
||||
"karma-jasmine": "^1.1.0",
|
||||
"karma-phantomjs-launcher": "^1.0.4",
|
||||
"karma-typescript": "^3.0.1",
|
||||
"karma-typescript-es6-transform": "^1.0.0",
|
||||
"lodash": "4.17.4",
|
||||
"minimist": "1.1.3",
|
||||
"node-html-encoder": "0.0.2",
|
||||
@@ -45,7 +54,9 @@
|
||||
"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",
|
||||
"postchangelog": "git commit -am \"chore(): update changelog\""
|
||||
"postchangelog": "git commit -am \"chore(): update changelog\"",
|
||||
"test": "karma start karma.conf.js --single-run",
|
||||
"test:watch": "karma start karma.conf.js"
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
|
||||
@@ -52,6 +52,16 @@ const PLUGINS = fs.readdirSync(PLUGINS_PATH);
|
||||
|
||||
// Build specific list of plugins to build from arguments, if any
|
||||
let pluginsToBuild = process.argv.slice(2);
|
||||
let ignoreErrors = false;
|
||||
let errors = [];
|
||||
|
||||
const index = pluginsToBuild.indexOf('ignore-errors');
|
||||
if (index > -1) {
|
||||
ignoreErrors = true;
|
||||
pluginsToBuild.splice(index, 1);
|
||||
console.log('Build will continue even if errors were thrown. Errors will be printed when build finishes.');
|
||||
}
|
||||
|
||||
if (!pluginsToBuild.length) {
|
||||
pluginsToBuild = PLUGINS;
|
||||
}
|
||||
@@ -102,10 +112,16 @@ const addPluginToQueue = pluginName => {
|
||||
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;
|
||||
|
||||
if (!ignoreErrors) {
|
||||
// oops! something went wrong.
|
||||
console.log(err);
|
||||
callback(`\n\nBuilding ${pluginName} failed.`);
|
||||
return;
|
||||
} else {
|
||||
errors.push(err);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// we're done with this plugin!
|
||||
@@ -125,7 +141,17 @@ pluginsToBuild.forEach(addPluginToQueue);
|
||||
QUEUE.start((err) => {
|
||||
|
||||
if (err) {
|
||||
console.log('Error building plugins. ', err);
|
||||
console.log('Error building plugins.');
|
||||
console.log(err);
|
||||
process.stderr.write(err);
|
||||
process.exit(1);
|
||||
} else if (errors.length) {
|
||||
errors.forEach(e => {
|
||||
console.log(e.message) && console.log('\n');
|
||||
process.stderr.write(err);
|
||||
});
|
||||
console.log('Build complete with errors');
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log('Done processing plugins!');
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
"skipLibCheck": true,
|
||||
"lib": ["es2015", "dom"],
|
||||
"sourceMap": true,
|
||||
"inlineSources": true
|
||||
"inlineSources": true,
|
||||
"noImplicitAny": true
|
||||
},
|
||||
"files": [
|
||||
"../../src/@ionic-native/core/index.ts"
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
"skipLibCheck": true,
|
||||
"lib": ["es2015", "dom"],
|
||||
"sourceMap": true,
|
||||
"inlineSources": true
|
||||
"inlineSources": true,
|
||||
"noImplicitAny": true
|
||||
},
|
||||
"files": []
|
||||
}
|
||||
|
||||
65
scripts/ci-tests.js
Normal file
65
scripts/ci-tests.js
Normal file
@@ -0,0 +1,65 @@
|
||||
const exec = require('child-process-promise').exec;
|
||||
let diff;
|
||||
exec(`git branch | grep \\* | cut -d ' ' -f2`)
|
||||
.then(output => {
|
||||
if (output.stderr) {
|
||||
return Promise.reject(output.stderr);
|
||||
}
|
||||
|
||||
const branch = output.stdout.trim();
|
||||
|
||||
if (branch !== 'master') {
|
||||
|
||||
console.log('Merging master branch in ...');
|
||||
// not on master branch
|
||||
// let's test the changes that were made
|
||||
return exec(`git merge origin master`);
|
||||
}
|
||||
})
|
||||
.then((output) => {
|
||||
if (output && output.stderr) {
|
||||
return Promise.reject(output.stderr);
|
||||
}
|
||||
console.log('Checking for differences ...');
|
||||
return exec(`git diff --name-status origin master`)
|
||||
})
|
||||
.then((output) => {
|
||||
if (output && output.stderr) {
|
||||
return Promise.reject(output.stderr);
|
||||
}
|
||||
|
||||
diff = output.stdout;
|
||||
diff = diff.replace(/A\s+/g, '');
|
||||
diff = diff.match(/src\/@ionic-native\/plugins\/([a-zA-Z0-9\-]+)\/index\.ts/g);
|
||||
|
||||
if (!diff) process.exit();
|
||||
|
||||
console.log(`${ diff.length } plugins were modified. We will now build them to verify they still work.`);
|
||||
|
||||
return exec('npm run build:core --silent');
|
||||
})
|
||||
.then((output) => {
|
||||
|
||||
if (output && output.stderr) {
|
||||
return Promise.reject(output.stderr);
|
||||
}
|
||||
|
||||
console.log('Built core library successfully ...');
|
||||
console.log('Building plugins ...');
|
||||
|
||||
diff = diff.map(text => text.replace('src/@ionic-native/plugins/', '').replace('/index.ts', ''));
|
||||
|
||||
return exec(`npm run build:modules ${diff.join(' ')} --silent`);
|
||||
})
|
||||
.then((output) => {
|
||||
if (output && output.stderr) {
|
||||
console.log(output.stderr);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(output.stdout);
|
||||
process.exit();
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e.message || e);
|
||||
process.exit(1);
|
||||
});
|
||||
2
scripts/docs/templates/common.template.html
vendored
2
scripts/docs/templates/common.template.html
vendored
@@ -165,7 +165,7 @@ docType: "<$ doc.docType $>"
|
||||
<@ endif @>
|
||||
|
||||
<# --- Install commands --- #>
|
||||
<pre><code class="nohighlight">$ <@ if prop.install @><$ prop.install $><@ else @>ionic plugin add --save <$ prop.plugin $><@ endif @>
|
||||
<pre><code class="nohighlight">$ <@ if prop.install @><$ prop.install $><@ else @>ionic cordova plugin add <$ prop.plugin $><@ endif @>
|
||||
$ npm install --save @ionic-native/<$ doc.npmId $>
|
||||
</code></pre>
|
||||
<p>Repo:
|
||||
|
||||
2
scripts/docs/templates/readme.template.md
vendored
2
scripts/docs/templates/readme.template.md
vendored
@@ -16,7 +16,7 @@
|
||||
<@ for prop in doc.decorators[0].argumentInfo @>
|
||||
|
||||
```
|
||||
$ <@ if prop.install @><$ prop.install $><@ else @>ionic plugin add <$ prop.plugin $><@ endif @>
|
||||
$ <@ if prop.install @><$ prop.install $><@ else @>ionic cordova plugin add <$ prop.plugin $><@ endif @>
|
||||
$ npm install --save @ionic-native/<$ doc.npmId $>
|
||||
```
|
||||
|
||||
|
||||
2
scripts/git/config.sh
Normal file
2
scripts/git/config.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
git config --global user.email "hi@ionicframework.com"
|
||||
git config --global user.name "Ionitron"
|
||||
@@ -1,5 +1,3 @@
|
||||
declare var window;
|
||||
|
||||
export function checkReady() {
|
||||
const DEVICE_READY_TIMEOUT = 5000;
|
||||
|
||||
@@ -16,7 +14,7 @@ export function checkReady() {
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
if (!didFireReady && window.cordova) {
|
||||
if (!didFireReady && !!window.cordova) {
|
||||
console.warn(`Ionic 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);
|
||||
|
||||
239
src/@ionic-native/core/decorators.spec.ts
Normal file
239
src/@ionic-native/core/decorators.spec.ts
Normal file
@@ -0,0 +1,239 @@
|
||||
import 'core-js';
|
||||
import { Plugin, Cordova, CordovaProperty, CordovaCheck, CordovaInstance, InstanceProperty } from './decorators';
|
||||
import { IonicNativePlugin } from './ionic-native-plugin';
|
||||
import { ERR_CORDOVA_NOT_AVAILABLE, ERR_PLUGIN_NOT_INSTALLED } from './plugin';
|
||||
|
||||
declare const window: any;
|
||||
|
||||
class TestObject {
|
||||
|
||||
constructor(public _objectInstance: any) {}
|
||||
|
||||
@InstanceProperty
|
||||
name: string;
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
pingSync(): string { return; }
|
||||
|
||||
@CordovaInstance()
|
||||
ping(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
@Plugin({
|
||||
pluginName: 'TestPlugin',
|
||||
pluginRef: 'testPlugin',
|
||||
repo: '',
|
||||
plugin: 'cordova-plugin-my-plugin',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
class TestPlugin extends IonicNativePlugin {
|
||||
|
||||
@CordovaProperty
|
||||
name: string;
|
||||
|
||||
@Cordova({ sync: true })
|
||||
pingSync(): string { return; }
|
||||
|
||||
@Cordova()
|
||||
ping(): Promise<string> { return; }
|
||||
|
||||
@CordovaCheck()
|
||||
customPing(): Promise<string> {
|
||||
return Promise.resolve('pong');
|
||||
}
|
||||
|
||||
create(): TestObject {
|
||||
return new TestObject(TestPlugin.getPlugin().create());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function definePlugin() {
|
||||
(window as any).testPlugin = {
|
||||
name: 'John Smith',
|
||||
ping: (success: Function, error: Function) => success('pong'),
|
||||
pingSync: () => 'pong',
|
||||
create: function TestObject() {
|
||||
this.pingSync = () => 'pong';
|
||||
this.ping = (success: Function, error: Function) => success('pong');
|
||||
this.name = 'John Smith';
|
||||
return this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
describe('Regular Decorators', () => {
|
||||
|
||||
let plugin: TestPlugin;
|
||||
|
||||
beforeEach(() => {
|
||||
plugin = new TestPlugin();
|
||||
definePlugin();
|
||||
});
|
||||
|
||||
describe('Plugin', () => {
|
||||
|
||||
it('should set pluginName', () => {
|
||||
expect(TestPlugin.getPluginName()).toEqual('TestPlugin');
|
||||
});
|
||||
|
||||
it('should set pluginRef', () => {
|
||||
expect(TestPlugin.getPluginRef()).toEqual('testPlugin');
|
||||
});
|
||||
|
||||
it('should return original plugin object', () => {
|
||||
expect(TestPlugin.getPlugin()).toEqual(window.testPlugin);
|
||||
});
|
||||
|
||||
it('should return supported platforms', () => {
|
||||
expect(TestPlugin.getSupportedPlatforms()).toEqual(['Android', 'iOS']);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('Cordova', () => {
|
||||
|
||||
it('should do a sync function', () => {
|
||||
expect(plugin.pingSync()).toEqual('pong');
|
||||
});
|
||||
|
||||
it('should do an async function', (done: Function) => {
|
||||
plugin.ping()
|
||||
.then(res => {
|
||||
expect(res).toEqual('pong');
|
||||
done();
|
||||
})
|
||||
.catch(e => {
|
||||
expect(e).toBeUndefined();
|
||||
done('Method should have resolved');
|
||||
});
|
||||
});
|
||||
|
||||
it('should throw plugin_not_installed error', (done: Function) => {
|
||||
|
||||
delete window.testPlugin;
|
||||
window.cordova = true;
|
||||
|
||||
expect(<any>plugin.pingSync()).toEqual(ERR_PLUGIN_NOT_INSTALLED);
|
||||
|
||||
plugin.ping()
|
||||
.catch(e => {
|
||||
expect(e).toEqual(ERR_PLUGIN_NOT_INSTALLED.error);
|
||||
delete window.cordova;
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it('should throw cordova_not_available error', (done: Function) => {
|
||||
|
||||
delete window.testPlugin;
|
||||
|
||||
expect(<any>plugin.pingSync()).toEqual(ERR_CORDOVA_NOT_AVAILABLE);
|
||||
|
||||
plugin.ping()
|
||||
.catch(e => {
|
||||
expect(e).toEqual(ERR_CORDOVA_NOT_AVAILABLE.error);
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('CordovaProperty', () => {
|
||||
|
||||
it('should return property value', () => {
|
||||
expect(plugin.name).toEqual('John Smith');
|
||||
});
|
||||
|
||||
it('should set property value', () => {
|
||||
plugin.name = 'value2';
|
||||
expect(plugin.name).toEqual('value2');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('CordovaCheck', () => {
|
||||
|
||||
it('should run the method when plugin exists', (done) => {
|
||||
plugin.customPing()
|
||||
.then(res => {
|
||||
expect(res).toEqual('pong');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('shouldnt run the method when plugin doesnt exist', (done) => {
|
||||
delete window.testPlugin;
|
||||
window.cordova = true;
|
||||
plugin.customPing()
|
||||
.catch(e => {
|
||||
expect(e).toEqual(ERR_PLUGIN_NOT_INSTALLED.error);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('Instance Decorators', () => {
|
||||
|
||||
let instance: TestObject,
|
||||
plugin: TestPlugin;
|
||||
|
||||
beforeEach(() => {
|
||||
definePlugin();
|
||||
plugin = new TestPlugin();
|
||||
instance = plugin.create();
|
||||
});
|
||||
|
||||
describe('Instance plugin', () => {
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
describe('CordovaInstance', () => {
|
||||
|
||||
it('should call instance async method', (done) => {
|
||||
instance.ping()
|
||||
.then(r => {
|
||||
expect(r).toEqual('pong');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should call instance sync method', () => {
|
||||
expect(instance.pingSync()).toEqual('pong');
|
||||
});
|
||||
|
||||
it('shouldnt call instance method when _objectInstance is undefined', () => {
|
||||
|
||||
delete instance._objectInstance;
|
||||
instance.ping()
|
||||
.then(r => {
|
||||
expect(r).toBeUndefined();
|
||||
})
|
||||
.catch(e => {
|
||||
expect(e).toBeUndefined();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('InstanceProperty', () => {
|
||||
it('should return property value', () => {
|
||||
expect(instance.name).toEqual('John Smith');
|
||||
});
|
||||
|
||||
it('should set property value', () => {
|
||||
instance.name = 'John Cena';
|
||||
expect(instance.name).toEqual('John Cena');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -32,6 +32,8 @@ export interface PluginConfig {
|
||||
* Supported platforms
|
||||
*/
|
||||
platforms?: string[];
|
||||
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface CordovaOptions {
|
||||
@@ -133,7 +135,8 @@ export function InstanceCheck(opts: CordovaCheckOptions = {}) {
|
||||
return getPromise(() => { });
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -157,7 +160,8 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) {
|
||||
}
|
||||
return Promise.reject(check && check.error);
|
||||
}
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -182,12 +186,12 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export function Plugin(config: PluginConfig) {
|
||||
return function(cls) {
|
||||
export function Plugin(config: PluginConfig): ClassDecorator {
|
||||
return function(cls: any) {
|
||||
|
||||
// Add these fields to the class
|
||||
for (let k in config) {
|
||||
cls[k] = config[k];
|
||||
for (let prop in config) {
|
||||
cls[prop] = config[prop];
|
||||
}
|
||||
|
||||
cls['installed'] = function(printWarning?: boolean) {
|
||||
@@ -237,7 +241,8 @@ export function Cordova(opts: CordovaOptions = {}) {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
return wrap(this, methodName, opts).apply(this, args);
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -252,7 +257,8 @@ export function CordovaInstance(opts: any = {}) {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
return wrapInstance(this, methodName, opts).apply(this, args);
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -310,7 +316,8 @@ export function CordovaFunctionOverride(opts: any = {}) {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
return overrideFunction(this, methodName, opts);
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -346,7 +353,8 @@ export function CordovaFiniteObservable(opts: CordovaFiniteObservableOptions = {
|
||||
wrappedSubscription.unsubscribe();
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -38,4 +38,9 @@ export class IonicNativePlugin {
|
||||
*/
|
||||
static getPluginInstallName(): string { return; }
|
||||
|
||||
/**
|
||||
* Returns the plugin's supported platforms
|
||||
*/
|
||||
static getSupportedPlatforms(): string[] { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { get, getPlugin, getPromise, cordovaWarn, pluginWarn } from './util';
|
||||
import { getPlugin, getPromise, cordovaWarn, pluginWarn } from './util';
|
||||
import { checkReady } from './bootstrap';
|
||||
import { CordovaOptions } from './decorators';
|
||||
|
||||
@@ -7,8 +7,11 @@ import 'rxjs/add/observable/fromEvent';
|
||||
|
||||
checkReady();
|
||||
|
||||
declare var window;
|
||||
declare var Promise;
|
||||
// declare const window;
|
||||
// declare var Promise;
|
||||
|
||||
export const ERR_CORDOVA_NOT_AVAILABLE = { error: 'cordova_not_available' };
|
||||
export const ERR_PLUGIN_NOT_INSTALLED = { error: 'plugin_not_installed' };
|
||||
|
||||
|
||||
/**
|
||||
@@ -16,8 +19,8 @@ declare var Promise;
|
||||
* @return {boolean | { error: string } }
|
||||
* @private
|
||||
*/
|
||||
export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string);
|
||||
export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: string);
|
||||
export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string): boolean | { error: string };
|
||||
export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: string): boolean | { error: string };
|
||||
export function checkAvailability(plugin: any, methodName?: string, pluginName?: string): boolean | { error: string } {
|
||||
|
||||
let pluginRef, pluginInstance, pluginPackage;
|
||||
@@ -35,15 +38,11 @@ export function checkAvailability(plugin: any, methodName?: string, pluginName?:
|
||||
if (!pluginInstance || (!!methodName && typeof pluginInstance[methodName] === 'undefined')) {
|
||||
if (!window.cordova) {
|
||||
cordovaWarn(pluginName, methodName);
|
||||
return {
|
||||
error: 'cordova_not_available'
|
||||
};
|
||||
return ERR_CORDOVA_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
pluginWarn(pluginName, pluginPackage, methodName);
|
||||
return {
|
||||
error: 'plugin_not_installed'
|
||||
};
|
||||
return ERR_PLUGIN_NOT_INSTALLED;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -69,7 +68,7 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func
|
||||
args.unshift(reject);
|
||||
args.unshift(resolve);
|
||||
} else if (opts.callbackStyle === 'node') {
|
||||
args.push((err, result) => {
|
||||
args.push((err: any, result: any) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
@@ -135,8 +134,8 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
|
||||
}
|
||||
|
||||
function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
||||
let pluginResult, rej;
|
||||
const p = getPromise((resolve, reject) => {
|
||||
let pluginResult: any, rej: Function;
|
||||
const p = getPromise((resolve: Function, reject: Function) => {
|
||||
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
|
||||
rej = reject;
|
||||
});
|
||||
@@ -145,13 +144,13 @@ function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any
|
||||
// to error
|
||||
if (pluginResult && pluginResult.error) {
|
||||
p.catch(() => { });
|
||||
rej(pluginResult.error);
|
||||
typeof rej === 'function' && rej(pluginResult.error);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
||||
return getPromise((resolve, reject) => {
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
const pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
|
||||
if (pluginResult) {
|
||||
if (pluginResult.error) {
|
||||
@@ -178,11 +177,11 @@ 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.constructor.getPluginRef())[opts.clearFunction].call(pluginObj, pluginResult);
|
||||
return callCordovaPlugin(pluginObj, opts.clearFunction, []);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
|
||||
console.error(e);
|
||||
console.warn(e);
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -239,7 +238,7 @@ export function overrideFunction(pluginObj: any, methodName: string, args: any[]
|
||||
* @private
|
||||
*/
|
||||
export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOptions = {}) {
|
||||
return (...args) => {
|
||||
return (...args: any[]) => {
|
||||
if (opts.sync) {
|
||||
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
|
||||
return callCordovaPlugin(pluginObj, methodName, args, opts);
|
||||
@@ -259,7 +258,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOp
|
||||
* @private
|
||||
*/
|
||||
export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) {
|
||||
return (...args) => {
|
||||
return (...args: any[]) => {
|
||||
if (opts.sync) {
|
||||
|
||||
return callInstance(pluginObj, methodName, args, opts);
|
||||
@@ -277,37 +276,30 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
|
||||
return () => {
|
||||
try {
|
||||
if (opts.clearWithArgs) {
|
||||
return pluginObj._objectInstance[opts.clearFunction].apply(pluginObj._objectInstance, args);
|
||||
return callInstance(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||||
}
|
||||
return pluginObj._objectInstance[opts.clearFunction].call(pluginObj, pluginResult);
|
||||
return callInstance(pluginObj, opts.clearFunction, []);
|
||||
} catch (e) {
|
||||
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
|
||||
console.error(e);
|
||||
console.warn(e);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
} else if (opts.otherPromise) {
|
||||
|
||||
return getPromise((resolve, reject) => {
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
let result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
if (result && !result.error) {
|
||||
if (result && !!result.then) {
|
||||
result.then(resolve, reject);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
let pluginResult, rej;
|
||||
const p = getPromise((resolve, reject) => {
|
||||
pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
rej = reject;
|
||||
});
|
||||
if (pluginResult && pluginResult.error) {
|
||||
p.catch(() => { });
|
||||
rej(pluginResult.error);
|
||||
}
|
||||
return p;
|
||||
return getPromise((resolve: Function, reject: Function) => callInstance(pluginObj, methodName, args, opts, resolve, reject));
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
declare var window: any;
|
||||
declare const window: any;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export function get(obj, path) {
|
||||
path = path.split('.');
|
||||
for (let i = 0; i < path.length; i++) {
|
||||
export const get = (element: Element | Window, path: string): any => {
|
||||
const paths: string[] = path.split('.');
|
||||
let obj: any = element;
|
||||
for (let i: number = 0; i < paths.length; i++) {
|
||||
if (!obj) { return null; }
|
||||
obj = obj[path[i]];
|
||||
obj = obj[paths[i]];
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export function getPromise(cb) {
|
||||
export const getPromise = (callback: Function): Promise<any> => {
|
||||
|
||||
const tryNativePromise = () => {
|
||||
if (window.Promise) {
|
||||
return new Promise((resolve, reject) => {
|
||||
cb(resolve, reject);
|
||||
callback(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 2 or on a recent browser.');
|
||||
@@ -29,21 +30,21 @@ export function getPromise(cb) {
|
||||
};
|
||||
|
||||
return tryNativePromise();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param pluginRef
|
||||
* @returns {null|*}
|
||||
*/
|
||||
export function getPlugin(pluginRef: string): any {
|
||||
export const getPlugin = (pluginRef: string): any => {
|
||||
return get(window, pluginRef);
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export const pluginWarn = function(pluginName: string, plugin?: string, method?: string) {
|
||||
export const pluginWarn = (pluginName: string, plugin?: string, method?: string): void => {
|
||||
if (method) {
|
||||
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
|
||||
} else {
|
||||
@@ -59,7 +60,7 @@ export const pluginWarn = function(pluginName: string, plugin?: string, method?:
|
||||
* @param pluginName
|
||||
* @param method
|
||||
*/
|
||||
export const cordovaWarn = function(pluginName: string, method?: string) {
|
||||
export const cordovaWarn = (pluginName: string, method?: string): void => {
|
||||
if (method) {
|
||||
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
||||
} else {
|
||||
|
||||
@@ -51,7 +51,7 @@ export interface ActionSheetOptions {
|
||||
/**
|
||||
* Choose if destructive button will be the last
|
||||
*/
|
||||
destructiveButtonLast: boolean;
|
||||
destructiveButtonLast?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,6 +96,14 @@ export interface AdMobFreeRewardVideoConfig {
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* AdMobFreeBannerConfig
|
||||
* AdMobFreeInterstitialConfig
|
||||
* AdMobFreeRewardVideoConfig
|
||||
* @classes
|
||||
* AdMobFreeBanner
|
||||
* AdMobFreeInterstitial
|
||||
* AdMobFreeRewardVideo
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AdMobFree',
|
||||
@@ -108,9 +116,10 @@ export interface AdMobFreeRewardVideoConfig {
|
||||
export class AdMobFree extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Convenience constructor to get event names
|
||||
* Convenience object to get event names
|
||||
* @type {Object}
|
||||
*/
|
||||
events = {
|
||||
events: any = {
|
||||
BANNER_LOAD: 'admob.banner.events.LOAD',
|
||||
BANNER_LOAD_FAIL: 'admob.banner.events.LOAD_FAIL',
|
||||
BANNER_OPEN: 'admob.banner.events.OPEN',
|
||||
@@ -142,19 +151,19 @@ export class AdMobFree extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the AdMobFreeBanner object
|
||||
* @type {AdMobFreeBanner}
|
||||
*/
|
||||
banner: AdMobFreeBanner = new AdMobFreeBanner();
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the AdMobFreeInterstitial object
|
||||
* @type {AdMobFreeInterstitial}
|
||||
*/
|
||||
interstitial: AdMobFreeInterstitial = new AdMobFreeInterstitial();
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the AdMobFreeRewardVideo object
|
||||
* @type {AdMobFreeRewardVideo}
|
||||
*/
|
||||
rewardVideo: AdMobFreeRewardVideo = new AdMobFreeRewardVideo();
|
||||
@@ -183,28 +192,28 @@ export class AdMobFreeBanner {
|
||||
* Hide the banner.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
hide(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Create banner.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
prepare(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Remove the banner.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
remove(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show the banner.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
show(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -231,21 +240,21 @@ export class AdMobFreeInterstitial {
|
||||
* Check if interstitial is ready
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
isReady(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Prepare interstitial
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
prepare(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show the interstitial
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
show(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -272,21 +281,21 @@ export class AdMobFreeRewardVideo {
|
||||
* Check if reward video is ready
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
isReady(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Prepare reward video
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
prepare(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show the reward video
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
show(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -93,6 +93,8 @@ export interface AdExtras {
|
||||
* @name AdMob
|
||||
* @description
|
||||
* Plugin for Google Ads, including AdMob / DFP (doubleclick for publisher) and mediations to other Ad networks.
|
||||
*
|
||||
* IMPORTANT NOTICE: this plugin takes a percentage out of your earnings if you profit more than $1,000. Read more about this on the plugin's repo. For a completely free alternative, see [AdMob Free](../admob-free).
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AdMob } from '@ionic-native/admob';
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
|
||||
|
||||
export interface AlipayOrder {
|
||||
/**
|
||||
* appId assigned by Alipay
|
||||
@@ -100,7 +102,7 @@ export interface AlipayOrder {
|
||||
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'
|
||||
install: 'ionic cordova plugin add https://github.com/xueron/cordova-alipay-base --variable APP_ID=your_app_id'
|
||||
})
|
||||
@Injectable()
|
||||
export class Alipay extends IonicNativePlugin {
|
||||
|
||||
@@ -36,7 +36,7 @@ import { Injectable } from '@angular/core';
|
||||
@Injectable()
|
||||
export class AndroidPermissions extends IonicNativePlugin {
|
||||
|
||||
PERMISSION: {
|
||||
PERMISSION: any = {
|
||||
ACCESS_CHECKIN_PROPERTIES: 'android.permission.ACCESS_CHECKIN_PROPERTIES',
|
||||
ACCESS_COARSE_LOCATION: 'android.permission.ACCESS_COARSE_LOCATION',
|
||||
ACCESS_FINE_LOCATION: 'android.permission.ACCESS_FINE_LOCATION',
|
||||
@@ -199,13 +199,21 @@ export class AndroidPermissions extends IonicNativePlugin {
|
||||
@Cordova()
|
||||
checkPermission(permission: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Request permission
|
||||
* @param permission {string} The name of the permission to request
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
requestPermission(permission: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Request permissions
|
||||
* @param permissions {array} An array with permissions
|
||||
* @param permissions {Array<string>} An array with permissions
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
requestPermissions(permissions: string): Promise<any> { return; }
|
||||
requestPermissions(permissions: string[]): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* This function still works now, will not support in the future.
|
||||
|
||||
@@ -108,14 +108,16 @@ export class AppPreferences extends IonicNativePlugin {
|
||||
* @returns {Object} Custom object, bound to that suite
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
suite(suiteName: string): Object { return; }
|
||||
suite(suiteName: string): any { return; }
|
||||
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
platforms: ['iOS'],
|
||||
sync: true
|
||||
})
|
||||
iosSuite(suiteName: string): Object { return; }
|
||||
iosSuite(suiteName: string): any { return; }
|
||||
|
||||
/**
|
||||
* Return cloud synchronized configuration context
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
declare var window;
|
||||
|
||||
export interface AppRatePreferences {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
declare var window;
|
||||
|
||||
|
||||
export interface BackgroundFetchConfig {
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window;
|
||||
|
||||
export interface BackgroundGeolocationResponse {
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,7 +112,7 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
/**
|
||||
* Override the default title, ticker and text.
|
||||
* Available only for Android platform.
|
||||
* @param {Configure} options List of option to configure. See table below
|
||||
* @param {BackgroundModeConfiguration} options List of option to configure. See table below
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
@@ -122,12 +122,13 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
/**
|
||||
* Modify the displayed information.
|
||||
* Available only for Android platform.
|
||||
* @param {Configure} options Any options you want to update. See table below.
|
||||
* @param {BackgroundModeConfiguration} options Any options you want to update. See table below.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
configure(options?: BackgroundModeConfiguration): Promise<any> { return; }
|
||||
configure(options?: BackgroundModeConfiguration): void {}
|
||||
|
||||
/**
|
||||
* Listen for events that the plugin fires. Available events are `enable`, `disable`, `activate`, `deactivate` and `failure`.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
export interface BarcodeScannerOptions {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
/**
|
||||
* @name Brightness
|
||||
* @description
|
||||
|
||||
@@ -109,8 +109,8 @@ interface LocalPackage_Static {
|
||||
}
|
||||
/* tslint:enable */
|
||||
|
||||
declare var RemotePackage: RemotePackage_Static;
|
||||
declare var LocalPackage: LocalPackage_Static;
|
||||
declare const RemotePackage: RemotePackage_Static;
|
||||
declare const LocalPackage: LocalPackage_Static;
|
||||
|
||||
/**
|
||||
* Defines the JSON format of the current package information file.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var window: any,
|
||||
declare const 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';
|
||||
@@ -49,6 +49,7 @@ export interface IContactProperties {
|
||||
|
||||
/** An array of web pages associated with the contact. */
|
||||
urls?: IContactField[];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,6 +72,8 @@ export class Contact implements IContactProperties {
|
||||
@InstanceProperty categories: IContactField[];
|
||||
@InstanceProperty urls: IContactField[];
|
||||
|
||||
[key: string]: any;
|
||||
|
||||
constructor() {
|
||||
if (checkAvailability('navigator.contacts', 'create', 'Contacts') === true) {
|
||||
this._objectInstance = navigator.contacts.create();
|
||||
@@ -92,8 +95,8 @@ export class Contact implements IContactProperties {
|
||||
|
||||
@InstanceCheck()
|
||||
save(): Promise<any> {
|
||||
return getPromise((resolve, reject) => {
|
||||
this._objectInstance.save((contact) => {
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
this._objectInstance.save((contact: any) => {
|
||||
this._objectInstance = contact;
|
||||
resolve(this);
|
||||
}, reject);
|
||||
@@ -114,7 +117,7 @@ export interface IContactError {
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export declare var ContactError: {
|
||||
export declare const ContactError: {
|
||||
new (code: number): IContactError;
|
||||
UNKNOWN_ERROR: number;
|
||||
INVALID_ARGUMENT_ERROR: number;
|
||||
@@ -312,8 +315,8 @@ export class Contacts extends IonicNativePlugin {
|
||||
*/
|
||||
@CordovaCheck()
|
||||
find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
|
||||
return getPromise((resolve, reject) => {
|
||||
navigator.contacts.find(fields, (contacts) => {
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
navigator.contacts.find(fields, (contacts: any[]) => {
|
||||
resolve(contacts.map(processContact));
|
||||
}, reject, options);
|
||||
});
|
||||
@@ -325,8 +328,8 @@ export class Contacts extends IonicNativePlugin {
|
||||
*/
|
||||
@CordovaCheck()
|
||||
pickContact(): Promise<Contact> {
|
||||
return getPromise((resolve, reject) => {
|
||||
navigator.contacts.pickContact((contact) => resolve(processContact(contact)), reject);
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
navigator.contacts.pickContact((contact: any) => resolve(processContact(contact)), reject);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -335,7 +338,7 @@ export class Contacts extends IonicNativePlugin {
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
function processContact(contact) {
|
||||
function processContact(contact: any) {
|
||||
let newContact = new Contact();
|
||||
for (let prop in contact) {
|
||||
if (typeof contact[prop] === 'function') continue;
|
||||
|
||||
@@ -79,7 +79,7 @@ export interface DeeplinkMatch {
|
||||
pluginRef: 'IonicDeeplink',
|
||||
repo: 'https://github.com/driftyco/ionic-plugin-deeplinks',
|
||||
platforms: ['iOS', 'Android', 'Browser'],
|
||||
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 cordova 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()
|
||||
@@ -88,7 +88,7 @@ export class Deeplinks extends IonicNativePlugin {
|
||||
/**
|
||||
* Define a set of paths to match against incoming deeplinks.
|
||||
*
|
||||
* @param {paths} Define a set of paths to match against incoming deeplinks.
|
||||
* @param {paths} paths Define a set of paths to match against incoming deeplinks.
|
||||
* paths takes an object of the form { 'path': data }. If a deeplink
|
||||
* matches the path, the resulting path-data pair will be returned in the
|
||||
* promise result which you can then use to navigate in the app as you see fit.
|
||||
@@ -98,7 +98,7 @@ export class Deeplinks extends IonicNativePlugin {
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
route(paths): Observable<DeeplinkMatch> { return; }
|
||||
route(paths: any): Observable<DeeplinkMatch> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -110,17 +110,19 @@ export class Deeplinks extends IonicNativePlugin {
|
||||
* This handler will automatically navigate when a route matches. If you need finer-grained
|
||||
* control over the behavior of a matching deeplink, use the plain `route` method.
|
||||
*
|
||||
* @param {paths} Define a set of paths to match against incoming deeplinks.
|
||||
* @param {Nav} navController Define a set of paths to match against incoming deeplinks.
|
||||
* paths takes an object of the form { 'path': data }. If a deeplink
|
||||
* matches the path, the resulting path-data pair will be returned in the
|
||||
* promise result which you can then use to navigate in the app as you see fit.
|
||||
*
|
||||
* @param {Object} paths
|
||||
*
|
||||
* @returns {Observable<DeeplinkMatch>} Returns an Observable that resolves each time a deeplink comes through, and
|
||||
* errors if a deeplink comes through that does not match a given path.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
|
||||
routeWithNavController(navController: any, paths: any): Observable<DeeplinkMatch> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var window: any;
|
||||
declare const window: any;
|
||||
|
||||
/**
|
||||
* @name Device
|
||||
|
||||
@@ -75,7 +75,7 @@ export class Dialogs extends IonicNativePlugin {
|
||||
successIndex: 1,
|
||||
errorIndex: 4
|
||||
})
|
||||
confirm(message, title?: string, buttonLabels?: string[]): Promise<number> { return; }
|
||||
confirm(message: string, title?: string, buttonLabels?: string[]): Promise<number> { return; }
|
||||
|
||||
/**
|
||||
* Displays a native dialog box that is more customizable than the browser's prompt function.
|
||||
|
||||
@@ -42,10 +42,11 @@ export interface DocumentViewerOptions {
|
||||
* constructor(private document: DocumentViewer) { }
|
||||
*
|
||||
* ...
|
||||
* const options = {
|
||||
* const options: DocumentViewerOptions = {
|
||||
* title: 'My PDF'
|
||||
* }
|
||||
* this.document.view('assets/myFile.pdf', 'application/pdf', options)
|
||||
*
|
||||
* this.document.viewDocument('assets/myFile.pdf', 'application/pdf', options)
|
||||
*
|
||||
* ```
|
||||
*
|
||||
@@ -82,7 +83,7 @@ export class DocumentViewer extends IonicNativePlugin {
|
||||
* @param [onError] {Function}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
canViewDocument(url: string, contentType: string, options: Array<DocumentViewerOptions>, onPossible?: Function, onMissingApp?: Function, onImpossible?: Function, onError?: Function): void { }
|
||||
canViewDocument(url: string, contentType: string, options: DocumentViewerOptions, onPossible?: Function, onMissingApp?: Function, onImpossible?: Function, onError?: Function): void { }
|
||||
|
||||
/**
|
||||
* Opens the file
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var cordova: any;
|
||||
interface Cordova {
|
||||
plugins: CordovaPlugins & { email: any };
|
||||
}
|
||||
|
||||
declare const cordova: Cordova;
|
||||
|
||||
export interface EmailComposerOptions {
|
||||
|
||||
@@ -88,7 +92,7 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
isAvailable(app?: string): Promise<any> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
if (app) {
|
||||
cordova.plugins.email.isAvailable(app, (isAvailable) => {
|
||||
cordova.plugins.email.isAvailable(app, (isAvailable: boolean) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
@@ -96,7 +100,7 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cordova.plugins.email.isAvailable((isAvailable) => {
|
||||
cordova.plugins.email.isAvailable((isAvailable: boolean) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
|
||||
@@ -43,7 +43,7 @@ export interface FacebookLoginResponse {
|
||||
* Then type in the following command in your Terminal, where APP_ID and APP_NAME are the values from the Facebook Developer portal.
|
||||
*
|
||||
* ```bash
|
||||
* ionic plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"
|
||||
* ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"
|
||||
* ```
|
||||
*
|
||||
* After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings:
|
||||
@@ -114,7 +114,7 @@ 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 cordova plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"',
|
||||
installVariables: ['APP_ID', 'APP_NAME'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface NotificationData {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FCM } from 'ionic-native';
|
||||
* import { FCM } from '@ionic-native/fcm';
|
||||
*
|
||||
* constructor(private fcm: FCM) {}
|
||||
*
|
||||
@@ -38,7 +38,7 @@ export interface NotificationData {
|
||||
* })
|
||||
*
|
||||
* fcm.onNotification().subscribe(data=>{
|
||||
* if(data.wasPressed){
|
||||
* if(data.wasTapped){
|
||||
* console.log("Received in background");
|
||||
* } else {
|
||||
* console.log("Received in foreground");
|
||||
|
||||
@@ -23,7 +23,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FileChooser',
|
||||
plugin: 'http://github.com/don/cordova-filechooser.git',
|
||||
plugin: 'https://github.com/don/cordova-filechooser.git',
|
||||
pluginRef: 'fileChooser',
|
||||
repo: 'https://github.com/don/cordova-filechooser',
|
||||
platforms: ['Android']
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var window: any;
|
||||
declare const window: any;
|
||||
|
||||
/**
|
||||
* @name File Path
|
||||
|
||||
@@ -2,11 +2,37 @@ import { Injectable } from '@angular/core';
|
||||
import { CordovaProperty, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
export interface IFile extends Blob {
|
||||
lastModified: number;
|
||||
lastModifiedDate: number;
|
||||
/**
|
||||
* Name of the file, without path information
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Last modified date
|
||||
*/
|
||||
lastModified: number;
|
||||
/**
|
||||
* Last modified date
|
||||
*/
|
||||
lastModifiedDate: number;
|
||||
/**
|
||||
* Size in bytes
|
||||
*/
|
||||
size: number;
|
||||
/**
|
||||
* File mime type
|
||||
*/
|
||||
type: string;
|
||||
localURL: string;
|
||||
start: number;
|
||||
end: number;
|
||||
/**
|
||||
* Returns a "slice" of the file. Since Cordova Files don't contain the actual
|
||||
* content, this really returns a File with adjusted start and end.
|
||||
* Slices of slices are supported.
|
||||
* @param start {Number} The index at which to start the slice (inclusive).
|
||||
* @param end {Number} The index at which to end the slice (exclusive).
|
||||
*/
|
||||
slice(start: number, end: number): Blob;
|
||||
}
|
||||
|
||||
export interface LocalFileSystem {
|
||||
@@ -85,6 +111,11 @@ export interface FileSystem {
|
||||
* @readonly
|
||||
*/
|
||||
root: DirectoryEntry;
|
||||
|
||||
toJSON(): string;
|
||||
|
||||
encodeURIPath(path: string): string;
|
||||
|
||||
}
|
||||
|
||||
export interface Entry {
|
||||
@@ -106,6 +137,14 @@ export interface Entry {
|
||||
*/
|
||||
getMetadata(successCallback: MetadataCallback, errorCallback?: ErrorCallback): void;
|
||||
|
||||
/**
|
||||
* Set the metadata of the entry.
|
||||
* @param successCallback {Function} is called with a Metadata object
|
||||
* @param errorCallback {Function} is called with a FileError
|
||||
* @param metadataObject {Metadata} keys and values to set
|
||||
*/
|
||||
setMetadata(successCallback: MetadataCallback, errorCallback: ErrorCallback, metadataObject: Metadata): void;
|
||||
|
||||
/**
|
||||
* The name of the entry, excluding the path leading to it.
|
||||
*/
|
||||
@@ -121,6 +160,11 @@ export interface Entry {
|
||||
*/
|
||||
filesystem: FileSystem;
|
||||
|
||||
/**
|
||||
* an alternate URL which can be used by native webview controls, for example media players.
|
||||
*/
|
||||
nativeURL: string;
|
||||
|
||||
/**
|
||||
* Move an entry to a different location on the file system. It is an error to try to:
|
||||
*
|
||||
@@ -159,6 +203,12 @@ export interface Entry {
|
||||
*/
|
||||
toURL(): string;
|
||||
|
||||
/**
|
||||
* Return a URL that can be passed across the bridge to identify this entry.
|
||||
* @return string URL that can be passed across the bridge to identify this entry
|
||||
*/
|
||||
toInternalURL(): string;
|
||||
|
||||
/**
|
||||
* Deletes a file or directory. It is an error to attempt to delete a directory that is not empty. It is an error to attempt to delete the root directory of a filesystem.
|
||||
* @param successCallback A callback that is called on success.
|
||||
@@ -234,6 +284,8 @@ export interface DirectoryEntry extends Entry {
|
||||
* </ul>
|
||||
*/
|
||||
export interface DirectoryReader {
|
||||
localURL: string;
|
||||
hasReadEntries: boolean;
|
||||
/**
|
||||
* Read the next block of entries from this directory.
|
||||
* @param successCallback Called once per successful call to readEntries to deliver the next previously-unreported set of Entries in the associated Directory. If all Entries have already been returned from previous invocations of readEntries, successCallback must be called with a zero-length array as an argument.
|
||||
@@ -348,6 +400,7 @@ export interface RemoveResult {
|
||||
fileRemoved: Entry;
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
export declare class FileSaver extends EventTarget {
|
||||
/**
|
||||
* When the FileSaver constructor is called, the user agent must return a new FileSaver object with readyState set to INIT.
|
||||
@@ -437,6 +490,7 @@ export declare class FileSaver extends EventTarget {
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
* This interface expands on the FileSaver interface to allow for multiple write actions, rather than just saving a single Blob.
|
||||
*/
|
||||
export declare class FileWriter extends FileSaver {
|
||||
@@ -476,6 +530,7 @@ export interface IWriteOptions {
|
||||
truncate?: number; // if present, number of bytes to truncate file to before writing
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
export declare class FileError {
|
||||
constructor(code: number);
|
||||
static NOT_FOUND_ERR: number;
|
||||
@@ -495,10 +550,12 @@ export declare class FileError {
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
export declare class FileReader {
|
||||
static EMPTY: number;
|
||||
static LOADING: number;
|
||||
static DONE: number;
|
||||
static READ_CHUNK_SIZE: number;
|
||||
|
||||
readyState: number; // see constants in var declaration below
|
||||
error: Error;
|
||||
@@ -517,6 +574,11 @@ export declare class FileReader {
|
||||
readAsBinaryString(fe: IFile): void;
|
||||
readAsArrayBuffer(fe: IFile): void;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
[key: string]: any;
|
||||
|
||||
}
|
||||
|
||||
interface Window extends LocalFileSystem {}
|
||||
@@ -546,12 +608,18 @@ declare const window: Window;
|
||||
* The (now-defunct) Directories and System extensions Latest: http: //www.w3.org/TR/2012/WD-file-system-api-20120417/
|
||||
* Although most of the plugin code was written when an earlier spec was current: http: //www.w3.org/TR/2011/WD-file-system-api-20110419/
|
||||
* It also implements the FileWriter spec : http: //dev.w3.org/2009/dap/file-system/file-writer.html
|
||||
* @interfaces
|
||||
* IFile
|
||||
* Entry
|
||||
* DirectoryEntry
|
||||
* DirectoryReader
|
||||
* FileSystem
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'File',
|
||||
plugin: 'cordova-plugin-file',
|
||||
pluginRef: 'cordova.file',
|
||||
repo: 'https: //github.com/apache/cordova-plugin-file',
|
||||
repo: 'https://github.com/apache/cordova-plugin-file',
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'OS X', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
})
|
||||
@Injectable()
|
||||
@@ -630,7 +698,7 @@ export class File extends IonicNativePlugin {
|
||||
@CordovaProperty
|
||||
sharedDirectory: string;
|
||||
|
||||
cordovaFileError: {} = {
|
||||
cordovaFileError: any = {
|
||||
1: 'NOT_FOUND_ERR',
|
||||
2: 'SECURITY_ERR',
|
||||
3: 'ABORT_ERR',
|
||||
|
||||
@@ -72,6 +72,9 @@ export interface FlurryAnalyticsLocation {
|
||||
horizontalAccuracy?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export class FlurryAnalyticsObject {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, CordovaFunctionOverride, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window: any;
|
||||
declare const window: any;
|
||||
|
||||
/**
|
||||
* @name Geofence
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var navigator: any;
|
||||
declare const navigator: any;
|
||||
|
||||
export interface Coordinates {
|
||||
|
||||
@@ -174,7 +174,7 @@ export class Geolocation extends IonicNativePlugin {
|
||||
* Observable changes.
|
||||
*
|
||||
* ```typescript
|
||||
* var subscription = this.geolocation.watchPosition()
|
||||
* const subscription = this.geolocation.watchPosition()
|
||||
* .filter((p) => p.coords !== undefined) //Filter Out Errors
|
||||
* .subscribe(position => {
|
||||
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var window;
|
||||
|
||||
/**
|
||||
* @name Google Analytics
|
||||
* @description
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Cordova, CordovaInstance, CordovaCheck, Plugin, InstanceProperty, Insta
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/fromEvent';
|
||||
|
||||
declare var plugin: any;
|
||||
declare const plugin: any;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
@@ -853,14 +853,14 @@ export class Marker {
|
||||
|
||||
/**
|
||||
* Set the marker position.
|
||||
* @param latLng {GoogleMapLatLng}
|
||||
* @param latLng {LatLng}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setPosition(latLng: LatLng): void { return; }
|
||||
|
||||
/**
|
||||
* Return the marker position.
|
||||
* @return {Promise<GoogleMapLatLng>}
|
||||
* @return {Promise<LatLng>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getPosition(): Promise<LatLng> { return; }
|
||||
@@ -1473,7 +1473,7 @@ export class GroundOverlay {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<any>(
|
||||
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
|
||||
(resolve: Function) => this._objectInstance.addListenerOnce(eventName, resolve)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1766,7 +1766,7 @@ export class Geocoder {
|
||||
*/
|
||||
@CordovaCheck()
|
||||
geocode(request: GeocoderRequest): Promise<GeocoderResult[] | any> {
|
||||
return new Promise<GeocoderResult[]>(resolve => {
|
||||
return new Promise<GeocoderResult[]>((resolve: Function) => {
|
||||
plugin.google.maps.Geocoder.geocode(request, resolve);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
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 cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid',
|
||||
installVariables: ['REVERSED_CLIENT_ID']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
declare var navigator: any;
|
||||
declare const navigator: any;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var cordova: any;
|
||||
declare const cordova: any;
|
||||
|
||||
export interface Beacon {
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, CordovaInstance, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Plugin, CordovaInstance, InstanceCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/fromEvent';
|
||||
import { Observer } from 'rxjs/Observer';
|
||||
|
||||
declare var cordova: any;
|
||||
declare const cordova: Cordova & { InAppBrowser: any; };
|
||||
|
||||
export interface InAppBrowserOptions {
|
||||
/** Set to yes or no to turn the InAppBrowser's location bar on or off. */
|
||||
@@ -48,6 +48,11 @@ export interface InAppBrowserOptions {
|
||||
/** (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';
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
export interface InAppBrowserEvent extends Event {
|
||||
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
|
||||
@@ -80,12 +85,18 @@ export class InAppBrowserObject {
|
||||
*/
|
||||
constructor(url: string, target?: string, options?: string | InAppBrowserOptions) {
|
||||
try {
|
||||
if (options && typeof options !== 'string')
|
||||
options = Object.keys(options).map(key => `${key}=${options[key]}`).join(',');
|
||||
|
||||
if (options && typeof options !== 'string') {
|
||||
options = Object.keys(options).map((key: string) => `${key}=${(<InAppBrowserOptions>options)[key]}`).join(',');
|
||||
}
|
||||
|
||||
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
|
||||
|
||||
} catch (e) {
|
||||
window.open(url);
|
||||
|
||||
window.open(url, target);
|
||||
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,8 +141,12 @@ export class InAppBrowserObject {
|
||||
* @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.
|
||||
*/
|
||||
@InstanceCheck()
|
||||
on(event: string): Observable<InAppBrowserEvent> {
|
||||
return Observable.fromEvent(this._objectInstance, event);
|
||||
return new Observable<InAppBrowserEvent>((observer: Observer<InAppBrowserEvent>) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
declare var window: any;
|
||||
declare const window: any;
|
||||
|
||||
export interface IntelSecurityDataOptions {
|
||||
/** Non-empty string. **/
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var cordova: any;
|
||||
declare const cordova: any;
|
||||
|
||||
/**
|
||||
* @name Jins Meme
|
||||
|
||||
@@ -52,8 +52,8 @@ export type LinkedInLoginScopes = 'r_basicprofile' | 'r_emailaddress' | 'rw_comp
|
||||
pluginName: 'LinkedIn',
|
||||
plugin: 'cordova-plugin-linkedin',
|
||||
pluginRef: 'cordova.plugins.LinkedIn',
|
||||
repo: 'https://github.com/zyramedia/cordova-plugin-linkedin',
|
||||
install: 'ionic plugin add cordova-plugin-linkedin --variable APP_ID=YOUR_APP_ID',
|
||||
repo: 'https://github.com/zyra/cordova-plugin-linkedin',
|
||||
install: 'ionic cordova plugin add cordova-plugin-linkedin --variable APP_ID=YOUR_APP_ID',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
@@ -100,10 +100,17 @@ export class LinkedIn extends IonicNativePlugin {
|
||||
openProfile(memberId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if there is already an existing active session. This should be used to avoid unecessary login.
|
||||
* Checks if there is already an existing active session. This should be used to avoid unnecessary login.
|
||||
* @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates whether there is an active session
|
||||
*/
|
||||
@Cordova()
|
||||
hasActiveSession(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if there is an active session and returns the access token if it exists.
|
||||
* @return {Promise<any>} returns a promise that resolves with an object that contains an access token if there is an active session
|
||||
*/
|
||||
@Cordova()
|
||||
getActiveSession(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var navigator: any;
|
||||
declare const navigator: any;
|
||||
|
||||
export interface MediaFile {
|
||||
/**
|
||||
@@ -33,7 +33,7 @@ export interface MediaFile {
|
||||
* @param {Function} successCallback
|
||||
* @param {Function} errorCallback
|
||||
*/
|
||||
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any);
|
||||
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any): void;
|
||||
}
|
||||
|
||||
export interface MediaFileData {
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var Media: any;
|
||||
import { CordovaInstance, Plugin, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare const Media: any;
|
||||
// TODO for ionic native 4.x ... rename plugin class to Media and use Media.getPlugin() to retrieve the original media object
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export class MediaObject {
|
||||
|
||||
/**
|
||||
* Open a media file
|
||||
* @param src {string} A URI containing the audio content.
|
||||
* @param onStatusUpdate {Function} A callback function to be invoked when the status of the file changes
|
||||
*/
|
||||
constructor(private _objectInstance: any) {}
|
||||
|
||||
/**
|
||||
@@ -34,17 +29,13 @@ export class MediaObject {
|
||||
* Get the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1.
|
||||
* @returns {number} Returns a promise with the duration of the current recording
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
@CordovaInstance({ sync: true })
|
||||
getDuration(): number { return; }
|
||||
|
||||
/**
|
||||
* Starts or resumes playing an audio file.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
@CordovaInstance({ sync: true })
|
||||
play(iosOptions?: {
|
||||
numberOfLoops?: number,
|
||||
playAudioWhenScreenIsLocked?: boolean
|
||||
@@ -53,75 +44,57 @@ export class MediaObject {
|
||||
/**
|
||||
* Pauses playing an audio file.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
@CordovaInstance({ sync: true })
|
||||
pause(): void { }
|
||||
|
||||
/**
|
||||
* Releases the underlying operating system's audio resources. This is particularly important for Android, since there are a finite amount of OpenCore instances for media playback. Applications should call the release function for any Media resource that is no longer needed.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
@CordovaInstance({ sync: true })
|
||||
release(): void { }
|
||||
|
||||
/**
|
||||
* Sets the current position within an audio file.
|
||||
* @param {number} milliseconds The time position you want to set for the current audio file
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
@CordovaInstance({ sync: true })
|
||||
seekTo(milliseconds: number): void { }
|
||||
|
||||
/**
|
||||
* Set the volume for an audio file.
|
||||
* @param volume {number} The volume to set for playback. The value must be within the range of 0.0 to 1.0.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
@CordovaInstance({ sync: true })
|
||||
setVolume(volume: number): void { }
|
||||
|
||||
/**
|
||||
* Starts recording an audio file.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
@CordovaInstance({ sync: true })
|
||||
startRecord(): void { }
|
||||
|
||||
/**
|
||||
* Stops recording
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
@CordovaInstance({ sync: true })
|
||||
stopRecord(): void { }
|
||||
|
||||
/**
|
||||
* Pauses recording
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
@CordovaInstance({ sync: true })
|
||||
pauseRecord(): void { }
|
||||
|
||||
/**
|
||||
* Resumes recording
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
@CordovaInstance({ sync: true })
|
||||
resumeRecord(): void { }
|
||||
|
||||
/**
|
||||
* Stops playing an audio file.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
@CordovaInstance({ sync: true })
|
||||
stop(): void { }
|
||||
|
||||
}
|
||||
@@ -169,7 +142,7 @@ export type MediaErrorCallback = (error: MediaError) => void;
|
||||
* window.setTimeout(() => file.stopRecord(), 10000);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* You can find the reasons here: https://github.com/driftyco/ionic-native/issues/1452#issuecomment-299605906
|
||||
*
|
||||
* @usage
|
||||
@@ -292,15 +265,19 @@ export class MediaPlugin extends IonicNativePlugin {
|
||||
* @param [onError] {MediaErrorCallback} A callback function is be invoked if an error occurs.
|
||||
* @return {MediaObject}
|
||||
*/
|
||||
@CordovaCheck()
|
||||
create(src: string,
|
||||
onStatusUpdate?: MediaStatusUpdateCallback,
|
||||
onSuccess?: Function,
|
||||
onError?: MediaErrorCallback): MediaObject {
|
||||
|
||||
let instance: any;
|
||||
|
||||
if (checkAvailability(MediaPlugin.getPluginRef(), null, MediaPlugin.getPluginName()) === true) {
|
||||
// Creates a new media object
|
||||
const instance = new Media(src, onSuccess, onError, onStatusUpdate);
|
||||
return new MediaObject(instance);
|
||||
instance = new Media(src, onSuccess, onError, onStatusUpdate);
|
||||
}
|
||||
|
||||
return new MediaObject(instance);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,14 @@ export class Mixpanel extends IonicNativePlugin {
|
||||
@Cordova()
|
||||
reset(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param eventName {string}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
timeEvent(eventName: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param eventName {string}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Native Geocoder
|
||||
* @description
|
||||
* Cordova plugin for native forward and reverse geocoding
|
||||
|
||||
244
src/@ionic-native/plugins/native-keyboard/index.ts
Normal file
244
src/@ionic-native/plugins/native-keyboard/index.ts
Normal file
@@ -0,0 +1,244 @@
|
||||
import { Plugin, IonicNativePlugin, Cordova } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
export interface NativeKeyboardOptions {
|
||||
|
||||
/**
|
||||
* A function invoked when the user submits his input. Receives the text as a single property. Make sure your page is UTF-8 encoded so Chinese and Emoji are rendered OK.
|
||||
*/
|
||||
onSubmit: Function;
|
||||
|
||||
/**
|
||||
* A function invoked when the keyboard is about to pop up. Receives the height as a single property. (iOS only)
|
||||
*/
|
||||
onKeyboardWillShow: Function;
|
||||
|
||||
/**
|
||||
* A function invoked when the keyboard popped up. Receives the height as a single property.
|
||||
*/
|
||||
onKeyboardDidShow: Function;
|
||||
|
||||
/**
|
||||
* A function invoked when the keyboard is about to close. (iOS only)
|
||||
*/
|
||||
onKeyboardWillHide: Function;
|
||||
|
||||
/**
|
||||
* A function invoked when the keyboard closed.
|
||||
*/
|
||||
onKeyboardDidHide: Function;
|
||||
|
||||
/**
|
||||
* A function invoked when any key is pressed, sends the entire text as response.
|
||||
*/
|
||||
onTextChanged: Function;
|
||||
|
||||
/**
|
||||
* Highly recommended to pass in if you want to replicate the behavior of the video's above (scroll down when the keyboard opens). Pass in the scrollable DOM element containing the messages.
|
||||
*/
|
||||
autoscrollElement: HTMLElement;
|
||||
|
||||
/**
|
||||
* If `autoscrollElement` was set you can also make the list scroll down initially, when the messenger bar (without the keyboard popping up) is shown.
|
||||
*/
|
||||
scrollToBottomAfterMessengerShows: boolean;
|
||||
|
||||
/**
|
||||
* Setting this to `true` is like the video's above: the keyboard doesn't close upon submit. Defaults to `false`.
|
||||
*/
|
||||
keepOpenAfterSubmit: boolean;
|
||||
|
||||
/**
|
||||
* Makes the messenger bar slide in from the bottom. Defaults to `false`.
|
||||
*/
|
||||
animated: boolean;
|
||||
|
||||
/**
|
||||
* Open the keyboard when showing the messenger. Defaults to `false`.
|
||||
*/
|
||||
showKeyboard: boolean;
|
||||
|
||||
/**
|
||||
* The default text set in the messenger input bar.
|
||||
*/
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* The color of the typed text. Defaults to `#444444`.
|
||||
*/
|
||||
textColor: string;
|
||||
|
||||
/**
|
||||
* Like a regular HTML input placeholder.
|
||||
*/
|
||||
placeholder: string;
|
||||
|
||||
/**
|
||||
* The color of the placeholder text. Defaults to `#CCCCCC`.
|
||||
*/
|
||||
placeholderColor: string;
|
||||
|
||||
/**
|
||||
* The background color of the messenger bar. Defaults to `#F6F6F6`.
|
||||
*/
|
||||
backgroundColor: string;
|
||||
|
||||
/**
|
||||
* The background color of the textview. Looks nicest on Android if it's the same color as the `backgroundColor` property. Defaults to `#F6F6F6`.
|
||||
*/
|
||||
textViewBackgroundColor: string;
|
||||
|
||||
/**
|
||||
* The border color of the textview. Defaults to `#666666`. (iOS only)
|
||||
*/
|
||||
textViewBorderColor: string;
|
||||
|
||||
/**
|
||||
* Setting this > 0 will make a counter show up on iOS (and ignore superfluous input on Android, for now)
|
||||
*/
|
||||
maxChars: number;
|
||||
|
||||
/**
|
||||
* Options are: `"none"`, `"split"`, `"countdown"`, `"countdownreversed"`. Note that if `maxChars` is set, `"none"` will still show a counter. Defaults to `"none"`. (iOS only)
|
||||
*/
|
||||
counterStyle: string;
|
||||
|
||||
/**
|
||||
* Options are: "default", "decimalpad", "phonepad", "numberpad", "namephonepad", "number", "email", "twitter", "url", "alphabet", "search", "ascii". (iOS only)
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* Options are: "light", "dark". (iOS only)
|
||||
*/
|
||||
appearance: string;
|
||||
|
||||
/**
|
||||
* Disables things like the Emoji keyboard and the Predicive text entry bar (iOS only)
|
||||
*/
|
||||
secure: boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
leftButton: NativeKeyboardLeftButton;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
rightButton: NativeKeyboardButton;
|
||||
|
||||
}
|
||||
|
||||
export interface NativeKeyboardButton {
|
||||
/**
|
||||
* Either "text" (Android only currently), "fontawesome" or "ionicon".
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* Depends on the type. Examples: for "text" use "Send", for "fontawesome" use "fa-battery-quarter", for "ionicon" use "\uf48a" (go to http://ionicons.com, right-click and inspect the icon and use the value you find in :before). Note that some fonticons are not supported as the embedded fonts in the plugin may lag behind a little. So try one of the older icons first.
|
||||
*/
|
||||
value: string;
|
||||
/**
|
||||
* If type is "text" you can set this to either "normal", "bold" or "italic".
|
||||
*/
|
||||
textStyle: string;
|
||||
/**
|
||||
* A function invoked when the button is pressed. Use this button to prompt the user what he wants to do next by for instance rendering an ActionSheet.
|
||||
*/
|
||||
onPress: Function;
|
||||
}
|
||||
|
||||
export interface NativeKeyboardLeftButton extends NativeKeyboardButton {
|
||||
/**
|
||||
* Set to `true` to disable the button once text has been entered.
|
||||
*/
|
||||
disabledWhenTextEntered: boolean;
|
||||
}
|
||||
|
||||
export interface NativeKeyboardUpdateMessengerOptions {
|
||||
/**
|
||||
* Replace the messenger's text by this. The current text remains if omitted.
|
||||
*/
|
||||
text: string;
|
||||
/**
|
||||
* Position the cursor anywhere in the text range. Defaults to the end of the text.
|
||||
*/
|
||||
caretIndex: number;
|
||||
/**
|
||||
* If `false` or omitted no changes to the keyboard state are made.
|
||||
*/
|
||||
showKeyboard: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Native Keyboard
|
||||
* @description
|
||||
* A cross platform WhatsApp / Messenger / Slack -style keyboard even. For your Cordova app.
|
||||
*
|
||||
*
|
||||
* IMPORTANT NOTICE: this plugin is paid, please read more about this at the [plugin's repo](https://github.com/EddyVerbruggen/cordova-plugin-native-keyboard#i-like-it-hook-me-up).
|
||||
*
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { NativeKeyboard } from '@ionic-native/native-keyboard';
|
||||
*
|
||||
*
|
||||
* constructor(private nativeKeyboard: NativeKeyboard) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* NativeKeyboardOptions
|
||||
* NativeKeyboardButton
|
||||
* NativeKeyboardLeftButton
|
||||
* NativeKeyboardUpdateMessengerOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'NativeKeyboard',
|
||||
plugin: 'cordova-plugin-native-keyboard',
|
||||
pluginRef: 'NativeKeyboard',
|
||||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-native-keyboard',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class NativeKeyboard extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Show messenger
|
||||
* @param options {NativeKeyboardOptions}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
showMessenger(options: NativeKeyboardOptions): void {}
|
||||
|
||||
/**
|
||||
* Hide messenger
|
||||
* @param options {NativeKeyboardOptions}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
hideMessenger(options: NativeKeyboardOptions): void {}
|
||||
|
||||
/**
|
||||
* Programmatically pop up the keyboard again if the user dismissed it.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
showMessengerKeyboard(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Programmatically hide the keyboard (but not the messenger bar)
|
||||
*/
|
||||
@Cordova()
|
||||
hideMessengerKeyboard(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Manipulate the messenger while it's open. For instance if you want to update the text programmatically based on what the user typed.
|
||||
* @param options
|
||||
*/
|
||||
@Cordova()
|
||||
updateMessenger(options: NativeKeyboardUpdateMessengerOptions): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/merge';
|
||||
|
||||
|
||||
declare var navigator: any;
|
||||
declare const navigator: any;
|
||||
|
||||
/**
|
||||
* @name Network
|
||||
@@ -30,9 +30,9 @@ declare var navigator: any;
|
||||
*
|
||||
* // watch network for a connection
|
||||
* let connectSubscription = this.network.onConnect().subscribe(() => {
|
||||
* console.log('network connected!');
|
||||
* console.log('network connected!');
|
||||
* // We just got a connection but we need to wait briefly
|
||||
*
// before we determine the connection type. Might need to wait
|
||||
*
// before we determine the connection type. Might need to wait.
|
||||
* // prior to doing any api requests as well.
|
||||
* setTimeout(() => {
|
||||
* if (this.network.type === 'wifi') {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name PayPal
|
||||
* @description
|
||||
@@ -383,6 +384,11 @@ export interface PayPalConfigurationOptions {
|
||||
* PIN to use for sandbox if 'forceDefaultsInSandbox' is set.
|
||||
*/
|
||||
sandboxUserPin?: string;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
/**
|
||||
* @hidden
|
||||
@@ -413,7 +419,7 @@ export class PayPalConfiguration implements PayPalConfigurationOptions {
|
||||
};
|
||||
|
||||
if (options && typeof options === 'object') {
|
||||
for (var i in options) {
|
||||
for (let i in options) {
|
||||
if (defaults.hasOwnProperty(i)) {
|
||||
defaults[i] = options[i];
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ import { Injectable } from '@angular/core';
|
||||
plugin: 'cordova-plugin-photo-library',
|
||||
pluginRef: 'cordova.plugins.photoLibrary',
|
||||
repo: 'https://github.com/terikon/cordova-plugin-photo-library',
|
||||
install: 'ionic plugin add cordova-plugin-photo-library --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="To choose photos"',
|
||||
install: 'ionic cordova plugin add cordova-plugin-photo-library --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="To choose photos"',
|
||||
platforms: ['Android', 'Browser', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -172,7 +172,7 @@ export interface PinterestPin {
|
||||
plugin: 'cordova-plugin-pinterest',
|
||||
pluginRef: 'cordova.plugins.Pinterest',
|
||||
repo: 'https://github.com/zyramedia/cordova-plugin-pinterest',
|
||||
install: 'ionic plugin add cordova-plugin-pinterest --variable APP_ID=YOUR_APP_ID',
|
||||
install: 'ionic cordova plugin add cordova-plugin-pinterest --variable APP_ID=YOUR_APP_ID',
|
||||
installVariables: ['APP_ID'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
declare var cordova: any;
|
||||
import { Cordova, CordovaCheck, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
export interface PrintOptions {
|
||||
/**
|
||||
@@ -41,6 +38,7 @@ export interface PrintOptions {
|
||||
*/
|
||||
bounds?: number[] | any;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Printer
|
||||
* @description Prints documents or HTML rendered content
|
||||
@@ -71,7 +69,7 @@ export interface PrintOptions {
|
||||
pluginName: 'Printer',
|
||||
plugin: 'de.appplant.cordova.plugin.printer',
|
||||
pluginRef: 'cordova.plugins.printer',
|
||||
repo: 'https://github.com/katzer/cordova-plugin-printer.git',
|
||||
repo: 'https://github.com/katzer/cordova-plugin-printer',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
@@ -81,8 +79,31 @@ export class Printer extends IonicNativePlugin {
|
||||
* Checks whether to device is capable of printing.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
isAvailable(): Promise<boolean> {
|
||||
return this.check()
|
||||
.then((res: any) => Promise.resolve(res.avail));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the printer service is available (iOS) or if printer services are installed and enabled (Android).
|
||||
* @return {Promise<any>} returns a promise that resolve with an object indicating whether printing is available, and providing the number of printers available
|
||||
*/
|
||||
@CordovaCheck()
|
||||
check(): Promise<any> {
|
||||
return new Promise<any>((resolve: Function) => {
|
||||
Printer.getPlugin()
|
||||
.check((avail: boolean, count: any) => {
|
||||
resolve({ avail, count });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a system interface allowing the user to select an available printer. To speak with a printer directly you need to know the network address by picking them before via `printer.pick`.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
isAvailable(): Promise<boolean> { return; }
|
||||
pick(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Sends content to the printer.
|
||||
@@ -90,7 +111,10 @@ export class Printer extends IonicNativePlugin {
|
||||
* @param options {PrintOptions} optional. The options to pass to the printer
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
successIndex: 2,
|
||||
errorIndex: 4
|
||||
})
|
||||
print(content: string | HTMLElement, options?: PrintOptions): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window: any;
|
||||
|
||||
export type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error;
|
||||
export type EventResponse = RegistrationEventResponse & NotificationEventResponse & Error;
|
||||
|
||||
export interface RegistrationEventResponse {
|
||||
/**
|
||||
@@ -39,7 +39,7 @@ export interface NotificationEventResponse {
|
||||
/**
|
||||
* An optional collection of data sent by the 3rd party push service that does not fit in the above properties.
|
||||
*/
|
||||
additionalData: NotificationEventAdditionalData | any;
|
||||
additionalData: NotificationEventAdditionalData & any;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -264,7 +264,7 @@ export type PushEvent = 'registration' | 'error' | 'notification';
|
||||
plugin: 'phonegap-plugin-push',
|
||||
pluginRef: 'PushNotification',
|
||||
repo: 'https://github.com/phonegap/phonegap-plugin-push',
|
||||
install: 'ionic plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX',
|
||||
install: 'ionic cordova plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX',
|
||||
installVariables: ['SENDER_ID']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -25,7 +25,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
pluginRef: 'cordova.plugins.Rollbar',
|
||||
repo: 'https://github.com/Resgrid/cordova-plugins-rollbar',
|
||||
platforms: ['Android', 'iOS'],
|
||||
install: 'ionic plugin add resgrid-cordova-plugins-rollbar --variable ROLLBAR_ACCESS_TOKEN="YOUR_ROLLBAR_ACCEESS_TOKEN" --variable ROLLBAR_ENVIRONMENT="ROLLBAR_ENVIRONMENT"',
|
||||
install: 'ionic cordova plugin add resgrid-cordova-plugins-rollbar --variable ROLLBAR_ACCESS_TOKEN="YOUR_ROLLBAR_ACCEESS_TOKEN" --variable ROLLBAR_ENVIRONMENT="ROLLBAR_ENVIRONMENT"',
|
||||
installVariables: ['ROLLBAR_ACCESS_TOKEN', 'ROLLBAR_ENVIRONMENT']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window;
|
||||
|
||||
/**
|
||||
* @name Screen Orientation
|
||||
* @description
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare const navigator: any;
|
||||
|
||||
declare var navigator: any;
|
||||
/**
|
||||
* @name Screenshot
|
||||
* @description Captures a screen shot
|
||||
@@ -44,7 +44,7 @@ export class Screenshot extends IonicNativePlugin {
|
||||
return new Promise<any>(
|
||||
(resolve, reject) => {
|
||||
navigator.screenshot.save(
|
||||
(error, result) => {
|
||||
(error: any, result: any) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
@@ -70,7 +70,7 @@ export class Screenshot extends IonicNativePlugin {
|
||||
return new Promise<any>(
|
||||
(resolve, reject) => {
|
||||
navigator.screenshot.URI(
|
||||
(error, result) => {
|
||||
(error: any, result: any) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, Plugin, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var cordova: any;
|
||||
import { CordovaInstance, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export class SecureStorageObject {
|
||||
|
||||
constructor(private _objectInstance?: any) { }
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
/**
|
||||
* Gets a stored item
|
||||
@@ -120,13 +118,10 @@ export class SecureStorage extends IonicNativePlugin {
|
||||
* @param store {string}
|
||||
* @returns {Promise<SecureStorageObject>}
|
||||
*/
|
||||
@CordovaCheck()
|
||||
create(store: string): Promise<SecureStorageObject> {
|
||||
return new Promise((res, rej) => {
|
||||
if (checkAvailability('cordova.plugins.SecureStorage', null, 'SecureStorage') === true) {
|
||||
const instance = new cordova.plugins.SecureStorage(() => res(new SecureStorageObject(instance)), rej, store);
|
||||
} else {
|
||||
res(new SecureStorageObject());
|
||||
}
|
||||
return new Promise((res: Function, rej: Function) => {
|
||||
const instance = new (SecureStorage.getPlugin())(() => res(new SecureStorageObject(instance)), rej, store);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ export interface SpeechRecognitionListeningOptionsAndroid {
|
||||
}
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Speech Recognition
|
||||
* @description
|
||||
* This plugin does speech recognition using cloud services
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaInstance, Plugin, CordovaCheck, InstanceProperty, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
declare var sqlitePlugin;
|
||||
declare const sqlitePlugin: any;
|
||||
|
||||
export interface SQLiteDatabaseConfig {
|
||||
/**
|
||||
@@ -19,6 +18,21 @@ export interface SQLiteDatabaseConfig {
|
||||
iosDatabaseLocation?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export interface SQLiteTransaction {
|
||||
start: () => void;
|
||||
executeSql: (sql: any, values: any, success: Function, error: Function) => void;
|
||||
addStatement: (sql: any, values: any, success: Function, error: Function) => void;
|
||||
handleStatementSuccess: (handler: Function, response: any) => void;
|
||||
handleStatementFailure: (handler: Function, response: any) => void;
|
||||
run: () => void;
|
||||
abort: (txFailure: any) => void;
|
||||
finish: () => void;
|
||||
abortFromQ: (sqlerror: any) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@@ -26,12 +40,14 @@ export class SQLiteObject {
|
||||
|
||||
constructor(public _objectInstance: any) { }
|
||||
|
||||
@InstanceProperty databaseFeatures: any;
|
||||
@InstanceProperty databaseFeatures: { isSQLitePluginDatabase: boolean };
|
||||
|
||||
@InstanceProperty openDBs: any;
|
||||
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
addTransaction(transaction: any): void { }
|
||||
addTransaction(transaction: (tx: SQLiteTransaction) => void): void { }
|
||||
|
||||
/**
|
||||
* @param fn {any}
|
||||
@@ -44,11 +60,11 @@ export class SQLiteObject {
|
||||
transaction(fn: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* @param fn {any}
|
||||
* @param fn {Function}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
readTransaction(fn: any): Promise<any> { return; }
|
||||
readTransaction(fn: (tx: SQLiteTransaction) => void): Promise<any> { return; }
|
||||
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
@@ -59,12 +75,13 @@ export class SQLiteObject {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
close(): Promise<any> { return; }
|
||||
open(): Promise<any> { return; }
|
||||
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
start(): void { }
|
||||
/**
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
close(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Execute SQL on the opened database. Note, you must call `create` first, and
|
||||
@@ -74,71 +91,17 @@ export class SQLiteObject {
|
||||
executeSql(statement: string, params: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* @param sql
|
||||
* @param values
|
||||
* @param sqlStatements {Array<string | string[]>}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
addStatement(sql, values): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* @param sqlStatements {any}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
sqlBatch(sqlStatements: any): Promise<any> { return; }
|
||||
sqlBatch(sqlStatements: Array<string | string[]>): Promise<any> { return; }
|
||||
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
abortallPendingTransactions(): void { }
|
||||
|
||||
/**
|
||||
@param handler
|
||||
@param response
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
handleStatementSuccess(handler, response): void { }
|
||||
|
||||
/**
|
||||
* @param handler
|
||||
* @param response
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
handleStatementFailure(handler, response): void { }
|
||||
|
||||
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
run(): void { }
|
||||
|
||||
/**
|
||||
* @param txFailure
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
abort(txFailure): void { }
|
||||
|
||||
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
finish(): void { }
|
||||
|
||||
/**
|
||||
* @param sqlerror
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
abortFromQ(sqlerror): void { }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,6 +140,7 @@ export class SQLiteObject {
|
||||
* SQLiteObject
|
||||
* @interfaces
|
||||
* SQLiteDatabaseConfig
|
||||
* SQLiteTransaction
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'SQLite',
|
||||
@@ -198,7 +162,7 @@ export class SQLite extends IonicNativePlugin {
|
||||
@CordovaCheck()
|
||||
create(config: SQLiteDatabaseConfig): Promise<SQLiteObject> {
|
||||
return new Promise((resolve, reject) => {
|
||||
sqlitePlugin.openDatabase(config, db => resolve(new SQLiteObject(db)), reject);
|
||||
sqlitePlugin.openDatabase(config, (db: any) => resolve(new SQLiteObject(db)), reject);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
declare var window;
|
||||
|
||||
/**
|
||||
* @name Status Bar
|
||||
* @description
|
||||
|
||||
@@ -42,14 +42,14 @@ export class TextToSpeech extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* This function speaks
|
||||
* @param options {string | TTSOptions} Text to speak or TTSOptions
|
||||
* @param textOrOptions {string | TTSOptions} Text to speak or TTSOptions
|
||||
* @return {Promise<any>} Returns a promise that resolves when the speaking finishes
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
speak(options: string | TTSOptions): Promise<any> {
|
||||
speak(textOrOptions: string | TTSOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, Plugin, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var FileTransfer;
|
||||
declare const FileTransfer: any;
|
||||
|
||||
export interface FileUploadOptions {
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ export interface TwitterConnectResponse {
|
||||
plugin: 'twitter-connect-plugin',
|
||||
pluginRef: 'TwitterConnect',
|
||||
repo: 'https://github.com/ManifestWebDesign/twitter-connect-plugin',
|
||||
install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=fabric_API_key',
|
||||
install: 'ionic cordova plugin add twitter-connect-plugin --variable FABRIC_KEY=fabric_API_key',
|
||||
installVariables: ['FABRIC_KEY']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
73
src/@ionic-native/plugins/user-agent/index.ts
Normal file
73
src/@ionic-native/plugins/user-agent/index.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name User Agent
|
||||
* @description
|
||||
* The UserAgent plugin provides functions to set the HTTP user-agent header. For more info about User-Agents, please [see the HTTP User-Agent docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent).
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-useragent`. For more info, please see the [User-Agent plugin docs](https://github.com/LouisT/cordova-useragent).
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { UserAgent } from '@ionic-native/user-agent';
|
||||
*
|
||||
*
|
||||
* constructor(private userAgent: UserAgent) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.userAgent.set('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36')
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* * this.userAgent.get()
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* * this.userAgent.reset()
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'UserAgent',
|
||||
plugin: 'https://github.com/LouisT/cordova-useragent',
|
||||
pluginRef: 'plugins.useragent',
|
||||
repo: 'https://github.com/LouisT/cordova-useragent',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class UserAgent extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Changes the current user-agent to the one sent by argument.
|
||||
* @param userAgent {string} User-Agent
|
||||
* @return {Promise<any>} Returns a promise that resolves when the user-agent changes
|
||||
*/
|
||||
@Cordova()
|
||||
set(userAgent: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current user-agent string.
|
||||
* @return {Promise<any>} Returns a promise that resolves when the user-agent is returned
|
||||
*/
|
||||
@Cordova()
|
||||
get(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user-agent back to default
|
||||
* @return {Promise<any>} Returns a promise that resolves when the user-agent resets
|
||||
*/
|
||||
@Cordova()
|
||||
reset(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,9 +28,9 @@ export interface MediaFile {
|
||||
/**
|
||||
* Retrieves the format information of the media file.
|
||||
* @param {Function} successCallback
|
||||
* @param {Function} errorCallback
|
||||
* @param {Function} [errorCallback]
|
||||
*/
|
||||
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any);
|
||||
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any): any;
|
||||
}
|
||||
|
||||
export interface MediaFileData {
|
||||
|
||||
@@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window;
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Web Intent
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
export interface WheelSelectorItem {
|
||||
description: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface WheelSelectorOptions {
|
||||
@@ -44,6 +44,13 @@ export interface WheelSelectorOptions {
|
||||
* Default: false
|
||||
*/
|
||||
wrapWheelText?: boolean;
|
||||
|
||||
/**
|
||||
* The json key to display, by default it is description, this allows for setting any
|
||||
* key/value to be displayed
|
||||
* Default: description
|
||||
*/
|
||||
displayKey?: string;
|
||||
}
|
||||
|
||||
export interface WheelSelectorData {
|
||||
@@ -65,54 +72,95 @@ export interface WheelSelectorData {
|
||||
* ...
|
||||
*
|
||||
* let jsonData = {
|
||||
* numbers: [
|
||||
* { description: "1" },
|
||||
* { description: "2" },
|
||||
* { description: "3" }
|
||||
* ],
|
||||
* fruits: [
|
||||
* { description: "Apple" },
|
||||
* { description: "Banana" },
|
||||
* { description: "Tangerine" }
|
||||
* ],
|
||||
* };
|
||||
* numbers: [
|
||||
* { description: "1" },
|
||||
* { description: "2" },
|
||||
* { description: "3" }
|
||||
* ],
|
||||
* fruits: [
|
||||
* { description: "Apple" },
|
||||
* { description: "Banana" },
|
||||
* { description: "Tangerine" }
|
||||
* ],
|
||||
* firstNames: [
|
||||
* { name: "Fred", id: '1' },
|
||||
* { name: "Jane", id: '2' },
|
||||
* { name: "Bob", id: '3' },
|
||||
* { name: "Earl", id: '4' },
|
||||
* { name: "Eunice", id: '5' }
|
||||
* ],
|
||||
* lastNames: [
|
||||
* { name: "Johnson", id: '100' },
|
||||
* { name: "Doe", id: '101' },
|
||||
* { name: "Kinishiwa", id: '102' },
|
||||
* { name: "Gordon", id: '103' },
|
||||
* { name: "Smith", id: '104' }
|
||||
* ]
|
||||
* };
|
||||
*
|
||||
* //use most of the default values
|
||||
* this.selector.show({
|
||||
* title: "Select some Fruit",
|
||||
* items: [
|
||||
* jsonData.numbers,
|
||||
* jsonData.fruits
|
||||
* ]
|
||||
* }).then(
|
||||
* result => {
|
||||
* console.log('Selected: ' + result[0].description + ' at index: ' + result[0].index
|
||||
* + ' and ' + result[1].description + ' at index: ' + result[1].index);
|
||||
* },
|
||||
* err => console.log('Error occurred while getting result: ', err)
|
||||
* );
|
||||
* ...
|
||||
*
|
||||
* ...
|
||||
* //basic number selection, index is always returned in the result
|
||||
* selectANumber() {
|
||||
* this.selector.show({
|
||||
* title: "How Many?",
|
||||
* items: [
|
||||
* this.jsonData.numbers
|
||||
* ],
|
||||
* }).then(
|
||||
* result => {
|
||||
* console.log(result[0].description + ' at index: ' + result[0].index);
|
||||
* },
|
||||
* err => console.log('Error: ', err)
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* //set some initial default values to display: "2", "Tangerine"
|
||||
* this.selector.show({
|
||||
* title: "Select some Fruit",
|
||||
* items: [
|
||||
* jsonData.numbers,
|
||||
* jsonData.fruits
|
||||
* ],
|
||||
* defaultItems: [
|
||||
* jsonData.numbers[1],
|
||||
* jsonData.fruits[2]
|
||||
* ]
|
||||
* }).then(
|
||||
* result => {
|
||||
* console.log('Selected: ' + result[0].description + ' at index: ' + result[0].index
|
||||
* + ' and ' + result[1].description + ' at index: ' + result[1].index);
|
||||
* },
|
||||
* err => console.log('Error occurred while getting result: ', err)
|
||||
* );
|
||||
* //basic selection, setting initial displayed default values: '3' 'Banana'
|
||||
* selectFruit() {
|
||||
* this.selector.show({
|
||||
* title: "How Much?",
|
||||
* items: [
|
||||
* this.jsonData.numbers, this.jsonData.fruits
|
||||
* ],
|
||||
* positiveButtonText: "Ok",
|
||||
* negativeButtonText: "Nope",
|
||||
* defaultItems: [
|
||||
* this.jsonData.numbers[2], // '3'
|
||||
* this.jsonData.fruits[3] // 'Banana'
|
||||
* ]
|
||||
* }).then(
|
||||
* result => {
|
||||
* console.log(result[0].description + ' ' + result[1].description);
|
||||
* },
|
||||
* err => console.log('Error: ' + JSON.stringify(err))
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* //more complex as overrides which key to display
|
||||
* //then retrieve properties from original data
|
||||
* selectNamesUsingDisplayKey() {
|
||||
* this.selector.show({
|
||||
* title: "Who?",
|
||||
* items: [
|
||||
* this.jsonData.firstNames, this.jsonData.lastNames
|
||||
* ],
|
||||
* displayKey: 'name',
|
||||
* defaultItems: [
|
||||
* this.jsonData.firstNames[2],
|
||||
* this.jsonData.lastNames[3]
|
||||
* ]
|
||||
* }).then(
|
||||
* result => {
|
||||
* console.log(result[0].name + ' (id= ' + this.jsonData.firstNames[result[0].index].id + '), ' +
|
||||
* result[1].name + ' (id=' + this.jsonData.lastNames[result[1].index].id + ')');
|
||||
* },
|
||||
* err => console.log('Error: ' + JSON.stringify(err))
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
*
|
||||
|
||||
@@ -34,10 +34,12 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
})
|
||||
@Injectable()
|
||||
export class YoutubeVideoPlayer extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Plays a YouTube video
|
||||
* @param videoId {string} Video ID
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
openVideo(videoId: string): void { }
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"stripInternal": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"noImplicitAny": true,
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
|
||||
Reference in New Issue
Block a user