mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-04 00:06:19 +08:00
Compare commits
400 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a8146b76c | ||
|
|
2d60db9d3b | ||
|
|
3378d7a398 | ||
|
|
61defd480c | ||
|
|
4e28295486 | ||
|
|
dee32c921c | ||
|
|
2475c57e00 | ||
|
|
79b522f832 | ||
|
|
ccb2e55435 | ||
|
|
f09c9cfe9a | ||
|
|
d96d3eef07 | ||
|
|
95daca166b | ||
|
|
196be026ea | ||
|
|
1fa7c91105 | ||
|
|
ba105be55f | ||
|
|
92d26eab94 | ||
|
|
ce6e412788 | ||
|
|
7243ed3960 | ||
|
|
264670211d | ||
|
|
847147a5fa | ||
|
|
4639bf9a94 | ||
|
|
abb77e3e08 | ||
|
|
975f08b7b5 | ||
|
|
773722b767 | ||
|
|
447aa56e3c | ||
|
|
8d22798278 | ||
|
|
30297fb81d | ||
|
|
ac777fca40 | ||
|
|
43b70a12b5 | ||
|
|
ef28078815 | ||
|
|
e304ce0e53 | ||
|
|
9e5f03f15d | ||
|
|
465d5519d0 | ||
|
|
d683b9e5df | ||
|
|
2b2476e873 | ||
|
|
196adc8b2f | ||
|
|
363b41e075 | ||
|
|
2179699622 | ||
|
|
e65406cc2f | ||
|
|
ddb6d43ffa | ||
|
|
30ed33a046 | ||
|
|
3d0a12d40d | ||
|
|
6ca5beaf0b | ||
|
|
536a906366 | ||
|
|
7fcafaae81 | ||
|
|
1a7a0e7cc0 | ||
|
|
34bf136703 | ||
|
|
bb798340c5 | ||
|
|
1b04ebb5e2 | ||
|
|
a150d4d522 | ||
|
|
4246d47a6c | ||
|
|
024099a772 | ||
|
|
fff99694ba | ||
|
|
429529a5ee | ||
|
|
e2419a26b2 | ||
|
|
10eb3eeeeb | ||
|
|
533cc4efc9 | ||
|
|
6b433b5373 | ||
|
|
e684db479e | ||
|
|
81c576c28e | ||
|
|
e2f3702d0b | ||
|
|
806766e33e | ||
|
|
432c0e901d | ||
|
|
fb70a24c61 | ||
|
|
202c680643 | ||
|
|
7b94d4fccf | ||
|
|
5b15bb9f46 | ||
|
|
c3930c814a | ||
|
|
57af5c5e73 | ||
|
|
29604d6d3d | ||
|
|
76effe98f8 | ||
|
|
0783520723 | ||
|
|
ef898efcc6 | ||
|
|
fdd12b58b3 | ||
|
|
80047907ea | ||
|
|
3a1034eab0 | ||
|
|
c8586927c3 | ||
|
|
f22c603c30 | ||
|
|
957396b5e5 | ||
|
|
d891c3eea0 | ||
|
|
37aa9a82fe | ||
|
|
392b11bd05 | ||
|
|
d4fe051d56 | ||
|
|
a2d33963b1 | ||
|
|
332f9aefe5 | ||
|
|
4942b88873 | ||
|
|
39ec5158a0 | ||
|
|
c11aec33a7 | ||
|
|
21045ea535 | ||
|
|
955c450483 | ||
|
|
00c0707dad | ||
|
|
79f88d6a02 | ||
|
|
ce5966bf10 | ||
|
|
fb8dbe5fc0 | ||
|
|
cde87e2113 | ||
|
|
262e18f409 | ||
|
|
39ef066875 | ||
|
|
35d317f7f3 | ||
|
|
5505e5f064 | ||
|
|
e6b0250d97 | ||
|
|
aa4c3b3787 | ||
|
|
57bbcdebfb | ||
|
|
85825c7b91 | ||
|
|
1acade4883 | ||
|
|
7c1b409542 | ||
|
|
fe02c84fd9 | ||
|
|
a2cc1870b4 | ||
|
|
1c6a3a3bc5 | ||
|
|
0c097ba2be | ||
|
|
0dd507ff03 | ||
|
|
4e0673c8e9 | ||
|
|
0cecf4e43f | ||
|
|
9ab458bba2 | ||
|
|
7e900dae22 | ||
|
|
0fa82e5c56 | ||
|
|
4af3d5bcc1 | ||
|
|
976401a4e9 | ||
|
|
6230958585 | ||
|
|
47fa44c932 | ||
|
|
f1dd8d61f5 | ||
|
|
3d387798b6 | ||
|
|
380eb88a39 | ||
|
|
6e2c998dad | ||
|
|
7105048b89 | ||
|
|
6061af6238 | ||
|
|
1decedd899 | ||
|
|
b5fe6631fe | ||
|
|
25c1cf4058 | ||
|
|
b265b5bd0c | ||
|
|
247efa656a | ||
|
|
238e2ab26c | ||
|
|
146c823f2a | ||
|
|
1b55513bc4 | ||
|
|
953841681c | ||
|
|
76a45a3834 | ||
|
|
eff9bc376c | ||
|
|
b9993c24f0 | ||
|
|
9752c865fc | ||
|
|
4c4cf76f7a | ||
|
|
70cbcbf1e9 | ||
|
|
2caf0684ef | ||
|
|
aa4b2cd2ae | ||
|
|
c56aa7e3ae | ||
|
|
3f8f97f015 | ||
|
|
1f3b97cef2 | ||
|
|
927bd1a9ba | ||
|
|
c43a51e2bb | ||
|
|
1a9a843cde | ||
|
|
2e543291ef | ||
|
|
ad9556ca03 | ||
|
|
cbdde57681 | ||
|
|
d8bac2f0ab | ||
|
|
12a83831c8 | ||
|
|
cdb99a74cc | ||
|
|
dd12be6722 | ||
|
|
cf0c740269 | ||
|
|
bde2b38668 | ||
|
|
b35dab2634 | ||
|
|
ff793d649b | ||
|
|
e8faf22357 | ||
|
|
a6f9714422 | ||
|
|
71349655c0 | ||
|
|
f1a036d8b0 | ||
|
|
7bbd25c1a2 | ||
|
|
01ae8e11fc | ||
|
|
aff653de2e | ||
|
|
0867cfff3f | ||
|
|
d395b42788 | ||
|
|
bc6bf6671e | ||
|
|
9f1a0f9585 | ||
|
|
3c54a1c7f5 | ||
|
|
06e666d6a0 | ||
|
|
9a4e36d9d8 | ||
|
|
0e970f5038 | ||
|
|
398d0eeac5 | ||
|
|
73d0d57bbc | ||
|
|
c0d27262e4 | ||
|
|
f41dfee912 | ||
|
|
f5f92e191a | ||
|
|
a6ae0919e4 | ||
|
|
5b914d7f15 | ||
|
|
2f3331e9ea | ||
|
|
c972497475 | ||
|
|
3582e877d6 | ||
|
|
0c79ac16ec | ||
|
|
3af23023ee | ||
|
|
f289a6bbb6 | ||
|
|
e64cc0c61c | ||
|
|
7144eb0afa | ||
|
|
fa93226cbf | ||
|
|
613340118c | ||
|
|
55d573f144 | ||
|
|
b56297e115 | ||
|
|
b8ac7bfb6a | ||
|
|
7cb95f1b91 | ||
|
|
da0fd821f7 | ||
|
|
6a18d3f1e0 | ||
|
|
5072c99938 | ||
|
|
e40247c211 | ||
|
|
593607e914 | ||
|
|
51fc5332ff | ||
|
|
27fdac91fd | ||
|
|
3c125bbc84 | ||
|
|
62c39b33c6 | ||
|
|
e6f81519cc | ||
|
|
64ce132262 | ||
|
|
af91977f82 | ||
|
|
07443e0b53 | ||
|
|
72f838d768 | ||
|
|
fa86cee3fa | ||
|
|
83c25b41ef | ||
|
|
2128703d8d | ||
|
|
b52371b174 | ||
|
|
65c2665fc0 | ||
|
|
279b449456 | ||
|
|
9bd4994f01 | ||
|
|
ab74703841 | ||
|
|
18a81a77a9 | ||
|
|
2ebfa46437 | ||
|
|
1d4fc03cba | ||
|
|
e9283a994d | ||
|
|
ed6fe880b6 | ||
|
|
a2d979a277 | ||
|
|
1ccfb1d84c | ||
|
|
2ec0f87a79 | ||
|
|
03ac735476 | ||
|
|
9eb29f8924 | ||
|
|
85a1f6a35b | ||
|
|
3cb7d6d4d8 | ||
|
|
884cabd301 | ||
|
|
663c24d2fa | ||
|
|
fecf8ad994 | ||
|
|
b05ba586f8 | ||
|
|
4ed8f9337f | ||
|
|
25446441cf | ||
|
|
0805d7754e | ||
|
|
d60c0800e7 | ||
|
|
35f498b82c | ||
|
|
8cf4a57a77 | ||
|
|
cb51b5abd6 | ||
|
|
59a8e76ba9 | ||
|
|
8f985025d1 | ||
|
|
7d9df8c82f | ||
|
|
22ccbfdf8f | ||
|
|
c6a76c26e0 | ||
|
|
c3f9fb4a23 | ||
|
|
abeedbf2fa | ||
|
|
9bdabd3ac3 | ||
|
|
0467a0dd32 | ||
|
|
3eb69b4056 | ||
|
|
793e2e34d3 | ||
|
|
dd7098d5bd | ||
|
|
268e22456e | ||
|
|
9950b18e38 | ||
|
|
b4deaaa941 | ||
|
|
328e5de3f3 | ||
|
|
41dae53bf2 | ||
|
|
3027b5ea16 | ||
|
|
ec773de686 | ||
|
|
f3b7467ffd | ||
|
|
d9546f15ed | ||
|
|
52dcd808b6 | ||
|
|
985193bebd | ||
|
|
9bf9e9d073 | ||
|
|
8b9995a5af | ||
|
|
2d3add6507 | ||
|
|
ee59b55c29 | ||
|
|
28bb6dc1a8 | ||
|
|
b587a0e647 | ||
|
|
d9d7919174 | ||
|
|
11c42757d7 | ||
|
|
4e4216ff6d | ||
|
|
496968b9fc | ||
|
|
bf3f9d8799 | ||
|
|
6f22134851 | ||
|
|
aaeabb9f96 | ||
|
|
6d4da1fff4 | ||
|
|
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 | ||
|
|
f223481307 | ||
|
|
5145395dd7 | ||
|
|
dfd0514a43 | ||
|
|
d5919d1736 | ||
|
|
71f7051997 | ||
|
|
2858b4bad7 | ||
|
|
4c8deb2bed | ||
|
|
277b2b15e6 | ||
|
|
ebf402864b | ||
|
|
6b702973ec | ||
|
|
7d4e8acce8 | ||
|
|
31983d8317 | ||
|
|
8c842b00b6 | ||
|
|
c6feaafcca | ||
|
|
a7f7b26a76 | ||
|
|
d0dec7a17d | ||
|
|
7487293d33 | ||
|
|
4f6ec0cfcd | ||
|
|
b35417a017 | ||
|
|
adf9c5a323 | ||
|
|
7c797123f5 | ||
|
|
bd1794d7f5 | ||
|
|
46502cb864 | ||
|
|
02cc615c21 | ||
|
|
749fd8af43 | ||
|
|
e2acde5332 | ||
|
|
5203d026d4 | ||
|
|
362ae4422b | ||
|
|
965a90c52c | ||
|
|
a28de660bc | ||
|
|
fec19b734c | ||
|
|
6773ed341c | ||
|
|
23ad074d04 | ||
|
|
912668d8f8 | ||
|
|
cf531af244 | ||
|
|
a94651dc75 | ||
|
|
ad0680bd90 | ||
|
|
66a82dd5ce | ||
|
|
8ea8ac40e5 | ||
|
|
2d477ba9a0 | ||
|
|
f98f90a9a3 | ||
|
|
fba0ce2bb6 | ||
|
|
22d0260cde | ||
|
|
25aeb406ae | ||
|
|
385da017a0 | ||
|
|
efae1be116 | ||
|
|
7f919d5c90 | ||
|
|
00c156811f | ||
|
|
8512dd5d92 | ||
|
|
ad514bbf63 | ||
|
|
45108c4c18 | ||
|
|
17e166d04d | ||
|
|
dea9f42d5f | ||
|
|
e193baf1c1 | ||
|
|
10d61c21c2 | ||
|
|
7e322aadb8 | ||
|
|
4835182ad5 | ||
|
|
49ac21145a | ||
|
|
8a81ee08e3 | ||
|
|
36d101af02 | ||
|
|
8e65474c1d |
4
.github/CONTRIBUTING.md
vendored
4
.github/CONTRIBUTING.md
vendored
@@ -4,7 +4,7 @@
|
||||
#### There are no rules, but here are a few things to consider:
|
||||
###### Before you submit an issue:
|
||||
* Do a quick search to see if there are similar issues
|
||||
* Make sure that you are waiting for `deviceready` to fire before interacting with any plugin. If you are using Ionic 2, this can be done using [the `Platform.ready()` function](http://ionicframework.com/docs/api/platform/Platform/#ready).
|
||||
* Make sure that you are waiting for `deviceready` to fire before interacting with any plugin. If you are using Ionic, this can be done using [the `Platform.ready()` function](http://ionicframework.com/docs/api/platform/Platform/#ready).
|
||||
* **Check that you are using the latest version of** `ionic-native`, you can install the latest version by running `npm i --save @ionic-native/core@latest`
|
||||
|
||||
###### Still having problems? submit an issue with the following details:
|
||||
@@ -16,4 +16,4 @@
|
||||
## Feature request?
|
||||
Have a plugin you'd like to see supported? Since Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whatever plugin you'd like to add.
|
||||
|
||||
Take a look at our [Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more info on adding new plugins.
|
||||
Take a look at our [Developer Guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for more info on adding new plugins.
|
||||
|
||||
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
|
||||
[ ] support 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. -->
|
||||
|
||||
**Ionic info:** (run `ionic info` from a terminal/cmd prompt and paste output below):
|
||||
|
||||
```
|
||||
insert the output from ionic info here
|
||||
```
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,5 +3,5 @@ node_modules/
|
||||
.idea
|
||||
.tmp
|
||||
aot/
|
||||
dist/
|
||||
scripts/ionic-native-bower
|
||||
dist/
|
||||
|
||||
1620
CHANGELOG.md
1620
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
11
DEVELOPER.md
11
DEVELOPER.md
@@ -103,7 +103,7 @@ Next, let's look at the `watchPosition` method.
|
||||
|
||||
The `@Cordova` decorator has a few more options now.
|
||||
|
||||
`observable` indicates that this method may call its callbacks multiple times, so `@Cordova` wraps it in an [`Observable`](https://github.com/driftyco/ionic-native#promises-and-observables) instead of a Promise.
|
||||
`observable` indicates that this method may call its callbacks multiple times, so `@Cordova` wraps it in an [`Observable`](https://github.com/ionic-team/ionic-native#promises-and-observables) instead of a Promise.
|
||||
|
||||
`callbackOrder` refers to the method signature of the underlying Cordova plugin, and tells Ionic Native which arguments are the callbacks to map to the wrapping Promise or Observable. In this case, the signature is [`watchPosition(success, error, options)`](https://github.com/apache/cordova-plugin-geolocation#navigatorgeolocationwatchposition), so we need to tell `@Cordova` that the callbacks are the first arguments, not the last arguments. For rare cases, you can also specify the options `successIndex` and `errorIndex` to indicate where in the argument list the callbacks are located.
|
||||
|
||||
@@ -209,4 +209,13 @@ Example:
|
||||
someMethod(): Promise<any> {
|
||||
// anything here will only run if the plugin is available
|
||||
}
|
||||
```
|
||||
|
||||
#### CordovaFunctionOverride
|
||||
Wrap a stub function in a call to a Cordova plugin, checking if both Cordova and the required plugin are installed.
|
||||
|
||||
Example:
|
||||
```ts
|
||||
@CordovaFunctionOverride()
|
||||
someMethod(): Observable<any> { return; }
|
||||
```
|
||||
40
README.md
40
README.md
@@ -1,9 +1,9 @@
|
||||
[](https://circleci.com/gh/driftyco/ionic-native) [](http://commitizen.github.io/cz-cli/) 
|
||||
[](https://circleci.com/gh/ionic-team/ionic-native) [](http://commitizen.github.io/cz-cli/) 
|
||||
|
||||
|
||||
# Ionic Native
|
||||
|
||||
Ionic Native is a curated set of wrappers for Cordova plugins that make adding any native functionality you need to your [Ionic 2](http://ionicframework.com/) mobile app easy.
|
||||
Ionic Native is a curated set of wrappers for Cordova plugins that make adding any native functionality you need to your [Ionic](https://ionicframework.com/) mobile app easy.
|
||||
|
||||
Ionic Native wraps plugin callbacks in a Promise or Observable, providing a common interface for all plugins and making it easy to use plugins with Angular change detection.
|
||||
|
||||
@@ -14,11 +14,11 @@ Run following command to install Ionic Native in your project.
|
||||
npm install @ionic-native/core --save
|
||||
```
|
||||
|
||||
You also need to install the Ionic Native package for each plugin you want to add. Please see the [Ionic Native documentation](http://ionicframework.com/docs/native/) for complete instructions on how to add and use the plugins.
|
||||
You also need to install the Ionic Native package for each plugin you want to add. Please see the [Ionic Native documentation](https://ionicframework.com/docs/native/) for complete instructions on how to add and use the plugins.
|
||||
|
||||
## Documentation
|
||||
|
||||
For the full Ionic Native documentation, please visit [http://ionicframework.com/docs/native/](http://ionicframework.com/docs/native/).
|
||||
For the full Ionic Native documentation, please visit [https://ionicframework.com/docs/native/](https://ionicframework.com/docs/native/).
|
||||
|
||||
### Basic Usage
|
||||
|
||||
@@ -52,38 +52,28 @@ import { NgZone } from '@angular/core';
|
||||
@Component({ ... })
|
||||
export class MyComponent {
|
||||
|
||||
constructor(private geolocation: Geolocation, private platform: Platform, private ngZone: NgZone) {
|
||||
constructor(private geolocation: Geolocation, private platform: Platform) {
|
||||
|
||||
platform.ready().then(() => {
|
||||
|
||||
// get position
|
||||
geolocation.getCurrentPosition().then(pos => {
|
||||
|
||||
console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`)
|
||||
|
||||
});
|
||||
|
||||
|
||||
// watch position
|
||||
const watch = geolocation.watchPosition().subscribe(pos => {
|
||||
|
||||
console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`)
|
||||
|
||||
// Currently, observables from Ionic Native plugins
|
||||
// need to run inside of zone to trigger change detection
|
||||
ngZone.run(() => {
|
||||
this.position = pos;
|
||||
})
|
||||
|
||||
this.position = pos;
|
||||
});
|
||||
|
||||
// to stop watching
|
||||
watch.unsubscribe();
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
@@ -165,24 +155,24 @@ export class AppModule {}
|
||||
|
||||
Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
## Plugin Missing?
|
||||
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
|
||||
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
|
||||
|
||||
## Ionic V1/Angular 1 support
|
||||
## Ionic v1 (AngularJS, Angular 1.x) support
|
||||
|
||||
For Ionic V1/Angular 1 support, please use version 2 of Ionic Native. See the [2.x README](https://github.com/driftyco/ionic-native/blob/8cd648db5cddd7bdbe2bd78839b19c620cc8c04c/README.md) for usage information.
|
||||
For Ionic v1 (AngularJS, Angular 1.x) support, please use version 2 of Ionic Native. See the [2.x README](https://github.com/ionic-team/ionic-native/blob/v2.x/README.md) for usage information.
|
||||
|
||||
# Credits
|
||||
|
||||
Ibby Hadeed - [@ihadeed](http://github.com/ihadeed)
|
||||
Ibby Hadeed - [@ihadeed](https://github.com/ihadeed)
|
||||
|
||||
Tim Lancina - [@timlancina](http://twitter.com/timlancina)
|
||||
Tim Lancina - [@timlancina](https://twitter.com/timlancina)
|
||||
|
||||
Mike Hartington - [@mhartington](https://twitter.com/mhartington)
|
||||
|
||||
Max Lynch - [@maxlynch](http://twitter.com/maxlynch)
|
||||
Max Lynch - [@maxlynch](https://twitter.com/maxlynch)
|
||||
|
||||
Rob Wormald - [@robwormald](https://twitter.com/robwormald)
|
||||
|
||||
19
circle.yml
19
circle.yml
@@ -7,12 +7,15 @@ jobs:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: ionic-site
|
||||
key: ionic-site-{{ checksum "package.json" }}
|
||||
- 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-{{ checksum "package.json" }}
|
||||
paths:
|
||||
- ~/ionic-site/
|
||||
- restore_cache:
|
||||
@@ -27,6 +30,16 @@ jobs:
|
||||
- run:
|
||||
name: Run tslint
|
||||
command: npm run lint
|
||||
- run: bash ./scripts/git/config.sh
|
||||
- run:
|
||||
name: Build Ionic Native
|
||||
command: npm run build:core && ./node_modules/.bin/tsc
|
||||
- run:
|
||||
name: Generate README files to ensure docs are valid
|
||||
command: npm run readmes
|
||||
- run:
|
||||
name: Run tests
|
||||
command: npm test
|
||||
- add_ssh_keys
|
||||
- deploy:
|
||||
name: Update docs
|
||||
|
||||
12
gulpfile.js
12
gulpfile.js
@@ -34,14 +34,16 @@ gulp.task('plugin:create', () => {
|
||||
|
||||
const src = flags.m ? './scripts/templates/wrap-min.tmpl':'./scripts/templates/wrap.tmpl',
|
||||
pluginName = flags.n,
|
||||
pluginNameSpaced = pluginName.replace(/(?!^)([A-Z])/g, ' $1');
|
||||
spaced = pluginName.replace(/(?!^)([A-Z])/g, ' $1'),
|
||||
kebabCase = _.kebabCase(pluginName);
|
||||
|
||||
return gulp.src(src)
|
||||
.pipe(replace('$PluginName', pluginName))
|
||||
.pipe(replace('$Plugin_Name', pluginNameSpaced))
|
||||
.pipe(replace('$pluginName', _.lowerFirst(pluginName)))
|
||||
.pipe(replace('{{ PluginName }}', pluginName))
|
||||
.pipe(replace('{{ Plugin_Name }}', spaced))
|
||||
.pipe(replace('{{ pluginName }}', _.lowerFirst(pluginName)))
|
||||
.pipe(replace('{{ plugin-name }}', kebabCase))
|
||||
.pipe(rename('index.ts'))
|
||||
.pipe(gulp.dest('./src/@ionic-native/plugins/' + _.kebabCase(pluginName)));
|
||||
.pipe(gulp.dest('./src/@ionic-native/plugins/' + kebabCase));
|
||||
|
||||
} else {
|
||||
console.log("Usage is: gulp plugin:create -n PluginName");
|
||||
|
||||
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);
|
||||
|
||||
};
|
||||
7075
package-lock.json
generated
Normal file
7075
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
54
package.json
54
package.json
@@ -1,17 +1,22 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "3.7.0",
|
||||
"version": "4.4.2",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"homepage": "https://ionicframework.com/",
|
||||
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@angular/compiler": "4.0.0",
|
||||
"@angular/compiler-cli": "4.0.0",
|
||||
"@angular/core": "4.0.0",
|
||||
"@angular/compiler": "4.4.4",
|
||||
"@angular/compiler-cli": "4.4.4",
|
||||
"@angular/core": "4.4.4",
|
||||
"@types/cordova": "0.0.34",
|
||||
"@types/jasmine": "^2.6.3",
|
||||
"@types/node": "^8.0.50",
|
||||
"canonical-path": "0.0.2",
|
||||
"child-process-promise": "2.2.0",
|
||||
"conventional-changelog-cli": "1.2.0",
|
||||
"cpr": "2.0.2",
|
||||
"cz-conventional-changelog": "1.2.0",
|
||||
"child-process-promise": "2.2.1",
|
||||
"conventional-changelog-cli": "1.3.4",
|
||||
"cpr": "2.0.0",
|
||||
"cz-conventional-changelog": "2.0.0",
|
||||
"decamelize": "1.2.0",
|
||||
"dgeni": "0.4.7",
|
||||
"dgeni-packages": "0.16.10",
|
||||
@@ -21,18 +26,25 @@
|
||||
"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",
|
||||
"minimist": "1.2.0",
|
||||
"node-html-encoder": "0.0.2",
|
||||
"q": "1.4.1",
|
||||
"q": "1.5.0",
|
||||
"queue": "4.2.1",
|
||||
"rimraf": "2.5.4",
|
||||
"rxjs": "5.1.1",
|
||||
"rimraf": "2.6.1",
|
||||
"rxjs": "5.5.2",
|
||||
"semver": "5.3.0",
|
||||
"tslint": "3.15.1",
|
||||
"tslint-ionic-rules": "0.0.7",
|
||||
"typescript": "2.2.1",
|
||||
"zone.js": "^0.8.4"
|
||||
"tslint-ionic-rules": "0.0.8",
|
||||
"typescript": "~2.4.2",
|
||||
"zone.js": "0.8.18"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run test:watch",
|
||||
@@ -44,7 +56,17 @@
|
||||
"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",
|
||||
"readmes": "gulp readmes"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ionic-team/ionic-native.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ionic-team/ionic-native/issues"
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
|
||||
@@ -19,7 +19,7 @@ const ROOT = path.resolve(path.join(__dirname, '../../')), // root ionic-native
|
||||
// dependency versions
|
||||
const ANGULAR_VERSION = '*',
|
||||
RXJS_VERSION = '^5.0.1',
|
||||
MIN_CORE_VERSION = '^3.6.0',
|
||||
MIN_CORE_VERSION = '^4.2.0',
|
||||
IONIC_NATIVE_VERSION = require(path.resolve(ROOT, 'package.json')).version;
|
||||
|
||||
// package dependencies
|
||||
@@ -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!');
|
||||
}
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
"peerDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/driftyco/ionic-native.git"
|
||||
"url": "https://github.com/ionic-team/ionic-native.git"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
"peerDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/driftyco/ionic-native.git"
|
||||
"url": "https://github.com/ionic-team/ionic-native.git"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
@@ -41,7 +41,7 @@ module.exports = currentVersion => {
|
||||
docTypes: ['class'],
|
||||
getOutputPath: doc => doc.originalModule.replace(config.pluginDir + '/', '')
|
||||
.replace('/plugins', '')
|
||||
.replace('/index', '/README.md')
|
||||
.replace(/\/index$/, '/README.md')
|
||||
}];
|
||||
|
||||
})
|
||||
|
||||
@@ -22,8 +22,24 @@ module.exports = function jekyll(renderDocsProcessor) {
|
||||
doc.URL = doc.outputPath.replace('docs//', 'docs/')
|
||||
.replace('/index.md', '')
|
||||
.replace('content/', '');
|
||||
// add trailing slash to plugin pages
|
||||
if(!doc.URL.endsWith("/") && !doc.URL.endsWith(".html")) {
|
||||
doc.URL = doc.URL+'/';
|
||||
}
|
||||
});
|
||||
|
||||
const betaDocs = [];
|
||||
|
||||
docs = docs.filter(doc => {
|
||||
if (doc.beta === true) {
|
||||
betaDocs.push(doc);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
docs = docs.concat(betaDocs);
|
||||
|
||||
// add side menu
|
||||
docs.push({
|
||||
docType: 'nativeMenu',
|
||||
|
||||
@@ -6,5 +6,6 @@ module.exports = [
|
||||
{'name': 'usage'},
|
||||
{'name': 'hidden'}, // hide from docs
|
||||
{'name': 'classes'}, // related classes
|
||||
{'name': 'interfaces'} // related interfaces
|
||||
{'name': 'interfaces'}, // related interfaces
|
||||
{'name': 'paid', transforms: (doc, tag, value) => typeof value !== 'undefined'} // paid plugin, set value to true
|
||||
];
|
||||
|
||||
42
scripts/docs/templates/common.template.html
vendored
42
scripts/docs/templates/common.template.html
vendored
@@ -44,7 +44,7 @@ docType: "<$ doc.docType $>"
|
||||
<@- endmacro -@>
|
||||
|
||||
<@- macro githubViewLink(doc) -@>
|
||||
<a href="https://github.com/driftyco/ionic-native/tree/master/<$ doc.fileInfo.relativePath $>#L<$ doc.location.start.line+1 $>-L<$ doc.location.end.line+1 $>"><$ doc.fileInfo.relativePath $> (line <$ doc.location.start.line+1 $>)</a>
|
||||
<a href="https://github.com/ionic-team/ionic-native/tree/master/<$ doc.fileInfo.relativePath $>#L<$ doc.location.start.line+1 $>-L<$ doc.location.end.line+1 $>"><$ doc.fileInfo.relativePath $> (line <$ doc.location.start.line+1 $>)</a>
|
||||
<@- endmacro -@>
|
||||
|
||||
<@- macro paramTable(params, isDirective) -@>
|
||||
@@ -127,7 +127,7 @@ docType: "<$ doc.docType $>"
|
||||
|
||||
<@- macro documentClass(doc) @>
|
||||
<@- if doc.statics.length -@>
|
||||
<h2>Static Members</h2>
|
||||
<h2><a class="anchor" name="static-members" href="#static-members"></a>Static Members</h2>
|
||||
<@ for method in doc.statics -@>
|
||||
<$ documentMethod(method) $>
|
||||
<@ endfor -@>
|
||||
@@ -136,7 +136,7 @@ docType: "<$ doc.docType $>"
|
||||
<# --- methods in class --- #>
|
||||
<@- if doc.members and doc.members.length @>
|
||||
|
||||
<h2>Instance Members</h2>
|
||||
<h2><a class="anchor" name="instance-members" href="#instance-members"></a>Instance Members</h2>
|
||||
<@ for method in doc.members -@>
|
||||
<$ documentMethod(method) $>
|
||||
<@- endfor @>
|
||||
@@ -147,9 +147,12 @@ docType: "<$ doc.docType $>"
|
||||
<@- if doc.beta == true -@>
|
||||
<span class="beta" title="beta">β</span>
|
||||
<@- endif -@>
|
||||
<@- if doc.paid == true -@>
|
||||
<span class="paid" title="paid">Paid</span>
|
||||
<@- endif -@>
|
||||
</h1>
|
||||
|
||||
<a class="improve-v2-docs" href="http://github.com/driftyco/ionic-native/edit/master/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic-native/', '')|replace('//','/') $>#L<$ doc.location.start.line $>">
|
||||
<a class="improve-v2-docs" href="http://github.com/ionic-team/ionic-native/edit/master/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic-native/', '')|replace('//','/') $>#L<$ doc.location.start.line $>">
|
||||
Improve this doc
|
||||
</a>
|
||||
|
||||
@@ -163,23 +166,36 @@ docType: "<$ doc.docType $>"
|
||||
href="<$ prop.repo $>/issues">plugin repo</a>.
|
||||
</p>
|
||||
<@ endif @>
|
||||
<@ if doc.paid == true @>
|
||||
<p class="paid-notice">
|
||||
This plugin might require a paid license, or might take a share of your app's earnings.
|
||||
Check the <a target="_blank" rel="nofollow" href="<$ prop.repo $>">plugin's repo</a> for more information.
|
||||
</p>
|
||||
<@ endif @>
|
||||
|
||||
<# --- Plugin description --- #>
|
||||
<$ doc.description | marked $>
|
||||
|
||||
<# --- Install commands --- #>
|
||||
<pre><code class="nohighlight">$ <@ if prop.install @><$ prop.install $><@ else @>ionic plugin add --save <$ prop.plugin $><@ endif @>
|
||||
$ npm install --save @ionic-native/<$ doc.npmId $>
|
||||
</code></pre>
|
||||
<p>Repo:
|
||||
<a href="<$ prop.repo $>">
|
||||
<$ prop.repo $>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<# --- Plugin description --- #>
|
||||
<$ doc.description | marked $>
|
||||
<# --- Install commands --- #>
|
||||
<h2><a class="anchor" name="installation" href="#installation"></a>Installation</h2>
|
||||
<ol class="installation">
|
||||
<li>Install the Cordova and Ionic Native plugins:<br>
|
||||
<pre><code class="nohighlight">$ <@ if prop.install @><$ prop.install | replace('<', '<').replace('>', '>') $><@ else @>ionic cordova plugin add <$ prop.plugin $><@ endif @>
|
||||
$ npm install --save @ionic-native/<$ doc.npmId $>
|
||||
</code></pre>
|
||||
</li>
|
||||
<li><a href="https://ionicframework.com/docs/native/#Add_Plugins_to_Your_App_Module">Add this plugin to your app's module</a></li>
|
||||
</ol>
|
||||
|
||||
<# --- Plugin supported platforms --- #>
|
||||
<@ if prop.platforms @>
|
||||
<h2>Supported platforms</h2>
|
||||
<h2><a class="anchor" name="platforms" href="#platforms"></a>Supported platforms</h2>
|
||||
<ul>
|
||||
<@ for platform in prop.platforms -@>
|
||||
<li><$ platform $></li>
|
||||
@@ -191,13 +207,13 @@ $ npm install --save @ionic-native/<$ doc.npmId $>
|
||||
|
||||
<# --- Plugin usage --- #>
|
||||
<@ if doc.usage @>
|
||||
<h2>Usage</h2>
|
||||
<h2><a class="anchor" name="usage" href="#usage"></a>Usage</h2>
|
||||
<$ doc.usage | marked $>
|
||||
<@ endif @>
|
||||
|
||||
<# --- Plugin attributes --- #>
|
||||
<@- if doc.properties -@>
|
||||
<h2>Attributes:</h2>
|
||||
<h2><a class="anchor" name="attributes" href="#attributes"></a>Attributes:</h2>
|
||||
<table class="table" style="margin:0;">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -4,11 +4,7 @@
|
||||
<li class="capitalize {% if page.id == 'mocking' %}active{% endif %}">
|
||||
<a href="/docs/native/browser.html">Browser Usage</a>
|
||||
</li>
|
||||
<@- for doc in docs @><@ if doc.URL and doc.private != true and doc.beta != true @>
|
||||
<@- for doc in docs @><@ if doc.URL and doc.private != true @>
|
||||
<li class="capitalize {% if page.id == '<$ doc.name|lower|dashify $>' %}active{% endif %}">
|
||||
<a href="/<$ doc.URL $>"><$ doc.name $></a>
|
||||
</li><@ endif @><@ endfor @>
|
||||
<@- for doc in docs @><@ if doc.URL and doc.private != true and doc.beta == true @>
|
||||
<li class="capitalize {% if page.id == '<$ doc.name|lower|dashify $>' %}active{% endif %}">
|
||||
<a href="/<$ doc.URL $>"><$ doc.name $> <span class="beta">β</span></a>
|
||||
<a href="/<$ doc.URL $>"><$ doc.name $><@ if doc.paid == true @> <span class="paid">Paid</span><@ endif @><@ if doc.beta == true @> <span class="beta">β</span><@ endif @></a>
|
||||
</li><@ endif @><@ endfor @>
|
||||
|
||||
4
scripts/docs/templates/readme.template.md
vendored
4
scripts/docs/templates/readme.template.md
vendored
@@ -1,4 +1,4 @@
|
||||
<a style="float:right;font-size:12px;" href="http://github.com/driftyco/ionic-native/edit/master/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic-native/', '')|replace('//','/') $>#L<$ doc.location.start.line $>">
|
||||
<a style="float:right;font-size:12px;" href="http://github.com/ionic-team/ionic-native/edit/master/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic-native/', '')|replace('//','/') $>#L<$ doc.location.start.line $>">
|
||||
Improve this doc
|
||||
</a>
|
||||
|
||||
@@ -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 $>
|
||||
```
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ function run {
|
||||
if [ $CHANGED -eq 0 ];
|
||||
then
|
||||
echo "-- No changes detected for the following commit, docs not updated."
|
||||
echo "https://github.com/driftyco/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
|
||||
echo "https://github.com/ionic-team/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
|
||||
else
|
||||
git config --global user.email "hi@ionicframework.com"
|
||||
git config --global user.name "Ionitron"
|
||||
git commit -am "Automated build of native docs driftyco/$CIRCLE_PROJECT_REPONAME@$CIRCLE_SHA1"
|
||||
git commit -am "Automated build of native docs ionic-team/$CIRCLE_PROJECT_REPONAME@$CIRCLE_SHA1"
|
||||
# in case a different commit was pushed to ionic-site during doc/demo gen,
|
||||
# try to rebase around it before pushing
|
||||
git fetch
|
||||
|
||||
@@ -18,12 +18,12 @@ function run {
|
||||
if [ -z "$CHANGED" ];
|
||||
then
|
||||
echo "-- No changes detected for the following commit, docs not updated."
|
||||
echo "https://github.com/driftyco/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
|
||||
echo "https://github.com/ionic-team/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
|
||||
else
|
||||
git config --global user.email "hi@ionicframework.com"
|
||||
git config --global user.name "Ionitron"
|
||||
git add -A
|
||||
git commit -am "Automated build of native readmes for driftyco/$CIRCLE_PROJECT_REPONAME@$CIRCLE_SHA1"
|
||||
git commit -am "Automated build of native readmes for ionic-team/$CIRCLE_PROJECT_REPONAME@$CIRCLE_SHA1"
|
||||
# in case a different commit was pushed to ionic-site during doc/demo gen,
|
||||
# try to rebase around it before pushing
|
||||
git fetch
|
||||
|
||||
@@ -21,7 +21,7 @@ function run {
|
||||
git config --global user.email "hi@ionicframework.com"
|
||||
git config --global user.name "Ionitron"
|
||||
|
||||
git clone git@github.com:driftyco/$REPOSITORY.git $DIRECTORY $ARGS
|
||||
git clone git@github.com:ionic-team/$REPOSITORY.git $DIRECTORY $ARGS
|
||||
cd $DIRECTORY
|
||||
git fetch origin --tags
|
||||
cd ../
|
||||
|
||||
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,30 +1,61 @@
|
||||
import { Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
/**
|
||||
* This is a template for new plugin wrappers
|
||||
*
|
||||
* TODO:
|
||||
* - Add/Change information below
|
||||
* - Document usage (importing, executing main functionality)
|
||||
* - Remove any imports that you are not using
|
||||
* - Add this file to /src/index.ts (follow style of other plugins)
|
||||
* - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs and any other docs you added
|
||||
* - Remove this note
|
||||
*
|
||||
*/
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name $Plugin_Name
|
||||
* @name {{ Plugin_Name }}
|
||||
* @description
|
||||
* This plugin does something
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { $PluginName } from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { {{ PluginName }} } from '@ionic-native/{{ plugin-name }}';
|
||||
*
|
||||
*
|
||||
* constructor(private $pluginName: $PluginName) { }
|
||||
* constructor(private {{ pluginName }}: {{ PluginName }}) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.{{ pluginName }}.functionName('Hello', 123)
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: '$PluginName',
|
||||
plugin: '',
|
||||
pluginRef: '',
|
||||
repo: '',
|
||||
platforms: []
|
||||
pluginName: '{{ PluginName }}',
|
||||
plugin: '', // npm package name, example: cordova-plugin-camera
|
||||
pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation
|
||||
repo: '', // the github repository URL for the plugin
|
||||
install: '', // OPTIONAL install command, in case the plugin requires variables
|
||||
installVariables: [], // OPTIONAL the plugin requires variables
|
||||
platforms: [] // Array of platforms supported, example: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class $PluginName extends IonicNativePlugin {
|
||||
export class {{ PluginName }} extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* This function does something
|
||||
* @param arg1 {string} Some param to configure something
|
||||
* @param arg2 {number} Another param to configure something
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
functionName(arg1: string, arg2: number): Promise<any> {
|
||||
return; // We add return; here to avoid any IDE / Compiler errors
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,36 +15,37 @@ import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty, Io
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name $Plugin_Name
|
||||
* @name {{ Plugin_Name }}
|
||||
* @description
|
||||
* This plugin does something
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { $PluginName } from '@ionic-native/';
|
||||
* ```typescript
|
||||
* import { {{ PluginName }} } from '@ionic-native/{{ plugin-name }}';
|
||||
*
|
||||
*
|
||||
* constructor(private $pluginName: $PluginName) { }
|
||||
* constructor(private {{ pluginName }}: {{ PluginName }}) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.$pluginName.functionName('Hello', 123)
|
||||
* this.{{ pluginName }}.functionName('Hello', 123)
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: '$PluginName',
|
||||
pluginName: '{{ PluginName }}',
|
||||
plugin: '', // npm package name, example: cordova-plugin-camera
|
||||
pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation
|
||||
repo: '', // the github repository URL for the plugin
|
||||
platforms: [], // Array of platforms supported, example: ['Android', 'iOS']
|
||||
install: '', // OPTIONAL install command, in case the plugin requires variables
|
||||
installVariables: [], // OPTIONAL the plugin requires variables
|
||||
platforms: [] // Array of platforms supported, example: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class $PluginName extends IonicNativePlugin {
|
||||
export class {{ PluginName }} extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* This function does something
|
||||
|
||||
@@ -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);
|
||||
|
||||
277
src/@ionic-native/core/decorators.spec.ts
Normal file
277
src/@ionic-native/core/decorators.spec.ts
Normal file
@@ -0,0 +1,277 @@
|
||||
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';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
@Cordova({
|
||||
destruct: true
|
||||
})
|
||||
destructPromise(): Promise<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
destruct: true,
|
||||
observable: true
|
||||
})
|
||||
destructObservable(): Observable<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
},
|
||||
destructPromise: (success: Function) => success('hello', 'world'),
|
||||
destructObservable: (success: Function) => success('hello', 'world')
|
||||
};
|
||||
}
|
||||
|
||||
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('CordovaOptions', () => {
|
||||
|
||||
describe('destruct', () => {
|
||||
|
||||
it('should destruct values returned by a Promise', (done) => {
|
||||
plugin.destructPromise()
|
||||
.then((args: any[]) => {
|
||||
expect(args).toEqual(['hello', 'world']);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should destruct values returned by an Observable', (done) => {
|
||||
plugin.destructObservable()
|
||||
.subscribe((args: any[]) => {
|
||||
expect(args).toEqual(['hello', 'world']);
|
||||
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,9 +32,12 @@ export interface PluginConfig {
|
||||
* Supported platforms
|
||||
*/
|
||||
platforms?: string[];
|
||||
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface CordovaOptions {
|
||||
destruct?: boolean;
|
||||
/**
|
||||
* Set to true if the wrapped method is a sync function
|
||||
*/
|
||||
@@ -102,17 +105,6 @@ export interface CordovaCheckOptions {
|
||||
observable?: boolean;
|
||||
}
|
||||
|
||||
export interface CordovaFiniteObservableOptions extends CordovaOptions {
|
||||
/**
|
||||
* Function that gets a result returned from plugin's success callback, and decides whether it is last value and observable should complete.
|
||||
*/
|
||||
resultFinalPredicate?: (result: any) => boolean;
|
||||
/**
|
||||
* Function that gets called after resultFinalPredicate, and removes service data that indicates end of stream from the result.
|
||||
*/
|
||||
resultTransform?: (result: any) => any;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@@ -133,7 +125,8 @@ export function InstanceCheck(opts: CordovaCheckOptions = {}) {
|
||||
return getPromise(() => { });
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -157,12 +150,12 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) {
|
||||
}
|
||||
return Promise.reject(check && check.error);
|
||||
}
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
@@ -182,12 +175,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 +230,8 @@ export function Cordova(opts: CordovaOptions = {}) {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
return wrap(this, methodName, opts).apply(this, args);
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -247,12 +241,13 @@ export function Cordova(opts: CordovaOptions = {}) {
|
||||
*
|
||||
* Wrap an instance method
|
||||
*/
|
||||
export function CordovaInstance(opts: any = {}) {
|
||||
export function CordovaInstance(opts: CordovaOptions = {}) {
|
||||
return (target: Object, methodName: string) => {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
return wrapInstance(this, methodName, opts).apply(this, args);
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -310,43 +305,9 @@ export function CordovaFunctionOverride(opts: any = {}) {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
return overrideFunction(this, methodName, opts);
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* Wraps method that returns an observable that can be completed. Provided opts.resultFinalPredicate dictates when the observable completes.
|
||||
*
|
||||
*/
|
||||
export function CordovaFiniteObservable(opts: CordovaFiniteObservableOptions = {}) {
|
||||
if (opts.observable === false) {
|
||||
throw new Error('CordovaFiniteObservable decorator can only be used on methods that returns observable. Please provide correct option.');
|
||||
}
|
||||
opts.observable = true;
|
||||
return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>) => {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
let wrappedObservable: Observable<any> = wrap(this, methodName, opts).apply(this, args);
|
||||
return new Observable<any>((observer) => {
|
||||
let wrappedSubscription = wrappedObservable.subscribe({
|
||||
next: (x) => {
|
||||
observer.next(opts.resultTransform ? opts.resultTransform(x) : x);
|
||||
if (opts.resultFinalPredicate && opts.resultFinalPredicate(x)) {
|
||||
observer.complete();
|
||||
}
|
||||
},
|
||||
error: (err) => { observer.error(err); },
|
||||
complete: () => { observer.complete(); }
|
||||
});
|
||||
return () => {
|
||||
wrappedSubscription.unsubscribe();
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
69
src/@ionic-native/core/ionic-native-plugin.spec.ts
Normal file
69
src/@ionic-native/core/ionic-native-plugin.spec.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
// This is to verify that new (FileTransfer.getPlugin)() works
|
||||
|
||||
import { Plugin, CordovaInstance } from './decorators';
|
||||
import { checkAvailability } from './plugin';
|
||||
import { IonicNativePlugin } from './ionic-native-plugin';
|
||||
|
||||
class FT {
|
||||
hello(): string {
|
||||
return 'world';
|
||||
}
|
||||
}
|
||||
|
||||
(window as any).FileTransfer = () => new FT();
|
||||
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-file-transfer',
|
||||
pluginRef: 'FileTransfer',
|
||||
repo: '',
|
||||
pluginName: 'FileTransfer'
|
||||
})
|
||||
export class FileTransfer extends IonicNativePlugin {
|
||||
create(): FileTransferObject {
|
||||
let instance: any;
|
||||
if (checkAvailability(FileTransfer.getPluginRef(), null, FileTransfer.getPluginName()) === true) {
|
||||
instance = new (FileTransfer.getPlugin())();
|
||||
}
|
||||
return new FileTransferObject(instance);
|
||||
}
|
||||
}
|
||||
|
||||
export class FileTransferObject {
|
||||
|
||||
constructor(public _objectInstance: any) {
|
||||
console.info('Creating a new FileTransferObject with instance: ', _objectInstance);
|
||||
}
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
hello(): string { return; }
|
||||
|
||||
}
|
||||
|
||||
describe('Mock FileTransfer Plugin', () => {
|
||||
|
||||
let plugin: FileTransfer,
|
||||
instance: FileTransferObject;
|
||||
|
||||
beforeAll(() => {
|
||||
plugin = new FileTransfer();
|
||||
instance = plugin.create();
|
||||
});
|
||||
|
||||
it('should create a new FileTransfer plugin instance', () => {
|
||||
expect(plugin instanceof FileTransfer).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should create new FileTransferObject instance', () => {
|
||||
expect(instance instanceof FileTransferObject).toBeTruthy();
|
||||
});
|
||||
|
||||
it('FileTransferObject instance should have _objectInstance property', () => {
|
||||
expect(instance._objectInstance).toBeDefined();
|
||||
});
|
||||
|
||||
it('FileTransferObject.hello should return world', () => {
|
||||
console.info('instance hello is', instance.hello());
|
||||
expect(instance.hello()).toEqual('world');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -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,9 +134,13 @@ 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) => {
|
||||
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
|
||||
let pluginResult: any, rej: Function;
|
||||
const p = getPromise((resolve: Function, reject: Function) => {
|
||||
if (opts.destruct) {
|
||||
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args));
|
||||
} else {
|
||||
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
|
||||
}
|
||||
rej = reject;
|
||||
});
|
||||
// Angular throws an error on unhandled rejection, but in this case we have already printed
|
||||
@@ -145,13 +148,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) {
|
||||
@@ -167,7 +170,14 @@ function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts:
|
||||
|
||||
function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
||||
return new Observable(observer => {
|
||||
let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||||
let pluginResult;
|
||||
|
||||
if (opts.destruct) {
|
||||
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, (...args: any[]) => observer.next(args), (...args: any[]) => observer.error(args));
|
||||
} else {
|
||||
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||||
}
|
||||
|
||||
if (pluginResult && pluginResult.error) {
|
||||
observer.error(pluginResult.error);
|
||||
observer.complete();
|
||||
@@ -178,11 +188,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 +249,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 +269,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);
|
||||
@@ -267,7 +277,14 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
|
||||
} else if (opts.observable) {
|
||||
|
||||
return new Observable(observer => {
|
||||
let pluginResult = callInstance(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||||
|
||||
let pluginResult;
|
||||
|
||||
if (opts.destruct) {
|
||||
pluginResult = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => observer.next(args), (...args: any[]) => observer.error(args));
|
||||
} else {
|
||||
pluginResult = callInstance(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||||
}
|
||||
|
||||
if (pluginResult && pluginResult.error) {
|
||||
observer.error(pluginResult.error);
|
||||
@@ -277,38 +294,51 @@ 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) => {
|
||||
let result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
if (result && !result.error) {
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
let result;
|
||||
if (opts.destruct) {
|
||||
result = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args));
|
||||
} else {
|
||||
result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
}
|
||||
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);
|
||||
let pluginResult: any, rej: Function;
|
||||
const p = getPromise((resolve: Function, reject: Function) => {
|
||||
if (opts.destruct) {
|
||||
pluginResult = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args));
|
||||
} else {
|
||||
pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
}
|
||||
rej = reject;
|
||||
});
|
||||
// Angular throws an error on unhandled rejection, but in this case we have already printed
|
||||
// a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
|
||||
// to error
|
||||
if (pluginResult && pluginResult.error) {
|
||||
p.catch(() => { });
|
||||
rej(pluginResult.error);
|
||||
typeof rej === 'function' && rej(pluginResult.error);
|
||||
}
|
||||
return p;
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,56 +1,57 @@
|
||||
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.');
|
||||
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 or on a recent browser.');
|
||||
}
|
||||
};
|
||||
|
||||
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 {
|
||||
console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed.');
|
||||
}
|
||||
if (plugin) {
|
||||
console.warn('Install the ' + pluginName + ' plugin: \'ionic plugin add ' + plugin + '\'');
|
||||
console.warn('Install the ' + pluginName + ' plugin: \'ionic cordova plugin add ' + plugin + '\'');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, CordovaProperty, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
export interface ActionSheetOptions {
|
||||
|
||||
@@ -51,7 +51,7 @@ export interface ActionSheetOptions {
|
||||
/**
|
||||
* Choose if destructive button will be the last
|
||||
*/
|
||||
destructiveButtonLast: boolean;
|
||||
destructiveButtonLast?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,18 +94,26 @@ export interface ActionSheetOptions {
|
||||
plugin: 'cordova-plugin-actionsheet',
|
||||
pluginRef: 'plugins.actionsheet',
|
||||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Browser']
|
||||
platforms: ['Android', 'Browser', 'iOS', 'Windows', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class ActionSheet extends IonicNativePlugin {
|
||||
|
||||
@CordovaProperty
|
||||
/**
|
||||
* Convenience property to select an Android theme value
|
||||
*/
|
||||
ANDROID_THEMES: {
|
||||
THEME_TRADITIONAL: number;
|
||||
THEME_HOLO_DARK: number;
|
||||
THEME_HOLO_LIGHT: number;
|
||||
THEME_DEVICE_DEFAULT_DARK: number;
|
||||
THEME_DEVICE_DEFAULT_LIGHT: number;
|
||||
} = {
|
||||
THEME_TRADITIONAL: 1,
|
||||
THEME_HOLO_DARK: 2,
|
||||
THEME_HOLO_LIGHT: 3,
|
||||
THEME_DEVICE_DEFAULT_DARK: 4,
|
||||
THEME_DEVICE_DEFAULT_LIGHT: 5
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export interface AdMobOptions {
|
||||
overlap?: boolean;
|
||||
|
||||
/**
|
||||
* Position of banner ad. Defaults to `TOP_CENTER`. You can use the `AdMob.AD_POSITION` property to select other values.
|
||||
* Position of banner ad. Defaults to `TOP_CENTER`. You can use the `AdMobPro.AD_POSITION` property to select other values.
|
||||
*/
|
||||
position?: number;
|
||||
|
||||
@@ -90,15 +90,18 @@ export interface AdExtras {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name AdMob
|
||||
* @paid
|
||||
* @name AdMob Pro
|
||||
* @description
|
||||
* Plugin for Google Ads, including AdMob / DFP (doubleclick for publisher) and mediations to other Ad networks.
|
||||
* 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 [AdMobPro Free](../admob-free).
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AdMob } from '@ionic-native/admob';
|
||||
* import { AdMobPro } from '@ionic-native/admob-pro';
|
||||
* import { Platform } from 'ionic-angular';
|
||||
*
|
||||
* constructor(private admob: AdMob, private platform: Platform ) { }
|
||||
* constructor(private admob: AdMobPro, private platform: Platform ) { }
|
||||
*
|
||||
* ionViewDidLoad() {
|
||||
* this.admob.onAdDismiss()
|
||||
@@ -107,12 +110,12 @@ export interface AdExtras {
|
||||
*
|
||||
* onClick() {
|
||||
* let adId;
|
||||
* if(this.platform.is('android') {
|
||||
* if(this.platform.is('android')) {
|
||||
* adId = 'YOUR_ADID_ANDROID';
|
||||
* } else if (this.platform.is('ios')) {
|
||||
* adId = 'YOUR_ADID_IOS';
|
||||
* }
|
||||
* this.admob.prepareInterstitial(adId)
|
||||
* this.admob.prepareInterstitial({adId: adId})
|
||||
* .then(() => { this.admob.showInterstitial(); });
|
||||
* }
|
||||
*
|
||||
@@ -123,14 +126,14 @@ export interface AdExtras {
|
||||
* AdExtras
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AdMob',
|
||||
pluginName: 'AdMob Pro',
|
||||
plugin: 'cordova-plugin-admobpro',
|
||||
pluginRef: 'AdMob',
|
||||
repo: 'https://github.com/floatinghotpot/cordova-admob-pro',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class AdMob extends IonicNativePlugin {
|
||||
export class AdMobPro extends IonicNativePlugin {
|
||||
|
||||
AD_POSITION: {
|
||||
NO_CHANGE: number;
|
||||
@@ -176,7 +179,7 @@ export class AdMob extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Show banner at position
|
||||
* @param position {number} Position. Use `AdMob.AD_POSITION` to set values.
|
||||
* @param position {number} Position. Use `AdMobPro.AD_POSITION` to set values.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
|
||||
|
||||
export interface AlipayOrder {
|
||||
/**
|
||||
* appId assigned by Alipay
|
||||
@@ -99,8 +101,9 @@ export interface AlipayOrder {
|
||||
plugin: 'cordova-alipay-base',
|
||||
pluginRef: 'Alipay.Base',
|
||||
repo: 'https://github.com/xueron/cordova-alipay-base',
|
||||
platforms: ['Android', 'iOS'],
|
||||
install: 'ionic plugin add https://github.com/xueron/cordova-alipay-base --variable APP_ID=your_app_id'
|
||||
install: 'ionic cordova plugin add cordova-alipay-base --variable APP_ID=your_app_id',
|
||||
installVariables: ['APP_ID'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Alipay extends IonicNativePlugin {
|
||||
|
||||
@@ -192,7 +192,7 @@ export class AndroidFingerprintAuth extends IonicNativePlugin {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves if fingerprint auth is available on the device
|
||||
*/
|
||||
@Cordova()
|
||||
isAvailable(): Promise<{ isAvailable: boolean }> { return; }
|
||||
isAvailable(): Promise<{ isAvailable: boolean, isHardwareDetected: boolean, hasEnrolledFingerprints: boolean }> { return; }
|
||||
|
||||
/**
|
||||
* Delete the cipher used for encryption and decryption by username
|
||||
|
||||
@@ -1,6 +1,35 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* Bit flag values for setSystemUiVisibility()
|
||||
* @see https://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int)
|
||||
*/
|
||||
export enum AndroidSystemUiFlags {
|
||||
/** View has requested the system UI (status bar) to be visible (the default). SYSTEM_UI_FLAG_VISIBLE */
|
||||
Visible = 0,
|
||||
/** View has requested the system UI to enter an unobtrusive "low profile" mode. SYSTEM_UI_FLAG_LOW_PROFILE */
|
||||
LowProfile = 1,
|
||||
/** View has requested that the system navigation be temporarily hidden. SYSTEM_UI_FLAG_HIDE_NAVIGATION */
|
||||
HideNavigation = 2,
|
||||
/** View has requested to go into the normal fullscreen mode so that its content can take over the screen while still allowing the user to interact with the application. SYSTEM_UI_FLAG_FULLSCREEN */
|
||||
Fullscreen = 4,
|
||||
/** Requests the navigation bar to draw in a mode that is compatible with light navigation bar backgrounds. SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR */
|
||||
LightNavigationBar = 16,
|
||||
/** When using other layout flags, we would like a stable view of the content insets given to fitSystemWindows(Rect). SYSTEM_UI_FLAG_LAYOUT_STABLE */
|
||||
LayoutStable = 256,
|
||||
/** View would like its window to be laid out as if it has requested SYSTEM_UI_FLAG_HIDE_NAVIGATION, even if it currently hasn't. SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION */
|
||||
LayoutHideNavigation = 512,
|
||||
/** View would like its window to be laid out as if it has requested SYSTEM_UI_FLAG_FULLSCREEN, even if it currently hasn't. SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN */
|
||||
LayoutFullscreen = 1024,
|
||||
/** View would like to remain interactive when hiding the navigation bar with SYSTEM_UI_FLAG_HIDE_NAVIGATION. SYSTEM_UI_FLAG_IMMERSIVE */
|
||||
Immersive = 2048,
|
||||
/** View would like to remain interactive when hiding the status bar with SYSTEM_UI_FLAG_FULLSCREEN and/or hiding the navigation bar with SYSTEM_UI_FLAG_HIDE_NAVIGATION. SYSTEM_UI_FLAG_IMMERSIVE_STICKY */
|
||||
ImmersiveSticky = 4096,
|
||||
/** Requests the status bar to draw in a mode that is compatible with light status bar backgrounds. SYSTEM_UI_FLAG_LIGHT_STATUS_BAR */
|
||||
LightStatusBar = 8192
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Android Full Screen
|
||||
* @description
|
||||
@@ -92,4 +121,13 @@ export class AndroidFullScreen extends IonicNativePlugin {
|
||||
*/
|
||||
@Cordova()
|
||||
immersiveMode(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Manually set the the system UI to a custom mode. This mirrors the Android method of the same name. (Android 4.4+ only).
|
||||
* @see https://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int)
|
||||
* @param {AndroidSystemUiFlags} visibility Bitwise-OR of flags in AndroidSystemUiFlags
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
setSystemUiVisibility(visibility: AndroidSystemUiFlags): Promise<void> { return; }
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import { Injectable } from '@angular/core';
|
||||
*
|
||||
* this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
|
||||
* success => console.log('Permission granted'),
|
||||
* err => this.androidPermissions.requestPermissions(this.androidPermissions.PERMISSION.CAMERA)
|
||||
* err => this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA)
|
||||
* );
|
||||
*
|
||||
* this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]);
|
||||
@@ -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.
|
||||
|
||||
@@ -8,24 +8,24 @@ import { Injectable } from '@angular/core';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Platfrom } from 'ionic-angular';
|
||||
* import { AppMinimize } from '@ionic-native/app-minimize';
|
||||
*
|
||||
*
|
||||
* constructor(private appMinimize: AppMinimize) { }
|
||||
* constructor(private platform: Platform, private appMinimize: AppMinimize) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.plugin.minimize().then(
|
||||
* success => console.log('Closed'),
|
||||
* err => console.log('Something went wrong')
|
||||
* );
|
||||
* this.platform.registerBackButtonAction(() => {
|
||||
* this.appMinimize.minimize();
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AppMinimize',
|
||||
plugin: 'https://github.com/tomloprod/cordova-plugin-appminimize.git',
|
||||
pluginRef: 'cordova.plugins.appMinimize',
|
||||
plugin: 'cordova-plugin-appminimize',
|
||||
pluginRef: 'plugins.appMinimize',
|
||||
repo: 'https://github.com/tomloprod/cordova-plugin-appminimize',
|
||||
platforms: ['Android']
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ import { Injectable } from '@angular/core';
|
||||
plugin: 'cordova-plugin-app-preferences',
|
||||
pluginRef: 'plugins.appPreferences',
|
||||
repo: 'https://github.com/apla/me.apla.cordova.app-preferences',
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'iOS', 'OS X', 'Windows 8', 'Windows Phone']
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'iOS', 'macOS', 'Windows 8', 'Windows Phone']
|
||||
})
|
||||
@Injectable()
|
||||
export class AppPreferences extends IonicNativePlugin {
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
@@ -64,6 +61,10 @@ export interface AppRateCallbacks {
|
||||
* call back function. called when rate-dialog showing
|
||||
*/
|
||||
onRateDialogShow?: Function;
|
||||
/**
|
||||
* call back function. called when user clicked on negative feedback
|
||||
*/
|
||||
handleNegativeFeedback?: Function;
|
||||
|
||||
}
|
||||
|
||||
@@ -143,7 +144,7 @@ export interface AppUrls {
|
||||
plugin: 'cordova-plugin-apprate',
|
||||
pluginRef: 'AppRate',
|
||||
repo: 'https://github.com/pushandplay/cordova-plugin-apprate',
|
||||
platforms: ['Android', 'iOS', 'Windows (experimental)']
|
||||
platforms: ['Android', 'BlackBerry 10', 'iOS', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
export class AppRate extends IonicNativePlugin {
|
||||
@@ -162,4 +163,10 @@ export class AppRate extends IonicNativePlugin {
|
||||
@Cordova()
|
||||
promptForRating(immediately: boolean): void { };
|
||||
|
||||
/**
|
||||
* Immediately send the user to the app store rating page
|
||||
*/
|
||||
@Cordova()
|
||||
navigateToAppStore(): void { };
|
||||
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
plugin: 'cordova-plugin-app-version',
|
||||
pluginRef: 'cordova.getAppVersion',
|
||||
repo: 'https://github.com/whiteoctober/cordova-plugin-app-version',
|
||||
platforms: ['Android', 'iOS']
|
||||
platforms: ['Android', 'iOS', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
export class AppVersion extends IonicNativePlugin {
|
||||
|
||||
@@ -22,9 +22,9 @@ import { Injectable } from '@angular/core';
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Appodeal',
|
||||
plugin: 'https://github.com/appodeal/appodeal-cordova-plugin',
|
||||
plugin: 'https://github.com/appodeal/appodeal-cordova-plugin.git',
|
||||
pluginRef: 'Appodeal',
|
||||
repo: 'https://github.com/appodeal/appodeal-cordova-plugin.git',
|
||||
repo: 'https://github.com/appodeal/appodeal-cordova-plugin',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
@@ -127,7 +125,7 @@ export interface BackgroundGeolocationConfig {
|
||||
startForeground?: boolean;
|
||||
|
||||
/**
|
||||
* ANDROID, WP8 ONLY
|
||||
* ANDROID ONLY
|
||||
* When using BackgroundGeolocation.LocationProvider.ANDROID_DISTANCE_FILTER_PROVIDER:
|
||||
* The minimum time interval between location updates in milliseconds.
|
||||
* @see Android docs (http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20android.app.PendingIntent))
|
||||
@@ -266,7 +264,7 @@ export interface BackgroundGeolocationConfig {
|
||||
* BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
|
||||
*
|
||||
* ```typescript
|
||||
* import { BackgroundGeolocation, BackgroundGeolocationConfig } from '@ionic-native/background-geolocation';
|
||||
* import { BackgroundGeolocation, BackgroundGeolocationConfig, BackgroundGeolocationResponse } from '@ionic-native/background-geolocation';
|
||||
*
|
||||
* constructor(private backgroundGeolocation: BackgroundGeolocation) { }
|
||||
*
|
||||
@@ -308,7 +306,7 @@ export interface BackgroundGeolocationConfig {
|
||||
plugin: 'cordova-plugin-mauron85-background-geolocation',
|
||||
pluginRef: 'backgroundGeolocation',
|
||||
repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation',
|
||||
platforms: ['iOS', 'Android', 'Windows Phone 8']
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class BackgroundGeolocation extends IonicNativePlugin {
|
||||
@@ -393,7 +391,7 @@ export class BackgroundGeolocation extends IonicNativePlugin {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows Phone']
|
||||
platforms: ['iOS']
|
||||
})
|
||||
finish(): Promise<any> { return; }
|
||||
|
||||
@@ -403,7 +401,7 @@ export class BackgroundGeolocation extends IonicNativePlugin {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows Phone']
|
||||
platforms: ['iOS']
|
||||
})
|
||||
changePace(isMoving: boolean): Promise<any> { return; }
|
||||
|
||||
@@ -422,7 +420,7 @@ export class BackgroundGeolocation extends IonicNativePlugin {
|
||||
* @returns {Promise<Location>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows Phone']
|
||||
platforms: ['iOS']
|
||||
})
|
||||
getStationaryLocation(): Promise<BackgroundGeolocationResponse> { return; }
|
||||
|
||||
@@ -432,7 +430,7 @@ export class BackgroundGeolocation extends IonicNativePlugin {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows Phone']
|
||||
platforms: ['iOS']
|
||||
})
|
||||
onStationary(): Promise<any> { return; }
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ export interface BackgroundModeConfiguration {
|
||||
text?: String;
|
||||
|
||||
/**
|
||||
* This will look for <icon name>.png in platforms/android/res/drawable|mipmap
|
||||
* This will look for `<icon name>.png` in platforms/android/res/drawable|mipmap
|
||||
*/
|
||||
icon?: string;
|
||||
|
||||
color?: string;
|
||||
|
||||
/**
|
||||
* By default the app will come to foreground when taping on the notification. If false, plugin wont come to foreground when tapped.
|
||||
* By default the app will come to foreground when taping on the notification. If false, plugin won't come to foreground when tapped.
|
||||
*/
|
||||
resume?: boolean;
|
||||
|
||||
@@ -50,7 +50,7 @@ export interface BackgroundModeConfiguration {
|
||||
* @name Background Mode
|
||||
* @description
|
||||
* Cordova plugin to prevent the app from going to sleep while in background.
|
||||
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode
|
||||
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, visit: https://github.com/katzer/cordova-plugin-background-mode
|
||||
*@usage
|
||||
* ```typescript
|
||||
* import { BackgroundMode } from '@ionic-native/background-mode';
|
||||
@@ -70,7 +70,7 @@ export interface BackgroundModeConfiguration {
|
||||
plugin: 'cordova-plugin-background-mode',
|
||||
pluginRef: 'cordova.plugins.backgroundMode',
|
||||
repo: 'https://github.com/katzer/cordova-plugin-background-mode',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
platforms: ['AmazonFire OS', 'Android', 'Browser', 'iOS', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
export class BackgroundMode extends IonicNativePlugin {
|
||||
@@ -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`.
|
||||
@@ -178,7 +179,7 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
overrideBackButton(): void { }
|
||||
|
||||
/**
|
||||
* Exclude the app from the recent task list works on Android 5.0+.
|
||||
* Exclude the app from the recent task list. Works on Android 5.0+.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
|
||||
@@ -27,7 +27,7 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
plugin: 'cordova-plugin-badge',
|
||||
pluginRef: 'cordova.plugins.notification.badge',
|
||||
repo: 'https://github.com/katzer/cordova-plugin-badge',
|
||||
platforms: ['Android', 'iOS', 'Browser', 'Windows', 'Amazon FireOS', 'Windows Phone 8']
|
||||
platforms: ['Android', 'Browser', 'iOS', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
export class Badge extends IonicNativePlugin {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
export interface BarcodeScannerOptions {
|
||||
|
||||
/**
|
||||
@@ -93,7 +92,7 @@ export interface BarcodeScanResult {
|
||||
plugin: 'phonegap-plugin-barcodescanner',
|
||||
pluginRef: 'cordova.plugins.barcodeScanner',
|
||||
repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows 10', 'Windows 8', 'BlackBerry 10', 'Browser']
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'iOS', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
export class BarcodeScanner extends IonicNativePlugin {
|
||||
|
||||
45
src/@ionic-native/plugins/base64/index.ts
Normal file
45
src/@ionic-native/plugins/base64/index.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Base64
|
||||
* @description
|
||||
* This Plugin is used to encode base64 of any file, it uses js code for iOS, but in case of android it uses native code to handle android versions lower than v.3
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Base64 } from '@ionic-native/base64';
|
||||
*
|
||||
* constructor(private base64: Base64) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let filePath: string = 'file:///...';
|
||||
* this.base64.encodeFile(filePath).then((base64File: string) => {
|
||||
* console.log(base64File);
|
||||
* }, (err) => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Base64',
|
||||
plugin: 'com-badrit-base64',
|
||||
pluginRef: 'plugins.Base64',
|
||||
repo: 'https://github.com/hazemhagrass/phonegap-base64',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Base64 extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* This function encodes base64 of any file
|
||||
* @param {string} filePath Absolute file path
|
||||
* @return {Promise<string>} Returns a promise that resolves when the file is successfully encoded
|
||||
*/
|
||||
@Cordova()
|
||||
encodeFile(filePath: string): Promise<string> { return; }
|
||||
|
||||
}
|
||||
@@ -49,7 +49,7 @@ export interface BatteryStatusResponse {
|
||||
plugin: 'cordova-plugin-battery-status',
|
||||
pluginRef: 'navigator.battery',
|
||||
repo: 'https://github.com/apache/cordova-plugin-battery-status',
|
||||
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
|
||||
platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Tizen', 'Ubuntu', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
export class BatteryStatus extends IonicNativePlugin {
|
||||
|
||||
@@ -173,7 +173,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
plugin: 'cordova-plugin-ble-central',
|
||||
pluginRef: 'ble',
|
||||
repo: 'https://github.com/don/cordova-plugin-ble-central',
|
||||
platforms: ['iOS', 'Android']
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class BLE extends IonicNativePlugin {
|
||||
@@ -441,7 +441,7 @@ export class BLE extends IonicNativePlugin {
|
||||
*@returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static readRSSI(
|
||||
readRSSI(
|
||||
deviceId: string,
|
||||
): Promise<any> { return; }
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name Bluetooth Serial
|
||||
* @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.
|
||||
* @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino (not Android to Android or iOS to iOS).
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { BluetoothSerial } from '@ionic-native/bluetooth-serial';
|
||||
@@ -35,7 +35,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
repo: 'https://github.com/don/BluetoothSerial',
|
||||
plugin: 'cordova-plugin-bluetooth-serial',
|
||||
pluginRef: 'bluetoothSerial',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone', 'Browser']
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class BluetoothSerial extends IonicNativePlugin {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
/**
|
||||
* @name Brightness
|
||||
* @description
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
* @name Call Number
|
||||
* @description
|
||||
* Call a number directly from your Cordova/Ionic application.
|
||||
* **NOTE**: The iOS Simulator (and maybe Android Simulators) do not provide access to the phone subsystem.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
@@ -14,7 +15,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.callNumber.callNumber(18001010101, true)
|
||||
* this.callNumber.callNumber("18001010101", true)
|
||||
* .then(() => console.log('Launched dialer!'))
|
||||
* .catch(() => console.log('Error launching dialer'));
|
||||
*
|
||||
@@ -25,7 +26,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
plugin: 'call-number',
|
||||
pluginRef: 'plugins.CallNumber',
|
||||
repo: 'https://github.com/Rohfosho/CordovaCallNumberPlugin',
|
||||
platforms: ['iOS', 'Android']
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class CallNumber extends IonicNativePlugin {
|
||||
|
||||
@@ -57,7 +57,7 @@ export interface CameraPreviewPictureOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { CameraPreview, PictureOptions, CameraPreviewOptions, CameraPreviewDimensions } from '@ionic-native/camera-preview';
|
||||
* import { CameraPreview, CameraPreviewPictureOptions, CameraPreviewOptions, CameraPreviewDimensions } from '@ionic-native/camera-preview';
|
||||
*
|
||||
* constructor(private cameraPreview: CameraPreview) { }
|
||||
*
|
||||
@@ -93,7 +93,7 @@ export interface CameraPreviewPictureOptions {
|
||||
*
|
||||
*
|
||||
* // picture options
|
||||
* const pictureOpts: PictureOptions = {
|
||||
* const pictureOpts: CameraPreviewPictureOptions = {
|
||||
* width: 1280,
|
||||
* height: 1280,
|
||||
* quality: 85
|
||||
|
||||
@@ -85,6 +85,42 @@ export interface CameraPopoverOptions {
|
||||
arrowDir: number;
|
||||
}
|
||||
|
||||
export enum DestinationType {
|
||||
DATA_URL = 0,
|
||||
FILE_URL,
|
||||
NATIVE_URI
|
||||
}
|
||||
|
||||
export enum EncodingType {
|
||||
JPEG = 0,
|
||||
PNG
|
||||
}
|
||||
|
||||
export enum MediaType {
|
||||
PICTURE = 0,
|
||||
VIDEO,
|
||||
ALLMEDIA
|
||||
}
|
||||
|
||||
export enum PictureSourceType {
|
||||
PHOTOLIBRARY = 0,
|
||||
CAMERA,
|
||||
SAVEDPHOTOALBUM
|
||||
}
|
||||
|
||||
export enum PopoverArrowDirection {
|
||||
ARROW_UP = 1,
|
||||
ARROW_DOWN,
|
||||
ARROW_LEFT,
|
||||
ARROW_RIGHT,
|
||||
ARROW_ANY
|
||||
}
|
||||
|
||||
export enum Direction {
|
||||
BACK = 0,
|
||||
FRONT
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Camera
|
||||
* @description
|
||||
@@ -125,7 +161,7 @@ export interface CameraPopoverOptions {
|
||||
plugin: 'cordova-plugin-camera',
|
||||
pluginRef: 'navigator.camera',
|
||||
repo: 'https://github.com/apache/cordova-plugin-camera',
|
||||
platforms: ['Android', 'BlackBerry', 'Browser', 'Firefox', 'FireOS', 'iOS', 'Windows', 'Windows Phone 8', 'Ubuntu']
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class Camera extends IonicNativePlugin {
|
||||
|
||||
@@ -133,6 +133,11 @@ export interface CardIOResponse {
|
||||
* @name Card IO
|
||||
* @description
|
||||
* @usage
|
||||
* Note: For use with iOS 10 + When building your app with the iOS 10 SDK +, you have to add some info to the info.plist file. This is due to increased security in iOS 10. Go to your app directory and search for the <your app name>Info.plist file. Add the following lines in the main <dict> element.
|
||||
* ```xml
|
||||
*<key>NSCameraUsageDescription</key>
|
||||
*<string>To scan credit cards.</string>
|
||||
*```
|
||||
* ```typescript
|
||||
* import { CardIO } from '@ionic-native/card-io';
|
||||
*
|
||||
@@ -147,7 +152,7 @@ export interface CardIOResponse {
|
||||
* if(res){
|
||||
* let options = {
|
||||
* requireExpiry: true,
|
||||
* requireCCV: false,
|
||||
* requireCVV: false,
|
||||
* requirePostalCode: false
|
||||
* };
|
||||
* CardIO.scan(options);
|
||||
@@ -164,7 +169,7 @@ export interface CardIOResponse {
|
||||
plugin: 'card.io.cordova.mobilesdk',
|
||||
pluginRef: 'CardIO',
|
||||
repo: 'https://github.com/card-io/card.io-Cordova-Plugin',
|
||||
platforms: ['iOS', 'Android']
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class CardIO extends IonicNativePlugin {
|
||||
|
||||
@@ -5,8 +5,6 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
* @description
|
||||
* Clipboard management plugin for Cordova that supports iOS, Android, and Windows Phone 8.
|
||||
*
|
||||
* Requires Cordova plugin: https://github.com/VersoSolutions/CordovaClipboard
|
||||
* For more info, please see the [Clipboard plugin docs](https://github.com/VersoSolutions/CordovaClipboard.git).
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
@@ -31,10 +29,10 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Clipboard',
|
||||
plugin: 'https://github.com/VersoSolutions/CordovaClipboard.git',
|
||||
plugin: 'cordova-clipboard',
|
||||
pluginRef: 'cordova.plugins.clipboard',
|
||||
repo: 'https://github.com/VersoSolutions/CordovaClipboard',
|
||||
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
|
||||
repo: 'https://github.com/ihadeed/cordova-clipboard',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class Clipboard extends IonicNativePlugin {
|
||||
|
||||
@@ -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;
|
||||
@@ -291,7 +294,7 @@ export class ContactFindOptions implements IContactFindOptions {
|
||||
plugin: 'cordova-plugin-contacts',
|
||||
pluginRef: 'navigator.contacts',
|
||||
repo: 'https://github.com/apache/cordova-plugin-contacts',
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Ubuntu', 'Windows', 'Windows 8', 'Windows Phone']
|
||||
platforms: ['Android', 'BlackBerry 10', 'Firefox OS', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class Contacts extends IonicNativePlugin {
|
||||
@@ -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;
|
||||
|
||||
@@ -10,20 +10,59 @@ import { Injectable } from '@angular/core';
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { CouchbaseLite } from '@ionic-native/couchbase-lite';
|
||||
*
|
||||
* constructor(private couchbase: CouchbaseLite) {
|
||||
*
|
||||
* couchbase.getURL()
|
||||
* .then(url => console.log(url))
|
||||
* .catch(error => console.error(error));
|
||||
*
|
||||
* import { Http } from '@angular/http';
|
||||
* import { Observable } from 'rxjs/Observable'
|
||||
* constructor(private couchbase: CouchbaseLite, private platform:Platform,private _http:Http) {
|
||||
* this.initMethod();
|
||||
* }
|
||||
* url:string;
|
||||
* initMethod() {
|
||||
* this.couchbase.getURL().then((url)=> {
|
||||
* this.url = url;
|
||||
* })
|
||||
* }
|
||||
* getUrl() {
|
||||
* return this.url;
|
||||
* }
|
||||
* // DATABASES //
|
||||
* createDatabase(database_name:string) {
|
||||
* let url = this.getUrl();
|
||||
* url = url+database_name;
|
||||
* return this._http
|
||||
* .put(url)
|
||||
* .map(data => { this.results = data['results'] })
|
||||
* .catch((error:any) => {
|
||||
* return Observable.throw(error.json() || 'Couchbase Lite error');
|
||||
* })
|
||||
* }
|
||||
* deleteDatabase(database_name:string) {
|
||||
* let url = this.getUrl();
|
||||
* url = url+database_name;
|
||||
* return this._http
|
||||
* .delete(url)
|
||||
* .map(data => { this.results = data['results'] })
|
||||
* .catch((error:any) => {
|
||||
* return Observable.throw(error.json() || 'Couchbase Lite error');
|
||||
* })
|
||||
* }
|
||||
*
|
||||
* getAllDbs() {
|
||||
* let url = this.getUrl();
|
||||
* url = url+'_all_dbs';
|
||||
* return this._http
|
||||
* .get(url)
|
||||
* .map(data => { this.results = data['results'] })
|
||||
* .catch((error:any) => {
|
||||
* return Observable.throw(error.json() || 'Couchbase Lite error');
|
||||
* })
|
||||
* }
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'CouchbaseLite',
|
||||
plugin: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin',
|
||||
plugin: 'couchbase-lite-phonegap-plugin',
|
||||
pluginRef: 'cblite',
|
||||
repo: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin',
|
||||
platforms: ['Android', 'iOS']
|
||||
|
||||
@@ -39,7 +39,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
plugin: 'cordova-plugin-dbmeter',
|
||||
pluginRef: 'DBMeter',
|
||||
repo: 'https://github.com/akofman/cordova-plugin-dbmeter',
|
||||
platforms: ['iOS', 'Android']
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class DBMeter extends IonicNativePlugin {
|
||||
|
||||
@@ -49,7 +49,7 @@ export interface DeeplinkMatch {
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Alternatively, if you're using Ionic 2, there's a convenience method that takes a reference to a `NavController` and handles
|
||||
* Alternatively, if you're using Ionic, there's a convenience method that takes a reference to a `NavController` and handles
|
||||
* the actual navigation for you:
|
||||
*
|
||||
* ```typescript
|
||||
@@ -67,7 +67,7 @@ export interface DeeplinkMatch {
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* See the [Ionic 2 Deeplinks Demo](https://github.com/driftyco/ionic2-deeplinks-demo/blob/master/app/app.ts) for an example of how to
|
||||
* See the [Ionic Deeplinks Demo](https://github.com/ionic-team/ionic2-deeplinks-demo/blob/master/app/app.ts) for an example of how to
|
||||
* retrieve the `NavController` reference at runtime.
|
||||
*
|
||||
* @interfaces
|
||||
@@ -77,10 +77,10 @@ export interface DeeplinkMatch {
|
||||
pluginName: 'Deeplinks',
|
||||
plugin: 'ionic-plugin-deeplinks',
|
||||
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=/',
|
||||
installVariables: ['URL_SCHEME', 'DEEPLINK_SCHEME', 'DEEPLINK_HOST', 'ANDROID_PATH_PREFIX']
|
||||
repo: 'https://github.com/ionic-team/ionic-plugin-deeplinks',
|
||||
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'],
|
||||
platforms: ['Android', 'Browser', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Deeplinks extends IonicNativePlugin {
|
||||
@@ -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,29 +98,31 @@ export class Deeplinks extends IonicNativePlugin {
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
route(paths): Observable<DeeplinkMatch> { return; }
|
||||
route(paths: any): Observable<DeeplinkMatch> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* This is a convenience version of `route` that takes a reference to a NavController
|
||||
* from Ionic 2, or a custom class that conforms to this protocol:
|
||||
* from Ionic, or a custom class that conforms to this protocol:
|
||||
*
|
||||
* NavController.push = function(View, Params){}
|
||||
*
|
||||
* 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; }
|
||||
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'DeviceAccounts',
|
||||
plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git',
|
||||
plugin: 'cordova-device-accounts',
|
||||
pluginRef: 'plugins.DeviceAccounts',
|
||||
repo: 'https://github.com/loicknuchel/cordova-device-accounts',
|
||||
repo: 'https://github.com/danielsogl/cordova-device-accounts',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -72,7 +72,7 @@ export interface DeviceMotionAccelerometerOptions {
|
||||
plugin: 'cordova-plugin-device-motion',
|
||||
pluginRef: 'navigator.accelerometer',
|
||||
repo: 'https://github.com/apache/cordova-plugin-device-motion',
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class DeviceMotion extends IonicNativePlugin {
|
||||
|
||||
@@ -77,7 +77,7 @@ export interface DeviceOrientationCompassOptions {
|
||||
plugin: 'cordova-plugin-device-orientation',
|
||||
pluginRef: 'navigator.compass',
|
||||
repo: 'https://github.com/apache/cordova-plugin-device-orientation',
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
})
|
||||
@Injectable()
|
||||
export class DeviceOrientation extends IonicNativePlugin {
|
||||
|
||||
@@ -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
|
||||
@@ -24,7 +24,7 @@ declare var window: any;
|
||||
plugin: 'cordova-plugin-device',
|
||||
pluginRef: 'device',
|
||||
repo: 'https://github.com/apache/cordova-plugin-device',
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'OS X', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'macOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
})
|
||||
@Injectable()
|
||||
export class Device extends IonicNativePlugin {
|
||||
|
||||
@@ -148,7 +148,7 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ successIndex: 1, errorIndex: 2 })
|
||||
@Cordova({ callbackOrder: 'reverse' })
|
||||
isCameraAvailable( externalStorage?: boolean ): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
@@ -257,7 +257,7 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'], successIndex: 1, errorIndex: 2 })
|
||||
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
|
||||
isCameraAuthorized( externalStorage?: boolean ): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
@@ -266,7 +266,7 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'], successIndex: 1, errorIndex: 2 })
|
||||
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
|
||||
getCameraAuthorizationStatus( externalStorage?: boolean ): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
@@ -275,7 +275,7 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'], successIndex: 1, errorIndex: 2 })
|
||||
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
|
||||
requestCameraAuthorization( externalStorage?: boolean ): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,8 +45,8 @@ export interface DialogsPromptCallback {
|
||||
pluginName: 'Dialogs',
|
||||
plugin: 'cordova-plugin-dialogs',
|
||||
pluginRef: 'navigator.notification',
|
||||
repo: 'https://github.com/apache/cordova-plugin-dialogs.git',
|
||||
platforms: ['Android', 'BlackBerry 10', 'Firefox OS', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
repo: 'https://github.com/apache/cordova-plugin-dialogs',
|
||||
platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
})
|
||||
@Injectable()
|
||||
export class Dialogs extends IonicNativePlugin {
|
||||
@@ -69,13 +69,13 @@ export class Dialogs extends IonicNativePlugin {
|
||||
* @param {string} message Dialog message.
|
||||
* @param {string} title Dialog title. (Optional, defaults to Confirm)
|
||||
* @param {Array<string>} buttonLabels Array of strings specifying button labels. (Optional, defaults to [OK,Cancel])
|
||||
* @returns {Promise<number>} Returns a promise that resolves the button index that was clicked. Note that the index use one-based indexing.
|
||||
* @returns {Promise<number>} Returns a promise that resolves the button index that was clicked, or 0 if the user has dismissed the dialog by clicking outside the dialog box. Note that the index use one-based indexing.
|
||||
*/
|
||||
@Cordova({
|
||||
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.
|
||||
|
||||
@@ -2,29 +2,29 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
export interface DocumentViewerOptions {
|
||||
title: string;
|
||||
documentView: {
|
||||
title?: string;
|
||||
documentView?: {
|
||||
closeLabel: string;
|
||||
};
|
||||
navigationView: {
|
||||
navigationView?: {
|
||||
closeLabel: string;
|
||||
};
|
||||
email: {
|
||||
email?: {
|
||||
enabled: boolean;
|
||||
};
|
||||
print: {
|
||||
print?: {
|
||||
enabled: boolean;
|
||||
};
|
||||
openWith: {
|
||||
openWith?: {
|
||||
enabled: boolean;
|
||||
};
|
||||
bookmarks: {
|
||||
bookmarks?: {
|
||||
enabled: boolean;
|
||||
};
|
||||
search: {
|
||||
search?: {
|
||||
enabled: boolean;
|
||||
};
|
||||
autoClose: {
|
||||
autoClose?: {
|
||||
onPause: boolean;
|
||||
};
|
||||
}
|
||||
@@ -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,20 +83,20 @@ 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
|
||||
*
|
||||
* @param url {string} Url to the file
|
||||
* @param contentType {string} Content type of the file
|
||||
* @param options {Array<DocumentViewerOptions>} options
|
||||
* @param options {DocumentViewerOptions} options
|
||||
* @param [onShow] {Function}
|
||||
* @param [onClose] {Function}
|
||||
* @param [onMissingApp] {Function}
|
||||
* @param [onError] {Function}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
viewDocument(url: string, contentType: string, options: Array<DocumentViewerOptions>, onShow?: Function, onClose?: Function, onMissingApp?: Function, onError?: Function): void { }
|
||||
viewDocument(url: string, contentType: string, options: DocumentViewerOptions, onShow?: Function, onClose?: Function, onMissingApp?: Function, onError?: Function): void { }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,24 +1,46 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var cordova: any;
|
||||
|
||||
export interface EmailComposerOptions {
|
||||
|
||||
/**
|
||||
* App to send the email with
|
||||
*/
|
||||
app?: string;
|
||||
|
||||
/**
|
||||
* Email address(es) for To field
|
||||
*/
|
||||
to?: string | Array<string>;
|
||||
|
||||
/**
|
||||
* Email address(es) for CC field
|
||||
*/
|
||||
cc?: string | Array<string>;
|
||||
|
||||
/**
|
||||
* Email address(es) for BCC field
|
||||
*/
|
||||
bcc?: string | Array<string>;
|
||||
|
||||
attachments?: Array<any>;
|
||||
/**
|
||||
* File paths or base64 data streams
|
||||
*/
|
||||
attachments?: string[];
|
||||
|
||||
/**
|
||||
* Subject of the email
|
||||
*/
|
||||
subject?: string;
|
||||
|
||||
/**
|
||||
* Email body (for HTML, set isHtml to true)
|
||||
*/
|
||||
body?: string;
|
||||
|
||||
/**
|
||||
* Indicates if the body is HTML or plain text
|
||||
*/
|
||||
isHtml?: boolean;
|
||||
|
||||
}
|
||||
@@ -63,17 +85,28 @@ export interface EmailComposerOptions {
|
||||
*
|
||||
* // Send a text message using default options
|
||||
* this.emailComposer.open(email);
|
||||
* ```
|
||||
*
|
||||
* You can also assign aliases to email apps
|
||||
* ```ts
|
||||
* // add alias
|
||||
* this.email.addAlias('gmail', 'com.google.android.gm');
|
||||
*
|
||||
* // then use alias when sending email
|
||||
* this.email.open({
|
||||
* app: 'gmail',
|
||||
* ...
|
||||
* });
|
||||
* ```
|
||||
* @interfaces
|
||||
* EmailComposerOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'EmailComposer',
|
||||
plugin: 'cordova-plugin-email',
|
||||
plugin: 'cordova-plugin-email-composer',
|
||||
pluginRef: 'cordova.plugins.email',
|
||||
repo: 'https://github.com/hypery2k/cordova-email-plugin',
|
||||
platforms: ['Android', 'iOS']
|
||||
repo: 'https://github.com/katzer/cordova-plugin-email-composer',
|
||||
platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
export class EmailComposer extends IonicNativePlugin {
|
||||
@@ -88,7 +121,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) => {
|
||||
EmailComposer.getPlugin().isAvailable(app, (isAvailable: boolean) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
@@ -96,7 +129,7 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cordova.plugins.email.isAvailable((isAvailable) => {
|
||||
EmailComposer.getPlugin().isAvailable((isAvailable: boolean) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
@@ -107,6 +140,26 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Request permission to access email accounts information
|
||||
* @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates if the permission was granted
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 0,
|
||||
errorIndex: 2
|
||||
})
|
||||
requestPermission(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the app has a permission to access email accounts information
|
||||
* @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates if the permission was granted
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 0,
|
||||
errorIndex: 2
|
||||
})
|
||||
hasPermission(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Adds a new mail app alias.
|
||||
*
|
||||
|
||||
@@ -44,7 +44,7 @@ export interface EstimoteBeaconRegion {
|
||||
plugin: 'cordova-plugin-estimote',
|
||||
pluginRef: 'estimote.beacons',
|
||||
repo: 'https://github.com/evothings/phonegap-estimotebeacons',
|
||||
platforms: ['iOS', 'Android']
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class EstimoteBeacons extends IonicNativePlugin {
|
||||
@@ -512,4 +512,3 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
writeConnectedMinor(minor: number): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Extended Device Information
|
||||
* @description
|
||||
* Retrieves additional device information that is not provided by other plugins
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { ExtendedDeviceInformation } from '@ionic-native/extended-device-information';
|
||||
*
|
||||
*
|
||||
* constructor(private extendedDeviceInformation: ExtendedDeviceInformation) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* console.log('The Memory is: ' + this.extendedDeviceInformation.memory);
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'ExtendedDeviceInformation',
|
||||
plugin: 'cordova-plugin-extended-device-information',
|
||||
pluginRef: 'extended-device-information',
|
||||
repo: 'https://github.com/danielehrhardt/cordova-plugin-extended-device-information',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class ExtendedDeviceInformation extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Get the device's memory size
|
||||
*/
|
||||
@CordovaProperty
|
||||
memory: number;
|
||||
|
||||
/**
|
||||
* Get the device's CPU mhz
|
||||
*/
|
||||
@CordovaProperty
|
||||
cpumhz: string;
|
||||
|
||||
/**
|
||||
* Get the total storage
|
||||
*/
|
||||
@CordovaProperty
|
||||
totalstorage: string;
|
||||
|
||||
}
|
||||
@@ -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 cordova 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,9 +114,9 @@ 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']
|
||||
platforms: ['Android', 'iOS', 'Browser']
|
||||
})
|
||||
@Injectable()
|
||||
export class Facebook extends IonicNativePlugin {
|
||||
|
||||
@@ -25,32 +25,32 @@ export interface NotificationData {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FCM } from 'ionic-native';
|
||||
* import { FCM } from '@ionic-native/fcm';
|
||||
*
|
||||
* constructor(private fcm: FCM) {}
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* fcm.subscribeToTopic('marketing');
|
||||
*
|
||||
*
|
||||
* fcm.getToken().then(token=>{
|
||||
* backend.registerToken(token);
|
||||
* })
|
||||
*
|
||||
*
|
||||
* fcm.onNotification().subscribe(data=>{
|
||||
* if(data.wasPressed){
|
||||
* if(data.wasTapped){
|
||||
* console.log("Received in background");
|
||||
* } else {
|
||||
* console.log("Received in foreground");
|
||||
* };
|
||||
* })
|
||||
*
|
||||
*
|
||||
* fcm.onTokenRefresh().subscribe(token=>{
|
||||
* backend.registerToken(token);
|
||||
* })
|
||||
*
|
||||
* fcm.unsubscribeToTopic('marketing');
|
||||
*
|
||||
*
|
||||
* fcm.unsubscribeFromTopic('marketing');
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* NotificationData
|
||||
@@ -60,14 +60,14 @@ export interface NotificationData {
|
||||
plugin: 'cordova-plugin-fcm',
|
||||
pluginRef: 'FCMPlugin',
|
||||
repo: 'https://github.com/fechanique/cordova-plugin-fcm',
|
||||
platforms: ['iOS', 'Android']
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class FCM extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Get's device's current registration id
|
||||
*
|
||||
*
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the registration id token
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -75,7 +75,7 @@ export class FCM extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Event firing on the token refresh
|
||||
*
|
||||
*
|
||||
* @returns {Observable<string>} Returns an Observable that notifies with the change of device's registration id
|
||||
*/
|
||||
@Cordova({
|
||||
@@ -85,9 +85,9 @@ export class FCM extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Subscribes you to a [topic](https://firebase.google.com/docs/notifications/android/console-topics)
|
||||
*
|
||||
*
|
||||
* @param {string} topic Topic to be subscribed to
|
||||
*
|
||||
*
|
||||
* @returns {Promise<any>} Returns a promise resolving in result of subscribing to a topic
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -95,17 +95,17 @@ export class FCM extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Unubscribes you from a [topic](https://firebase.google.com/docs/notifications/android/console-topics)
|
||||
*
|
||||
*
|
||||
* @param {string} topic Topic to be unsubscribed from
|
||||
*
|
||||
*
|
||||
* @returns {Promise<any>} Returns a promise resolving in result of unsubscribing from a topic
|
||||
*/
|
||||
@Cordova()
|
||||
unsubscribeToTopic(topic: string): Promise<any> { return; }
|
||||
unsubscribeFromTopic(topic: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Watch for incoming notifications
|
||||
*
|
||||
*
|
||||
* @returns {Observable<any>} returns an object with data from the notification
|
||||
*/
|
||||
@Cordova({
|
||||
|
||||
@@ -23,9 +23,9 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FileChooser',
|
||||
plugin: 'http://github.com/don/cordova-filechooser.git',
|
||||
plugin: 'cordova-plugin-filechooser',
|
||||
pluginRef: 'fileChooser',
|
||||
repo: 'https://github.com/don/cordova-filechooser',
|
||||
repo: 'https://github.com/ihadeed/cordova-filechooser',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, Plugin, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var FileTransfer;
|
||||
|
||||
export interface FileUploadOptions {
|
||||
|
||||
/**
|
||||
@@ -109,21 +107,21 @@ export interface FileTransferError {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Transfer
|
||||
* @name File Transfer
|
||||
*
|
||||
* @description
|
||||
* This plugin allows you to upload and download files.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Transfer, FileUploadOptions, TransferObject } from '@ionic-native/transfer';
|
||||
* import { FileTransfer, FileUploadOptions, FileTransferObject } from '@ionic-native/file-transfer';
|
||||
* import { File } from '@ionic-native/file';
|
||||
*
|
||||
* constructor(private transfer: Transfer, private file: File) { }
|
||||
* constructor(private transfer: FileTransfer, private file: File) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* const fileTransfer: TransferObject = this.transfer.create();
|
||||
* const fileTransfer: FileTransferObject = this.transfer.create();
|
||||
*
|
||||
* // Upload a file:
|
||||
* fileTransfer.upload(..).then(..).catch(..);
|
||||
@@ -170,16 +168,17 @@ export interface FileTransferError {
|
||||
* FileUploadResult
|
||||
* FileTransferError
|
||||
* @classes
|
||||
* TransferObject
|
||||
* FileTransferObject
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FileTransfer',
|
||||
plugin: 'cordova-plugin-file-transfer',
|
||||
pluginRef: 'FileTransfer',
|
||||
repo: 'https://github.com/apache/cordova-plugin-file-transfer'
|
||||
repo: 'https://github.com/apache/cordova-plugin-file-transfer',
|
||||
platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
})
|
||||
@Injectable()
|
||||
export class Transfer extends IonicNativePlugin {
|
||||
export class FileTransfer extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Error code rejected from upload with FileTransferError
|
||||
@@ -201,10 +200,10 @@ export class Transfer extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Creates a new FileTransfer object
|
||||
* @return {TransferObject}
|
||||
* @return {FileTransferObject}
|
||||
*/
|
||||
create(): TransferObject {
|
||||
return new TransferObject();
|
||||
create(): FileTransferObject {
|
||||
return new FileTransferObject();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -216,12 +215,12 @@ export class Transfer extends IonicNativePlugin {
|
||||
plugin: 'cordova-plugin-file-transfer',
|
||||
pluginName: 'FileTransfer'
|
||||
})
|
||||
export class TransferObject {
|
||||
export class FileTransferObject {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor() {
|
||||
if (checkAvailability('FileTransfer', null, 'FileTransfer') === true) {
|
||||
this._objectInstance = new FileTransfer();
|
||||
if (checkAvailability(FileTransfer.getPluginRef(), null, FileTransfer.getPluginName()) === true) {
|
||||
this._objectInstance = new (FileTransfer.getPlugin())();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,15 +237,13 @@ export class TransferObject {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise<FileUploadResult> {
|
||||
return;
|
||||
}
|
||||
upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise<FileUploadResult> { return; }
|
||||
|
||||
/**
|
||||
* Downloads a file from server.
|
||||
*
|
||||
* @param {string} source URL of the server to download the file, as encoded by encodeURI().
|
||||
* @param {stirng} target Filesystem url representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.
|
||||
* @param {string} target Filesystem url representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.
|
||||
* @param {boolean} trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful because Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
|
||||
* @param {object} Optional parameters, currently only supports headers (such as Authorization (Basic Authentication), etc).
|
||||
* @returns {Promise<any>} Returns a Promise that resolves to a FileEntry object.
|
||||
@@ -255,9 +252,7 @@ export class TransferObject {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
download(source: string, target: string, trustAllHosts?: boolean, options?: { [s: string]: any; }): Promise<any> {
|
||||
return;
|
||||
}
|
||||
download(source: string, target: string, trustAllHosts?: boolean, options?: { [s: string]: any; }): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Registers a listener that gets called whenever a new chunk of data is transferred.
|
||||
@@ -275,5 +270,5 @@ export class TransferObject {
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
abort(): void { }
|
||||
abort(): void {}
|
||||
}
|
||||
@@ -1,158 +1,398 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaProperty, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var window: any;
|
||||
declare var cordova: any;
|
||||
|
||||
/** This interface represents a file system. */
|
||||
export interface FileSystem {
|
||||
/* The name of the file system, unique across the list of exposed file systems. */
|
||||
export interface IFile extends Blob {
|
||||
/**
|
||||
* Name of the file, without path information
|
||||
*/
|
||||
name: string;
|
||||
/** The root directory of the file system. */
|
||||
root: DirectoryEntry;
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
/**
|
||||
* Used for storage with no guarantee of persistence.
|
||||
*/
|
||||
TEMPORARY: number;
|
||||
|
||||
/**
|
||||
* Used for storage that should not be removed by the user agent without application or user permission.
|
||||
*/
|
||||
PERSISTENT: number;
|
||||
|
||||
/**
|
||||
* Requests a filesystem in which to store application data.
|
||||
* @param type Whether the filesystem requested should be persistent, as defined above. Use one of TEMPORARY or PERSISTENT.
|
||||
* @param size This is an indicator of how much storage space, in bytes, the application expects to need.
|
||||
* @param successCallback The callback that is called when the user agent provides a filesystem.
|
||||
* @param errorCallback A callback that is called when errors happen, or when the request to obtain the filesystem is denied.
|
||||
*/
|
||||
requestFileSystem(type: number, size: number, successCallback: FileSystemCallback, errorCallback?: ErrorCallback): void;
|
||||
|
||||
/**
|
||||
* Allows the user to look up the Entry for a file or directory referred to by a local URL.
|
||||
* @param url A URL referring to a local file in a filesystem accessable via this API.
|
||||
* @param successCallback A callback that is called to report the Entry to which the supplied URL refers.
|
||||
* @param errorCallback A callback that is called when errors happen, or when the request to obtain the Entry is denied.
|
||||
*/
|
||||
resolveLocalFileSystemURL(url: string, successCallback: EntryCallback, errorCallback?: ErrorCallback): void;
|
||||
|
||||
/**
|
||||
* see requestFileSystem.
|
||||
*/
|
||||
webkitRequestFileSystem(type: number, size: number, successCallback: FileSystemCallback, errorCallback?: ErrorCallback): void;
|
||||
}
|
||||
|
||||
export interface Metadata {
|
||||
/**
|
||||
* This is the time at which the file or directory was last modified.
|
||||
* @readonly
|
||||
*/
|
||||
modificationTime: Date;
|
||||
|
||||
/**
|
||||
* The size of the file, in bytes. This must return 0 for directories.
|
||||
* @readonly
|
||||
*/
|
||||
size: number;
|
||||
}
|
||||
|
||||
export interface Flags {
|
||||
/**
|
||||
* Used to indicate that the user wants to create a file or directory if it was not previously there.
|
||||
*/
|
||||
create?: boolean;
|
||||
|
||||
/**
|
||||
* By itself, exclusive must have no effect. Used with create, it must cause getFile and getDirectory to fail if the target path already exists.
|
||||
*/
|
||||
exclusive?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* An abstract interface representing entries in a file system,
|
||||
* each of which may be a File or DirectoryEntry.
|
||||
* This export interface represents a file system.
|
||||
*/
|
||||
export interface Entry {
|
||||
/** Entry is a file. */
|
||||
isFile: boolean;
|
||||
/** Entry is a directory. */
|
||||
isDirectory: boolean;
|
||||
/** The name of the entry, excluding the path leading to it. */
|
||||
export interface FileSystem {
|
||||
/**
|
||||
* This is the name of the file system. The specifics of naming filesystems is unspecified, but a name must be unique across the list of exposed file systems.
|
||||
* @readonly
|
||||
*/
|
||||
name: string;
|
||||
/** The full absolute path from the root to the entry. */
|
||||
fullPath: string;
|
||||
/** The file system on which the entry resides. */
|
||||
filesystem: FileSystem;
|
||||
nativeURL: string;
|
||||
|
||||
/**
|
||||
* The root directory of the file system.
|
||||
* @readonly
|
||||
*/
|
||||
root: DirectoryEntry;
|
||||
|
||||
toJSON(): string;
|
||||
|
||||
encodeURIPath(path: string): string;
|
||||
|
||||
}
|
||||
|
||||
export interface Entry {
|
||||
|
||||
/**
|
||||
* Entry is a file.
|
||||
*/
|
||||
isFile: boolean;
|
||||
|
||||
/**
|
||||
* Entry is a directory.
|
||||
*/
|
||||
isDirectory: boolean;
|
||||
|
||||
/**
|
||||
* Look up metadata about this entry.
|
||||
* @param successCallback A callback that is called with the time of the last modification.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
* @param errorCallback ErrorCallback A callback that is called when errors happen.
|
||||
*/
|
||||
getMetadata(successCallback: (metadata: Metadata) => void,
|
||||
errorCallback?: (error: FileError) => void): void;
|
||||
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.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The full absolute path from the root to the entry.
|
||||
*/
|
||||
fullPath: string;
|
||||
|
||||
/**
|
||||
* The file system on which the entry resides.
|
||||
*/
|
||||
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:
|
||||
* move a directory inside itself or to any child at any depth;move an entry into its parent if a name different from its current one isn't provided;
|
||||
* move a file to a path occupied by a directory;
|
||||
* move a directory to a path occupied by a file;
|
||||
* move any element to a path occupied by a directory which is not empty.
|
||||
*
|
||||
* <ui>
|
||||
* <li>move a directory inside itself or to any child at any depth;</li>
|
||||
* <li>move an entry into its parent if a name different from its current one isn't provided;</li>
|
||||
* <li>move a file to a path occupied by a directory;</li>
|
||||
* <li>move a directory to a path occupied by a file;</li>
|
||||
* <li>move any element to a path occupied by a directory which is not empty.</li>
|
||||
* <ul>
|
||||
*
|
||||
* A move of a file on top of an existing file must attempt to delete and replace that file.
|
||||
* A move of a directory on top of an existing empty directory must attempt to delete and replace that directory.
|
||||
* @param parent The directory to which to move the entry.
|
||||
* @param newName The new name of the entry. Defaults to the Entry's current name if unspecified.
|
||||
* @param successCallback A callback that is called with the Entry for the new location.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
*/
|
||||
moveTo(parent: DirectoryEntry,
|
||||
newName?: string,
|
||||
successCallback?: (entry: Entry) => void,
|
||||
errorCallback?: (error: FileError) => void): void;
|
||||
moveTo(parent: DirectoryEntry, newName?: string, successCallback?: EntryCallback, errorCallback?: ErrorCallback): void;
|
||||
|
||||
/**
|
||||
* Copy an entry to a different location on the file system. It is an error to try to:
|
||||
* copy a directory inside itself or to any child at any depth;
|
||||
* copy an entry into its parent if a name different from its current one isn't provided;
|
||||
* copy a file to a path occupied by a directory;
|
||||
* copy a directory to a path occupied by a file;
|
||||
* copy any element to a path occupied by a directory which is not empty.
|
||||
* A copy of a file on top of an existing file must attempt to delete and replace that file.
|
||||
* A copy of a directory on top of an existing empty directory must attempt to delete and replace that directory.
|
||||
*
|
||||
* <ul>
|
||||
* <li> copy a directory inside itself or to any child at any depth;</li>
|
||||
* <li> copy an entry into its parent if a name different from its current one isn't provided;</li>
|
||||
* <li> copy a file to a path occupied by a directory;</li>
|
||||
* <li> copy a directory to a path occupied by a file;</li>
|
||||
* <li> copy any element to a path occupied by a directory which is not empty.</li>
|
||||
* <li> A copy of a file on top of an existing file must attempt to delete and replace that file.</li>
|
||||
* <li> A copy of a directory on top of an existing empty directory must attempt to delete and replace that directory.</li>
|
||||
* </ul>
|
||||
*
|
||||
* Directory copies are always recursive--that is, they copy all contents of the directory.
|
||||
* @param parent The directory to which to move the entry.
|
||||
* @param newName The new name of the entry. Defaults to the Entry's current name if unspecified.
|
||||
* @param successCallback A callback that is called with the Entry for the new object.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
*/
|
||||
copyTo(parent: DirectoryEntry,
|
||||
newName?: string,
|
||||
successCallback?: (entry: Entry) => void,
|
||||
errorCallback?: (error: FileError) => void): void;
|
||||
copyTo(parent: DirectoryEntry, newName?: string, successCallback?: EntryCallback, errorCallback?: ErrorCallback): void;
|
||||
|
||||
/**
|
||||
* Returns a URL that can be used as the src attribute of a <video> or <audio> tag.
|
||||
* If that is not possible, construct a cdvfile:// URL.
|
||||
* @return string URL
|
||||
* Returns a URL that can be used to identify this entry. Unlike the URN defined in [FILE-API-ED], it has no specific expiration; as it describes a location on disk, it should be valid at least as long as that location exists.
|
||||
*/
|
||||
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.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
*/
|
||||
remove(successCallback: () => void,
|
||||
errorCallback?: (error: FileError) => void): void;
|
||||
remove(successCallback: VoidCallback, errorCallback?: ErrorCallback): void;
|
||||
|
||||
/**
|
||||
* Look up the parent DirectoryEntry containing this Entry. If this Entry is the root of its filesystem, its parent is itself.
|
||||
* @param successCallback A callback that is called with the time of the last modification.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
* @param successCallback A callback that is called to return the parent Entry.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
*/
|
||||
getParent(successCallback: (entry: Entry) => void,
|
||||
errorCallback?: (error: FileError) => void): void;
|
||||
getParent(successCallback: DirectoryEntryCallback, errorCallback?: ErrorCallback): void;
|
||||
}
|
||||
|
||||
/** This interface supplies information about the state of a file or directory. */
|
||||
export interface Metadata {
|
||||
/** This is the time at which the file or directory was last modified. */
|
||||
modificationTime: Date;
|
||||
/** The size of the file, in bytes. This must return 0 for directories. */
|
||||
size: number;
|
||||
}
|
||||
|
||||
/** This interface represents a directory on a file system. */
|
||||
/**
|
||||
* This export interface represents a directory on a file system.
|
||||
*/
|
||||
export interface DirectoryEntry extends Entry {
|
||||
/**
|
||||
* Creates a new DirectoryReader to read Entries from this Directory.
|
||||
*/
|
||||
createReader(): DirectoryReader;
|
||||
|
||||
/**
|
||||
* Creates or looks up a file.
|
||||
* @param path Either an absolute path or a relative path from this DirectoryEntry
|
||||
* to the file to be looked up or created.
|
||||
* It is an error to attempt to create a file whose immediate parent does not yet exist.
|
||||
* @param options If create and exclusive are both true, and the path already exists, getFile must fail.
|
||||
* If create is true, the path doesn't exist, and no other error occurs, getFile must create it as a zero-length file and return a corresponding FileEntry.
|
||||
* If create is not true and the path doesn't exist, getFile must fail.
|
||||
* If create is not true and the path exists, but is a directory, getFile must fail.
|
||||
* Otherwise, if no other error occurs, getFile must return a FileEntry corresponding to path.
|
||||
* @param path Either an absolute path or a relative path from this DirectoryEntry to the file to be looked up or created. It is an error to attempt to create a file whose immediate parent does not yet exist.
|
||||
* @param options
|
||||
* <ul>
|
||||
* <li>If create and exclusive are both true, and the path already exists, getFile must fail.</li>
|
||||
* <li>If create is true, the path doesn't exist, and no other error occurs, getFile must create it as a zero-length file and return a corresponding FileEntry.</li>
|
||||
* <li>If create is not true and the path doesn't exist, getFile must fail.</li>
|
||||
* <li>If create is not true and the path exists, but is a directory, getFile must fail.</li>
|
||||
* <li>Otherwise, if no other error occurs, getFile must return a FileEntry corresponding to path.</li>
|
||||
* </ul>
|
||||
* @param successCallback A callback that is called to return the File selected or created.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
*/
|
||||
getFile(path: string, options?: Flags,
|
||||
successCallback?: (entry: FileEntry) => void,
|
||||
errorCallback?: (error: FileError) => void): void;
|
||||
getFile(path: string, options?: Flags, successCallback?: FileEntryCallback, errorCallback?: ErrorCallback): void;
|
||||
|
||||
/**
|
||||
* Creates or looks up a directory.
|
||||
* @param path Either an absolute path or a relative path from this DirectoryEntry
|
||||
* to the directory to be looked up or created.
|
||||
* It is an error to attempt to create a directory whose immediate parent does not yet exist.
|
||||
* @param options If create and exclusive are both true and the path already exists, getDirectory must fail.
|
||||
* If create is true, the path doesn't exist, and no other error occurs, getDirectory must create and return a corresponding DirectoryEntry.
|
||||
* If create is not true and the path doesn't exist, getDirectory must fail.
|
||||
* If create is not true and the path exists, but is a file, getDirectory must fail.
|
||||
* Otherwise, if no other error occurs, getDirectory must return a DirectoryEntry corresponding to path.
|
||||
* @param successCallback A callback that is called to return the Directory selected or created.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
* @param path Either an absolute path or a relative path from this DirectoryEntry to the directory to be looked up or created. It is an error to attempt to create a directory whose immediate parent does not yet exist.
|
||||
* @param options
|
||||
* <ul>
|
||||
* <li>If create and exclusive are both true and the path already exists, getDirectory must fail.</li>
|
||||
* <li>If create is true, the path doesn't exist, and no other error occurs, getDirectory must create and return a corresponding DirectoryEntry.</li>
|
||||
* <li>If create is not true and the path doesn't exist, getDirectory must fail.</li>
|
||||
* <li>If create is not true and the path exists, but is a file, getDirectory must fail.</li>
|
||||
* <li>Otherwise, if no other error occurs, getDirectory must return a DirectoryEntry corresponding to path.</li>
|
||||
* </ul>
|
||||
* @param successCallback A callback that is called to return the DirectoryEntry selected or created.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
*
|
||||
*/
|
||||
getDirectory(path: string, options?: Flags,
|
||||
successCallback?: (entry: DirectoryEntry) => void,
|
||||
errorCallback?: (error: FileError) => void): void;
|
||||
getDirectory(path: string, options?: Flags, successCallback?: DirectoryEntryCallback, errorCallback?: ErrorCallback): void;
|
||||
|
||||
/**
|
||||
* Deletes a directory and all of its contents, if any. In the event of an error (e.g. trying
|
||||
* to delete a directory that contains a file that cannot be removed), some of the contents
|
||||
* of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem.
|
||||
* Deletes a directory and all of its contents, if any. In the event of an error [e.g. trying to delete a directory that contains a file that cannot be removed], some of the contents of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem.
|
||||
* @param successCallback A callback that is called on success.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
*/
|
||||
removeRecursively(successCallback: () => void,
|
||||
errorCallback?: (error: FileError) => void): void;
|
||||
removeRecursively(successCallback: VoidCallback, errorCallback?: ErrorCallback): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This export interface lets a user list files and directories in a directory. If there are no additions to or deletions from a directory between the first and last call to readEntries, and no errors occur, then:
|
||||
* <ul>
|
||||
* <li> A series of calls to readEntries must return each entry in the directory exactly once.</li>
|
||||
* <li> Once all entries have been returned, the next call to readEntries must produce an empty array.</li>
|
||||
* <li> If not all entries have been returned, the array produced by readEntries must not be empty.</li>
|
||||
* <li> The entries produced by readEntries must not include the directory itself ["."] or its parent [".."].</li>
|
||||
* </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.
|
||||
* @param errorCallback A callback indicating that there was an error reading from the Directory.
|
||||
*/
|
||||
readEntries(successCallback: EntriesCallback, errorCallback?: ErrorCallback): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This export interface represents a file on a file system.
|
||||
*/
|
||||
export interface FileEntry extends Entry {
|
||||
/**
|
||||
* Creates a new FileWriter associated with the file that this FileEntry represents.
|
||||
* @param successCallback A callback that is called with the new FileWriter.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
*/
|
||||
createWriter(successCallback: FileWriterCallback, errorCallback?: ErrorCallback): void;
|
||||
|
||||
/**
|
||||
* Returns a File that represents the current state of the file that this FileEntry represents.
|
||||
* @param successCallback A callback that is called with the File.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
*/
|
||||
file(successCallback: FileCallback, errorCallback?: ErrorCallback): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* When requestFileSystem() succeeds, the following callback is made.
|
||||
*/
|
||||
export interface FileSystemCallback {
|
||||
/**
|
||||
* @param filesystem The file systems to which the app is granted access.
|
||||
*/
|
||||
(filesystem: FileSystem): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This export interface is the callback used to look up Entry objects.
|
||||
*/
|
||||
export interface EntryCallback {
|
||||
/**
|
||||
* @param entry
|
||||
*/
|
||||
(entry: Entry): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This export interface is the callback used to look up FileEntry objects.
|
||||
*/
|
||||
export interface FileEntryCallback {
|
||||
/**
|
||||
* @param entry
|
||||
*/
|
||||
(entry: FileEntry): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This export interface is the callback used to look up DirectoryEntry objects.
|
||||
*/
|
||||
export interface DirectoryEntryCallback {
|
||||
/**
|
||||
* @param entry
|
||||
*/
|
||||
(entry: DirectoryEntry): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* When readEntries() succeeds, the following callback is made.
|
||||
*/
|
||||
export interface EntriesCallback {
|
||||
(entries: Entry[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This export interface is the callback used to look up file and directory metadata.
|
||||
*/
|
||||
export interface MetadataCallback {
|
||||
(metadata: Metadata): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This export interface is the callback used to create a FileWriter.
|
||||
*/
|
||||
export interface FileWriterCallback {
|
||||
(fileWriter: FileWriter): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This export interface is the callback used to obtain a File.
|
||||
*/
|
||||
export interface FileCallback {
|
||||
(file: IFile): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This export interface is the generic callback used to indicate success of an asynchronous method.
|
||||
*/
|
||||
export interface VoidCallback {
|
||||
(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* When an error occurs, the following callback is made.
|
||||
*/
|
||||
export interface ErrorCallback {
|
||||
(err: FileError): void;
|
||||
}
|
||||
|
||||
export interface RemoveResult {
|
||||
@@ -160,136 +400,163 @@ export interface RemoveResult {
|
||||
fileRemoved: Entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* This dictionary is used to supply arguments to methods
|
||||
* that look up or create files or directories.
|
||||
*/
|
||||
export interface Flags {
|
||||
/** Used to indicate that the user wants to create a file or directory if it was not previously there. */
|
||||
create?: boolean;
|
||||
/** By itself, exclusive must have no effect. Used with create, it must cause getFile and getDirectory to fail if the target path already exists. */
|
||||
exclusive?: boolean;
|
||||
}
|
||||
|
||||
export interface WriteOptions {
|
||||
replace?: boolean;
|
||||
append?: boolean;
|
||||
truncate?: number; // if present, number of bytes to truncate file to before writing
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface lets a user list files and directories in a directory. If there are
|
||||
* no additions to or deletions from a directory between the first and last call to
|
||||
* readEntries, and no errors occur, then:
|
||||
* A series of calls to readEntries must return each entry in the directory exactly once.
|
||||
* Once all entries have been returned, the next call to readEntries must produce an empty array.
|
||||
* If not all entries have been returned, the array produced by readEntries must not be empty.
|
||||
* The entries produced by readEntries must not include the directory itself ["."] or its parent [".."].
|
||||
*/
|
||||
export interface DirectoryReader {
|
||||
/** @hidden */
|
||||
export declare class FileSaver extends EventTarget {
|
||||
/**
|
||||
* 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.
|
||||
* @param errorCallback A callback indicating that there was an error reading from the Directory.
|
||||
* When the FileSaver constructor is called, the user agent must return a new FileSaver object with readyState set to INIT.
|
||||
* This constructor must be visible when the script's global object is either a Window object or an object implementing the WorkerUtils interface.
|
||||
*/
|
||||
readEntries(successCallback: (entries: Entry[]) => void,
|
||||
errorCallback?: (error: FileError) => void): void;
|
||||
}
|
||||
constructor(data: Blob);
|
||||
|
||||
/** This interface represents a file on a file system. */
|
||||
export interface FileEntry extends Entry {
|
||||
/**
|
||||
* Creates a new FileWriter associated with the file that this FileEntry represents.
|
||||
* @param successCallback A callback that is called with the new FileWriter.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
* When the abort method is called, user agents must run the steps below:
|
||||
* <ol>
|
||||
* <li> If readyState == DONE or readyState == INIT, terminate this overall series of steps without doing anything else. </li>
|
||||
* <li> Set readyState to DONE. </li>
|
||||
* <li> If there are any tasks from the object's FileSaver task source in one of the task queues, then remove those tasks. </li>
|
||||
* <li> Terminate the write algorithm being processed. </li>
|
||||
* <li> Set the error attribute to a DOMError object of type "AbortError". </li>
|
||||
* <li> Fire a progress event called abort </li>
|
||||
* <li> Fire a progress event called writeend </li>
|
||||
* <li> Terminate this algorithm. </li>
|
||||
* </ol>
|
||||
*/
|
||||
createWriter(successCallback: (writer: FileWriter) => void,
|
||||
errorCallback?: (error: FileError) => void): void;
|
||||
/**
|
||||
* Returns a File that represents the current state of the file that this FileEntry represents.
|
||||
* @param successCallback A callback that is called with the File.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
*/
|
||||
file(successCallback: (file: File) => void,
|
||||
errorCallback?: (error: FileError) => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface provides methods to monitor the asynchronous writing of blobs
|
||||
* to disk using progress events and event handler attributes.
|
||||
*/
|
||||
export interface FileSaver extends EventTarget {
|
||||
/** Terminate file operation */
|
||||
abort(): void;
|
||||
|
||||
/**
|
||||
* The FileSaver object can be in one of 3 states. The readyState attribute, on getting,
|
||||
* must return the current state, which must be one of the following values:
|
||||
* INIT
|
||||
* WRITING
|
||||
* DONE
|
||||
* The blob is being written.
|
||||
* @readonly
|
||||
*/
|
||||
INIT: number;
|
||||
|
||||
/**
|
||||
* The object has been constructed, but there is no pending write.
|
||||
* @readonly
|
||||
*/
|
||||
WRITING: number;
|
||||
|
||||
/**
|
||||
* The entire Blob has been written to the file, an error occurred during the write, or the write was aborted using abort(). The FileSaver is no longer writing the blob.
|
||||
* @readonly
|
||||
*/
|
||||
DONE: number;
|
||||
|
||||
/**
|
||||
* The FileSaver object can be in one of 3 states. The readyState attribute, on getting, must return the current state, which must be one of the following values:
|
||||
* <ul>
|
||||
* <li>INIT</li>
|
||||
* <li>WRITING</li>
|
||||
* <li>DONE</li>
|
||||
* <ul>
|
||||
* @readonly
|
||||
*/
|
||||
readyState: number;
|
||||
/** Handler for writestart events. */
|
||||
onwritestart: (event: ProgressEvent) => void;
|
||||
/** Handler for progress events. */
|
||||
onprogress: (event: ProgressEvent) => void;
|
||||
/** Handler for write events. */
|
||||
onwrite: (event: ProgressEvent) => void;
|
||||
/** Handler for abort events. */
|
||||
onabort: (event: ProgressEvent) => void;
|
||||
/** Handler for error events. */
|
||||
onerror: (event: ProgressEvent) => void;
|
||||
/** Handler for writeend events. */
|
||||
onwriteend: (event: ProgressEvent) => void;
|
||||
/** The last error that occurred on the FileSaver. */
|
||||
|
||||
/**
|
||||
* The last error that occurred on the FileSaver.
|
||||
* @readonly
|
||||
*/
|
||||
error: Error;
|
||||
|
||||
/**
|
||||
* Handler for writestart events
|
||||
*/
|
||||
onwritestart: (event: ProgressEvent) => void;
|
||||
|
||||
/**
|
||||
* Handler for progress events.
|
||||
*/
|
||||
onprogress: (event: ProgressEvent) => void;
|
||||
|
||||
/**
|
||||
* Handler for write events.
|
||||
*/
|
||||
onwrite: (event: ProgressEvent) => void;
|
||||
|
||||
/**
|
||||
* Handler for abort events.
|
||||
*/
|
||||
onabort: (event: ProgressEvent) => void;
|
||||
|
||||
/**
|
||||
* Handler for error events.
|
||||
*/
|
||||
onerror: (event: ProgressEvent) => void;
|
||||
|
||||
/**
|
||||
* Handler for writeend events.
|
||||
*/
|
||||
onwriteend: (event: ProgressEvent) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface expands on the FileSaver interface to allow for multiple write
|
||||
* actions, rather than just saving a single Blob.
|
||||
* @hidden
|
||||
* This interface expands on the FileSaver interface to allow for multiple write actions, rather than just saving a single Blob.
|
||||
*/
|
||||
export interface FileWriter extends FileSaver {
|
||||
export declare class FileWriter extends FileSaver {
|
||||
/**
|
||||
* The byte offset at which the next write to the file will occur. This always less or equal than length.
|
||||
* A newly-created FileWriter will have position set to 0.
|
||||
* The byte offset at which the next write to the file will occur. This must be no greater than length.
|
||||
* A newly-created FileWriter must have position set to 0.
|
||||
*/
|
||||
position: number;
|
||||
|
||||
/**
|
||||
* The length of the file. If the user does not have read access to the file,
|
||||
* this will be the highest byte offset at which the user has written.
|
||||
* The length of the file. If the user does not have read access to the file, this must be the highest byte offset at which the user has written.
|
||||
*/
|
||||
length: number;
|
||||
|
||||
/**
|
||||
* Write the supplied data to the file at position.
|
||||
* @param {Blob} data The blob to write.
|
||||
* @param data The blob to write.
|
||||
*/
|
||||
write(data: ArrayBuffer | Blob | string): void;
|
||||
|
||||
/**
|
||||
* The file position at which the next write will occur.
|
||||
* @param offset If nonnegative, an absolute byte offset into the file.
|
||||
* If negative, an offset back from the end of the file.
|
||||
* Seek sets the file position at which the next write will occur.
|
||||
* @param offset If nonnegative, an absolute byte offset into the file. If negative, an offset back from the end of the file.
|
||||
*/
|
||||
seek(offset: number): void;
|
||||
|
||||
/**
|
||||
* Changes the length of the file to that specified. If shortening the file, data beyond the new length
|
||||
* will be discarded. If extending the file, the existing data will be zero-padded up to the new length.
|
||||
* Changes the length of the file to that specified. If shortening the file, data beyond the new length must be discarded. If extending the file, the existing data must be zero-padded up to the new length.
|
||||
* @param size The size to which the length of the file is to be adjusted, measured in bytes.
|
||||
*/
|
||||
truncate(size: number): void;
|
||||
}
|
||||
|
||||
/* FileWriter states */
|
||||
export declare var FileWriter: {
|
||||
INIT: number;
|
||||
WRITING: number;
|
||||
DONE: number
|
||||
};
|
||||
export interface IWriteOptions {
|
||||
replace?: boolean;
|
||||
append?: boolean;
|
||||
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;
|
||||
static SECURITY_ERR: number;
|
||||
static ABORT_ERR: number;
|
||||
static NOT_READABLE_ERR: number;
|
||||
static ENCODING_ERR: number;
|
||||
static NO_MODIFICATION_ALLOWED_ERR: number;
|
||||
static INVALID_STATE_ERR: number;
|
||||
static SYNTAX_ERR: number;
|
||||
static INVALID_MODIFICATION_ERR: number;
|
||||
static QUOTA_EXCEEDED_ERR: number;
|
||||
static TYPE_MISMATCH_ERR: number;
|
||||
static PATH_EXISTS_ERR: number;
|
||||
/** Error code */
|
||||
code: number;
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
export declare class FileReader {
|
||||
static EMPTY: number;
|
||||
static LOADING: number;
|
||||
static DONE: number;
|
||||
static READ_CHUNK_SIZE: number;
|
||||
|
||||
export interface FileReader {
|
||||
readyState: number; // see constants in var declaration below
|
||||
error: Error;
|
||||
result: string | ArrayBuffer; // type depends on readAsXXX() call type
|
||||
@@ -302,42 +569,21 @@ export interface FileReader {
|
||||
onabort: (evt: ProgressEvent) => void;
|
||||
|
||||
abort(): void;
|
||||
readAsText(fe: File | Blob, encoding?: string): void;
|
||||
readAsDataURL(fe: File | Blob): void;
|
||||
readAsBinaryString(fe: File | Blob): void;
|
||||
readAsArrayBuffer(fe: File | Blob): void;
|
||||
readAsText(fe: IFile, encoding?: string): void;
|
||||
readAsDataURL(fe: IFile): void;
|
||||
readAsBinaryString(fe: IFile): void;
|
||||
readAsArrayBuffer(fe: IFile): void;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
[key: string]: any;
|
||||
|
||||
}
|
||||
|
||||
export declare var FileReader: {
|
||||
EMPTY: number;
|
||||
LOADING: number;
|
||||
DONE: number;
|
||||
|
||||
new (): FileReader;
|
||||
};
|
||||
|
||||
export interface FileError {
|
||||
/** Error code */
|
||||
code: number;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export declare var FileError: {
|
||||
new (code: number): FileError;
|
||||
NOT_FOUND_ERR: number;
|
||||
SECURITY_ERR: number;
|
||||
ABORT_ERR: number;
|
||||
NOT_READABLE_ERR: number;
|
||||
ENCODING_ERR: number;
|
||||
NO_MODIFICATION_ALLOWED_ERR: number;
|
||||
INVALID_STATE_ERR: number;
|
||||
SYNTAX_ERR: number;
|
||||
INVALID_MODIFICATION_ERR: number;
|
||||
QUOTA_EXCEEDED_ERR: number;
|
||||
TYPE_MISMATCH_ERR: number;
|
||||
PATH_EXISTS_ERR: number;
|
||||
};
|
||||
interface Window extends LocalFileSystem {}
|
||||
|
||||
declare const window: Window;
|
||||
|
||||
/**
|
||||
* @name File
|
||||
@@ -358,17 +604,23 @@ export declare var FileError: {
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* This plugin is based on several specs, including : The HTML5 File API http://www.w3.org/TR/FileAPI/
|
||||
* 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
|
||||
* This plugin is based on several specs, including : The HTML5 File API http: //www.w3.org/TR/FileAPI/
|
||||
* 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',
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'OS X', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'macOS', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
})
|
||||
@Injectable()
|
||||
export class File extends IonicNativePlugin {
|
||||
@@ -446,7 +698,7 @@ export class File extends IonicNativePlugin {
|
||||
@CordovaProperty
|
||||
sharedDirectory: string;
|
||||
|
||||
cordovaFileError: {} = {
|
||||
cordovaFileError: any = {
|
||||
1: 'NOT_FOUND_ERR',
|
||||
2: 'SECURITY_ERR',
|
||||
3: 'ABORT_ERR',
|
||||
@@ -749,12 +1001,12 @@ export class File extends IonicNativePlugin {
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} fileName path relative to base path
|
||||
* @param {string | Blob} text content or blob to write
|
||||
* @param {WriteOptions} options replace file if set to true. See WriteOptions for more information.
|
||||
* @param {IWriteOptions} options replace file if set to true. See WriteOptions for more information.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves to updated file entry or rejects with an error.
|
||||
*/
|
||||
@CordovaCheck()
|
||||
writeFile(path: string, fileName: string,
|
||||
text: string | Blob | ArrayBuffer, options: WriteOptions = {}): Promise<any> {
|
||||
text: string | Blob | ArrayBuffer, options: IWriteOptions = {}): Promise<any> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
const err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
@@ -780,10 +1032,10 @@ export class File extends IonicNativePlugin {
|
||||
* @hidden
|
||||
* @param {FileEntry} fe file entry object
|
||||
* @param {string | Blob} text content or blob to write
|
||||
* @param {WriteOptions} options replace file if set to true. See WriteOptions for more information.
|
||||
* @param {IWriteOptions} options replace file if set to true. See WriteOptions for more information.
|
||||
* @returns {Promise<FileEntry>} Returns a Promise that resolves to updated file entry or rejects with an error.
|
||||
*/
|
||||
private writeFileEntry(fe: FileEntry, text: string | Blob | ArrayBuffer, options: WriteOptions) {
|
||||
private writeFileEntry(fe: FileEntry, text: string | Blob | ArrayBuffer, options: IWriteOptions) {
|
||||
return this.createWriter(fe)
|
||||
.then((writer) => {
|
||||
if (options.append) {
|
||||
@@ -827,7 +1079,7 @@ export class File extends IonicNativePlugin {
|
||||
/**
|
||||
* Read file and return data as a base64 encoded data url.
|
||||
* A data url is of the form:
|
||||
* data:[<mediatype>][;base64],<data>
|
||||
* data: [<mediatype>][;base64],<data>
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
@@ -872,7 +1124,7 @@ export class File extends IonicNativePlugin {
|
||||
return this.getFile(directoryEntry, file, { create: false });
|
||||
})
|
||||
.then((fileEntry: FileEntry) => {
|
||||
let reader = new FileReader();
|
||||
const reader = new FileReader();
|
||||
return new Promise<T>((resolve, reject) => {
|
||||
reader.onloadend = () => {
|
||||
if (reader.result !== undefined || reader.result !== null) {
|
||||
@@ -885,7 +1137,7 @@ export class File extends IonicNativePlugin {
|
||||
};
|
||||
|
||||
fileEntry.file(file => {
|
||||
reader[`readAs${readAs}`].call(null, file);
|
||||
reader[`readAs${readAs}`].call(reader, file);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
@@ -974,7 +1226,7 @@ export class File extends IonicNativePlugin {
|
||||
resolveLocalFilesystemUrl(fileUrl: string): Promise<Entry> {
|
||||
return new Promise<Entry>((resolve, reject) => {
|
||||
try {
|
||||
window.resolveLocalFileSystemURL(fileUrl, (entry) => {
|
||||
window.resolveLocalFileSystemURL(fileUrl, (entry: Entry) => {
|
||||
resolve(entry);
|
||||
}, (err) => {
|
||||
this.fillErrorMessage(err);
|
||||
@@ -999,7 +1251,7 @@ export class File extends IonicNativePlugin {
|
||||
if (de.isDirectory) {
|
||||
return <DirectoryEntry>de;
|
||||
} else {
|
||||
let err = new FileError(13);
|
||||
const err = new FileError(13);
|
||||
err.message = 'input is not a directory';
|
||||
return Promise.reject<DirectoryEntry>(err);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,16 @@ export interface FingerprintOptions {
|
||||
* Disable 'use backup' option. Only for android (optional)
|
||||
*/
|
||||
disableBackup?: boolean;
|
||||
|
||||
/**
|
||||
* Title of fallback button. Only for iOS
|
||||
*/
|
||||
localizedFallbackTitle?: string;
|
||||
|
||||
/**
|
||||
* Description in authentication dialogue. Only for iOS
|
||||
*/
|
||||
localizedReason?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,7 +46,9 @@ export interface FingerprintOptions {
|
||||
* this.faio.show({
|
||||
* clientId: 'Fingerprint-Demo',
|
||||
* clientSecret: 'password', //Only necessary for Android
|
||||
* disableBackup:true //Only for Android(optional)
|
||||
* disableBackup:true, //Only for Android(optional)
|
||||
* localizedFallbackTitle: 'Use Pin', //Only for iOS
|
||||
* localizedReason: 'Please authenticate' //Only for iOS
|
||||
* })
|
||||
* .then((result: any) => console.log(result))
|
||||
* .catch((error: any) => console.log(error));
|
||||
|
||||
85
src/@ionic-native/plugins/firebase-analytics/index.ts
Normal file
85
src/@ionic-native/plugins/firebase-analytics/index.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Firebase Analytics
|
||||
* @description
|
||||
* Cordova plugin for Firebase Analytics
|
||||
*
|
||||
* Go to firebase console and export google-services.json and GoogleService-Info.plist. Put those files into the root of your cordova app folder.
|
||||
*
|
||||
* NOTE: on iOS in order to collect demographic, age, gender data etc. you should additionally include AdSupport.framework into your project.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FirebaseAnalytics } from '@ionic-native/firebase-analytics';
|
||||
*
|
||||
*
|
||||
* constructor(private firebaseAnalytics: FirebaseAnalytics) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.firebaseAnalytics.logEvent('page_view', {page: "dashboard"})
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FirebaseAnalytics',
|
||||
plugin: 'cordova-plugin-firebase-analytics',
|
||||
pluginRef: 'cordova.plugins.firebase.analytics',
|
||||
repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-analytics',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class FirebaseAnalytics extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Logs an app event.
|
||||
* Be aware of automatically collected events.
|
||||
* @param name {string} The name of the event
|
||||
* @param params {any} Some param to configure something
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
logEvent(name: string, params: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Sets the user ID property.
|
||||
* This feature must be used in accordance with Google's Privacy Policy.
|
||||
* @param id {string} The user ID
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
setUserId(id: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* This feature must be used in accordance with Google's Privacy Policy.
|
||||
* Be aware of automatically collected user properties.
|
||||
* @param name {string} The property name
|
||||
* @param value {string} The property value
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
setUserProperty(name: string, value: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Sets whether analytics collection is enabled for this app on this device.
|
||||
* @param enabled {boolean}
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
setEnabled(enabled: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Sets the current screen name, which specifies the current visual context in your app.
|
||||
* This helps identify the areas in your app where users spend their time and how they interact with your app.
|
||||
* @param name {string} The name of the screen
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
setCurrentScreen(name: string): Promise<any> { return; }
|
||||
|
||||
}
|
||||
91
src/@ionic-native/plugins/firebase-dynamic-links/index.ts
Normal file
91
src/@ionic-native/plugins/firebase-dynamic-links/index.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
export interface DynamicLinksOptions {
|
||||
title: string;
|
||||
message: string;
|
||||
deepLink?: string;
|
||||
callToActionText?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Firebase Dynamic Links
|
||||
* @description
|
||||
* Cordova plugin for Firebase Invites and Firebase Dynamic Links
|
||||
*
|
||||
* Variables APP_DOMAIN and APP_PATH specify web URL where your app will start an activity to handle the link. They also used to setup support for App Indexing.
|
||||
* Variable REVERSED_CLIENT_ID can be found in your GoogleService-Info.plist under the same key name.
|
||||
* Variable PHOTO_LIBRARY_USAGE_DESCRIPTION specifies required value for NSPhotoLibraryUsageDescription on iOS.
|
||||
* Go to firebase console and export google-services.json and GoogleService-Info.plist. Put those files into the root of your cordova app folder.
|
||||
*
|
||||
* Preferences:
|
||||
*
|
||||
* Preferences GoogleIOSClientId and GoogleAndroidClientId are used to setup dynamic links when you have an app for several platforms.
|
||||
* You can find values at your GoogleService-Info.plist (key ANDROID_CLIENT_ID) and google-services.json (key client[0].oauth_client[0].client_id).
|
||||
*
|
||||
*config.xml:
|
||||
* ```xml
|
||||
* <platform name="android">
|
||||
* <preference name="GoogleIOSClientId" value="..." />
|
||||
* </platform>
|
||||
* <platform name="ios">
|
||||
* <preference name="GoogleAndroidClientId" value="..." />
|
||||
* </platform>
|
||||
* ```
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FirebaseDynamicLinks } from '@ionic-native/firebase-dynamic-links';
|
||||
*
|
||||
*
|
||||
* constructor(private firebaseDynamicLinks: FirebaseDynamicLinks) { }
|
||||
*
|
||||
* ...
|
||||
* // The deepLink and callToActionText properties are optional
|
||||
* const options: DynamicLinksOptions = {
|
||||
* title: 'My Title';
|
||||
* message: 'My message';
|
||||
* deepLink: 'http://example.com/';
|
||||
* callToActionText: 'Message on button';
|
||||
* }
|
||||
*
|
||||
* this.firebaseDynamicLinks.sendInvitation(options)
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* this.firebaseDynamicLinks.onDynamicLink()
|
||||
* .then((res: any) => console.log(res)) //Handle the logic here after opening the app with the Dynamic link
|
||||
* .catch((error:any) => console.log(error));
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* DynamicLinksOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FirebaseDynamicLinks',
|
||||
plugin: ' cordova-plugin-firebase-dynamiclinks',
|
||||
pluginRef: 'cordova.plugins.firebase.dynamiclinks',
|
||||
repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-dynamiclinks',
|
||||
install: 'ionic cordova plugin add cordova-plugin-firebase-dynamiclinks --save --variable APP_DOMAIN="example.com" --variable APP_PATH="/"',
|
||||
installVariables: ['APP_DOMAIN', 'APP_PATH'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class FirebaseDynamicLinks extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Registers callback that is triggered on each dynamic link click.
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
onDynamicLink(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Display invitation dialog.
|
||||
* @param options {DynamicLinksOptions} Some param to configure something
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
sendInvitation(options: DynamicLinksOptions): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Firebase
|
||||
* @description
|
||||
* This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project! Android and iOS supported (including iOS 10).
|
||||
@@ -70,10 +71,10 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Check permission to receive push notifications
|
||||
* @return {Promise<any>}
|
||||
* @return {Promise<{isEnabled: boolean}>}
|
||||
*/
|
||||
@Cordova()
|
||||
hasPermission(): Promise<any> { return; }
|
||||
hasPermission(): Promise<{isEnabled: boolean}> { return; }
|
||||
|
||||
/**
|
||||
* Set icon badge number. Set to 0 to clear the badge.
|
||||
@@ -106,6 +107,13 @@ export class Firebase extends IonicNativePlugin {
|
||||
@Cordova()
|
||||
unsubscribe(topic: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Unregister from firebase, used to stop receiving push notifications.
|
||||
* Call this when you logout user from your app.
|
||||
*/
|
||||
@Cordova()
|
||||
unregister(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Log an event using Analytics
|
||||
* @param type {string}
|
||||
|
||||
@@ -23,7 +23,7 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
pluginName: 'Flashlight',
|
||||
plugin: 'cordova-plugin-flashlight',
|
||||
pluginRef: 'window.plugins.flashlight',
|
||||
repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git',
|
||||
repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -72,6 +72,9 @@ export interface FlurryAnalyticsLocation {
|
||||
horizontalAccuracy?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export class FlurryAnalyticsObject {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
@@ -208,8 +211,8 @@ export class FlurryAnalyticsObject {
|
||||
pluginName: 'FlurryAnalytics',
|
||||
plugin: 'cordova-plugin-flurryanalytics',
|
||||
pluginRef: 'FlurryAnalytics',
|
||||
repo: 'https://github.com/blakgeek/cordova-plugin-flurryanalytics.git',
|
||||
platforms: ['Android', 'iOS', 'Browser']
|
||||
repo: 'https://github.com/blakgeek/cordova-plugin-flurryanalytics',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class FlurryAnalytics extends IonicNativePlugin {
|
||||
@@ -224,7 +227,7 @@ export class FlurryAnalytics extends IonicNativePlugin {
|
||||
let instance: any;
|
||||
|
||||
if (checkAvailability(FlurryAnalytics.pluginRef, null, FlurryAnalytics.pluginName) === true) {
|
||||
instance = new (window as any).FlurryAnalaytics(options);
|
||||
instance = new (window as any).FlurryAnalytics(options);
|
||||
}
|
||||
|
||||
return new FlurryAnalyticsObject(instance);
|
||||
|
||||
133
src/@ionic-native/plugins/ftp/index.ts
Normal file
133
src/@ionic-native/plugins/ftp/index.ts
Normal file
@@ -0,0 +1,133 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name FTP
|
||||
* @description
|
||||
* This cordova plugin is created to use ftp (client) in web/js.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FTP } from '@ionic-native/ftp';
|
||||
*
|
||||
*
|
||||
* constructor(private fTP: FTP) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.fTP.connect('ftp_host', 'ftp_user', 'ftp_password')
|
||||
* .then((res: any) => console.log('Login successful', res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FTP',
|
||||
plugin: 'cordova-plugin-ftp',
|
||||
pluginRef: 'cordova.plugin.ftp',
|
||||
repo: 'https://github.com/xfally/cordova-plugin-ftp',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class FTP extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Connect to one ftp server.
|
||||
*
|
||||
* Just need to init the connection once. If success, you can do any ftp actions later.
|
||||
* @param hostname {string} The ftp server url. Like ip without protocol prefix, e.g. "192.168.1.1".
|
||||
* @param username {string} The ftp login username. If it and `password` are all blank/undefined, the default username "anonymous" is used.
|
||||
* @param password {string} The ftp login password. If it and `username` are all blank/undefined, the default password "anonymous@" is used.
|
||||
* @return {Promise<any>} The success callback. Notice: For iOS, if triggered, means `init` success, but NOT means the later action, e.g. `ls`... `download` will success!
|
||||
*/
|
||||
@Cordova()
|
||||
connect(hostname: string, username: string, password: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* List files (with info of `name`, `type`, `link`, `size`, `modifiedDate`) under one directory on the ftp server.
|
||||
* You can get one file's name using `fileList[x].name` (`x` is the location in array).
|
||||
*
|
||||
* Explain key:
|
||||
* - name: file name (utf-8).
|
||||
* - type: file type. number `0` means regular file, `1` means directory, `2` means symbolic link, `-1` means unknown type (maybe block dev, char dev...).
|
||||
* - link: if the file is a symbolic link, then this field store symbolic link information (utf-8), else it's a blank string.
|
||||
* - size: file size in bytes.
|
||||
* - modifiedDate: modified date of this file. date format is `yyyy-MM-dd HH:mm:ss zzz`, e.g "2015-12-01 20:45:00 GMT+8".
|
||||
*
|
||||
* @param path {string} The path on the ftp server. e.g. "/adf/123/".
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
ls(path: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Create one directory on the ftp server.
|
||||
*
|
||||
* @param path {string} The path on the ftp server. e.g. "/adf/123/".
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
mkdir(path: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Delete one directory on the ftp server.
|
||||
*
|
||||
* Tip: As many ftp server could not rm dir when it's not empty, so rm all files under the dir at first is recommended.
|
||||
*
|
||||
* @param path {string} The file (with full path) you want to delete. e.g. "/adf/123/newDir/myFile".
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
rmdir(path: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Delete one file on the ftp server.
|
||||
*
|
||||
* @param file {string} The file (with full path) you want to delete. e.g. "/adf/123/newDir/myFile".
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
rm(file: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Upload one local file to the ftp server.
|
||||
*
|
||||
* @param localFile {string} The file (with full path) you want to upload. e.g. "/local/path/to/localFile".
|
||||
* @param remoteFile {string} The file (with full path) you want to located on the ftp server. e.g. "/adf/123/newDir/remoteFile".
|
||||
* @return {Promise<any>} Returns a promise.
|
||||
* It will be triggered many times according the file's size.
|
||||
* The arg `0`, `0.1xx`, `0.2xx` ... `1` means the upload percent. When it reach `1`, means success.
|
||||
*/
|
||||
@Cordova()
|
||||
upload(localFile: string, remoteFile: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Download one remote file on the ftp server to local path.
|
||||
*
|
||||
* @param localFile {string} The file (with full path) you want to upload. e.g. "/local/path/to/localFile".
|
||||
* @param remoteFile {string} The file (with full path) you want to located on the ftp server. e.g. "/adf/123/newDir/remoteFile".
|
||||
* @return {Promise<any>} Returns a promise.
|
||||
* It will be triggered many times according the file's size.
|
||||
* The arg `0`, `0.1xx`, `0.2xx` ... `1` means the upload percent. When it reach `1`, means success.
|
||||
*/
|
||||
@Cordova()
|
||||
download(localFile: string, remoteFile: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Cancel all requests. Always success.
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
cancel(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Disconnect from ftp server.
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
disconnect(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -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
|
||||
@@ -72,20 +72,20 @@ declare var window: any;
|
||||
* ### Troubleshooting ###
|
||||
* #### I get compile errors when I run `ionic build ios` or `ionic run ios`. ####
|
||||
* This could be caused by the Cordova project directory in `/platforms/ios` not being named correctly.
|
||||
* Try running `ionic platform rm <platform>` then run `ionic platform add <platform>` to recreate the
|
||||
* Try running `ionic cordova platform rm <platform>` then run `ionic cordova platform add <platform>` to recreate the
|
||||
* platform directories.
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Geofence',
|
||||
plugin: 'cordova-plugin-geofence',
|
||||
pluginRef: 'geofence',
|
||||
repo: 'https://github.com/cowbell/cordova-plugin-geofence/',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows Phone']
|
||||
repo: 'https://github.com/cowbell/cordova-plugin-geofence',
|
||||
platforms: ['Android', 'iOS', 'Windows', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class Geofence extends IonicNativePlugin {
|
||||
|
||||
public TransitionType = {
|
||||
TransitionType = {
|
||||
ENTER: 1,
|
||||
EXIT: 2,
|
||||
BOTH: 3
|
||||
@@ -96,7 +96,7 @@ export class Geofence extends IonicNativePlugin {
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
@CordovaFunctionOverride()
|
||||
onTrasitionReceived(): Observable<any> { return; };
|
||||
onTransitionReceived(): Observable<any> { return; };
|
||||
|
||||
/**
|
||||
* Initializes the plugin. User will be prompted to allow the app to use location and notifications.
|
||||
@@ -139,20 +139,6 @@ export class Geofence extends IonicNativePlugin {
|
||||
@Cordova()
|
||||
getWatched(): Promise<string> { return; };
|
||||
|
||||
/**
|
||||
* Called when a geofence is crossed in the direction specified by `TransitType`.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
onTransitionReceived(): Observable<any> {
|
||||
|
||||
return new Observable<any>((observer) => {
|
||||
window && window.geofence && (window.geofence.onTransitionReceived = observer.next.bind(observer));
|
||||
return () => window.geofence.onTransitionReceived = () => { };
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user clicks a geofence notification. iOS and Android only.
|
||||
*
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -153,7 +153,9 @@ export interface GeolocationOptions {
|
||||
plugin: 'cordova-plugin-geolocation',
|
||||
pluginRef: 'navigator.geolocation',
|
||||
repo: 'https://github.com/apache/cordova-plugin-geolocation',
|
||||
platforms: ['Android', 'Firefox OS', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
install: 'ionic cordova plugin add cordova-plugin-geolocation --variable GEOLOCATION_USAGE_DESCRIPTION="To locate you"',
|
||||
installVariables: ['GEOLOCATION_USAGE_DESCRIPTION'],
|
||||
platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
})
|
||||
@Injectable()
|
||||
export class Geolocation extends IonicNativePlugin {
|
||||
@@ -174,7 +176,7 @@ export class Geolocation extends IonicNativePlugin {
|
||||
* Observable changes.
|
||||
*
|
||||
* ```typescript
|
||||
* var subscription = 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);
|
||||
|
||||
@@ -26,7 +26,7 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
plugin: 'cordova-plugin-globalization',
|
||||
pluginRef: 'navigator.globalization',
|
||||
repo: 'https://github.com/apache/cordova-plugin-globalization',
|
||||
platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Firefox OS', 'iOS', 'Windows Phone 8', 'Widnows', 'Browser']
|
||||
platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
})
|
||||
@Injectable()
|
||||
export class Globalization extends IonicNativePlugin {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var window;
|
||||
|
||||
/**
|
||||
* @name Google Analytics
|
||||
* @description
|
||||
@@ -36,7 +34,7 @@ declare var window;
|
||||
plugin: 'cordova-plugin-google-analytics',
|
||||
pluginRef: 'ga',
|
||||
repo: 'https://github.com/danwilson/google-analytics-plugin',
|
||||
platforms: ['Android', 'iOS', 'Browser']
|
||||
platforms: ['Android', 'Browser', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class GoogleAnalytics extends IonicNativePlugin {
|
||||
@@ -104,7 +102,7 @@ export class GoogleAnalytics extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Track custom metric
|
||||
* @param key {string}
|
||||
* @param key {number}
|
||||
* @param value {any}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@@ -112,7 +110,7 @@ export class GoogleAnalytics extends IonicNativePlugin {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
trackMetric(key: string, value?: any): Promise<any> { return; }
|
||||
trackMetric(key: number, value?: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track a screen
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,9 +23,9 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
plugin: 'cordova-plugin-googleplus',
|
||||
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',
|
||||
installVariables: ['REVERSED_CLIENT_ID']
|
||||
install: 'ionic cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid',
|
||||
installVariables: ['REVERSED_CLIENT_ID'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class GooglePlus extends IonicNativePlugin {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
/**
|
||||
* @name Header Color
|
||||
* @description
|
||||
* Cordova plugin to change color of header in multitask view
|
||||
* Cordova plugin to change color of header in Android Multitask View
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
|
||||
@@ -59,9 +59,9 @@ export interface HTTPResponse {
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'HTTP',
|
||||
plugin: 'cordova-plugin-http',
|
||||
pluginRef: 'cordovaHTTP',
|
||||
repo: 'https://github.com/wymsee/cordova-HTTP',
|
||||
plugin: 'cordova-plugin-advanced-http',
|
||||
pluginRef: 'cordova.plugin.http',
|
||||
repo: 'https://github.com/silkimen/cordova-plugin-advanced-http',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
@@ -92,6 +92,41 @@ export class HTTP extends IonicNativePlugin {
|
||||
@Cordova({ sync: true })
|
||||
setHeader(header: string, value: string): void { }
|
||||
|
||||
/**
|
||||
* Set the data serializer which will be used for all future POST and PUT requests. Takes a string representing the name of the serializer.
|
||||
* @param serializer {string} The name of the serializer. Can be urlencoded or json
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setDataSerializer(serializer: string): void { }
|
||||
|
||||
/**
|
||||
* Clear all cookies
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
clearCookies(): void { }
|
||||
|
||||
/**
|
||||
* Remove cookies
|
||||
* @param url {string}
|
||||
* @param cb
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
removeCookies(url: string, cb: () => void): void { }
|
||||
|
||||
/**
|
||||
* Disable following redirects automatically
|
||||
* @param disable {boolean} Set to true to disable following redirects automatically
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
disableRedirect(disable: boolean): void { }
|
||||
|
||||
/**
|
||||
* Set request timeout
|
||||
* @param timeout {number} The timeout in seconds. Default 60
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setRequestTimeout(timeout: number): void { }
|
||||
|
||||
/**
|
||||
* Enable or disable SSL Pinning. This defaults to false.
|
||||
*
|
||||
@@ -112,14 +147,6 @@ export class HTTP extends IonicNativePlugin {
|
||||
@Cordova()
|
||||
acceptAllCerts(accept: boolean): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Whether or not to validate the domain name in the certificate. This defaults to true.
|
||||
* @param validate {boolean} Set to true to validate
|
||||
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
validateDomainName(validate: boolean): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Make a POST request
|
||||
* @param url {string} The url to send the request to
|
||||
@@ -131,7 +158,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
post(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* Make a GET request
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
@@ -140,6 +167,46 @@ export class HTTP extends IonicNativePlugin {
|
||||
@Cordova()
|
||||
get(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
* Make a PUT request
|
||||
* @param url {string} The url to send the request to
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
put(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
* Make a PATCH request
|
||||
* @param url {string} The url to send the request to
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
patch(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
* Make a DELETE request
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
delete(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
* Make a HEAD request
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
head(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url {string} The url to send the request to
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user