Compare commits

...

144 Commits

Author SHA1 Message Date
Ibby Hadeed
41dae53bf2 chore(): update changelog 2017-06-01 14:23:32 -04:00
Ibby Hadeed
3027b5ea16 3.11.0 2017-06-01 14:23:27 -04:00
Ibby Hadeed
ec773de686 chore(): rename org 2017-06-01 14:03:56 -04:00
Daniel Sogl
f3b7467ffd docs(google-plus): renamed Web to Browser (#1635) 2017-06-01 13:08:53 -04:00
Niklas Häusele
d9546f15ed docs(): fix typo (#1632) 2017-06-01 13:06:07 -04:00
Daniel Sogl
52dcd808b6 refactor(docs): read the description (#1631)
* refactor(docs): read the description

- Added missing platforms
- Unified GitHub links
- Added missing installVariables

* Update index.ts

* Update index.ts

* Update index.ts

* Update index.ts
2017-06-01 13:05:47 -04:00
Raman Rasliuk
985193bebd fix(document-viewer): fix param type (#1634)
Options for  viewDocument should be an DocumentViewerOptions object, not array of DocumentViewerOptions objects
2017-06-01 13:05:20 -04:00
Daniel Sogl
9bf9e9d073 typo(package): added fields (#1633) 2017-06-01 13:01:42 -04:00
Daniel Sogl
8b9995a5af fix(secure-storage): add missing function (#1626)
* fix(secure-storage): add missing function

fix #1625

* Update index.ts
2017-05-31 21:03:46 -04:00
Daniel Sogl
2d3add6507 feat(plugin): add FTP plugin (#1627) 2017-05-31 21:03:07 -04:00
Daniel Sogl
ee59b55c29 docs(template): optimize template (#1628)
* Update wrap-min.tmpl

* Update wrap.tmpl
2017-05-31 21:01:37 -04:00
mhartington
28bb6dc1a8 docs(github): rename driftyco references to ionic-team 2017-05-30 11:01:13 -04:00
Nico
b587a0e647 docs(dialogs): confirm() can return a promise that resolves to 0 (#1617)
Document the fact that confirm() will return a promise that resolves to 0 if the user clicks outside the dialog box. This behavior was previously undocummented and could lead to issues if not handled properly.
2017-05-28 14:59:51 -04:00
Daniel Sogl
d9d7919174 chore(package): bump dependencies (#1611)
* chore(package): bump dependencies

I updated the dependencies to the latest bugfix and feature releases without any breaking changes.

* Update package.json

* Update package.json
2017-05-28 04:11:57 -04:00
Daniel Sogl
11c42757d7 docs(): rename OS X to macOS (#1614) 2017-05-28 04:01:27 -04:00
Daniel Sogl
4e4216ff6d docs(file): rename OS X to macOS (#1613) 2017-05-28 04:00:52 -04:00
Daniel Sogl
496968b9fc docs(device): rename OSX to macOS (#1612) 2017-05-28 04:00:18 -04:00
Jan Piotrowski
bf3f9d8799 refactor(core): fix "Install the plugin" command when not installed (#1606)
ionic plugin add ... => ionic cordova plugin add ...
2017-05-25 13:05:59 -04:00
Daniel Sogl
6f22134851 chore(package): bump zone.js and TS version (#1598)
* chore(package) bump zone.js version

* Update package.json
2017-05-25 13:05:29 -04:00
fabiodursoexin
aaeabb9f96 fix(flurry-analytics): fix original class reference (#1597)
fix: FlurryAnalaytics to FlurryAnalytics
2017-05-23 11:01:23 -04:00
Perry Govier
6d4da1fff4 Merge pull request #1465 from piotrowski/improved-plugin-docs
docs(template): Improved plugin docs
2017-05-22 10:03:25 -05:00
Ibby Hadeed
c0fd19fd33 chore(): update changelog 2017-05-20 06:26:59 -04:00
Ibby Hadeed
f2c4f380f8 3.10.2 2017-05-20 06:26:54 -04:00
Daniel Sogl
c96ae3db0d docs(nativegeocoder): out of beta (#1482)
Out of beta since a while
2017-05-20 06:25:45 -04:00
jasonmamy
c2a6198576 refactor(wheel-selector): added display key to override default values, added more docs (#1590) 2017-05-20 06:25:34 -04:00
Ibby Hadeed
2b3d4c9090 docs(): update install commands 2017-05-20 06:25:06 -04:00
Ibby Hadeed
dbb17d801e Merge branch 'master' of github.com:driftyco/ionic-native 2017-05-20 06:23:38 -04:00
Jonathan Alexander
0b1e4e6e84 docs(): update install command (#1592)
The install text is missing cordova so it won't install just by copying and pasting in a terminal.
2017-05-20 06:23:15 -04:00
Ibby Hadeed
8c82c87811 chore(): update changelog 2017-05-20 05:21:46 -04:00
Ibby Hadeed
9997caf506 3.10.1 2017-05-20 05:21:31 -04:00
Ibby Hadeed
c8f53d2dc3 feat(core): add getSupportedPlatforms method 2017-05-20 05:21:27 -04:00
Ibby Hadeed
a10d763a41 docs(linkedin): update repo and install command 2017-05-19 09:48:00 -04:00
Ibby Hadeed
e44fdb6730 chore(): update changelog 2017-05-19 09:44:02 -04:00
Ibby Hadeed
bb8973a0ea 3.10.0 2017-05-19 09:43:51 -04:00
Ibby Hadeed
6031a240a2 feat(native-keyboard): add native keyboard plugin (#1588)
* add native keyboard plugin

* feat(native-keyboard): add native keyboard plugin
2017-05-19 09:37:56 -04:00
Ibby Hadeed
2bd244a536 fix(admob-free): use otherPromise to fix browser development 2017-05-19 09:24:19 -04:00
Ibby Hadeed
64bff1bbed docs(): add notice about plugin taking share of earnings 2017-05-19 07:59:06 -04:00
Ibby Hadeed
da5266cd65 docs(admob-free): improve docs 2017-05-19 07:44:47 -04:00
Ibby Hadeed
c1082b1c14 fix command since I cant change permissions 2017-05-19 06:52:49 -04:00
Ibby Hadeed
2cf132ee88 Merge branch 'master' of github.com:driftyco/ionic-native 2017-05-19 06:46:03 -04:00
Ibby Hadeed
e411146e8f docs(): refactor 2017-05-19 06:38:02 -04:00
Ibby Hadeed
5f63493bdc refactor(): use const instead of var 2017-05-19 06:37:28 -04:00
Daniel Sogl
999c288b23 docs(Speech Recognition): out of beta (#1483) 2017-05-19 06:36:29 -04:00
seshachalamyv
2e83ade978 docs(): fix method name in example (#1585)
data.wasPressed
should be change as data.wasTapped
2017-05-19 06:36:04 -04:00
Ibby Hadeed
08bf57f488 chore(): config github before running ci-tests 2017-05-19 06:35:01 -04:00
Hélder Diniz
6f6392ea5c feat(user-agent): add User-Agent plugin (#1582)
* feat(user-agent): add User-Agent plugin

* feat(user-agent): Few changes upon request
2017-05-19 06:31:31 -04:00
Ibby Hadeed
0b2227d35a Merge branch 'master' of github.com:driftyco/ionic-native 2017-05-19 00:35:10 -04:00
Ibby Hadeed
4bfceadb65 refactor(tts): rename the speak method param 2017-05-19 00:35:06 -04:00
seshachalamyv
61c73eaa4e docs(): fix package name in import statement (#1581)
import { FCM } from 'ionic-native'; Corrected as import { FCM } from '@ionic-native/fcm';
2017-05-18 23:39:31 -04:00
Matias Solis de la Torre
c0c0c5cec5 docs(): update install command (#1584) 2017-05-18 23:38:58 -04:00
Ibby Hadeed
5b82d82d75 Update index.ts 2017-05-17 16:33:52 -04:00
mhartington
36be795623 docs(file): set filesaver class to hidden 2017-05-17 15:14:25 -04:00
mhartington
0996264483 docs(file): set classes to hidden
Set classes to hidden to prevent doc generation
2017-05-17 15:00:00 -04:00
Ibby Hadeed
2245bb8050 chore(): update changelog 2017-05-17 11:19:57 -04:00
Ibby Hadeed
e14e00edba 3.9.2 2017-05-17 11:19:55 -04:00
Ibby Hadeed
22102a7e4a fix(core): decorators should define enumerable properties 2017-05-17 11:19:35 -04:00
Ibby Hadeed
6416c2544c fix(action-sheet): destructiveButtonLast is optional 2017-05-17 11:07:34 -04:00
Ibby Hadeed
73a510f9c2 refactor(): remove unused import 2017-05-17 10:54:58 -04:00
Ibby Hadeed
b8b605db5e chore(): update changelog 2017-05-17 10:54:25 -04:00
Ibby Hadeed
12168d991a 3.9.1 2017-05-17 10:54:22 -04:00
Ibby Hadeed
93a119bf4b fix(core): fix issues when clearing observables 2017-05-17 10:54:09 -04:00
Ibby Hadeed
a7c62de389 refactor(core): otherPromise in wrapInstance shouldn't check for error 2017-05-17 10:47:39 -04:00
Ibby Hadeed
8aca6718e1 refactor(core): wrapInstance should return promise as-is
instance based method never throw errors like regular ones do
2017-05-17 10:46:47 -04:00
Ibby Hadeed
1ec4bdef8f docs(): update interface names 2017-05-17 10:36:05 -04:00
Ibby Hadeed
d6ed87d7cc fix merge conflict 2017-05-17 08:12:36 -04:00
Ibby Hadeed
55f3f37760 chore(): update changelog 2017-05-17 08:10:34 -04:00
Ibby Hadeed
4f547dae30 3.9.0 2017-05-17 08:10:31 -04:00
Ibby Hadeed
3cb83831c1 fix(app-preferences): suite is sync
closes #1321
2017-05-17 07:53:20 -04:00
Ibby Hadeed
ca7659378f fix(push): fix types
closes #1331
2017-05-17 07:51:19 -04:00
Ibby Hadeed
4333bc950d refactor(media): 2017-05-17 07:34:54 -04:00
Ibby Hadeed
ee4b61e405 fix(media): create will always return MediaObject even if plugin doesnt exist 2017-05-17 07:33:25 -04:00
Ibby Hadeed
975a65d619 fix(in-app-browser): fix on method
closes #1446
2017-05-17 07:27:51 -04:00
Ibby Hadeed
d68618f878 fix(media): create should return null if plugin is not available 2017-05-17 07:21:42 -04:00
Ibby Hadeed
e5aff0f5f0 Add TODO for 4.x 2017-05-17 07:13:04 -04:00
Ibby Hadeed
e596825ee9 docs(): update 2017-05-17 07:12:08 -04:00
Ibby Hadeed
991f2f04d4 feat(printer): add check method 2017-05-17 07:09:23 -04:00
Ibby Hadeed
ecdff8c0e5 docs(): add return type for pick 2017-05-17 07:03:27 -04:00
Ibby Hadeed
55071c0d65 fix(printer): fix implementation and add pick method 2017-05-17 07:03:07 -04:00
Ibby Hadeed
7d63e808ad docs(): fix repo link 2017-05-17 06:57:53 -04:00
Ibby Hadeed
84551cac67 docs(): fix docs 2017-05-17 06:53:13 -04:00
Ibby Hadeed
92ef4f0c33 fix(background-mode): configure doesn't return anything
closes #1457
2017-05-17 06:51:43 -04:00
Ibby Hadeed
d8eb621da4 docs(): fix param type 2017-05-17 06:50:43 -04:00
Ibby Hadeed
6534283a6f docs(): fix param type 2017-05-17 06:50:10 -04:00
Ibby Hadeed
f223481307 Merge branch 'master' into improved-plugin-docs 2017-05-17 06:48:46 -04:00
Daniel Sogl
5145395dd7 docs(template): fix install command (#1572) 2017-05-17 06:47:35 -04:00
Ibby Hadeed
dfd0514a43 refactor(): optimize code 2017-05-17 06:47:20 -04:00
Elias Boukamza
d5919d1736 fix(secure-storage): reject the promise if the plugin doesn't exist (#1562) 2017-05-17 06:45:54 -04:00
Ibby Hadeed
71f7051997 docs(): fix typo 2017-05-17 06:45:22 -04:00
Ibby Hadeed
2858b4bad7 remove support option 2017-05-17 06:39:08 -04:00
Ibby Hadeed
4c8deb2bed feat(linkedin): add getActiveSession method
closes #1570
2017-05-17 06:36:04 -04:00
Ibby Hadeed
277b2b15e6 Merge branch 'master' of github.com:driftyco/ionic-native 2017-05-17 06:32:49 -04:00
Ibby Hadeed
ebf402864b fix(android-permissions): fix PERMISSION property and add requestPermission
closes #1574
2017-05-17 06:32:27 -04:00
David Routhieau
6b702973ec docs(): update plugin install source (#1573) 2017-05-17 05:33:01 -04:00
Jan Piotrowski
7d4e8acce8 Remove --save
`ionic cordova plugin add` always adds `--save` to the Cordova call anyway
2017-05-17 11:31:41 +02:00
Ibby Hadeed
31983d8317 chore(): update changelog 2017-05-16 05:53:31 -04:00
Ibby Hadeed
8c842b00b6 3.8.1 2017-05-16 05:53:15 -04:00
Ibby Hadeed
c6feaafcca tslint 2017-05-16 05:49:09 -04:00
Ibby Hadeed
a7f7b26a76 reafactor(): amend last commit 2017-05-16 05:44:50 -04:00
Ibby Hadeed
d0dec7a17d fix(file): various fixes
closes #1564
2017-05-16 05:44:01 -04:00
Ibby Hadeed
7487293d33 Merge branch 'master' of github.com:driftyco/ionic-native 2017-05-16 05:31:42 -04:00
Ibby Hadeed
4f6ec0cfcd test(): update tests 2017-05-16 05:31:35 -04:00
Daniel Sogl
b35417a017 fix(document-viewer): fix params and docs for canViewDocument (#1568)
* refactor(document-viewer): fix example

* Update index.ts

* Update index.ts
2017-05-16 04:32:31 -04:00
David Routhieau
adf9c5a323 fix(file): fix repo link (#1566) 2017-05-16 00:38:39 -04:00
Raman Rasliuk
7c797123f5 fix(file): add toInternalURL (#1561)
* Put back toInternalURL

What was the reason to remove `toInternalURL` from `Entry`?
Fixes #1560

* Remove trailing whitespace
2017-05-15 04:55:06 -04:00
Daniel Sogl
bd1794d7f5 github(template): issue template (#1559)
* github(tempalte): issue template

* Update ISSUE_TEMPLATE.md
2017-05-15 03:23:54 -04:00
Daniel Sogl
46502cb864 docs(ionic-site): CLI V3 command (#1556) 2017-05-14 05:30:34 -04:00
Ibby Hadeed
02cc615c21 ci-tests fixes 2017-05-14 03:26:11 -04:00
Ibby Hadeed
749fd8af43 tests(): add basic tests (#1555) 2017-05-14 03:25:33 -04:00
Ibby Hadeed
e2acde5332 chore(): test plugin changes when PR is submitted (#1554)
* ci tests

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update
2017-05-14 03:19:48 -04:00
Ibby Hadeed
5203d026d4 Merge branch 'master' of github.com:driftyco/ionic-native 2017-05-14 02:09:11 -04:00
Ibby Hadeed
362ae4422b docs(sqlite): fix doc generation issue 2017-05-14 02:09:07 -04:00
Nicolas Molina Monroy
965a90c52c feat(mix-panel): add timeEvent (#1536)
* feat(mix-panel): add timeEvent

* style(mixpanel): remove params
2017-05-14 00:58:22 -04:00
Ibby Hadeed
a28de660bc refactor(): no implicit any 2017-05-14 00:55:16 -04:00
Ibby Hadeed
fec19b734c fix(sqlite): fix implementation and improve typings 2017-05-14 00:52:30 -04:00
Ibby Hadeed
6773ed341c chore(): add --ignore-errors flag 2017-05-14 00:20:38 -04:00
Ibby Hadeed
23ad074d04 chore(): update changelog 2017-05-13 23:12:36 -04:00
Ibby Hadeed
912668d8f8 3.8.0 2017-05-13 23:12:29 -04:00
Ibby Hadeed
cf531af244 Merge branch 'master' of github.com:driftyco/ionic-native 2017-05-13 23:12:20 -04:00
Ibby Hadeed
a94651dc75 chore(): update templates 2017-05-13 22:53:04 -04:00
Alexandru Albu
ad0680bd90 docs(google-map): update install command (#1525)
command for adding plugin has changed
2017-05-13 22:47:01 -04:00
IonicOnCouch
66a82dd5ce docs(): maximumImagesCount works only for Android. (#1540)
The option "maximumImagesCount" works only for Android. So there should be a comment.
2017-05-13 22:46:41 -04:00
jasonmamy
8ea8ac40e5 refactor(wheel-selector): fixed the interfaces and default values (#1544) 2017-05-13 22:46:19 -04:00
Daniel Sogl
2d477ba9a0 docs(readme): https + removed V2 tag (#1551) 2017-05-13 22:46:09 -04:00
Ibby Hadeed
f98f90a9a3 fix(file): various fixes (#1553)
* save schanges

* save changes

* save changes

* save changes
2017-05-13 22:44:10 -04:00
wleberre
fba0ce2bb6 docs(): fix typo (#1548) 2017-05-13 21:28:22 -04:00
Daniel Sogl
22d0260cde chore(package): bump angular and typescript (#1549) 2017-05-13 20:19:45 -04:00
Daniel Sogl
25aeb406ae core(package): update tslint-ionic-rules (#1539) 2017-05-12 05:03:52 -04:00
Daniel Sogl
385da017a0 feat(video-capture-plus): add Video Capture Plus plugin (#1538)
* feat(plugin): Video Capture Plus

fix #709

* Updated interfaces
2017-05-12 05:03:24 -04:00
Raman Rasliuk
efae1be116 fix(file): fix file reader (#1537)
Pass reader object on call function.
Fixes #1530
2017-05-12 04:18:38 -04:00
Eamon Bauman
7f919d5c90 docs(): fix options for prepareInterstitial (#1535)
Using the example in the previous version of this document, calling prepareInterstitial(adId) resulted in an
"-[__NSCFString count]: unrecognized selector sent to instance"
exception. This was alleviated by changing the call to prepareInterstitial({adId: adId}) 
(e.g. passing in an options object vs. just the adid string)
2017-05-12 04:16:48 -04:00
ChristopherTotty
00c156811f docs(geolocation): fix reference (#1533) 2017-05-12 04:16:14 -04:00
Jan Piotrowski
8512dd5d92 docs(header-color): improve description (#1532) 2017-05-12 04:16:01 -04:00
Niccolò Belli
ad514bbf63 fix(fcm): fix method name (#1531) 2017-05-12 04:15:35 -04:00
Dave Alden
45108c4c18 fix(diagnostic): fix Cordova decorator in camera API (#1527) 2017-05-12 03:53:56 -04:00
Diogo Trentini
17e166d04d docs(camera-preview): fix interface name (#1526) 2017-05-12 03:50:27 -04:00
Jan Piotrowski
dea9f42d5f Changed ionic pluginto ionic cordova plugin 2017-05-11 17:53:15 +02:00
Jan Piotrowski
e193baf1c1 Removed inline style block (as it was added to the main site css) 2017-05-11 11:33:19 +02:00
Ibby Hadeed
10d61c21c2 fix(app-minimize): fix pluginRef 2017-05-11 04:48:25 -04:00
Ibby Hadeed
7e322aadb8 docs(firebase): mark plugin as beta 2017-05-09 23:50:23 -04:00
Jan Piotrowski
4835182ad5 Replace inline styles with style block 2017-05-05 13:38:58 +02:00
Jan Piotrowski
49ac21145a Add link to "Add this plugin to your app's module" and make Installation into ordered list 2017-05-05 13:31:16 +02:00
Jan Piotrowski
8a81ee08e3 Switch placement of Description and Installation 2017-05-05 13:06:31 +02:00
Jan Piotrowski
36d101af02 remove stray "f" 2017-04-29 16:47:23 +02:00
Jan Piotrowski
8e65474c1d Add headline to install commands 2017-04-29 16:45:34 +02:00
119 changed files with 8419 additions and 1343 deletions

View File

@@ -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
View File

@@ -0,0 +1,28 @@
**I'm submitting a ...** (check one with "x")
[ ] bug report
[ ] feature request
<!-- Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://ionicworldwide.herokuapp.com/ -->
**Current behavior:**
<!-- Describe how the bug manifests. -->
**Expected behavior:**
<!-- Describe what the behavior would be without the bug. -->
**Steps to reproduce:**
<!-- If you are able to illustrate the bug or feature request with an example, please provide steps to reproduce. -->
**Related code:**
```
insert any relevant code here
```
**Other information:**
<!-- List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to fix, Stack Overflow links, forum links, etc. -->
**package.json info:**
```json
insert the content here
```

File diff suppressed because it is too large Load Diff

View File

@@ -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.

View File

@@ -1,9 +1,9 @@
[![Circle CI](https://circleci.com/gh/driftyco/ionic-native.svg?style=shield)](https://circleci.com/gh/driftyco/ionic-native) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) ![](https://img.shields.io/npm/v/@ionic-native/core.svg)
[![Circle CI](https://circleci.com/gh/ionic-team/ionic-native.svg?style=shield)](https://circleci.com/gh/ionic-team/ionic-native) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) ![](https://img.shields.io/npm/v/@ionic-native/core.svg)
# 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
@@ -165,24 +165,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.
![img](http://ionic-io-assets.s3.amazonaws.com/ionic-native-console.png)
![img](https://ionic-io-assets.s3.amazonaws.com/ionic-native-console.png)
## 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
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/Angular 1 support, please use version 2 of Ionic Native. See the [2.x README](https://github.com/ionic-team/ionic-native/blob/8cd648db5cddd7bdbe2bd78839b19c620cc8c04c/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)

View File

@@ -7,12 +7,15 @@ jobs:
steps:
- checkout
- restore_cache:
key: ionic-site
key: ionic-site-{{ .Branch }}
- run:
name: Prepare ionic-site repo
command: ./scripts/docs/prepare.sh
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
./scripts/docs/prepare.sh
fi
- save_cache:
key: ionic-site
key: ionic-site-{{ .Branch }}
paths:
- ~/ionic-site/
- restore_cache:
@@ -27,6 +30,13 @@ jobs:
- run:
name: Run tslint
command: npm run lint
- run: bash ./scripts/git/config.sh
- run:
name: Build changed plugins
command: node scripts/ci-tests.js
- run:
name: Run tests
command: npm test
- add_ssh_keys
- deploy:
name: Update docs

View File

@@ -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
View 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);
};

5567
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,17 +1,22 @@
{
"name": "ionic-native",
"version": "3.7.0",
"version": "3.11.0",
"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.1.3",
"@angular/compiler-cli": "4.1.3",
"@angular/core": "4.1.3",
"@types/cordova": "0.0.34",
"@types/jasmine": "^2.5.47",
"@types/node": "^7.0.18",
"canonical-path": "0.0.2",
"child-process-promise": "2.2.0",
"conventional-changelog-cli": "1.2.0",
"child-process-promise": "2.2.1",
"conventional-changelog-cli": "1.3.1",
"cpr": "2.0.2",
"cz-conventional-changelog": "1.2.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",
"rimraf": "2.6.1",
"rxjs": "5.1.1",
"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.3.3",
"zone.js": "^0.8.11"
},
"scripts": {
"start": "npm run test:watch",
@@ -44,7 +56,16 @@
"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"
},
"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": {

View File

@@ -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!');
}

View File

@@ -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"
}
}

View File

@@ -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"
}
}

View File

@@ -13,7 +13,8 @@
"skipLibCheck": true,
"lib": ["es2015", "dom"],
"sourceMap": true,
"inlineSources": true
"inlineSources": true,
"noImplicitAny": true
},
"files": [
"../../src/@ionic-native/core/index.ts"

View File

@@ -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
View 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);
});

View File

@@ -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) -@>
@@ -149,7 +149,7 @@ docType: "<$ doc.docType $>"
<@- 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>
@@ -164,18 +164,25 @@ docType: "<$ doc.docType $>"
</p>
<@ endif @>
<# --- 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>
<# --- Plugin description --- #>
<$ doc.description | marked $>
<p>Repo:
<a href="<$ prop.repo $>">
<$ prop.repo $>
</a>
</p>
<# --- Plugin description --- #>
<$ doc.description | marked $>
<# --- Install commands --- #>
<h2>Installation</h2>
<ol class="installation">
<li>Install the Cordova and Ionic Native plugins:<br>
<pre><code class="nohighlight">$ <@ if prop.install @><$ prop.install $><@ else @>ionic cordova plugin add <$ prop.plugin $><@ endif @>
$ npm install --save @ionic-native/<$ doc.npmId $>
</code></pre>
</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 @>

View File

@@ -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 $>
```

View File

@@ -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

View File

@@ -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

View File

@@ -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
View File

@@ -0,0 +1,2 @@
git config --global user.email "hi@ionicframework.com"
git config --global user.name "Ionitron"

View File

@@ -2,15 +2,15 @@ import { Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
/**
* @name $Plugin_Name
* @name {{ Plugin_Name }}
* @description
*
* @usage
* ```
* import { $PluginName } from 'ionic-native';
* ```typescript
* import { {{ PluginName }} } from '@ionic-native/{{ plugin-name }}';
*
*
* constructor(private $pluginName: $PluginName) { }
* constructor(private {{ pluginName }}: {{ PluginName }}) { }
*
* ...
*
@@ -18,13 +18,13 @@ import { Injectable } from '@angular/core';
* ```
*/
@Plugin({
pluginName: '$PluginName',
pluginName: '{{ PluginName }}',
plugin: '',
pluginRef: '',
repo: '',
platforms: []
})
@Injectable()
export class $PluginName extends IonicNativePlugin {
export class {{ PluginName }} extends IonicNativePlugin {
}

View File

@@ -15,28 +15,28 @@ 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
@@ -44,7 +44,7 @@ import { Observable } from 'rxjs/Observable';
install: '', // OPTIONAL install command, in case the plugin requires variables
})
@Injectable()
export class $PluginName extends IonicNativePlugin {
export class {{ PluginName }} extends IonicNativePlugin {
/**
* This function does something

View File

@@ -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);

View File

@@ -0,0 +1,239 @@
import 'core-js';
import { Plugin, Cordova, CordovaProperty, CordovaCheck, CordovaInstance, InstanceProperty } from './decorators';
import { IonicNativePlugin } from './ionic-native-plugin';
import { ERR_CORDOVA_NOT_AVAILABLE, ERR_PLUGIN_NOT_INSTALLED } from './plugin';
declare const window: any;
class TestObject {
constructor(public _objectInstance: any) {}
@InstanceProperty
name: string;
@CordovaInstance({ sync: true })
pingSync(): string { return; }
@CordovaInstance()
ping(): Promise<any> { return; }
}
@Plugin({
pluginName: 'TestPlugin',
pluginRef: 'testPlugin',
repo: '',
plugin: 'cordova-plugin-my-plugin',
platforms: ['Android', 'iOS']
})
class TestPlugin extends IonicNativePlugin {
@CordovaProperty
name: string;
@Cordova({ sync: true })
pingSync(): string { return; }
@Cordova()
ping(): Promise<string> { return; }
@CordovaCheck()
customPing(): Promise<string> {
return Promise.resolve('pong');
}
create(): TestObject {
return new TestObject(TestPlugin.getPlugin().create());
}
}
function definePlugin() {
(window as any).testPlugin = {
name: 'John Smith',
ping: (success: Function, error: Function) => success('pong'),
pingSync: () => 'pong',
create: function TestObject() {
this.pingSync = () => 'pong';
this.ping = (success: Function, error: Function) => success('pong');
this.name = 'John Smith';
return this;
}
};
}
describe('Regular Decorators', () => {
let plugin: TestPlugin;
beforeEach(() => {
plugin = new TestPlugin();
definePlugin();
});
describe('Plugin', () => {
it('should set pluginName', () => {
expect(TestPlugin.getPluginName()).toEqual('TestPlugin');
});
it('should set pluginRef', () => {
expect(TestPlugin.getPluginRef()).toEqual('testPlugin');
});
it('should return original plugin object', () => {
expect(TestPlugin.getPlugin()).toEqual(window.testPlugin);
});
it('should return supported platforms', () => {
expect(TestPlugin.getSupportedPlatforms()).toEqual(['Android', 'iOS']);
});
});
describe('Cordova', () => {
it('should do a sync function', () => {
expect(plugin.pingSync()).toEqual('pong');
});
it('should do an async function', (done: Function) => {
plugin.ping()
.then(res => {
expect(res).toEqual('pong');
done();
})
.catch(e => {
expect(e).toBeUndefined();
done('Method should have resolved');
});
});
it('should throw plugin_not_installed error', (done: Function) => {
delete window.testPlugin;
window.cordova = true;
expect(<any>plugin.pingSync()).toEqual(ERR_PLUGIN_NOT_INSTALLED);
plugin.ping()
.catch(e => {
expect(e).toEqual(ERR_PLUGIN_NOT_INSTALLED.error);
delete window.cordova;
done();
});
});
it('should throw cordova_not_available error', (done: Function) => {
delete window.testPlugin;
expect(<any>plugin.pingSync()).toEqual(ERR_CORDOVA_NOT_AVAILABLE);
plugin.ping()
.catch(e => {
expect(e).toEqual(ERR_CORDOVA_NOT_AVAILABLE.error);
done();
});
});
});
describe('CordovaProperty', () => {
it('should return property value', () => {
expect(plugin.name).toEqual('John Smith');
});
it('should set property value', () => {
plugin.name = 'value2';
expect(plugin.name).toEqual('value2');
});
});
describe('CordovaCheck', () => {
it('should run the method when plugin exists', (done) => {
plugin.customPing()
.then(res => {
expect(res).toEqual('pong');
done();
});
});
it('shouldnt run the method when plugin doesnt exist', (done) => {
delete window.testPlugin;
window.cordova = true;
plugin.customPing()
.catch(e => {
expect(e).toEqual(ERR_PLUGIN_NOT_INSTALLED.error);
done();
});
});
});
});
describe('Instance Decorators', () => {
let instance: TestObject,
plugin: TestPlugin;
beforeEach(() => {
definePlugin();
plugin = new TestPlugin();
instance = plugin.create();
});
describe('Instance plugin', () => {
});
describe('CordovaInstance', () => {
it('should call instance async method', (done) => {
instance.ping()
.then(r => {
expect(r).toEqual('pong');
done();
});
});
it('should call instance sync method', () => {
expect(instance.pingSync()).toEqual('pong');
});
it('shouldnt call instance method when _objectInstance is undefined', () => {
delete instance._objectInstance;
instance.ping()
.then(r => {
expect(r).toBeUndefined();
})
.catch(e => {
expect(e).toBeUndefined();
});
});
});
describe('InstanceProperty', () => {
it('should return property value', () => {
expect(instance.name).toEqual('John Smith');
});
it('should set property value', () => {
instance.name = 'John Cena';
expect(instance.name).toEqual('John Cena');
});
});
});

View File

@@ -32,6 +32,8 @@ export interface PluginConfig {
* Supported platforms
*/
platforms?: string[];
[key: string]: any;
}
export interface CordovaOptions {
@@ -133,7 +135,8 @@ export function InstanceCheck(opts: CordovaCheckOptions = {}) {
return getPromise(() => { });
}
}
},
enumerable: true
};
};
}
@@ -157,7 +160,8 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) {
}
return Promise.reject(check && check.error);
}
}
},
enumerable: true
};
};
}
@@ -182,12 +186,12 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) {
* }
* ```
*/
export function Plugin(config: PluginConfig) {
return function(cls) {
export function Plugin(config: PluginConfig): ClassDecorator {
return function(cls: any) {
// Add these fields to the class
for (let k in config) {
cls[k] = config[k];
for (let prop in config) {
cls[prop] = config[prop];
}
cls['installed'] = function(printWarning?: boolean) {
@@ -237,7 +241,8 @@ export function Cordova(opts: CordovaOptions = {}) {
return {
value: function(...args: any[]) {
return wrap(this, methodName, opts).apply(this, args);
}
},
enumerable: true
};
};
}
@@ -252,7 +257,8 @@ export function CordovaInstance(opts: any = {}) {
return {
value: function(...args: any[]) {
return wrapInstance(this, methodName, opts).apply(this, args);
}
},
enumerable: true
};
};
}
@@ -310,7 +316,8 @@ export function CordovaFunctionOverride(opts: any = {}) {
return {
value: function(...args: any[]) {
return overrideFunction(this, methodName, opts);
}
},
enumerable: true
};
};
}
@@ -346,7 +353,8 @@ export function CordovaFiniteObservable(opts: CordovaFiniteObservableOptions = {
wrappedSubscription.unsubscribe();
};
});
}
},
enumerable: true
};
};
}

View File

@@ -38,4 +38,9 @@ export class IonicNativePlugin {
*/
static getPluginInstallName(): string { return; }
/**
* Returns the plugin's supported platforms
*/
static getSupportedPlatforms(): string[] { return; }
}

View File

@@ -1,4 +1,4 @@
import { get, getPlugin, getPromise, cordovaWarn, pluginWarn } from './util';
import { getPlugin, getPromise, cordovaWarn, pluginWarn } from './util';
import { checkReady } from './bootstrap';
import { CordovaOptions } from './decorators';
@@ -7,8 +7,11 @@ import 'rxjs/add/observable/fromEvent';
checkReady();
declare var window;
declare var Promise;
// declare const window;
// declare var Promise;
export const ERR_CORDOVA_NOT_AVAILABLE = { error: 'cordova_not_available' };
export const ERR_PLUGIN_NOT_INSTALLED = { error: 'plugin_not_installed' };
/**
@@ -16,8 +19,8 @@ declare var Promise;
* @return {boolean | { error: string } }
* @private
*/
export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string);
export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: string);
export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string): boolean | { error: string };
export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: string): boolean | { error: string };
export function checkAvailability(plugin: any, methodName?: string, pluginName?: string): boolean | { error: string } {
let pluginRef, pluginInstance, pluginPackage;
@@ -35,15 +38,11 @@ export function checkAvailability(plugin: any, methodName?: string, pluginName?:
if (!pluginInstance || (!!methodName && typeof pluginInstance[methodName] === 'undefined')) {
if (!window.cordova) {
cordovaWarn(pluginName, methodName);
return {
error: 'cordova_not_available'
};
return ERR_CORDOVA_NOT_AVAILABLE;
}
pluginWarn(pluginName, pluginPackage, methodName);
return {
error: 'plugin_not_installed'
};
return ERR_PLUGIN_NOT_INSTALLED;
}
return true;
@@ -69,7 +68,7 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func
args.unshift(reject);
args.unshift(resolve);
} else if (opts.callbackStyle === 'node') {
args.push((err, result) => {
args.push((err: any, result: any) => {
if (err) {
reject(err);
} else {
@@ -135,8 +134,8 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
}
function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
let pluginResult, rej;
const p = getPromise((resolve, reject) => {
let pluginResult: any, rej: Function;
const p = getPromise((resolve: Function, reject: Function) => {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
rej = reject;
});
@@ -145,13 +144,13 @@ function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any
// to error
if (pluginResult && pluginResult.error) {
p.catch(() => { });
rej(pluginResult.error);
typeof rej === 'function' && rej(pluginResult.error);
}
return p;
}
function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
return getPromise((resolve, reject) => {
return getPromise((resolve: Function, reject: Function) => {
const pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
if (pluginResult) {
if (pluginResult.error) {
@@ -178,11 +177,11 @@ function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: a
if (opts.clearWithArgs) {
return callCordovaPlugin(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
}
return get(window, pluginObj.constructor.getPluginRef())[opts.clearFunction].call(pluginObj, pluginResult);
return callCordovaPlugin(pluginObj, opts.clearFunction, []);
}
} catch (e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
console.error(e);
console.warn(e);
}
};
});
@@ -239,7 +238,7 @@ export function overrideFunction(pluginObj: any, methodName: string, args: any[]
* @private
*/
export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOptions = {}) {
return (...args) => {
return (...args: any[]) => {
if (opts.sync) {
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
return callCordovaPlugin(pluginObj, methodName, args, opts);
@@ -259,7 +258,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOp
* @private
*/
export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) {
return (...args) => {
return (...args: any[]) => {
if (opts.sync) {
return callInstance(pluginObj, methodName, args, opts);
@@ -277,37 +276,30 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
return () => {
try {
if (opts.clearWithArgs) {
return pluginObj._objectInstance[opts.clearFunction].apply(pluginObj._objectInstance, args);
return callInstance(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
}
return pluginObj._objectInstance[opts.clearFunction].call(pluginObj, pluginResult);
return callInstance(pluginObj, opts.clearFunction, []);
} catch (e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
console.error(e);
console.warn(e);
}
};
});
} else if (opts.otherPromise) {
return getPromise((resolve, reject) => {
return getPromise((resolve: Function, reject: Function) => {
let result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
if (result && !result.error) {
if (result && !!result.then) {
result.then(resolve, reject);
} else {
reject();
}
});
} else {
let pluginResult, rej;
const p = getPromise((resolve, reject) => {
pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject);
rej = reject;
});
if (pluginResult && pluginResult.error) {
p.catch(() => { });
rej(pluginResult.error);
}
return p;
return getPromise((resolve: Function, reject: Function) => callInstance(pluginObj, methodName, args, opts, resolve, reject));
}
};

View File

@@ -1,27 +1,28 @@
declare var window: any;
declare const window: any;
/**
* @private
*/
export function get(obj, path) {
path = path.split('.');
for (let i = 0; i < path.length; i++) {
export const get = (element: Element | Window, path: string): any => {
const paths: string[] = path.split('.');
let obj: any = element;
for (let i: number = 0; i < paths.length; i++) {
if (!obj) { return null; }
obj = obj[path[i]];
obj = obj[paths[i]];
}
return obj;
}
};
/**
* @private
*/
export function getPromise(cb) {
export const getPromise = (callback: Function): Promise<any> => {
const tryNativePromise = () => {
if (window.Promise) {
return new Promise((resolve, reject) => {
cb(resolve, reject);
callback(resolve, reject);
});
} else {
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 2 or on a recent browser.');
@@ -29,28 +30,28 @@ export function getPromise(cb) {
};
return tryNativePromise();
}
};
/**
* @private
* @param pluginRef
* @returns {null|*}
*/
export function getPlugin(pluginRef: string): any {
export const getPlugin = (pluginRef: string): any => {
return get(window, pluginRef);
};
/**
* @private
*/
export const pluginWarn = function(pluginName: string, plugin?: string, method?: string) {
export const pluginWarn = (pluginName: string, plugin?: string, method?: string): void => {
if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
} else {
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 {

View File

@@ -51,7 +51,7 @@ export interface ActionSheetOptions {
/**
* Choose if destructive button will be the last
*/
destructiveButtonLast: boolean;
destructiveButtonLast?: boolean;
}
/**

View File

@@ -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; }
}

View File

@@ -93,6 +93,8 @@ export interface AdExtras {
* @name AdMob
* @description
* Plugin for Google Ads, including AdMob / DFP (doubleclick for publisher) and mediations to other Ad networks.
*
* IMPORTANT NOTICE: this plugin takes a percentage out of your earnings if you profit more than $1,000. Read more about this on the plugin's repo. For a completely free alternative, see [AdMob Free](../admob-free).
* @usage
* ```typescript
* import { AdMob } from '@ionic-native/admob';
@@ -107,12 +109,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(); });
* }
*

View File

@@ -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 https://github.com/xueron/cordova-alipay-base --variable APP_ID=your_app_id',
installVariables: ['APP_ID'],
platforms: ['Android', 'iOS']
})
@Injectable()
export class Alipay extends IonicNativePlugin {

View File

@@ -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.

View File

@@ -24,8 +24,8 @@ import { Injectable } from '@angular/core';
*/
@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']
})

View File

@@ -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

View File

@@ -1,9 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window;
export interface AppRatePreferences {
/**

View File

@@ -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()

View File

@@ -1,9 +1,6 @@
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
declare var window;
export interface BackgroundFetchConfig {
/**

View File

@@ -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 {
/**

View File

@@ -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`.

View File

@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
export interface BarcodeScannerOptions {
/**

View File

@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
/**
* @name Brightness
* @description

View File

@@ -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

View File

@@ -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.

View File

@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
declare var window: any,
declare const window: any,
navigator: any;
export type ContactFieldType = '*' | 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
@@ -49,6 +49,7 @@ export interface IContactProperties {
/** An array of web pages associated with the contact. */
urls?: IContactField[];
}
/**
@@ -71,6 +72,8 @@ export class Contact implements IContactProperties {
@InstanceProperty categories: IContactField[];
@InstanceProperty urls: IContactField[];
[key: string]: any;
constructor() {
if (checkAvailability('navigator.contacts', 'create', 'Contacts') === true) {
this._objectInstance = navigator.contacts.create();
@@ -92,8 +95,8 @@ export class Contact implements IContactProperties {
@InstanceCheck()
save(): Promise<any> {
return getPromise((resolve, reject) => {
this._objectInstance.save((contact) => {
return getPromise((resolve: Function, reject: Function) => {
this._objectInstance.save((contact: any) => {
this._objectInstance = contact;
resolve(this);
}, reject);
@@ -114,7 +117,7 @@ export interface IContactError {
/**
* @hidden
*/
export declare var ContactError: {
export declare const ContactError: {
new (code: number): IContactError;
UNKNOWN_ERROR: number;
INVALID_ARGUMENT_ERROR: number;
@@ -312,8 +315,8 @@ export class Contacts extends IonicNativePlugin {
*/
@CordovaCheck()
find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
return getPromise((resolve, reject) => {
navigator.contacts.find(fields, (contacts) => {
return getPromise((resolve: Function, reject: Function) => {
navigator.contacts.find(fields, (contacts: any[]) => {
resolve(contacts.map(processContact));
}, reject, options);
});
@@ -325,8 +328,8 @@ export class Contacts extends IonicNativePlugin {
*/
@CordovaCheck()
pickContact(): Promise<Contact> {
return getPromise((resolve, reject) => {
navigator.contacts.pickContact((contact) => resolve(processContact(contact)), reject);
return getPromise((resolve: Function, reject: Function) => {
navigator.contacts.pickContact((contact: any) => resolve(processContact(contact)), reject);
});
}
@@ -335,7 +338,7 @@ export class Contacts extends IonicNativePlugin {
/**
* @hidden
*/
function processContact(contact) {
function processContact(contact: any) {
let newContact = new Contact();
for (let prop in contact) {
if (typeof contact[prop] === 'function') continue;

View File

@@ -23,7 +23,7 @@ import { Injectable } from '@angular/core';
*/
@Plugin({
pluginName: 'CouchbaseLite',
plugin: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin',
plugin: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin.git',
pluginRef: 'cblite',
repo: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin',
platforms: ['Android', 'iOS']

View File

@@ -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 2 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: ['iOS', 'Android', 'Browser']
})
@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,7 +98,7 @@ export class Deeplinks extends IonicNativePlugin {
@Cordova({
observable: true
})
route(paths): Observable<DeeplinkMatch> { return; }
route(paths: any): Observable<DeeplinkMatch> { return; }
/**
*
@@ -110,17 +110,19 @@ export class Deeplinks extends IonicNativePlugin {
* This handler will automatically navigate when a route matches. If you need finer-grained
* control over the behavior of a matching deeplink, use the plain `route` method.
*
* @param {paths} Define a set of paths to match against incoming deeplinks.
* @param {Nav} navController Define a set of paths to match against incoming deeplinks.
* paths takes an object of the form { 'path': data }. If a deeplink
* matches the path, the resulting path-data pair will be returned in the
* promise result which you can then use to navigate in the app as you see fit.
*
* @param {Object} paths
*
* @returns {Observable<DeeplinkMatch>} Returns an Observable that resolves each time a deeplink comes through, and
* errors if a deeplink comes through that does not match a given path.
*/
@Cordova({
observable: true
})
routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
routeWithNavController(navController: any, paths: any): Observable<DeeplinkMatch> { return; }
}

View File

@@ -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 {

View File

@@ -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; }
/**

View File

@@ -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', 'Windows Phone 7', 'Windows Phone 8', 'Windows']
})
@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.

View File

@@ -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 { }
}

View File

@@ -1,7 +1,11 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
declare var cordova: any;
interface Cordova {
plugins: CordovaPlugins & { email: any };
}
declare const cordova: Cordova;
export interface EmailComposerOptions {
@@ -88,7 +92,7 @@ export class EmailComposer extends IonicNativePlugin {
isAvailable(app?: string): Promise<any> {
return new Promise<boolean>((resolve, reject) => {
if (app) {
cordova.plugins.email.isAvailable(app, (isAvailable) => {
cordova.plugins.email.isAvailable(app, (isAvailable: boolean) => {
if (isAvailable) {
resolve();
} else {
@@ -96,7 +100,7 @@ export class EmailComposer extends IonicNativePlugin {
}
});
} else {
cordova.plugins.email.isAvailable((isAvailable) => {
cordova.plugins.email.isAvailable((isAvailable: boolean) => {
if (isAvailable) {
resolve();
} else {

View File

@@ -43,7 +43,7 @@ export interface FacebookLoginResponse {
* Then type in the following command in your Terminal, where APP_ID and APP_NAME are the values from the Facebook Developer portal.
*
* ```bash
* ionic plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"
* ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"
* ```
*
* After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings:
@@ -114,7 +114,7 @@ export interface FacebookLoginResponse {
plugin: 'cordova-plugin-facebook4',
pluginRef: 'facebookConnectPlugin',
repo: 'https://github.com/jeduan/cordova-plugin-facebook4',
install: 'ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"',
install: 'ionic cordova plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"',
installVariables: ['APP_ID', 'APP_NAME'],
platforms: ['Android', 'iOS']
})

View File

@@ -25,7 +25,7 @@ export interface NotificationData {
*
* @usage
* ```typescript
* import { FCM } from 'ionic-native';
* import { FCM } from '@ionic-native/fcm';
*
* constructor(private fcm: FCM) {}
*
@@ -38,7 +38,7 @@ export interface NotificationData {
* })
*
* fcm.onNotification().subscribe(data=>{
* if(data.wasPressed){
* if(data.wasTapped){
* console.log("Received in background");
* } else {
* console.log("Received in foreground");
@@ -49,7 +49,7 @@ export interface NotificationData {
* backend.registerToken(token);
* })
*
* fcm.unsubscribeToTopic('marketing');
* fcm.unsubscribeFromTopic('marketing');
*
* ```
* @interfaces
@@ -101,7 +101,7 @@ export class FCM extends IonicNativePlugin {
* @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

View File

@@ -23,7 +23,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
*/
@Plugin({
pluginName: 'FileChooser',
plugin: 'http://github.com/don/cordova-filechooser.git',
plugin: 'https://github.com/don/cordova-filechooser.git',
pluginRef: 'fileChooser',
repo: 'https://github.com/don/cordova-filechooser',
platforms: ['Android']

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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).

View File

@@ -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()

View File

@@ -72,6 +72,9 @@ export interface FlurryAnalyticsLocation {
horizontalAccuracy?: number;
}
/**
* @hidden
*/
export class FlurryAnalyticsObject {
constructor(private _objectInstance: any) { }
@@ -208,7 +211,7 @@ export class FlurryAnalyticsObject {
pluginName: 'FlurryAnalytics',
plugin: 'cordova-plugin-flurryanalytics',
pluginRef: 'FlurryAnalytics',
repo: 'https://github.com/blakgeek/cordova-plugin-flurryanalytics.git',
repo: 'https://github.com/blakgeek/cordova-plugin-flurryanalytics',
platforms: ['Android', 'iOS', 'Browser']
})
@Injectable()
@@ -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);

View 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; }
}

View File

@@ -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
@@ -79,7 +79,7 @@ declare var window: any;
pluginName: 'Geofence',
plugin: 'cordova-plugin-geofence',
pluginRef: 'geofence',
repo: 'https://github.com/cowbell/cordova-plugin-geofence/',
repo: 'https://github.com/cowbell/cordova-plugin-geofence',
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows Phone']
})
@Injectable()

View File

@@ -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,7 @@ 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']
platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Firefox OS', 'iOS', 'Tizen', 'Windows', 'Windows Phone']
})
@Injectable()
export class Geolocation extends IonicNativePlugin {
@@ -174,7 +174,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);

View File

@@ -1,8 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window;
/**
* @name Google Analytics
* @description

View File

@@ -3,7 +3,7 @@ import { Cordova, CordovaInstance, CordovaCheck, Plugin, InstanceProperty, Insta
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
declare var plugin: any;
declare const plugin: any;
/**
* @hidden
@@ -455,7 +455,7 @@ export class GoogleMap {
pluginRef: 'plugin.google.maps.Map',
plugin: 'cordova-plugin-googlemaps',
repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps',
install: 'ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"',
install: 'ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"',
installVariables: ['API_KEY_FOR_ANDROID', 'API_KEY_FOR_IOS'],
platforms: ['Android', 'iOS']
})
@@ -853,14 +853,14 @@ export class Marker {
/**
* Set the marker position.
* @param latLng {GoogleMapLatLng}
* @param latLng {LatLng}
*/
@CordovaInstance({ sync: true })
setPosition(latLng: LatLng): void { return; }
/**
* Return the marker position.
* @return {Promise<GoogleMapLatLng>}
* @return {Promise<LatLng>}
*/
@CordovaInstance()
getPosition(): Promise<LatLng> { return; }
@@ -1473,7 +1473,7 @@ export class GroundOverlay {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
(resolve: Function) => this._objectInstance.addListenerOnce(eventName, resolve)
);
}
@@ -1766,7 +1766,7 @@ export class Geocoder {
*/
@CordovaCheck()
geocode(request: GeocoderRequest): Promise<GeocoderResult[] | any> {
return new Promise<GeocoderResult[]>(resolve => {
return new Promise<GeocoderResult[]>((resolve: Function) => {
plugin.google.maps.Geocoder.geocode(request, resolve);
});
}

View File

@@ -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', 'Browser']
})
@Injectable()
export class GooglePlus extends IonicNativePlugin {

View File

@@ -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

View File

@@ -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

View File

@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var cordova: any;
declare const cordova: any;
export interface Beacon {
/**

View File

@@ -4,7 +4,7 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
export interface ImagePickerOptions {
/**
* max images to be selected, defaults to 15. If this is set to 1, upon selection of a single image, the plugin will return it.
* max images to be selected, defaults to 15. If this is set to 1, upon selection of a single image, the plugin will return it. (Android only)
*/
maximumImagesCount?: number;
@@ -57,9 +57,11 @@ export interface ImagePickerOptions {
*/
@Plugin({
pluginName: 'ImagePicker',
plugin: 'https://github.com/Telerik-Verified-Plugins/ImagePicker',
plugin: 'https://github.com/Telerik-Verified-Plugins/ImagePicker.git',
pluginRef: 'window.imagePicker',
repo: 'https://github.com/Telerik-Verified-Plugins/ImagePicker',
install: 'ionic cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker.git --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="your usage message"',
installVariables: ['PHOTO_LIBRARY_USAGE_DESCRIPTION'],
platforms: ['Android', 'iOS']
})
@Injectable()

View File

@@ -1,9 +1,9 @@
import { Injectable } from '@angular/core';
import { Plugin, CordovaInstance, IonicNativePlugin } from '@ionic-native/core';
import { Plugin, CordovaInstance, InstanceCheck, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
import { Observer } from 'rxjs/Observer';
declare var cordova: any;
declare const cordova: Cordova & { InAppBrowser: any; };
export interface InAppBrowserOptions {
/** Set to yes or no to turn the InAppBrowser's location bar on or off. */
@@ -48,6 +48,11 @@ export interface InAppBrowserOptions {
/** (Windows only) Set to yes to create the browser control without a border around it.
* Please note that if location=no is also specified, there will be no control presented to user to close IAB window. */
fullscreen?: 'yes';
/**
* @hidden
*/
[key: string]: any;
}
export interface InAppBrowserEvent extends Event {
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
@@ -80,12 +85,18 @@ export class InAppBrowserObject {
*/
constructor(url: string, target?: string, options?: string | InAppBrowserOptions) {
try {
if (options && typeof options !== 'string')
options = Object.keys(options).map(key => `${key}=${options[key]}`).join(',');
if (options && typeof options !== 'string') {
options = Object.keys(options).map((key: string) => `${key}=${(<InAppBrowserOptions>options)[key]}`).join(',');
}
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
} catch (e) {
window.open(url);
window.open(url, target);
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.');
}
}
@@ -130,8 +141,12 @@ export class InAppBrowserObject {
* @param event {string} Name of the event
* @returns {Observable<InAppBrowserEvent>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
*/
@InstanceCheck()
on(event: string): Observable<InAppBrowserEvent> {
return Observable.fromEvent(this._objectInstance, event);
return new Observable<InAppBrowserEvent>((observer: Observer<InAppBrowserEvent>) => {
this._objectInstance.addEventListener(event, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
});
}
}
@@ -166,7 +181,7 @@ export class InAppBrowserObject {
plugin: 'cordova-plugin-inappbrowser',
pluginRef: 'cordova.InAppBrowser',
repo: 'https://github.com/apache/cordova-plugin-inappbrowser',
platforms: ['Amazon', 'Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'OS X', 'Ubuntu', 'Windows', 'Windows Phone']
platforms: ['Amazon', 'Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'macOS', 'Ubuntu', 'Windows', 'Windows Phone']
})
@Injectable()
export class InAppBrowser extends IonicNativePlugin {

View File

@@ -1,7 +1,7 @@
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
declare var window: any;
declare const window: any;
export interface IntelSecurityDataOptions {
/** Non-empty string. **/

View File

@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Plugin, Cordova, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var cordova: any;
declare const cordova: any;
/**
* @name Jins Meme

View File

@@ -24,7 +24,7 @@ import { Observable } from 'rxjs/Observable';
pluginName: 'Keyboard',
plugin: 'ionic-plugin-keyboard',
pluginRef: 'cordova.plugins.Keyboard',
repo: 'https://github.com/driftyco/ionic-plugin-keyboard',
repo: 'https://github.com/ionic-team/ionic-plugin-keyboard',
platforms: ['Android', 'BlackBerry 10', 'iOS', 'Windows']
})
@Injectable()

View File

@@ -7,7 +7,7 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
* @description
* Get and set data in the iOS Keychain
*
* Requires Cordova plugin: `cordova-plugin-ios-keychain`. For more info, please see the [Keychain plugin docs](https://github.com/driftyco/cordova-plugin-ios-keychain).
* Requires Cordova plugin: `cordova-plugin-ios-keychain`. For more info, please see the [Keychain plugin docs](https://github.com/ionic-team/cordova-plugin-ios-keychain).
*
* @usage
* ```typescript
@@ -29,7 +29,7 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
pluginName: 'Keychain',
plugin: 'cordova-plugin-ios-keychain',
pluginRef: 'window.Keychain',
repo: 'https://github.com/driftyco/cordova-plugin-ios-keychain/',
repo: 'https://github.com/ionic-team/cordova-plugin-ios-keychain',
platforms: ['iOS']
})
@Injectable()

View File

@@ -52,8 +52,9 @@ export type LinkedInLoginScopes = 'r_basicprofile' | 'r_emailaddress' | 'rw_comp
pluginName: 'LinkedIn',
plugin: 'cordova-plugin-linkedin',
pluginRef: 'cordova.plugins.LinkedIn',
repo: 'https://github.com/zyramedia/cordova-plugin-linkedin',
install: 'ionic plugin add cordova-plugin-linkedin --variable APP_ID=YOUR_APP_ID',
repo: 'https://github.com/zyra/cordova-plugin-linkedin',
install: 'ionic cordova plugin add cordova-plugin-linkedin --variable APP_ID=YOUR_APP_ID',
installVariables: ['APP_ID'],
platforms: ['Android', 'iOS']
})
@Injectable()
@@ -100,10 +101,17 @@ export class LinkedIn extends IonicNativePlugin {
openProfile(memberId: string): Promise<any> { return; }
/**
* Checks if there is already an existing active session. This should be used to avoid unecessary login.
* Checks if there is already an existing active session. This should be used to avoid unnecessary login.
* @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates whether there is an active session
*/
@Cordova()
hasActiveSession(): Promise<boolean> { return; }
/**
* Checks if there is an active session and returns the access token if it exists.
* @return {Promise<any>} returns a promise that resolves with an object that contains an access token if there is an active session
*/
@Cordova()
getActiveSession(): Promise<any> { return; }
}

View File

@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var navigator: any;
declare const navigator: any;
export interface MediaFile {
/**
@@ -33,7 +33,7 @@ export interface MediaFile {
* @param {Function} successCallback
* @param {Function} errorCallback
*/
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any);
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any): void;
}
export interface MediaFileData {

View File

@@ -1,19 +1,14 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
declare var Media: any;
import { CordovaInstance, Plugin, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
declare const Media: any;
// TODO for ionic native 4.x ... rename plugin class to Media and use Media.getPlugin() to retrieve the original media object
/**
* @hidden
*/
export class MediaObject {
/**
* Open a media file
* @param src {string} A URI containing the audio content.
* @param onStatusUpdate {Function} A callback function to be invoked when the status of the file changes
*/
constructor(private _objectInstance: any) {}
/**
@@ -34,17 +29,13 @@ export class MediaObject {
* Get the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1.
* @returns {number} Returns a promise with the duration of the current recording
*/
@CordovaInstance({
sync: true
})
@CordovaInstance({ sync: true })
getDuration(): number { return; }
/**
* Starts or resumes playing an audio file.
*/
@CordovaInstance({
sync: true
})
@CordovaInstance({ sync: true })
play(iosOptions?: {
numberOfLoops?: number,
playAudioWhenScreenIsLocked?: boolean
@@ -53,75 +44,57 @@ export class MediaObject {
/**
* Pauses playing an audio file.
*/
@CordovaInstance({
sync: true
})
@CordovaInstance({ sync: true })
pause(): void { }
/**
* Releases the underlying operating system's audio resources. This is particularly important for Android, since there are a finite amount of OpenCore instances for media playback. Applications should call the release function for any Media resource that is no longer needed.
*/
@CordovaInstance({
sync: true
})
@CordovaInstance({ sync: true })
release(): void { }
/**
* Sets the current position within an audio file.
* @param {number} milliseconds The time position you want to set for the current audio file
*/
@CordovaInstance({
sync: true
})
@CordovaInstance({ sync: true })
seekTo(milliseconds: number): void { }
/**
* Set the volume for an audio file.
* @param volume {number} The volume to set for playback. The value must be within the range of 0.0 to 1.0.
*/
@CordovaInstance({
sync: true
})
@CordovaInstance({ sync: true })
setVolume(volume: number): void { }
/**
* Starts recording an audio file.
*/
@CordovaInstance({
sync: true
})
@CordovaInstance({ sync: true })
startRecord(): void { }
/**
* Stops recording
*/
@CordovaInstance({
sync: true
})
@CordovaInstance({ sync: true })
stopRecord(): void { }
/**
* Pauses recording
*/
@CordovaInstance({
sync: true
})
@CordovaInstance({ sync: true })
pauseRecord(): void { }
/**
* Resumes recording
*/
@CordovaInstance({
sync: true
})
@CordovaInstance({ sync: true })
resumeRecord(): void { }
/**
* Stops playing an audio file.
*/
@CordovaInstance({
sync: true
})
@CordovaInstance({ sync: true })
stop(): void { }
}
@@ -169,8 +142,8 @@ export type MediaErrorCallback = (error: MediaError) => void;
* window.setTimeout(() => file.stopRecord(), 10000);
* });
* ```
*
* You can find the reasons here: https://github.com/driftyco/ionic-native/issues/1452#issuecomment-299605906
*
* You can find the reasons here: https://github.com/ionic-team/ionic-native/issues/1452#issuecomment-299605906
*
* @usage
* ```typescript
@@ -292,15 +265,19 @@ export class MediaPlugin extends IonicNativePlugin {
* @param [onError] {MediaErrorCallback} A callback function is be invoked if an error occurs.
* @return {MediaObject}
*/
@CordovaCheck()
create(src: string,
onStatusUpdate?: MediaStatusUpdateCallback,
onSuccess?: Function,
onError?: MediaErrorCallback): MediaObject {
let instance: any;
if (checkAvailability(MediaPlugin.getPluginRef(), null, MediaPlugin.getPluginName()) === true) {
// Creates a new media object
const instance = new Media(src, onSuccess, onError, onStatusUpdate);
return new MediaObject(instance);
instance = new Media(src, onSuccess, onError, onStatusUpdate);
}
return new MediaObject(instance);
}

View File

@@ -86,6 +86,14 @@ export class Mixpanel extends IonicNativePlugin {
@Cordova()
reset(): Promise<any> { return; }
/**
*
* @param eventName {string}
* @returns {Promise<any>}
*/
@Cordova()
timeEvent(eventName: string): Promise<any> { return; }
/**
*
* @param eventName {string}

View File

@@ -33,7 +33,8 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
pluginName: 'NativeAudio',
plugin: 'cordova-plugin-nativeaudio',
pluginRef: 'plugins.NativeAudio',
repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio'
repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio',
platforms: ['Android', 'iOS']
})
@Injectable()
export class NativeAudio extends IonicNativePlugin {

View File

@@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
/**
* @beta
* @name Native Geocoder
* @description
* Cordova plugin for native forward and reverse geocoding

View File

@@ -0,0 +1,244 @@
import { Plugin, IonicNativePlugin, Cordova } from '@ionic-native/core';
import { Injectable } from '@angular/core';
export interface NativeKeyboardOptions {
/**
* A function invoked when the user submits his input. Receives the text as a single property. Make sure your page is UTF-8 encoded so Chinese and Emoji are rendered OK.
*/
onSubmit: Function;
/**
* A function invoked when the keyboard is about to pop up. Receives the height as a single property. (iOS only)
*/
onKeyboardWillShow: Function;
/**
* A function invoked when the keyboard popped up. Receives the height as a single property.
*/
onKeyboardDidShow: Function;
/**
* A function invoked when the keyboard is about to close. (iOS only)
*/
onKeyboardWillHide: Function;
/**
* A function invoked when the keyboard closed.
*/
onKeyboardDidHide: Function;
/**
* A function invoked when any key is pressed, sends the entire text as response.
*/
onTextChanged: Function;
/**
* Highly recommended to pass in if you want to replicate the behavior of the video's above (scroll down when the keyboard opens). Pass in the scrollable DOM element containing the messages.
*/
autoscrollElement: HTMLElement;
/**
* If `autoscrollElement` was set you can also make the list scroll down initially, when the messenger bar (without the keyboard popping up) is shown.
*/
scrollToBottomAfterMessengerShows: boolean;
/**
* Setting this to `true` is like the video's above: the keyboard doesn't close upon submit. Defaults to `false`.
*/
keepOpenAfterSubmit: boolean;
/**
* Makes the messenger bar slide in from the bottom. Defaults to `false`.
*/
animated: boolean;
/**
* Open the keyboard when showing the messenger. Defaults to `false`.
*/
showKeyboard: boolean;
/**
* The default text set in the messenger input bar.
*/
text: string;
/**
* The color of the typed text. Defaults to `#444444`.
*/
textColor: string;
/**
* Like a regular HTML input placeholder.
*/
placeholder: string;
/**
* The color of the placeholder text. Defaults to `#CCCCCC`.
*/
placeholderColor: string;
/**
* The background color of the messenger bar. Defaults to `#F6F6F6`.
*/
backgroundColor: string;
/**
* The background color of the textview. Looks nicest on Android if it's the same color as the `backgroundColor` property. Defaults to `#F6F6F6`.
*/
textViewBackgroundColor: string;
/**
* The border color of the textview. Defaults to `#666666`. (iOS only)
*/
textViewBorderColor: string;
/**
* Setting this > 0 will make a counter show up on iOS (and ignore superfluous input on Android, for now)
*/
maxChars: number;
/**
* Options are: `"none"`, `"split"`, `"countdown"`, `"countdownreversed"`. Note that if `maxChars` is set, `"none"` will still show a counter. Defaults to `"none"`. (iOS only)
*/
counterStyle: string;
/**
* Options are: "default", "decimalpad", "phonepad", "numberpad", "namephonepad", "number", "email", "twitter", "url", "alphabet", "search", "ascii". (iOS only)
*/
type: string;
/**
* Options are: "light", "dark". (iOS only)
*/
appearance: string;
/**
* Disables things like the Emoji keyboard and the Predicive text entry bar (iOS only)
*/
secure: boolean;
/**
*
*/
leftButton: NativeKeyboardLeftButton;
/**
*
*/
rightButton: NativeKeyboardButton;
}
export interface NativeKeyboardButton {
/**
* Either "text" (Android only currently), "fontawesome" or "ionicon".
*/
type: string;
/**
* Depends on the type. Examples: for "text" use "Send", for "fontawesome" use "fa-battery-quarter", for "ionicon" use "\uf48a" (go to http://ionicons.com, right-click and inspect the icon and use the value you find in :before). Note that some fonticons are not supported as the embedded fonts in the plugin may lag behind a little. So try one of the older icons first.
*/
value: string;
/**
* If type is "text" you can set this to either "normal", "bold" or "italic".
*/
textStyle: string;
/**
* A function invoked when the button is pressed. Use this button to prompt the user what he wants to do next by for instance rendering an ActionSheet.
*/
onPress: Function;
}
export interface NativeKeyboardLeftButton extends NativeKeyboardButton {
/**
* Set to `true` to disable the button once text has been entered.
*/
disabledWhenTextEntered: boolean;
}
export interface NativeKeyboardUpdateMessengerOptions {
/**
* Replace the messenger's text by this. The current text remains if omitted.
*/
text: string;
/**
* Position the cursor anywhere in the text range. Defaults to the end of the text.
*/
caretIndex: number;
/**
* If `false` or omitted no changes to the keyboard state are made.
*/
showKeyboard: boolean;
}
/**
* @name Native Keyboard
* @description
* A cross platform WhatsApp / Messenger / Slack -style keyboard even. For your Cordova app.
*
*
* IMPORTANT NOTICE: this plugin is paid, please read more about this at the [plugin's repo](https://github.com/EddyVerbruggen/cordova-plugin-native-keyboard#i-like-it-hook-me-up).
*
*
* @usage
* ```
* import { NativeKeyboard } from '@ionic-native/native-keyboard';
*
*
* constructor(private nativeKeyboard: NativeKeyboard) { }
*
* ...
*
*
* ```
* @interfaces
* NativeKeyboardOptions
* NativeKeyboardButton
* NativeKeyboardLeftButton
* NativeKeyboardUpdateMessengerOptions
*/
@Plugin({
pluginName: 'NativeKeyboard',
plugin: 'cordova-plugin-native-keyboard',
pluginRef: 'NativeKeyboard',
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-native-keyboard',
platforms: ['iOS', 'Android']
})
@Injectable()
export class NativeKeyboard extends IonicNativePlugin {
/**
* Show messenger
* @param options {NativeKeyboardOptions}
*/
@Cordova({ sync: true })
showMessenger(options: NativeKeyboardOptions): void {}
/**
* Hide messenger
* @param options {NativeKeyboardOptions}
*/
@Cordova({ sync: true })
hideMessenger(options: NativeKeyboardOptions): void {}
/**
* Programmatically pop up the keyboard again if the user dismissed it.
* @return {Promise<any>}
*/
@Cordova()
showMessengerKeyboard(): Promise<any> { return; }
/**
* Programmatically hide the keyboard (but not the messenger bar)
*/
@Cordova()
hideMessengerKeyboard(): Promise<any> { return; }
/**
* Manipulate the messenger while it's open. For instance if you want to update the text programmatically based on what the user typed.
* @param options
*/
@Cordova()
updateMessenger(options: NativeKeyboardUpdateMessengerOptions): Promise<any> { return; }
}

View File

@@ -4,7 +4,7 @@ import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/merge';
declare var navigator: any;
declare const navigator: any;
/**
* @name Network
@@ -30,9 +30,9 @@ declare var navigator: any;
*
* // watch network for a connection
* let connectSubscription = this.network.onConnect().subscribe(() => {
* console.log('network connected!');
* console.log('network connected!');
* // We just got a connection but we need to wait briefly
* // before we determine the connection type. Might need to wait
* // before we determine the connection type. Might need to wait.
* // prior to doing any api requests as well.
* setTimeout(() => {
* if (this.network.type === 'wifi') {
@@ -51,9 +51,9 @@ declare var navigator: any;
@Plugin({
pluginName: 'Network',
plugin: 'cordova-plugin-network-information',
pluginRef: 'navigator.connection',
repo: 'https://github.com/apache/cordova-plugin-network-information',
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser'],
pluginRef: 'navigator.connection'
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
})
@Injectable()
export class Network extends IonicNativePlugin {

View File

@@ -32,7 +32,8 @@ declare let window: any;
pluginName: 'NFC',
plugin: 'phonegap-nfc',
pluginRef: 'nfc',
repo: 'https://github.com/chariotsolutions/phonegap-nfc'
repo: 'https://github.com/chariotsolutions/phonegap-nfc',
platforms: ['Android', 'Windows ', 'BlackBerry 7', 'BlackBerry 10']
})
/**
*@{ NFC } class methods

View File

@@ -1,5 +1,6 @@
import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
/**
* @name PayPal
* @description
@@ -383,6 +384,11 @@ export interface PayPalConfigurationOptions {
* PIN to use for sandbox if 'forceDefaultsInSandbox' is set.
*/
sandboxUserPin?: string;
/**
* @hidden
*/
[key: string]: any;
}
/**
* @hidden
@@ -413,7 +419,7 @@ export class PayPalConfiguration implements PayPalConfigurationOptions {
};
if (options && typeof options === 'object') {
for (var i in options) {
for (let i in options) {
if (defaults.hasOwnProperty(i)) {
defaults[i] = options[i];
}

View File

@@ -44,7 +44,8 @@ import { Injectable } from '@angular/core';
plugin: 'cordova-plugin-photo-library',
pluginRef: 'cordova.plugins.photoLibrary',
repo: 'https://github.com/terikon/cordova-plugin-photo-library',
install: 'ionic plugin add cordova-plugin-photo-library --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="To choose photos"',
install: 'ionic cordova plugin add cordova-plugin-photo-library --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="To choose photos"',
installVariables: ['PHOTO_LIBRARY_USAGE_DESCRIPTION'],
platforms: ['Android', 'Browser', 'iOS']
})
@Injectable()

View File

@@ -28,7 +28,8 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
pluginName: 'PinDialog',
plugin: 'cordova-plugin-pin-dialog',
pluginRef: 'plugins.pinDialog',
repo: 'https://github.com/Paldom/PinDialog'
repo: 'https://github.com/Paldom/PinDialog',
platforms: ['Android', 'iOS']
})
@Injectable()
export class PinDialog extends IonicNativePlugin {

View File

@@ -172,7 +172,7 @@ export interface PinterestPin {
plugin: 'cordova-plugin-pinterest',
pluginRef: 'cordova.plugins.Pinterest',
repo: 'https://github.com/zyramedia/cordova-plugin-pinterest',
install: 'ionic plugin add cordova-plugin-pinterest --variable APP_ID=YOUR_APP_ID',
install: 'ionic cordova plugin add cordova-plugin-pinterest --variable APP_ID=YOUR_APP_ID',
installVariables: ['APP_ID'],
platforms: ['Android', 'iOS']
})

View File

@@ -24,7 +24,8 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
pluginName: 'PowerManagement',
plugin: 'cordova-plugin-powermanagement-orig',
pluginRef: 'powerManagement',
repo: 'https://github.com/Viras-/cordova-plugin-powermanagement'
repo: 'https://github.com/Viras-/cordova-plugin-powermanagement',
platforms: ['Android', 'iOS', 'WindowsPhone', 'Windows']
})
@Injectable()
export class PowerManagement extends IonicNativePlugin {

View File

@@ -1,8 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var cordova: any;
import { Cordova, CordovaCheck, Plugin, IonicNativePlugin } from '@ionic-native/core';
export interface PrintOptions {
/**
@@ -41,6 +38,7 @@ export interface PrintOptions {
*/
bounds?: number[] | any;
}
/**
* @name Printer
* @description Prints documents or HTML rendered content
@@ -71,7 +69,7 @@ export interface PrintOptions {
pluginName: 'Printer',
plugin: 'de.appplant.cordova.plugin.printer',
pluginRef: 'cordova.plugins.printer',
repo: 'https://github.com/katzer/cordova-plugin-printer.git',
repo: 'https://github.com/katzer/cordova-plugin-printer',
platforms: ['Android', 'iOS']
})
@Injectable()
@@ -81,8 +79,31 @@ export class Printer extends IonicNativePlugin {
* Checks whether to device is capable of printing.
* @returns {Promise<boolean>}
*/
isAvailable(): Promise<boolean> {
return this.check()
.then((res: any) => Promise.resolve(res.avail));
}
/**
* Checks if the printer service is available (iOS) or if printer services are installed and enabled (Android).
* @return {Promise<any>} returns a promise that resolve with an object indicating whether printing is available, and providing the number of printers available
*/
@CordovaCheck()
check(): Promise<any> {
return new Promise<any>((resolve: Function) => {
Printer.getPlugin()
.check((avail: boolean, count: any) => {
resolve({ avail, count });
});
});
}
/**
* Displays a system interface allowing the user to select an available printer. To speak with a printer directly you need to know the network address by picking them before via `printer.pick`.
* @returns {Promise<any>}
*/
@Cordova()
isAvailable(): Promise<boolean> { return; }
pick(): Promise<any> { return; }
/**
* Sends content to the printer.
@@ -90,7 +111,10 @@ export class Printer extends IonicNativePlugin {
* @param options {PrintOptions} optional. The options to pass to the printer
* @returns {Promise<any>}
*/
@Cordova()
@Cordova({
successIndex: 2,
errorIndex: 4
})
print(content: string | HTMLElement, options?: PrintOptions): Promise<any> { return; }
}

View File

@@ -4,7 +4,7 @@ import { Observable } from 'rxjs/Observable';
declare var window: any;
export type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error;
export type EventResponse = RegistrationEventResponse & NotificationEventResponse & Error;
export interface RegistrationEventResponse {
/**
@@ -39,7 +39,7 @@ export interface NotificationEventResponse {
/**
* An optional collection of data sent by the 3rd party push service that does not fit in the above properties.
*/
additionalData: NotificationEventAdditionalData | any;
additionalData: NotificationEventAdditionalData & any;
}
/**
@@ -264,8 +264,9 @@ export type PushEvent = 'registration' | 'error' | 'notification';
plugin: 'phonegap-plugin-push',
pluginRef: 'PushNotification',
repo: 'https://github.com/phonegap/phonegap-plugin-push',
install: 'ionic plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX',
installVariables: ['SENDER_ID']
install: 'ionic cordova plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX',
installVariables: ['SENDER_ID'],
platforms: ['Android', 'iOS', 'Browser', 'Windows ']
})
@Injectable()
export class Push extends IonicNativePlugin {

View File

@@ -24,9 +24,9 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
plugin: 'resgrid-cordova-plugins-rollbar',
pluginRef: 'cordova.plugins.Rollbar',
repo: 'https://github.com/Resgrid/cordova-plugins-rollbar',
platforms: ['Android', 'iOS'],
install: 'ionic plugin add resgrid-cordova-plugins-rollbar --variable ROLLBAR_ACCESS_TOKEN="YOUR_ROLLBAR_ACCEESS_TOKEN" --variable ROLLBAR_ENVIRONMENT="ROLLBAR_ENVIRONMENT"',
installVariables: ['ROLLBAR_ACCESS_TOKEN', 'ROLLBAR_ENVIRONMENT']
install: 'ionic cordova plugin add resgrid-cordova-plugins-rollbar --variable ROLLBAR_ACCESS_TOKEN="YOUR_ROLLBAR_ACCEESS_TOKEN" --variable ROLLBAR_ENVIRONMENT="ROLLBAR_ENVIRONMENT"',
installVariables: ['ROLLBAR_ACCESS_TOKEN', 'ROLLBAR_ENVIRONMENT'],
platforms: ['Android', 'iOS']
})
@Injectable()
export class Rollbar extends IonicNativePlugin {

View File

@@ -58,8 +58,8 @@ export interface SafariViewControllerOptions {
pluginName: 'SafariViewController',
plugin: 'cordova-plugin-safariviewcontroller',
pluginRef: 'SafariViewController',
platforms: ['iOS', 'Android'],
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller'
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller',
platforms: ['iOS', 'Android']
})
@Injectable()
export class SafariViewController extends IonicNativePlugin {

View File

@@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var window;
/**
* @name Screen Orientation
* @description

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@angular/core';
import { Plugin, IonicNativePlugin } from '@ionic-native/core';
declare const navigator: any;
declare var navigator: any;
/**
* @name Screenshot
* @description Captures a screen shot
@@ -25,7 +25,8 @@ declare var navigator: any;
pluginName: 'Screenshot',
plugin: 'https://github.com/gitawego/cordova-screenshot.git',
pluginRef: 'navigator.screenshot',
repo: 'https://github.com/gitawego/cordova-screenshot.git'
repo: 'https://github.com/gitawego/cordova-screenshot',
platforms: ['Android', 'iOS']
})
@Injectable()
export class Screenshot extends IonicNativePlugin {
@@ -44,7 +45,7 @@ export class Screenshot extends IonicNativePlugin {
return new Promise<any>(
(resolve, reject) => {
navigator.screenshot.save(
(error, result) => {
(error: any, result: any) => {
if (error) {
reject(error);
} else {
@@ -70,7 +71,7 @@ export class Screenshot extends IonicNativePlugin {
return new Promise<any>(
(resolve, reject) => {
navigator.screenshot.URI(
(error, result) => {
(error: any, result: any) => {
if (error) {
reject(error);
} else {

View File

@@ -1,14 +1,12 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, Plugin, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
declare var cordova: any;
import { CordovaInstance, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
/**
* @hidden
*/
export class SecureStorageObject {
constructor(private _objectInstance?: any) { }
constructor(private _objectInstance: any) { }
/**
* Gets a stored item
@@ -59,6 +57,13 @@ export class SecureStorageObject {
})
clear(): Promise<any> { return; }
/**
* Brings up the screen-lock settings
* @returns {Promise<any>}
*/
@CordovaInstance()
secureDevice(): Promise<any> { return; }
}
/**
@@ -120,13 +125,10 @@ export class SecureStorage extends IonicNativePlugin {
* @param store {string}
* @returns {Promise<SecureStorageObject>}
*/
@CordovaCheck()
create(store: string): Promise<SecureStorageObject> {
return new Promise((res, rej) => {
if (checkAvailability('cordova.plugins.SecureStorage', null, 'SecureStorage') === true) {
const instance = new cordova.plugins.SecureStorage(() => res(new SecureStorageObject(instance)), rej, store);
} else {
res(new SecureStorageObject());
}
return new Promise((res: Function, rej: Function) => {
const instance = new (SecureStorage.getPlugin())(() => res(new SecureStorageObject(instance)), rej, store);
});
}

View File

@@ -23,7 +23,8 @@ import { Observable } from 'rxjs/Observable';
pluginName: 'Shake',
plugin: 'cordova-plugin-shake',
pluginRef: 'shake',
repo: 'https://github.com/leecrossley/cordova-plugin-shake'
repo: 'https://github.com/leecrossley/cordova-plugin-shake',
platforms: ['iOS']
})
@Injectable()
export class Shake extends IonicNativePlugin {

View File

@@ -44,7 +44,6 @@ export interface SpeechRecognitionListeningOptionsAndroid {
}
/**
* @beta
* @name Speech Recognition
* @description
* This plugin does speech recognition using cloud services

Some files were not shown because too many files have changed in this diff Show More