Compare commits

...

73 Commits

Author SHA1 Message Date
Ibby Hadeed
115c167cfa chore(): update changelog 2016-08-13 11:22:44 -04:00
Ibby Hadeed
b8d7806843 Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-08-13 11:21:46 -04:00
Ibby Hadeed
4c2bb9e052 1.3.12 2016-08-13 11:19:57 -04:00
Ibby Hadeed
618d866bfe fix(inappbrowser): fix event listener
closes 419
2016-08-13 11:19:46 -04:00
Guillermo
66d1da2b55 docs(): Fix GeocoderResult interface (#418) 2016-08-11 08:52:30 -04:00
Ibby Hadeed
ecbe5faef8 docs(): add missing docs 2016-08-11 07:55:26 -04:00
Ibby Hadeed
2160a2d9e8 docs(): add missing docs 2016-08-11 07:42:10 -04:00
Ibby Hadeed
39385135de chore(): update changelog 2016-08-11 07:39:00 -04:00
Ibby Hadeed
014038a678 1.3.11 2016-08-11 07:38:10 -04:00
Kessiler
c60c3b7671 fix(camera): camera options should be optional. Fixes #413 (#417) 2016-08-11 07:29:14 -04:00
Ibrahim Hadeed
154c029f79 feat(photo-viewer): add wrapper for plugin (#359)
* feat(photo-viewer): add wrapper for plugin

* tslint
2016-08-11 07:28:52 -04:00
Ibrahim Hadeed
4b8ab4a00f feat(inappbrowser): implement instance based wrapper (#305)
* feat(inappbrowser): the inAppBrowser class is no longer static

* feat(inappbrowser): fallback on window.open if plugin not available

* change warning text to match expected release version
2016-08-11 07:26:39 -04:00
Ibby Hadeed
9b86ac637f fix merge issues 2016-08-11 07:22:23 -04:00
Ibrahim Hadeed
6ed32efe27 feat(file): alternate file implementation (#283)
* alternate file implementation

* SocialSharing: Add recommended `shareWithOptions` method

* Revert "SocialSharing: Add recommended `shareWithOptions` method"

* refactor(file): tslint & remove window declaration

* export all from file

* remove the cordova export and declaration
2016-08-11 07:21:02 -04:00
Kessiler
43e8a6d3d2 feat(GoogleMaps): Allow specify enableHighAccuracy option that attempt to get your location with highest accuracy (#410) 2016-08-09 01:37:16 -04:00
Kessiler
cf3f0f63c3 feat(GoogleAnalytics): Add campaign measurement tracking (#405) 2016-08-09 01:30:53 -04:00
Ibrahim Hadeed
7a84262fee feat(keyboard): enable hideKeyboardAccessoryBar function (#398)
closes #394
2016-08-09 01:30:15 -04:00
Keith D. Moore
3748bccad2 Network: Changed connection to return a Typescript string 2016-08-06 09:56:34 -05:00
cither1
0c486b0965 fix(index): export Geolocation interfaces. (#404) 2016-08-06 03:20:38 -04:00
Markus Wagner
306cb5d2a3 feat(ibeacon): using option otherPromise instead of sync (#388)
Since the plugin's methods return already a promise, the workaround with the `sync` option was used. This worked well for the method calls. However, when either cordova or the plugin was not available, an error was thrown, instead of rejecting the returned promise.

Therefore a better way is to use the `otherPromise` option, introduced with https://github.com/driftyco/ionic-native/releases/tag/v1.3.8.
2016-08-06 02:46:36 -04:00
Max Keyner
b413f21d4b docs(): remove unnecessary semicolumn (#400) 2016-08-06 02:45:53 -04:00
Brian Dennis
36624aff9c docs(flashlight): fix isSwitchedOn return type 2016-08-05 10:44:33 -05:00
Alex Muramoto
225a44ca4d docs(TouchID): Improves formatting of usage docs (#397)
* Fixes syntax error in usage example, and improves usage formatting

* Moves error codes into usage section
2016-08-04 17:58:35 -04:00
Aaron Czichon
cabeeb8dab feat(video-player): Added video player plugin (#391)
* Added OneSignal wrapper

* documentation

* Changes for callback of notification revieced

* fixes for @Cordova decorators without Promise return

* Merge

* Improvements to OneSignal
extended init function with notificationOpenedCallback as an optional parameter

* Platforms removed
OneSignal supports more than only these 3 platforms. It's available to nearly all Cordova platforms.

* Init method turned into observable

* Screen Orientation Plugin added. Closes #342

* Added VideoPlayer plugin #318
2016-08-04 17:57:44 -04:00
Max Lynch
9d03a6009b Merge pull request #392 from tlaverdure/docs(google-maps)
docs(google maps) - Updates to Google Maps docs
2016-08-04 09:43:06 -05:00
Max Lynch
93fb978a5c Merge pull request #386 from walkingriver/walkingriver-bower-fix
Removed unnecessary ionic.native.min.js
2016-08-04 09:42:21 -05:00
Max Lynch
6a6c256e05 Merge pull request #393 from walkingriver/patch-1
Added comment for iOS.
2016-08-04 09:41:47 -05:00
Max Lynch
9ca38cd8a1 fix(ng1): Copy object properly. Fixes #357 2016-08-04 09:40:24 -05:00
Michael Callaghan
066821dbec Added comment for iOS.
It doesn't matter what you send as the duration to vibrate() under iOS, it's always the same.
2016-08-04 10:01:34 -04:00
Thiery Laverdure
8242c88cbb Update googlemaps.ts 2016-08-04 08:37:45 -04:00
Thiery Laverdure
484f9a0076 Extra space. 2016-08-04 08:36:59 -04:00
Thiery Laverdure
049903222a Updates to google maps docs.
I would do more, but I'll see what kind of feedback I get first from these changes.
2016-08-04 08:31:51 -04:00
Michael Callaghan
7ae82f471d Removed unnecessary ionic.native.min.js
walkingriver commented 9 minutes ago
When installing the bower package created from this, a couple of warnings are printed:

bower ionic-native#* invalid-meta The "main" field cannot contain minified files
bower ionic-native#* invalid-meta The "main" field has to contain only 1 file per filetype; found multiple .js files: ["ionic.native.js","ionic.native.min.js"]
2016-08-02 23:20:00 -04:00
Gilles Callebaut
2503ef2ee5 docs(): Update nativestorage.ts (#384) 2016-08-02 18:52:37 -04:00
Saurabh Vyas
899c695414 docs(): Missing Comma / Syntax Error (#381)
A comma was missing :)
2016-08-02 18:30:56 -04:00
Max Lynch
990c9c2a49 Bower script 2016-08-02 11:23:39 -05:00
Max Lynch
f23436fe6d Bower release 2016-08-02 11:03:23 -05:00
Max Lynch
29816f7ab5 Created bower package. #369 2016-08-02 10:17:35 -05:00
Max Lynch
09e6fc9738 chore(backgroundGeolocation): update usage 2016-08-01 16:44:51 -05:00
Max Lynch
4e206812f0 fix(backgroundGeolocation): update config and move to sync. Fixes #331 2016-08-01 16:41:59 -05:00
Max Lynch
53b6d813d5 note about ng1 observables 2016-08-01 14:25:55 -05:00
Max Lynch
06c749ffab chore(docs): camera preview link. Fixes #361 2016-08-01 13:46:58 -05:00
mhartington
5162411b38 docs(): updated docs 2016-08-01 14:02:17 -04:00
Ibby Hadeed
ea049ff82f chore(): update changelog 2016-08-01 02:32:27 -04:00
Ibby Hadeed
838629db3a 1.3.10 2016-08-01 02:32:11 -04:00
Aaron Czichon
bd9366bdfe feat(screen-orientation): Added Screen Orientation Plugin #342 (#366)
* Added OneSignal wrapper

* documentation

* Changes for callback of notification revieced

* fixes for @Cordova decorators without Promise return

* Merge

* Improvements to OneSignal
extended init function with notificationOpenedCallback as an optional parameter

* Platforms removed
OneSignal supports more than only these 3 platforms. It's available to nearly all Cordova platforms.

* Init method turned into observable

* Screen Orientation Plugin added. Closes #342
2016-07-31 14:32:34 -04:00
John C. Bland II
206fa625fd docs(): Fix quotes on TouchID.isAvailable error comment (#370) 2016-07-31 14:31:27 -04:00
John C. Bland II
58c3fda956 docs(): Change <Fabric API Key> to not break the doc formatter (#371) 2016-07-31 14:31:02 -04:00
Alex Muramoto
ccf7fb56c8 fix(diagnostics): Corrects isEnabled functions to isAvailable (#373)
- Location, camera, wifi, and bluetooth 'isEnabled' functions are incorrect. All should be is Available.
2016-07-31 14:30:48 -04:00
Alex Muramoto
eeb5393a3f docs(): Adds basic documentation for importing Diagnostic plugin (#374) 2016-07-31 14:25:51 -04:00
Daniele Sartiano
8dfe0dbaf2 docs(): Update sqlite.ts (#375)
Fixed typo
2016-07-31 14:25:27 -04:00
Matt Lewis
817a4340e7 fix(ng1): use $q promises instead of the native Promise (#378) 2016-07-31 14:24:56 -04:00
Nazır Doğan
5506e8a2e2 docs(): Update inappbrowser.ts (#376) 2016-07-31 14:24:15 -04:00
Ibby Hadeed
aa51c03c5c remove window 2016-07-28 12:51:35 -04:00
Marcin Wadoń
40bd9bb20d Image resizer plugin class (#355) 2016-07-28 12:46:48 -04:00
Ibrahim Hadeed
41c9adf55a feat(crop): add crop plugin (#284) 2016-07-28 12:45:37 -04:00
Bruno Sato
2c9245c06c docs(): fix typo (#358) 2016-07-28 12:44:14 -04:00
Max Lynch
d3d14d0b86 Update README.md 2016-07-28 09:28:58 -05:00
Max Lynch
2c01d1998f Update README.md 2016-07-26 13:34:53 -05:00
Aaron Czichon
08fe04e87e fix(one-signal): return Observable instead of promise (#352)
* Added OneSignal wrapper

* documentation

* Changes for callback of notification revieced

* fixes for @Cordova decorators without Promise return

* Merge

* Improvements to OneSignal
extended init function with notificationOpenedCallback as an optional parameter

* Platforms removed
OneSignal supports more than only these 3 platforms. It's available to nearly all Cordova platforms.

* Init method turned into observable
2016-07-25 09:52:17 -04:00
Ankur Raiyani
8b9e317519 docs(statusbar): fix typo (#351) 2016-07-25 09:34:24 -04:00
mhartington
e20c411dff fix(brightness): use correct pluginRef 2016-07-24 20:50:01 -04:00
Ibrahim Hadeed
c854c5a18c Delete .DS_Store 2016-07-23 07:21:10 -04:00
Ibby Hadeed
af97b7a362 chore(changelog): update changelog 2016-07-23 07:19:29 -04:00
Ibby Hadeed
cfcf9fbfd1 1.3.9 2016-07-23 07:19:06 -04:00
Ibby Hadeed
971ee4adda minor refractor 2016-07-23 07:18:32 -04:00
Ibby Hadeed
df326f773f feat(android-fingerprint-auth): add wrapper for plugin
closes #334
2016-07-23 07:13:35 -04:00
Ibby Hadeed
b8f475f188 refactor(index): export interfaces from Facebook and Twitter
closes #344
2016-07-23 07:01:02 -04:00
Sameera (Sam)
cb24876f23 docs(transfer): example added for Transfer plugin (#349) 2016-07-23 06:48:55 -04:00
begriffin
075842d69d feat(secure-storage): Add Secure Storage Wrapper (#347)
* Add SecureStorage plugin.

* Add SecureStorage plugin.

* Added create() and removed init() to provide more consistency to ionic-native plugins.
Edited comments to reflect changes.

* Removed init and comment edit.
2016-07-23 06:45:53 -04:00
Alex Muramoto
77d31cdf42 fix(file): readAsText() and adds readAsDataURL() in File plugin (#346)
* Updates docs for CameraPreview, Base64ToGallery and Developer.MD

-DEVELOPER.md: Corrects 'npm run tslint' instruction to 'npm run lint'
-CameraPreview: Fixes syntax error in hide
-Base64ToGallery: Adds desc of options obj props

* Fixes resolveLocalFileSystemURL bug in File.readAsText() and adds File.readAsDataUrl()

- File.readAsText(): window.resolveLocalFileSystemURL() was incorrectly implemented

* Updates callback arg in File.checkFile()

Callback arg of window.resolveLocalFileSystemURL was fileSystem, but it actually returns fileEntry

* Corrects repo link and comments out setFlashMode()

- Repo prop and link in desc were not pointing to the same gh repo as the plugin
- setFlashMode() is not currently available in the repo that gets pulled by the corodova plugin
2016-07-22 14:08:11 -04:00
Alex Muramoto
b95191af06 docs(): CameraPreview, Base64ToGallery and Developer.MD (#343)
-DEVELOPER.md: Corrects 'npm run tslint' instruction to 'npm run lint'
-CameraPreview: Fixes syntax error in hide
-Base64ToGallery: Adds desc of options obj props
2016-07-21 12:40:51 -04:00
Guillermo
7952f9ef60 Improvements on documentation (#340)
* Improvements on documentation and some refactor

* ts | js -> typescript (docs)
2016-07-20 11:17:09 -04:00
87 changed files with 2045 additions and 886 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
node_modules/
.idea
dist/
scripts/ionic-native-bower

View File

@@ -1,3 +1,64 @@
<a name="1.3.12"></a>
## [1.3.12](https://github.com/driftyco/ionic-native/compare/v1.3.10...v1.3.12) (2016-08-13)
### Bug Fixes
* **backgroundGeolocation:** update config and move to sync. Fixes [#331](https://github.com/driftyco/ionic-native/issues/331) ([4e20681](https://github.com/driftyco/ionic-native/commit/4e20681)), closes [#331](https://github.com/driftyco/ionic-native/issues/331)
* **camera:** camera options should be optional. Fixes [#413](https://github.com/driftyco/ionic-native/issues/413) ([#417](https://github.com/driftyco/ionic-native/issues/417)) ([c60c3b7](https://github.com/driftyco/ionic-native/commit/c60c3b7)), closes [#413](https://github.com/driftyco/ionic-native/issues/413) [#417](https://github.com/driftyco/ionic-native/issues/417)
* **inappbrowser:** fix event listener ([618d866](https://github.com/driftyco/ionic-native/commit/618d866))
* **index:** export Geolocation interfaces. ([#404](https://github.com/driftyco/ionic-native/issues/404)) ([0c486b0](https://github.com/driftyco/ionic-native/commit/0c486b0))
* **ng1:** Copy object properly. Fixes [#357](https://github.com/driftyco/ionic-native/issues/357) ([9ca38cd](https://github.com/driftyco/ionic-native/commit/9ca38cd)), closes [#357](https://github.com/driftyco/ionic-native/issues/357)
### Features
* **file:** alternate file implementation ([#283](https://github.com/driftyco/ionic-native/issues/283)) ([6ed32ef](https://github.com/driftyco/ionic-native/commit/6ed32ef))
* **GoogleAnalytics:** Add campaign measurement tracking ([#405](https://github.com/driftyco/ionic-native/issues/405)) ([cf3f0f6](https://github.com/driftyco/ionic-native/commit/cf3f0f6))
* **GoogleMaps:** Allow specify enableHighAccuracy option that attempt to get your location with highest accuracy ([#410](https://github.com/driftyco/ionic-native/issues/410)) ([43e8a6d](https://github.com/driftyco/ionic-native/commit/43e8a6d))
* **ibeacon:** using option otherPromise instead of sync ([#388](https://github.com/driftyco/ionic-native/issues/388)) ([306cb5d](https://github.com/driftyco/ionic-native/commit/306cb5d))
* **inappbrowser:** implement instance based wrapper ([#305](https://github.com/driftyco/ionic-native/issues/305)) ([4b8ab4a](https://github.com/driftyco/ionic-native/commit/4b8ab4a))
* **keyboard:** enable hideKeyboardAccessoryBar function ([#398](https://github.com/driftyco/ionic-native/issues/398)) ([7a84262](https://github.com/driftyco/ionic-native/commit/7a84262)), closes [#394](https://github.com/driftyco/ionic-native/issues/394)
* **photo-viewer:** add wrapper for plugin ([#359](https://github.com/driftyco/ionic-native/issues/359)) ([154c029](https://github.com/driftyco/ionic-native/commit/154c029))
* **video-player:** Added video player plugin ([#391](https://github.com/driftyco/ionic-native/issues/391)) ([cabeeb8](https://github.com/driftyco/ionic-native/commit/cabeeb8)), closes [#342](https://github.com/driftyco/ionic-native/issues/342)
<a name="1.3.10"></a>
## [1.3.10](https://github.com/driftyco/ionic-native/compare/v1.3.9...v1.3.10) (2016-08-01)
### Bug Fixes
* **brightness:** use correct pluginRef ([e20c411](https://github.com/driftyco/ionic-native/commit/e20c411))
* **diagnostics:** Corrects isEnabled functions to isAvailable ([#373](https://github.com/driftyco/ionic-native/issues/373)) ([ccf7fb5](https://github.com/driftyco/ionic-native/commit/ccf7fb5))
* **ng1:** use $q promises instead of the native Promise ([#378](https://github.com/driftyco/ionic-native/issues/378)) ([817a434](https://github.com/driftyco/ionic-native/commit/817a434))
* **one-signal:** return Observable instead of promise ([#352](https://github.com/driftyco/ionic-native/issues/352)) ([08fe04e](https://github.com/driftyco/ionic-native/commit/08fe04e))
### Features
* **crop:** add crop plugin ([#284](https://github.com/driftyco/ionic-native/issues/284)) ([41c9adf](https://github.com/driftyco/ionic-native/commit/41c9adf))
* **screen-orientation:** Added Screen Orientation Plugin [#342](https://github.com/driftyco/ionic-native/issues/342) ([#366](https://github.com/driftyco/ionic-native/issues/366)) ([bd9366b](https://github.com/driftyco/ionic-native/commit/bd9366b)), closes [#342](https://github.com/driftyco/ionic-native/issues/342)
<a name="1.3.9"></a>
## [1.3.9](https://github.com/driftyco/ionic-native/compare/v1.3.8...v1.3.9) (2016-07-23)
### Bug Fixes
* **file:** readAsText() and adds readAsDataURL() in File plugin ([#346](https://github.com/driftyco/ionic-native/issues/346)) ([77d31cd](https://github.com/driftyco/ionic-native/commit/77d31cd))
### Features
* **android-fingerprint-auth:** add wrapper for plugin ([df326f7](https://github.com/driftyco/ionic-native/commit/df326f7)), closes [#334](https://github.com/driftyco/ionic-native/issues/334)
* **secure-storage:** Add Secure Storage Wrapper ([#347](https://github.com/driftyco/ionic-native/issues/347)) ([075842d](https://github.com/driftyco/ionic-native/commit/075842d))
<a name="1.3.8"></a>
## [1.3.8](https://github.com/driftyco/ionic-native/compare/v1.3.7...v1.3.8) (2016-07-20)

View File

@@ -98,7 +98,7 @@ You need to run `npm run build` in the `ionic-native` project, this will create
### Cleaning the code
You need to run `npm run tslint` to analyze the code and ensure it's consistency with the repository style. Fix any errors before submitting a PR.
You need to run `npm run lint` to analyze the code and ensure it's consistency with the repository style. Fix any errors before submitting a PR.
### 'Wrapping' Up

View File

@@ -17,9 +17,9 @@ For the full Ionic Native documentation, please visit [http://ionicframework.com
Ionic Native wraps plugin callbacks in a Promise or [Observable](https://gist.github.com/staltz/868e7e9bc2a7b8c1f754), providing a common interface for all plugins and ensuring that native events trigger change detection in Angular 2.
```
import {Geolocation} from 'ionic-native';
import { Geolocation } from 'ionic-native';
Geolocation.getCurrentPosition().then(pos => {
Geolocation.getCurrentPosition().then(pos => {
console.log('lat: ' + pos.coords.latitude + ', lon: ' + pos.coords.longitude);
});
@@ -31,13 +31,50 @@ let watch = Geolocation.watchPosition().subscribe(pos => {
watch.unsubscribe();
```
### Angular 1
Ionic Native works as a stand-in for [ngCordova](http://ngcordova.com/). In many cases, the usage is identical, but we import `ionic.native` instead of `ngCordova` as our module.
As a rule of thumb: take the ES6 class name of the plugin and add `$cordova` to get the service name. For example, `Geolocation` would be `$cordovaGeolocation`, and `Camera` will be `$cordovaCamera`:
```javascript
angular.module('myApp', ['ionic', 'ionic.native'])
.controller('MyCtrl', function($scope, $cordovaCamera) {
$scope.takePicture = function() {
$cordovaCamera.getPicture(opts).then(function(p) {
}, function(err) {
});
};
});
```
For services that return observables, the Angular 1 digest cycle must be done manually (currently):
```javascript
angular.module('myApp', ['ionic', 'ionic.native'])
.controller('MyCtrl', function($scope, $cordovaGeolocation) {
$scope.takePicture = function() {
$cordovaGeolocation.watchPosition(opts).subscribe(function(p) {
$scope.$apply(function() {
$scope.position = p.coords;
});
}, function(err) {
});
};
});
```
### Runtime Diagnostics
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)
## Installation
Run following commmand to install ionic-native in your project.
Run following commmand to install ionic-native in your project.
```
npm install ionic-native --save
```

View File

@@ -1,6 +1,6 @@
{
"name": "ionic-native",
"version": "1.3.8",
"version": "1.3.12",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"main": "dist/index.js",
"files": [

26
scripts/bower.json Normal file
View File

@@ -0,0 +1,26 @@
{
"name": "ionic-native",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"main": [
"ionic.native.js"
],
"authors": [
"Max Lynch <max@ionic.io>"
],
"license": "MIT",
"keywords": [
"ionic",
"native",
"html5",
"hybrid",
"mobile"
],
"homepage": "https://github.com/driftyco/ionic-native-bower",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}

28
scripts/bower.sh Normal file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
set -e
# readJsonProp(jsonFile, property)
# - restriction: property needs to be on an own line!
function readJsonProp {
echo $(sed -En 's/.*"'$2'"[ ]*:[ ]*"(.*)".*/\1/p' $1)
}
VERSION=$(readJsonProp "package.json" "version")
echo "BOWERING IONIC-NATIVE VERSION $VERSION. FOR GREAT JUSTICE..."
DIR="scripts/ionic-native-bower"
rm -rf $DIR
mkdir $DIR
cp dist/ionic.native.js dist/ionic.native.min.js $DIR
cd $DIR
git init
git remote add origin git@github.com:driftyco/ionic-native-bower.git
cp ../bower.json .
git add .
git commit -m "Bower release"
git tag -f -m v$VERSION v$VERSION
git push -f --tags origin master
echo "BOWERING COMPLETED SOMEWHAT SUCCESSFULLY"

View File

@@ -6,6 +6,7 @@ declare var window;
import {ActionSheet} from './plugins/actionsheet';
import {AdMob} from './plugins/admob';
import { AndroidFingerprintAuth } from './plugins/android-fingerprint-auth';
import {AppAvailability} from './plugins/appavailability';
import {AppRate} from './plugins/apprate';
import {AppVersion} from './plugins/appversion';
@@ -24,6 +25,7 @@ import {CameraPreview} from './plugins/camera-preview';
import {CardIO} from './plugins/card-io';
import {Clipboard} from './plugins/clipboard';
import {Contacts} from './plugins/contacts';
import {Crop} from './plugins/crop';
import {DatePicker} from './plugins/datepicker';
import {DBMeter} from './plugins/dbmeter';
import {Deeplinks} from './plugins/deeplinks';
@@ -47,6 +49,7 @@ import {Hotspot} from './plugins/hotspot';
import {Httpd} from './plugins/httpd';
import {IBeacon} from './plugins/ibeacon';
import {ImagePicker} from './plugins/imagepicker';
import {ImageResizer} from './plugins/imageresizer';
import {InAppBrowser} from './plugins/inappbrowser';
import {Insomnia} from './plugins/insomnia';
import {Keyboard} from './plugins/keyboard';
@@ -57,11 +60,14 @@ import {NativeStorage} from './plugins/nativestorage';
import {MediaPlugin} from './plugins/media';
import {Network} from './plugins/network';
import {OneSignal} from './plugins/onesignal';
import { PhotoViewer } from './plugins/photo-viewer';
import {ScreenOrientation} from './plugins/screen-orientation';
import {PinDialog} from './plugins/pin-dialog';
import {Printer} from './plugins/printer';
import {Push} from './plugins/push';
import {SafariViewController} from './plugins/safari-view-controller';
import {Screenshot} from './plugins/screenshot';
import {SecureStorage} from './plugins/securestorage';
import {Sim} from './plugins/sim';
import {SMS} from './plugins/sms';
import {SocialSharing} from './plugins/socialsharing';
@@ -74,6 +80,7 @@ import {Toast} from './plugins/toast';
import {TouchID} from './plugins/touchid';
import {TwitterConnect} from './plugins/twitter-connect';
import {Vibration} from './plugins/vibration';
import {VideoPlayer} from './plugins/video-player';
import {WebIntent} from './plugins/webintent';
export * from './plugins/3dtouch';
export * from './plugins/background-geolocation';
@@ -87,11 +94,14 @@ export * from './plugins/datepicker';
export * from './plugins/device';
export * from './plugins/devicemotion';
export * from './plugins/deviceorientation';
export * from './plugins/file';
export * from './plugins/filetransfer';
export * from './plugins/geolocation';
export * from './plugins/googlemaps';
export * from './plugins/httpd';
export * from './plugins/ibeacon';
export * from './plugins/imagepicker';
export * from './plugins/imageresizer';
export * from './plugins/inappbrowser';
export * from './plugins/launchnavigator';
export * from './plugins/localnotifications';
@@ -103,9 +113,12 @@ export * from './plugins/safari-view-controller';
export * from './plugins/sms';
export * from './plugins/spinnerdialog';
export * from './plugins/toast';
export * from './plugins/twitter-connect';
export * from './plugins/video-player';
export {
ActionSheet,
AdMob,
AndroidFingerprintAuth,
AppAvailability,
AppRate,
AppVersion,
@@ -118,6 +131,7 @@ export {
BluetoothSerial,
CameraPreview,
Clipboard,
Crop,
DBMeter,
Deeplinks,
DeviceAccounts,
@@ -125,9 +139,7 @@ export {
Diagnostic,
EmailComposer,
Facebook,
File,
Flashlight,
Geolocation,
Globalization,
GooglePlus,
GoogleAnalytics,
@@ -137,8 +149,11 @@ export {
NativeStorage,
Network,
OneSignal,
PhotoViewer,
ScreenOrientation,
PinDialog,
Screenshot,
SecureStorage,
SocialSharing,
Sim,
Splashscreen,
@@ -146,7 +161,6 @@ export {
StatusBar,
TouchID,
Transfer,
TwitterConnect,
Vibration,
WebIntent
}
@@ -157,6 +171,7 @@ export * from './plugins/plugin';
window['IonicNative'] = {
ActionSheet: ActionSheet,
AdMob: AdMob,
AndroidFingerprintAuth: AndroidFingerprintAuth,
AppAvailability: AppAvailability,
AppRate: AppRate,
AppVersion: AppVersion,
@@ -175,6 +190,7 @@ window['IonicNative'] = {
CardIO: CardIO,
Clipboard: Clipboard,
Contacts: Contacts,
Crop: Crop,
DatePicker: DatePicker,
DBMeter: DBMeter,
Deeplinks: Deeplinks,
@@ -197,6 +213,7 @@ window['IonicNative'] = {
Httpd: Httpd,
IBeacon: IBeacon,
ImagePicker: ImagePicker,
ImageResizer: ImageResizer,
InAppBrowser: InAppBrowser,
Keyboard: Keyboard,
LaunchNavigator: LaunchNavigator,
@@ -208,9 +225,12 @@ window['IonicNative'] = {
Printer: Printer,
Push: Push,
OneSignal: OneSignal,
PhotoViewer: PhotoViewer,
ScreenOrientation: ScreenOrientation,
PinDialog: PinDialog,
SafariViewController: SafariViewController,
Screenshot: Screenshot,
SecureStorage: SecureStorage,
Sim: Sim,
SMS: SMS,
SocialSharing: SocialSharing,
@@ -223,6 +243,7 @@ window['IonicNative'] = {
TouchID: TouchID,
Transfer: Transfer,
TwitterConnect: TwitterConnect,
VideoPlayer: VideoPlayer,
Vibration: Vibration,
WebIntent: WebIntent
};

View File

@@ -15,14 +15,11 @@ export function initAngular1(plugins) {
(function(serviceName, cls, name) {
window.angular.module('ionic.native').service(serviceName, [function() {
let funcs = {};
for (var k in cls) {
funcs[k] = cls[k];
}
funcs['name'] = name;
var funcs = window.angular.copy(cls);
funcs.prototype['name'] = name;
return funcs;
}]);
})(serviceName, cls, name);
}
}
}
}

View File

@@ -10,13 +10,13 @@ declare var window: any;
* @usage
* Please do refer to the original plugin's repo for detailed usage. The usage example here might not be sufficient.
* ```
* import {ThreeDeeTouch} from 'ionic-native';
* import { ThreeDeeTouch } from 'ionic-native';
*
* // import for type completion on variables
* import {ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch} from 'ionic-native';
* import { ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch } from 'ionic-native';
* ...
*
* ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable)):
* ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable));
*
* ThreeDeeTouch.watchForceTouches()
* .subscribe(
@@ -57,7 +57,7 @@ declare var window: any;
* ThreeDeeTouchForceTouch.onHomeIconPressed().subscribe(
* (payload) => {
* // returns an object that is the button you presed
* console.log(`Pressed the ${payload.title} button`)
* console.log('Pressed the ${payload.title} button')
* console.log(payload.type)
*
* }
@@ -130,13 +130,16 @@ export class ThreeDeeTouch {
sync: true
})
static disableLinkPreview(): void { }
}
export interface ThreeDeeTouchQuickAction {
type?: string;
title: string;
subtitle?: string;
iconType?: string;
}
export interface ThreeDeeTouchForceTouch {
force: number;
timestamp: number;

View File

@@ -9,8 +9,9 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet).
*
* @usage
* ```ts
* import {ActionSheet} from 'ionic-native';
* ```typescript
* import { ActionSheet } from 'ionic-native';
*
*
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
* ActionSheet.show({
@@ -18,8 +19,8 @@ import { Cordova, Plugin } from './plugin';
* 'buttonLabels': buttonLabels,
* 'addCancelButtonWithLabel': 'Cancel',
* 'addDestructiveButtonWithLabel' : 'Delete'
* }).then(buttonIndex => {
* console.log('Button pressed: ' + buttonLabels[buttonIndex - 1]);
* }).then((buttonIndex: number) => {
* console.log('Button pressed: ' + buttonIndex);
* });
* ```
*
@@ -72,4 +73,5 @@ export class ActionSheet {
*/
@Cordova()
static hide(options?: any): Promise<any> { return; }
}

View File

@@ -0,0 +1,77 @@
import { Cordova, Plugin } from './plugin';
/**
* @name Android Fingerprint Auth
* @description
* This plugin will open a native dialog fragment prompting the user to authenticate using their fingerprint. If the device has a secure lockscreen (pattern, PIN, or password), the user may opt to authenticate using that method as a backup.
* @usage
* ```typescript
* import { AndroidFingerprintAuth } from 'ionic-native';
*
* AndroidFingerprintAuth.isAvailable()
* .then((result)=> {
* if(result.isAvailable){
* // it is available
*
* AndroidFingerprintAuth.show({ clientId: "myAppName", clientSecret: "so_encrypted_much_secure_very_secret" })
* .then(result => {
* if(result.withFingerprint) {
* console.log('Successfully authenticated with fingerprint!');
* } else if(result.withPassword) {
* console.log('Successfully authenticated with backup password!');
* } else console.log('Didn\'t authenticate!');
* })
* .catch(error => console.error(error));
*
* } else {
* // fingerprint auth isn't available
* }
* })
* .catch(error => console.error(error));
* ```
*/
@Plugin({
plugin: 'cordova-plugin-android-fingerprint-auth',
pluginRef: 'FingerprintAuth',
repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth'
})
export class AndroidFingerprintAuth {
/**
* Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
* @param params {any}
*/
@Cordova()
static show(params: {
/**
* Used as the alias for your key in the Android Key Store.
*/
clientId: string;
/**
* Used to encrypt the token returned upon successful fingerprint authentication.
*/
clientSecret: string;
/**
* Set to true to remove the "USE BACKUP" button
*/
disableBackup?: boolean;
/**
* Change the language. (en_US or es)
*/
locale?: string
}): Promise<{
/**
* Base64 encoded string
*/
withFingerprint: string;
/**
*
*/
withPassword: boolean;
}> {return; }
/**
* Check if service is available
*/
@Cordova()
static isAvailable(): Promise<{isAvailable: boolean}> {return; }
}

View File

@@ -8,22 +8,22 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability).
*
* @usage
* ```js
* import {AppAvailability} from 'ionic-native';
* ```typescript
* import { AppAvailability } from 'ionic-native';
*
*
* var app;
* let app;
*
* if(device.platform === 'iOS') {
* if (device.platform === 'iOS') {
* app = 'twitter://';
* }else if(device.platform === 'Android'){
* } else if (device.platform === 'Android') {
* app = 'com.twitter.android';
* }
*
* AppAvailability.check(app)
* .then(
* yes => console.log(app + " is available"),
* no => console.log(app + " is NOT available")
* (yes: string) => console.log(app + ' is available'),
* (no: string) => console.log(app + ' is NOT available')
* );
* ```
*/

View File

@@ -11,14 +11,14 @@ declare var window;
* Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [AppRate plugin docs](https://github.com/pushandplay/cordova-plugin-apprate).
*
* @usage
* ```js
* import {AppRate} from 'ionic-native';
* ```typescript
* import { AppRate } from 'ionic-native';
*
* AppRate.preferences.storeAppURL = {
* ios: '<my_app_id>',
* android: 'market://details?id=<package_name>',
* };
*
* AppRate.preferences.storeAppURL.ios = '<my_app_id>';
* AppRate.preferences.storeAppURL.android = 'market://details?id=<package_name>';
* AppRate.preferences.storeAppURL.blackberry = 'appworld://content/[App Id]/';
* AppRate.preferences.storeAppURL.windows8 = 'ms-windows-store:Review?name=<the Package Family Name of the application>';
* AppRate.promptForRating();
* ```
*

View File

@@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `cordova-plugin-app-version`. For more info, please see the [Cordova App Version docs](https://github.com/whiteoctober/cordova-plugin-app-version).
*
* @usage
* ```js
* import {AppVersion} from 'ionic-native';
* ```typescript
* import { AppVersion } from 'ionic-native';
*
*
* AppVersion.getAppName();

View File

@@ -89,7 +89,7 @@ export interface Config {
* When enabled, the plugin will emit sounds for life-cycle events of
* background-geolocation! See debugging sounds table.
*/
debug: boolean;
debug?: boolean;
/**
* The minimum distance (measured in meters) a device must move horizontally
@@ -100,7 +100,9 @@ export interface Config {
/**
* IOS, ANDROID ONLY
* Enable this in order to force a stop() when the application terminated
* (e.g. on iOS, double-tap home button, swipe away the app).
* (e.g. on iOS, double-tap home button, swipe away the app).o
*
* Defaults to true
*/
stopOnTerminate?: boolean;
@@ -111,7 +113,7 @@ export interface Config {
* and the MS doc (http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator.reportinterval)
* for more information
*/
locationTimeout?: number;
interval?: number;
/**
* ANDROID ONLY
@@ -142,7 +144,7 @@ export interface Config {
* ANDROID ONLY
* Set location service provider @see wiki (https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers)
*/
locationService?: number;
locationProvider?: number;
/**
* IOS ONLY
@@ -162,9 +164,8 @@ export interface Config {
*
* @usage
*
* ```ts
* import {BackgroundGeolocation} from 'ionic-native';
*
* ```typescript
* import { BackgroundGeolocation } from 'ionic-native';
*
*
* // When device is ready :
@@ -179,18 +180,19 @@ export interface Config {
* stopOnTerminate: false, // enable this to clear background location settings when the app terminates
* };
*
* BackgroundGeolocation.configure(config)
* .then((location) => {
* console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
*
* // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
* // and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
* // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
* BackgroundGeolocation.finish(); // FOR IOS ONLY
* })
* .catch((error) => {
* console.log('BackgroundGeolocation error');
* });
* BackgroundGeolocation.configure((location) => {
console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
// IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
// and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
// IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
BackgroundGeolocation.finish(); // FOR IOS ONLY
* }, (error) => {
* console.log('BackgroundGeolocation error');
* }, {
* //options
* });
*
* // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
* BackgroundGeolocation.start();
@@ -220,9 +222,9 @@ export class BackgroundGeolocation {
* Options a json object of type Config
*/
@Cordova({
callbackOrder: 'reverse'
sync: true
})
static configure(options: Config): Promise<Location> { return; }
static configure(callback: Function, errorCallback: Function, options: Config): void { return; }
/**

View File

@@ -6,8 +6,8 @@ import { Cordova, Plugin } from './plugin';
* Cordova plugin to prevent the app from going to sleep while in background.
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode#android-customization
*@usage
* ```js
* import {BackgroundMode} from 'ionic-native';
* ```typescript
* import { BackgroundMode } from 'ionic-native';
*
* BackgroundMode.enable();
* ```
@@ -91,6 +91,7 @@ export class BackgroundMode {
sync: true
})
static on(eventName: string, callback: any): void { }
}
/**

View File

@@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge).
*
* @usage
* ```js
* import {Badge} from 'ionic-native';
* ```typescript
* import { Badge } from 'ionic-native';
*
*
* Badge.set(10);
@@ -74,4 +74,5 @@ export class Badge {
*/
@Cordova()
static registerPermission(): Promise<any> { return; }
}

View File

@@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).
*
* @usage
* ```js
* import {BarcodeScanner} from 'ionic-native';
* ```typescript
* import { BarcodeScanner } from 'ionic-native';
*
*
* BarcodeScanner.scan().then((barcodeData) => {

View File

@@ -3,13 +3,13 @@ import { Cordova, Plugin } from './plugin';
* @name Base64 To Gallery
* @description This plugin allows you to save base64 data as a png image into the device
* @usage
* ```ts
* import {Base64ToGallery} from 'ionic-native';
* ```typescript
* import { Base64ToGallery } from 'ionic-native';
*
*
* Base64ToGallery.base64ToGallery(base64Data, 'img_').then(
* res => console.log("Saved image to gallery ", res),
* err => console.log("Error saving image to gallery ", err)
* res => console.log('Saved image to gallery ', res),
* err => console.log('Error saving image to gallery ', err)
* );
* ```
*/
@@ -24,7 +24,7 @@ export class Base64ToGallery {
/**
* Converts a base64 string to an image file in the device gallery
* @param {string} data The actual base64 string that you want to save
* @param {any} options (optional) An object with properties: prefix, mediaScanner
* @param {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS.
* @returns {Promise} returns a promise that resolves when the image is saved.
*/
@Cordova()

View File

@@ -7,14 +7,13 @@ import { Observable } from 'rxjs/Observable';
* Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status).
*
* @usage
* ```js
* import {BatteryStatus} from 'ionic-native';
*
* ```typescript
* import { BatteryStatus } from 'ionic-native';
*
*
* // watch change in battery status
* let subscription = BatteryStatus.onChange().subscribe(
* status => {
* (status: StatusObject) => {
* console.log(status.level, status.isPlugged);
* }
* );

View File

@@ -24,7 +24,7 @@ import { Observable } from 'rxjs/Observable';
*
* Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning.
*
* ```ts
* ```typescript
* {
* "name": "Battery Demo",
* "id": "20:FF:D0:FF:D1:C0",
@@ -34,7 +34,7 @@ import { Observable } from 'rxjs/Observable';
* ```
* After connecting, the peripheral object also includes service, characteristic and descriptor information.
*
* ```ts
* ```typescript
* {
* "name": "Battery Demo",
* "id": "20:FF:D0:FF:D1:C0",
@@ -93,7 +93,7 @@ import { Observable } from 'rxjs/Observable';
*
* ### Android
*
* ```ts
* ```typescript
* {
* "name": "demo",
* "id": "00:1A:7D:DA:71:13",
@@ -108,7 +108,7 @@ import { Observable } from 'rxjs/Observable';
*
* Note that iOS uses the string value of the constants for the [Advertisement Data Retrieval Keys](https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBCentralManagerDelegate_Protocol/index.html#//apple_ref/doc/constant_group/Advertisement_Data_Retrieval_Keys). This will likely change in the future.
*
* ```ts
* ```typescript
* {
* "name": "demo",
* "id": "D8479A4F-7517-BCD3-91B5-3302B2F81802",
@@ -137,7 +137,7 @@ import { Observable } from 'rxjs/Observable';
*
* This means that you need convert your data to ArrayBuffers before sending and from ArrayBuffers when receiving.
*
* ```ts
* ```typescript
* // ASCII only
* function stringToBytes(string) {
* var array = new Uint8Array(string.length);

View File

@@ -5,12 +5,15 @@ import { Observable } from 'rxjs/Observable';
* @name Bluetooth Serial
* @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.
* @usage
* ```ts
* ```typescript
* import { BluetoothSerial } from 'ionic-native';
*
*
* // Write a string
* Bluetooth.write("hello world").then(success, failure);
* BluetoothSerial.write("hello world").then(success, failure);
*
* // Array of int or bytes
* Bluetooth.write([186, 220, 222]).then(success, failure);
* BluetoothSerial.write([186, 220, 222]).then(success, failure);
*
* // Typed Array
* var data = new Uint8Array(4);
@@ -18,10 +21,10 @@ import { Observable } from 'rxjs/Observable';
* data[1] = 0x42;
* data[2] = 0x43;
* data[3] = 0x44;
* Bluetooth.write(data).then(success, failure);
* BluetoothSerial.write(data).then(success, failure);
*
* // Array Buffer
* Bluetooth.write(data.buffer).then(success, failure);
* BluetoothSerial.write(data.buffer).then(success, failure);
* ```
*/
@Plugin({
@@ -218,4 +221,5 @@ export class BluetoothSerial {
sync: true
})
static setDiscoverable(discoverableDuration: number): void { }
}

View File

@@ -8,8 +8,9 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `cordova-plugin-brightness`. For more info, please see the [Brightness plugin docs](https://github.com/mgcrea/cordova-plugin-brightness).
*
* @usage
* ```ts
* import {Brightness} from 'ionic-native';
* ```typescript
* import { Brightness } from 'ionic-native';
*
*
* let brightnessValue: number = 0.8;
* Brightness.setBrightness(brightnessValue);
@@ -18,7 +19,7 @@ import { Cordova, Plugin } from './plugin';
*/
@Plugin({
plugin: 'cordova-plugin-brightness',
pluginRef: 'plugins.brightness',
pluginRef: 'cordova.plugins.brightness',
repo: 'https://github.com/mgcrea/cordova-plugin-brightness',
platforms: ['Android', 'iOS']
})
@@ -47,4 +48,5 @@ export class Brightness {
*/
@Cordova()
static setKeepScreenOn(value: boolean): void { }
}

View File

@@ -1,6 +1,9 @@
import { Cordova, Plugin } from './plugin';
/**
* @private
*/
export interface CalendarOptions {
firstReminderMinutes?: number;
secondReminderMinutes?: number;
@@ -12,11 +15,6 @@ export interface CalendarOptions {
url?: string;
}
export interface Calendar {
id: number;
name: string;
}
/**
* @name Calendar
* @description
@@ -24,7 +22,18 @@ export interface Calendar {
*
* Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin).
*
*
* @usage
* ```
* import {Calendar} from 'ionic-native';
*
*
*
* Calendar.createCalendar('MyCalendar').then(
* (msg) => { console.log(msg); },
* (err) => { console.log(err); }
* );
* ```
*
*/
@Plugin({
@@ -87,23 +96,8 @@ export class Calendar {
/**
* Create a calendar. (iOS only)
*
* @usage
* ```
* import {Calendar} from 'ionic-native';
*
*
*
* Calendar.createCalendar('MyCalendar').then(
* (msg) => { console.log(msg); },
* (err) => { console.log(err); }
* );
* ```
*
* @param {string | Object} nameOrOptions either a string name or a options object.
* options:
* calendarName: string the name of the calendar
* calendarColor: string the hex color of the calendar
* @return Returns a Promise
* @param {string | Object} nameOrOptions either a string name or a options object. If string, provide the calendar name. IF an object, provide a calendar name as a string and a calendar color in hex format as a string
* @return {Promise} Returns a Promise
*/
@Cordova()
static createCalendar(
@@ -112,15 +106,6 @@ export class Calendar {
/**
* Delete a calendar. (iOS only)
*
* @usage
* ```
* Calendar.deleteCalendar('MyCalendar').then(
* (msg) => { console.log(msg); },
* (err) => { console.log(err); }
* );
* ```
*
* @param {string} name Name of the calendar to delete.
* @return Returns a Promise
*/
@@ -158,7 +143,6 @@ export class Calendar {
/**
* Silently create an event.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
@@ -268,7 +252,6 @@ export class Calendar {
/**
* Find an event with additional options.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
@@ -413,8 +396,10 @@ export class Calendar {
/**
* Open the calendar at the specified date.
* @return {Date} date
* @param {Date} date The date you want to open the calendar on
* @return {Promise<any>} Promise returns a promise
*/
@Cordova()
static openCalendar(date: Date): Promise<any> { return; }
}

View File

@@ -1,30 +1,31 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
export interface CameraPreviewOptions {
x: number;
y: number;
width: number;
height: number;
/**
* Choose the camera to use (front- or back-facing).
* 'front' for front camera
* 'rear' for rear camera
*/
camera: string;
/** Take photo on tap */
tapPhoto: boolean;
/** */
previewDrag: boolean;
/** */
toBack: boolean;
/** Alpha use when toBack is set to true */
alpha: number;
x: number;
y: number;
width: number;
height: number;
/**
* Choose the camera to use (front- or back-facing).
* 'front' for front camera
* 'rear' for rear camera
*/
camera: string;
/** Take photo on tap */
tapPhoto: boolean;
/** */
previewDrag: boolean;
/** */
toBack: boolean;
/** Alpha use when toBack is set to true */
alpha: number;
}
export interface CameraPreviewSize {
maxWidth: number;
maxHeight: number;
maxWidth: number;
maxHeight: number;
}
/**
@@ -32,13 +33,13 @@ export interface CameraPreviewSize {
* @description
* Showing camera preview in HTML
*
* Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera-preview`. For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/westonganger/cordova-plugin-camera-preview).
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
*
*/
@Plugin({
plugin: 'cordova-plugin-camera-preview',
pluginRef: 'cordova.plugins.camerapreview',
repo: 'https://github.com/westonganger/cordova-plugin-camera-preview',
repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
platforms: ['Android', 'iOS']
})
export class CameraPreview {
@@ -50,7 +51,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static startCamera(options: CameraPreviewOptions): void {};
static startCamera(options: CameraPreviewOptions): void { };
/**
* Stops the camera preview instance.
@@ -58,7 +59,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static stopCamera(): void {};
static stopCamera(): void { };
/**
* Take the picture, the parameter size is optional
@@ -66,7 +67,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static takePicture(size: CameraPreviewSize): void {};
static takePicture(size: CameraPreviewSize): void { };
/**
* Register a callback function that receives the original picture and the image captured from the preview box.
@@ -82,7 +83,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static switchCamera(): void {};
static switchCamera(): void { };
/**
* Show the camera preview box.
@@ -90,7 +91,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static show(): void {};
static show(): void { };
/**
* Hide the camera preview box.
@@ -98,15 +99,15 @@ export class CameraPreview {
@Cordova({
sync: true
})
static hide(): void {};
static hide(): void { };
/**
* Set the default mode for the Flash.
*/
@Cordova({
sync: true
})
static setFlashMode(mode: number): void {};
// @Cordova({
// sync: true
// })
// static setFlashMode(mode: number): void { };
/**
* Set camera color effect.
@@ -114,7 +115,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static setColorEffect(effect: string): void {};
static setColorEffect(effect: string): void { };
/**
* @private

View File

@@ -93,14 +93,16 @@ export interface CameraPopoverOptions {
* Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera).
*
* @usage
* ```js
* import {Camera} from 'ionic-native';
* ```typescript
* import { Camera } from 'ionic-native';
*
*
* Camera.getPicture(options).then((imageData) => {
* // imageData is either a base64 encoded string or a file URI
* // If it's base64:
* let base64Image = "data:image/jpeg;base64," + imageData;
* let base64Image = 'data:image/jpeg;base64,' + imageData;
* }, (err) => {
* // Handle error
* });
* ```
*/
@@ -186,13 +188,13 @@ export class Camera {
/**
* Take a picture or video, or load one from the library.
* @param {CameraOptions} options Options that you want to pass to the camera. Encoding type, quality, etc.
* @param {CameraOptions?} options Options that you want to pass to the camera. Encoding type, quality, etc. Optional
* @return {Promise} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.
*/
@Cordova({
callbackOrder: 'reverse'
})
static getPicture(options: CameraOptions): Promise<any> { return; }
static getPicture(options?: CameraOptions): Promise<any> { return; }
/**
* Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.

View File

@@ -1,13 +1,13 @@
import { Cordova, Plugin } from './plugin';
/**
* @name CardIO
* @description
* @usage
* ```
* import {CardIO} from 'ionic-native';
* import { CardIO } from 'ionic-native';
*
* ...
*
* CardIO.canScan()
* .then(
@@ -51,6 +51,7 @@ export class CardIO {
*/
@Cordova()
static version(): Promise<string> { return; }
}
export interface CardIOOptions {

View File

@@ -10,19 +10,18 @@ import { Cordova, Plugin } from './plugin';
* For more info, please see the [Clipboard plugin docs](https://github.com/VersoSolutions/CordovaClipboard.git).
*
* @usage
* ```js
* import {Clipboard} from 'ionic-native';
* ```typescript
* import { Clipboard } from 'ionic-native';
*
*
*
* Clipboard.copy("Hello world");
* Clipboard.copy('Hello world');
*
* Clipboard.paste().then(
* (resolve : string) => {
* (resolve: string) => {
* alert(resolve);
* },
* (reject : string) => {
* alert("Error: " + reject);
* (reject: string) => {
* alert('Error: ' + reject);
* }
* );
* );

View File

@@ -1,4 +1,4 @@
import { Cordova, CordovaInstance, Plugin, InstanceProperty } from './plugin';
import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin';
declare var window: any,
@@ -257,16 +257,15 @@ export class ContactFindOptions implements IContactFindOptions {
*
* @usage
*
* ```js
* import {Contact} from 'ionic-native';
*
* ```typescript
* import { Contact } from 'ionic-native';
*
*
* let contact = new Contact();
* contact.displayName = "Mr. Ionitron";
* contact.displayName = 'Mr. Ionitron';
* contact.save().then(
* () => console.log("Contact saved!", contact),
* (error: any) => console.error("Error saving contact.", error)
* () => console.log('Contact saved!', contact),
* (error: any) => console.error('Error saving contact.', error)
* );
* ```
*
@@ -308,4 +307,5 @@ export class Contacts {
*/
@Cordova()
static pickContact(): Promise<any> { return; }
}

34
src/plugins/crop.ts Normal file
View File

@@ -0,0 +1,34 @@
import {Cordova, Plugin} from './plugin';
/**
* @name Crop
* @description Crops images
* @usage
* ```
* import {Crop} from 'ionic-native';
*
* ...
*
* Crop.crop('path/to/image.jpg', {quality: 75})
* .then(
* newImage => console.log("new image path is: " + newImage),
* error => console.error("Error cropping image", error)
* );
* ```
*/
@Plugin({
plugin: 'cordova-plugin-crop',
pluginRef: 'plugins',
repo: 'https://github.com/jeduan/cordova-plugin-crop'
})
export class Crop {
/**
* Crops an image
* @param pathToImage
* @param options
* @return {Promise<string>} Returns a promise that resolves with the new image path, or rejects if failed to crop.
*/
@Cordova({
callbackOrder: 'reverse'
})
static crop(pathToImage: string, options?: {quality: number}): Promise<string> {return; }
}

View File

@@ -1,5 +1,6 @@
import { Cordova, Plugin } from './plugin';
export interface DatePickerOptions {
/**
* Platforms: iOS, Android, Windows
@@ -73,16 +74,16 @@ export interface DatePickerOptions {
* Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker).
*
* @usage
* ```js
* import {DatePicker} from 'ionic-native';
* ```typescript
* import { DatePicker } from 'ionic-native';
*
*
* DatePicker.show({
* date: new Date(),
* mode: 'date'
* }).then(
* date => console.log("Got date: ", date),
* err => console.log("Error occurred while getting date:", err)
* date => console.log('Got date: ', date),
* err => console.log('Error occurred while getting date: ', err)
* );
* ```
*

View File

@@ -6,9 +6,8 @@ import { Observable } from 'rxjs/Observable';
* @name DB Meter
* @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
* @usage
* ```ts
* import {DBMeter} from 'ionic-native';
*
* ```typescript
* import { DBMeter } from 'ionic-native';
*
*
* // Start listening
@@ -18,7 +17,7 @@ import { Observable } from 'rxjs/Observable';
*
* // Check if we are listening
* DBMeter.isListening().then(
* (isListening : boolean) => console.log(isListening)
* (isListening: boolean) => console.log(isListening)
* );
*
* // Stop listening
@@ -26,8 +25,8 @@ import { Observable } from 'rxjs/Observable';
*
* // Delete DBMeter instance from memory
* DBMeter.delete().then(
* () => console.log("Deleted DB Meter instance"),
* error => console.log("Error occurred while deleting DB Meter instance")
* () => console.log('Deleted DB Meter instance'),
* error => console.log('Error occurred while deleting DB Meter instance')
* );
* ```
*/

View File

@@ -27,8 +27,8 @@ export interface DeeplinkMatch {
* and Universal App Links.
*
* @usage
* ```ts
* import {IonicDeeplinks} from 'ionic-native';
* ```typescript
* import { IonicDeeplinks } from 'ionic-native';
*
* ```
*/
@@ -77,4 +77,5 @@ export class Deeplinks {
observable: true
})
static routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
}

View File

@@ -33,9 +33,8 @@ export interface Device {
* Access information about the underlying device and platform.
*
* @usage
* ```js
* import {Device} from 'ionic-native';
*
* ```typescript
* import { Device } from 'ionic-native';
*
*
* console.log('Device UUID is: ' + Device.device.uuid);
@@ -55,4 +54,5 @@ export class Device {
*/
@CordovaProperty
static get device() { return window.device; }
}

View File

@@ -32,4 +32,5 @@ export class DeviceAccounts {
*/
@Cordova()
static getEmail(): Promise<any> { return; }
}

View File

@@ -41,19 +41,18 @@ export interface AccelerometerOptions {
* Requires Cordova plugin: `cordova-plugin-device-motion`. For more info, please see the [Device Motion docs](https://github.com/apache/cordova-plugin-device-motion).
*
* @usage
* ```ts
* import {DeviceMotion} from 'ionic-native';
*
* ```typescript
* import { DeviceMotion } from 'ionic-native';
*
*
* // Get the device current acceleration
* DeviceMotion.getCurrentAcceleration().then(
* acceleration => console.log(acceleration),
* error => console.log(error)
* (acceleration: AccelerationData) => console.log(acceleration),
* (error: any) => console.log(error)
* );
*
* // Watch device acceleration
* var subscription = DeviceMotion.watchAcceleration().subscribe(acceleration => {
* var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: AccelerationData) => {
* console.log(acceleration);
* });
*
@@ -87,4 +86,5 @@ export class DeviceMotion {
clearFunction: 'clearWatch'
})
static watchAcceleration(options?: AccelerometerOptions): Observable<AccelerationData> { return; }
}

View File

@@ -46,20 +46,20 @@ export interface CompassOptions {
* Requires Cordova plugin: `cordova-plugin-device-orientation`. For more info, please see the [Device Orientation docs](https://github.com/apache/cordova-plugin-device-orientation).
*
* @usage
* ```ts
* import {DeviceOrientation} from 'ionic-native';
*
* ```typescript
* // CompassHeading is an interface for compass
* import { DeviceOrientation, CompassHeading } from 'ionic-native';
*
*
* // Get the device current compass heading
* DeviceOrientation.getCurrentHeading().then(
* data => console.log(data),
* error => console.log(error)
* (data: CompassHeading) => console.log(data),
* (error: any) => console.log(error)
* );
*
* // Watch the device compass heading change
* var subscription = DeviceOrientation.watchHeading().subscribe(
* data => console.log(data)
* (data: CompassHeading) => console.log(data)
* );
*
* // Stop watching heading change

View File

@@ -1,6 +1,15 @@
import { Cordova, Plugin } from './plugin';
/**
* @name Diagnostic
* @description
* Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi
*
* @usage
* ```typescript
* import { Diagnostic } from 'ionic-native';
* ```
*/
@Plugin({
plugin: 'cordova.plugins.diagnostic',
pluginRef: 'cordova.plugins.diagnostic',
@@ -11,28 +20,28 @@ export class Diagnostic {
* Checks if app is able to access device location.
*/
@Cordova()
static isLocationEnabled(): Promise<any> { return; }
static isLocationAvailable(): Promise<any> { return; }
/**
* Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
* On Android this requires permission. `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />`
*/
@Cordova()
static isWifiEnabled(): Promise<any> { return; }
static isWifiAvailable(): Promise<any> { return; }
/**
* Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
* application is authorized to use it.
*/
@Cordova()
static isCameraEnabled(): Promise<any> { return; }
static isCameraAvailable(): Promise<any> { return; }
/**
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
* On Android this requires permission <uses-permission android:name="android.permission.BLUETOOTH" />
*/
@Cordova()
static isBluetoothEnabled(): Promise<any> { return; }
static isBluetoothAvailable(): Promise<any> { return; }
/**
* Returns the location authorization status for the application.
@@ -95,4 +104,5 @@ export class Diagnostic {
*/
@Cordova()
static isRegisteredForRemoteNotifications(): Promise<any> { return; }
}

View File

@@ -23,8 +23,8 @@ export interface PromptCallback {
* Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the [Dialogs plugin docs](https://github.com/apache/cordova-plugin-dialogs).
*
* @usage
* ```js
* import {Dialogs} from 'ionic-native';
* ```typescript
* import { Dialogs } from 'ionic-native';
*
*
*

View File

@@ -10,13 +10,14 @@ declare var cordova: any;
* Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/katzer/cordova-plugin-email-composer).
*
* DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version.
* A good alternative to this plugin is the social sharing plugin.
*
* @usage
* ```ts
* import {EmailComposer} from 'ionic-native';
* ```typescript
* import { EmailComposer } from 'ionic-native';
*
*
* EmailComposer.isAvailable().then((available) =>{
* EmailComposer.isAvailable().then((available: boolean) =>{
* if(available) {
* //Now we know we can send
* }

View File

@@ -69,8 +69,8 @@ import { Cordova, Plugin } from './plugin';
* For tracking events, see `logEvent` and `logPurchase`.
*
* @usage
* ```js
* import {Facebook} from 'ionic-native';
* ```typescript
* import { Facebook } from 'ionic-native';
*
*
*
@@ -98,7 +98,7 @@ export class Facebook {
/**
* Login to Facebook to authenticate this app.
*
* ```ts
* ```typescript
* {
* status: "connected",
* authResponse: {
@@ -245,7 +245,9 @@ export class Facebook {
url: string,
picture: string
}): Promise<any> { return; }
}
export interface FacebookLoginResponse {
status: string;
authResponse: {

File diff suppressed because it is too large Load Diff

View File

@@ -112,25 +112,42 @@ export interface FileTransferError {
* This plugin allows you to upload and download files.
*
* @usage
* ```typescript
* import { Transfer } from 'ionic-native';
*
* Create instance:
* ```ts
*
* // Create instance:
* const fileTransfer = new Transfer();
* ```
*
* Upload a file:
* ```ts
* // Upload a file:
* fileTransfer.upload(..).then(..).catch(..);
* ```
*
* Download a file:
* ```ts
* // Download a file:
* fileTransfer.download(..).then(..).catch(..);
* ```
*
* Abort active transfer:
* ```ts
* // Abort active transfer:
* fileTransfer.abort();
*
* E.g
*
* upload(){
* const fileTransfer = new Transfer();
* var options: any;
*
* options = {
* fileKey: 'file',
* fileName: 'name.jpg',
* headers: {}
* .....
* }
* fileTransfer.upload("<file path>", "<api endpoint>", options)
* .then((data) => {
* // success
* }, (err) => {
* // error
* })
* }
*
* ```
*
*/

View File

@@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin).
*
* @usage
* ```js
* import {Flashlight} from 'ionic-native';
* ```typescript
* import { Flashlight } from 'ionic-native';
*
*
*
@@ -53,7 +53,7 @@ export class Flashlight {
/**
* Checks if the flashlight is turned on.
* Returns a boolean
* @returns {boolean}
*/
@Cordova({
sync: true

View File

@@ -102,20 +102,19 @@ export interface GeolocationOptions {
*
* @usage
*
* ```ts
* import {Geolocation} from 'ionic-native';
*
* ```typescript
* import { Geolocation } from 'ionic-native';
*
*
* Geolocation.getCurrentPosition().then((resp) => {
* //resp.coords.latitude
* //resp.coords.longitude
* // resp.coords.latitude
* // resp.coords.longitude
* })
*
* let watch = Geolocation.watchPosition();
* watch.subscribe((data) => {
* //data.coords.latitude
* //data.coords.longitude
* // data.coords.latitude
* // data.coords.longitude
* })
* ```
*/
@@ -140,7 +139,7 @@ export class Geolocation {
* Watch the current device's position. Clear the watch by unsubscribing from
* Observable changes.
*
* ```ts
* ```typescript
* var subscription = Geolocation.watchPosition().subscribe(position => {
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
* });

View File

@@ -4,9 +4,8 @@ import { Cordova, Plugin } from './plugin';
* @name Globalization
* @description
* @usage
* ```js
* import {Globalization} from 'ionic-native';
*
* ```typescript
* import { Globalization } from 'ionic-native';
*
*
* ```

View File

@@ -5,7 +5,9 @@ import { Cordova, Plugin } from './plugin';
* @name Google Plus
* @description
* @usage
* ```
* ```typescript
* import { GooglePlus } from 'ionic-native';
*
*
* ```
*/

View File

@@ -31,10 +31,11 @@ export class GoogleAnalytics {
* Track a screen
* https://developers.google.com/analytics/devguides/collection/analyticsjs/screens
*
* @param {string} title Screen title
* @param {string} title Screen title
* @param {string} campaignUrl Campaign url for measuring referrals
*/
@Cordova()
static trackView(title: string): Promise<any> { return; }
static trackView(title: string, campaignUrl?: string): Promise<any> { return; }
/**
* Track an event

View File

@@ -46,14 +46,16 @@ export const GoogleMapsAnimation = {
* @description This plugin uses the native Google Maps SDK
* @usage
* ```
* import {GoogleMap, GoogleMapsEvent} from 'ionic-native';
* import { GoogleMap, GoogleMapsEvent } from 'ionic-native';
*
* ...
*
* // somewhere in your component
* let map = new GoogleMap('elementID');
* let map = new GoogleMap('elementID', {
* // Map Options: https://developers.google.com/maps/documentation/javascript/3.exp/reference#MapOptions
});
*
* map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log("Map is ready!"));
* map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!'));
* ```
*/
@Plugin({
@@ -65,8 +67,9 @@ export class GoogleMap {
_objectInstance: any;
/**
* Checks if a map object has been created.
* @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates if the plugin is available.
* Checks if a map object has been created and is available.
*
* @return {Promise<boolean>}
*/
@Cordova()
static isAvailable(): Promise<boolean> {
@@ -77,6 +80,11 @@ export class GoogleMap {
this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId), options);
}
/**
* Listen to a map event.
*
* @return {Observable<any>}
*/
on(event: any): Observable<any> {
return new Observable(
(observer) => {
@@ -86,13 +94,17 @@ export class GoogleMap {
);
}
/**
* Listen to a map event only once.
*
* @return {Promise<any>}
*/
one(event: any): Promise<any> {
return new Promise<any>(
resolve => this._objectInstance.one(event, resolve)
);
}
@CordovaInstance({ sync: true })
setDebuggable(isDebuggable: boolean): void {
}
@@ -102,7 +114,9 @@ export class GoogleMap {
}
/**
* Get the position of the camera
* Get the position of the camera.
*
* @return {Promise<CameraPosition>}
*/
@CordovaInstance()
getCameraPosition(): Promise<CameraPosition> {
@@ -110,15 +124,19 @@ export class GoogleMap {
}
/**
* Get the location of the user
* Get the location of the user.
*
* @return {Promise<MyLocation>}
*/
@CordovaInstance()
getMyLocation(): Promise<MyLocation> {
getMyLocation(options?: MyLocationOptions): Promise<MyLocation> {
return;
}
/**
* Get the visible region
* Get the visible region.
*
* @return {Promise<VisibleRegion>}
*/
@CordovaInstance()
getVisibleRegion(): Promise<VisibleRegion> {
@@ -343,6 +361,13 @@ export interface MyLocation {
bearing?: number;
}
/**
* @private
*/
export interface MyLocationOptions {
enableHighAccuracy?: boolean;
}
/**
* @private
*/
@@ -1013,13 +1038,24 @@ export interface GeocoderRequest {
* @private
*/
export interface GeocoderResult {
adminArea?: string;
country?: string;
countryCode?: string;
extra?: {
featureName?: string;
lines?: Array<string>;
permises?: string;
phone?: string;
url?: string
},
locale?: string;
locality?: string;
position?: { lat: number; lng: number };
postalCode?: string;
subAdminArea?: string;
subLocality?: string;
subThoroughfare?: string;
thoroughfare?: string;
locality?: string;
adminArea?: string;
postalCode?: string;
country?: string;
}
/**
* @private
@@ -1032,8 +1068,11 @@ export class Geocoder {
*/
static geocode(request: GeocoderRequest): Promise<GeocoderResult[]> {
return new Promise<GeocoderResult[]>((resolve, reject) => {
if (!plugin || !plugin.google || !plugin.google.maps || !plugin.google.maps.Geocoder) reject({ error: 'plugin_not_installed' });
else plugin.google.maps.Geocoder.geocode(request, resolve);
if (!plugin || !plugin.google || !plugin.google.maps || !plugin.google.maps.Geocoder) {
reject({ error: 'plugin_not_installed' });
} else {
plugin.google.maps.Geocoder.geocode(request, resolve);
}
});
}
}

View File

@@ -4,14 +4,13 @@ import { Cordova, Plugin } from './plugin';
* @name Hotspot
* @description
* @usage
* ```js
* import {Hotspot, Network} from 'ionic-native';
* ```typescript
* import { Hotspot, Network } from 'ionic-native';
*
* ...
* Hotspot.scanWifi().then((networks: Array<Network>) => {
* console.log(networks);
* });
* ...
*
* Hotspot.scanWifi().then((networks: Array<Network>) => {
* console.log(networks);
* });
*
* ```
*/

View File

@@ -7,6 +7,20 @@ import { Observable } from 'rxjs/Observable';
* @description
* Embedded httpd for Cordova apps. Light weight HTTP server.
* @usage
* ```typescript
* import {Httpd, HttpdOptions} from 'ionic-native';
*
* let options: HttpdOptions = {
* www_root: 'httpd_root', // relative path to app's www directory
* port: 80,
* localhost_only: false
* };
*
* Httpd.startServer(options).subscribe((data) => {
* console.log('Server is live');
* });
*
* ```
*/
@Plugin({
plugin: 'https://github.com/floatinghotpot/cordova-httpd.git',
@@ -25,7 +39,7 @@ export class Httpd {
observable: true,
clearFunction: 'stopServer'
})
static startServer(options: any): Observable<string> { return; }
static startServer(options?: any): Observable<string> { return; }
/**
* Gets the URL of the running server

View File

@@ -231,8 +231,8 @@ export interface Delegate {
*
* @usage
*
* ```ts
* import {IBeacon} from 'ionic-native';
* ```typescript
* import { IBeacon } from 'ionic-native';
*
*
* // Request permission to use location on iOS
@@ -243,13 +243,13 @@ export interface Delegate {
* // Subscribe to some of the delegate's event handlers
* delegate.didRangeBeaconsInRegion()
* .subscribe(
* data => {console.log('didRangeBeaconsInRegion: ', data)},
* error => console.error
* data => console.log('didRangeBeaconsInRegion: ', data),
* error => console.error();
* );
* delegate.didStartMonitoringForRegion()
* .subscribe(
* data => {console.log('didStartMonitoringForRegion: ', data)},
* error => console.error
* data => console.log('didStartMonitoringForRegion: ', data),
* error => console.error();
* );
* delegate.didEnterRegion()
* .subscribe(
@@ -419,7 +419,7 @@ export class IBeacon {
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the request and started to send events.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static onDomDelegateReady(): Promise<void> { return; }
/**
@@ -427,7 +427,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved with a {Boolean}
* indicating whether bluetooth is active.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static isBluetoothEnabled(): Promise<boolean> { return; }
/**
@@ -436,7 +436,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved when Bluetooth
* could be enabled. If not, the promise will be rejected with an error.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static enableBluetooth(): Promise<void> { return; }
/**
@@ -445,7 +445,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved when Bluetooth
* could be enabled. If not, the promise will be rejected with an error.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static disableBluetooth(): Promise<void> { return; }
/**
@@ -465,7 +465,7 @@ export class IBeacon {
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the monitoring request.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static startMonitoringForRegion(region: BeaconRegion): Promise<string> { return; }
/**
@@ -482,7 +482,7 @@ export class IBeacon {
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the request to stop monitoring.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static stopMonitoringForRegion(region: BeaconRegion): Promise<void> { return; }
/**
@@ -498,7 +498,7 @@ export class IBeacon {
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the request to stop monitoring.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static requestStateForRegion(region: Region): Promise<void> { return; }
@@ -516,7 +516,7 @@ export class IBeacon {
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the monitoring request.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static startRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
/**
@@ -533,7 +533,7 @@ export class IBeacon {
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the request to stop monitoring.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static stopRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
/**
@@ -542,7 +542,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved with the
* requested authorization status.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static getAuthorizationStatus(): Promise<any> { return; }
/**
@@ -554,7 +554,7 @@ export class IBeacon {
* If you are using this plugin on Android devices only, you will never have to use this, nor {@code requestAlwaysAuthorization}
* @returns Returns a promise that is resolved when the request dialog is shown.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static requestWhenInUseAuthorization(): Promise<void> { return; }
@@ -564,7 +564,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved when the native layer
* shows the request dialog.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static requestAlwaysAuthorization(): Promise<void> { return; }
/**
@@ -572,7 +572,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved with an {Array}
* of {Region} instances that are being monitored by the native layer.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static getMonitoredRegions(): Promise<Region[]> { return; }
/**
@@ -580,7 +580,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved with an {Array}
* of {Region} instances that are being ranged by the native layer.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static getRangedRegions(): Promise<Region[]> { return; }
/**
@@ -588,7 +588,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved with a {Boolean}
* indicating whether ranging is available or not.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static isRangingAvailable(): Promise<boolean> { return; }
/**
@@ -600,7 +600,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved with a {Boolean}
* indicating whether the region type is supported or not.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static isMonitoringAvailableForClass(region: Region): Promise<boolean> { return; }
/**
@@ -620,7 +620,7 @@ export class IBeacon {
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the advertising request.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static startAdvertising(region: Region, measuredPower: number): Promise<void> { return; }
/**
@@ -631,7 +631,7 @@ export class IBeacon {
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the request to stop advertising.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static stopAdvertising(region: Region): Promise<void> { return; }
/**
@@ -639,7 +639,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved with a {Boolean}
* indicating whether advertising is available or not.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static isAdvertisingAvailable(): Promise<boolean> { return; }
/**
@@ -647,7 +647,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved with a {Boolean}
* indicating whether advertising is active.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static isAdvertising(): Promise<boolean> { return; }
/**
@@ -657,7 +657,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved as soon as the
* native layer has set the logging level accordingly.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static disableDebugLogs(): Promise<void> { return; }
/**
@@ -668,7 +668,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved as soon as the
* native layer has set the flag to enabled.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static enableDebugNotifications(): Promise<void> { return; }
/**
@@ -678,7 +678,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved as soon as the
* native layer has set the flag to disabled.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static disableDebugNotifications(): Promise<void> { return; }
/**
@@ -688,7 +688,7 @@ export class IBeacon {
* @returns Returns a promise which is resolved as soon as the
* native layer has set the logging level accordingly.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static enableDebugLogs(): Promise<void> { return; }
/**
@@ -701,7 +701,7 @@ export class IBeacon {
* message received by the native layer for appending. The returned message
* is expected to be equivalent to the one provided in the original call.
*/
@Cordova({sync: true})
@Cordova({otherPromise: true})
static appendToDeviceLog(message: string): Promise<void> { return; }
}

View File

@@ -27,8 +27,8 @@ export interface ImagePickerOptions {
* For more info, please see the https://github.com/wymsee/cordova-imagePicker
*
* @usage
* ```js
* import {ImagePicker} from 'ionic-native';
* ```typescript
* import { ImagePicker } from 'ionic-native';
*
*
*
@@ -36,8 +36,7 @@ export interface ImagePickerOptions {
* for (var i = 0; i < results.length; i++) {
* console.log('Image URI: ' + results[i]);
* }
* }, (err) => {
* });
* }, (err) => { });
* ```
*/
@Plugin({

View File

@@ -0,0 +1,77 @@
import { Cordova, Plugin } from './plugin';
export interface ImageResizerOptions {
/**
* The URI for the image on the device to get scaled
*/
uri: string;
/**
* The width of the new image
*/
width: number;
/**
* The height of the new image
*/
height: number;
/**
* The name of the folder the image should be put
* (Android only)
*/
folderName?: string;
/**
*
* Quality given as Number for the quality of the new image
* (Android and iOS only)
*/
quality?: number;
/**
* A custom name for the file. Default name is a timestamp
* (Android and Windows only)
*/
fileName?: string;
}
/**
* @name ImageResizer
* @description
* Cordova Plugin For Image Resize
*
* Requires plugin `info.protonet.imageresizer` - use the Ionic CLI and type in the following command:
* `ionic plugin add https://github.com/protonet/cordova-plugin-image-resizer.git`
*
* For more info, please see the https://github.com/protonet/cordova-plugin-image-resizer
*
* @usage
* ```typescript
* import { ImageResizer, ImageResizerOptions } from 'ionic-native';
*
* let options = {
* uri: uri,
* folderName: 'Protonet',
* quality: 90,
* width: 1280,
* height: 1280
* } as ImageResizerOptions;
*
* ImageResizer
* .resize(options)
* .then(
* (filePath: string) => { console.log('FilePath', filePath); },
* () => { console.log('Error occured'); }
* )
* ```
*/
@Plugin({
plugin: 'https://github.com/protonet/cordova-plugin-image-resizer.git',
pluginRef: 'ImageResizer',
repo: 'https://github.com/protonet/cordova-plugin-image-resizer'
})
export class ImageResizer {
@Cordova()
static resize(options: ImageResizerOptions): Promise<any> { return; }
}

View File

@@ -1,5 +1,6 @@
import { Cordova, Plugin } from './plugin';
import { Plugin, CordovaInstance } from './plugin';
import { Observable } from 'rxjs/Observable';
declare var cordova: any;
export interface InAppBrowserEvent extends Event {
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
@@ -11,66 +12,36 @@ export interface InAppBrowserEvent extends Event {
/** the error message, only in the case of loaderror. */
message: string;
}
export interface InAppBrowserRef {
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener(type: string, callback: (event: InAppBrowserEvent) => void);
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener(type: string, callback: (event: InAppBrowserEvent) => void);
/** Closes the InAppBrowser window. */
close();
/**
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
* if the InAppBrowser was already visible.
*/
show();
/**
* Injects JavaScript code into the InAppBrowser window.
* @param script Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the JavaScript code is injected.
* If the injected script is of type code, the callback executes with
* a single parameter, which is the return value of the script, wrapped in an Array.
* For multi-line scripts, this is the return value of the last statement,
* or the last expression evaluated.
*/
executeScript(script: { file?: string, code?: string }, callback?: (result?: any) => void);
/**
* Injects CSS into the InAppBrowser window.
* @param css Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the CSS is injected.
*/
insertCSS(css: { file?: string, code?: string }, callback?: () => void);
}
/**
* @name InAppBrowser
* @description Launches in app Browser
* @usage
* ```typescript
* import {InAppBrowser} from 'ionic-native';
*
*
* ...
*
*
* let browser = new InAppBrowser('https://ionic.io', '_system');
* browser.executeScript(...);
* browser.insertCSS(...);
* browser.close();
* ```
*/
@Plugin({
plugin: 'cordova-plugin-inappbrowser',
pluginRef: 'cordova.InAppBrowser'
pluginRef: 'cordova.InAppBrowser',
repo: 'https://github.com/apache/cordova-plugin-inappbrowser'
})
export class InAppBrowser {
static open(url: string, target?: string, options?: string): void {
console.warn('Native: Your current usage of the InAppBrowser plugin is depreciated as of ionic-native@1.3.8. Please check the Ionic Native docs for the latest usage details.');
}
private _objectInstance: any;
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
@@ -79,9 +50,54 @@ export class InAppBrowser {
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
@Cordova({
sync: true
})
static open(url: string, target?: string, options?: string): InAppBrowserRef { return; }
constructor(url: string, target?: string, options?: string) {
try {
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
} catch (e) {
window.open(url);
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open, all instance methods will NOT work.');
}
}
/**
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
* if the InAppBrowser was already visible.
*/
@CordovaInstance({sync: true})
show(): void { }
/**
* Closes the InAppBrowser window.
*/
@CordovaInstance({sync: true})
close(): void { }
/**
* Injects JavaScript code into the InAppBrowser window.
* @param script Details of the script to run, specifying either a file or code key.
*/
@CordovaInstance()
executeScript(script: {file?: string, code?: string}): Promise<any> {return; }
/**
* Injects CSS into the InAppBrowser window.
* @param css Details of the script to run, specifying either a file or code key.
*/
@CordovaInstance()
insertCss(css: {file?: string, code?: string}): Promise<any> {return; }
/**
* A method that allows you to listen to events happening in the browser.
* @param event Event name
* @returns {Observable<any>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
*/
on(event: string): Observable<InAppBrowserEvent> {
return new Observable<InAppBrowserEvent>((observer) => {
this._objectInstance.addEventListener(event, observer.next.bind);
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
});
}
}

View File

@@ -7,8 +7,9 @@ import { Cordova, Plugin } from './plugin';
* Prevent the screen of the mobile device from falling asleep.
*
* @usage
* ```js
* import {Insomnia} from 'ionic-native';
* ```typescript
* import { Insomnia } from 'ionic-native';
*
*
* Insomnia.keepAwake()
* .then(

View File

@@ -6,8 +6,8 @@ import { Observable } from 'rxjs/Observable';
* @name Keyboard
* @description
* @usage
* ```js
* import {Keyboard} from 'ionic-native';
* ```typescript
* import { Keyboard } from 'ionic-native';
*
*
*
@@ -24,9 +24,8 @@ export class Keyboard {
* Hide the keyboard accessory bar with the next, previous and done buttons.
* @param hide {boolean}
*/
static hideKeyboardAccessoryBar(hide: boolean): void {
console.log('hideKeyboardAccessoryBar method has been removed temporarily.');
}
@Cordova({sync: true})
static hideKeyboardAccessoryBar(hide: boolean): void { }
/**
* Force keyboard to be shown.

View File

@@ -66,18 +66,18 @@ export interface LaunchNavigatorOptions {
* @usage
* Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper.
*
* ```js
* import {LaunchNavigator, LaunchNavigatorOptions} from 'ionic-native';
* ```typescript
* import { LaunchNavigator, LaunchNavigatorOptions } from 'ionic-native';
*
* let options: LaunchNavigatorOptions = {
* start: 'London, ON',
* app: LaunchNavigator.APPS.UBER
* };
*
* LaunchNavigator.navigate("Toronto, ON", options)
* LaunchNavigator.navigate('Toronto, ON', options)
* .then(
* success => console.log("Launched navigator"),
* error => console.log("Error launching navigator", error)
* success => console.log('Launched navigator'),
* error => console.log('Error launching navigator', error)
* );
* ```
*/

View File

@@ -7,16 +7,15 @@ import { Cordova, Plugin } from './plugin';
* This plugin allows you to display local notifications on the device
*
* @usage
* ```ts
* import {LocalNotifications} from 'ionic-native';
*
* ```typescript
* import { LocalNotifications } from 'ionic-native';
*
*
* // Schedule a single notification
* LocalNotifications.schedule({
* id: 1,
* text: "Single Notification",
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf'
* text: 'Single Notification',
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf',
* data: { secret: key }
* });
*
@@ -24,22 +23,22 @@ import { Cordova, Plugin } from './plugin';
* // Schedule multiple notifications
* LocalNotifications.schedule([{
* id: 1,
* text: "Multi Notification 1",
* text: 'Multi Notification 1',
* sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf',
* data: { secret:key }
* },{
* id: 2,
* title: "Local Notification Example",
* text: "Multi Notification 2",
* icon: "http://example.com/icon.png"
* title: 'Local Notification Example',
* text: 'Multi Notification 2',
* icon: 'http://example.com/icon.png'
* }]);
*
*
* // Schedule delayed notification
* LocalNotifications.schedule({
* text: "Delayed Notification",
* text: 'Delayed Notification',
* at: new Date(new Date().getTime() + 3600),
* led: "FF0000",
* led: 'FF0000',
* sound: null
* });
* ```

View File

@@ -9,9 +9,8 @@ declare var navigator: any;
* @description
* @usage
* ```typescript
* import {MediaCapture} from 'ionic-native';
* import { MediaCapture } from 'ionic-native';
*
* ...
*
* let options: CaptureImageOptions = { limit: 3 };
* MediaCapture.captureImage(options)

View File

@@ -8,22 +8,22 @@ declare var Media: any;
* @name MediaPlugin
* @description
* @usage
* ```ts
* import {MediaPlugin} from 'ionic-native';
* ```typescript
* import { MediaPlugin } from 'ionic-native';
*
*
*
* // Create a MediaPlugin instance. Expects path to file or url as argument
* var file = new MediaPlugin("path/to/file.mp3");
* var file = new MediaPlugin('path/to/file.mp3');
*
* // Catch the Success & Error Output
* // Platform Quirks
* // iOS calls success on completion of playback only
* // Android calls success on completion of playback AND on release()
* file.init.then(() => {
* console.log("Playback Finished");
* console.log('Playback Finished');
* }, (err) => {
* console.log("somthing went wrong! error code: "+err.code+" message: "+err.message);
* console.log('somthing went wrong! error code: ' + err.code + ' message: ' + err.message);
* });
*
* // play the file
@@ -55,7 +55,7 @@ declare var Media: any;
* file.release();
*
* // Recording to a file
* var newFile = new MediaPlugin("path/to/file.mp3");
* var newFile = new MediaPlugin('path/to/file.mp3');
* newFile.startRecord();
*
* newFile.stopRecord();

View File

@@ -2,12 +2,12 @@ import { Cordova, Plugin } from './plugin';
/**
* @name Native Storage
* @description
* @name NativeStorage
* @description Native storage of variables in Android and iOS
*
* @usage
* ```typescript
* import {NativeStorage} from 'ionic-native';
* import { NativeStorage } from 'ionic-native';
*
* NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
* .then(
@@ -30,7 +30,7 @@ import { Cordova, Plugin } from './plugin';
export class NativeStorage {
/**
* Stores a value
* @param reference
* @param reference {string}
* @param value
*/
@Cordova()
@@ -38,14 +38,14 @@ export class NativeStorage {
/**
* Gets a stored item
* @param reference
* @param reference {string}
*/
@Cordova()
static getItem(reference: string): Promise<any> {return; }
/**
* Removes a single stored item
* @param reference
* @param reference {string}
*/
@Cordova()
static remove(reference: string): Promise<any> {return; }

View File

@@ -10,12 +10,12 @@ declare var navigator: any;
* Requires Cordova plugin: cordova-plugin-network-information. For more info, please see the [Network plugin docs](https://github.com/apache/cordova-plugin-network-information).
*
* @usage
* ```js
* import {Network} from 'ionic-native';
* ```typescript
* import { Network } from 'ionic-native';
*
* // watch network for a disconnect
* let disconnectSubscription = Network.onDisconnect().subscribe(() => {
* console.log('network was disconnected :-( ')
* console.log('network was disconnected :-(');
* });
*
* // stop disconnect watch
@@ -24,9 +24,9 @@ declare var navigator: any;
*
* // watch network for a connection
* let connectSubscription = 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 (Network.connection === 'wifi') {
@@ -54,7 +54,7 @@ export class Network {
* Return the network connection type
*/
@CordovaProperty
static get connection(): String { return navigator.connection.type; }
static get connection(): string { return navigator.connection.type; }
/**
* Get notified when the device goes offline

View File

@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
@@ -10,15 +11,16 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `onesignal-cordova-plugin`. For more info, please see the [OneSignal Cordova Docs](https://documentation.onesignal.com/docs/phonegap-sdk-installation).
*
* @usage
* ```ts
* import {OneSignal} from 'ionic-native';
* ```typescript
* import { OneSignal } from 'ionic-native';
*
* let notificationOpenedCallback(jsonData: any) {
* console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
* };
* OneSignal.init("b2f7f966-d8cc-11e4-bed1-df8f05be55ba",
* {googleProjectNumber: "703322744261"},
* notificationOpenedCallback);
*
* OneSignal.init('b2f7f966-d8cc-11e4-bed1-df8f05be55ba',
* {googleProjectNumber: '703322744261'},
* notificationOpenedCallback);
*
* OneSignal.enableInAppAlertNotification(true);
* ```
@@ -27,8 +29,7 @@ import { Cordova, Plugin } from './plugin';
@Plugin({
plugin: 'onesignal-cordova-plugin',
pluginRef: 'plugins.OneSignal',
repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK',
platforms: ['Android', 'iOS', 'Windows Phone 8']
repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK'
})
export class OneSignal {
@@ -37,14 +38,14 @@ export class OneSignal {
*
* @param {appId} Your AppId from your OneSignal app
* @param {options} The Google Project Number (which you can get from the Google Developer Potal) and the autoRegister option.
* @returns {Promise} Returns a Promise that resolves when remote notification was recieved.
* @returns {Observable} when a notification is received. Handle your notification action here.
*/
@Cordova()
@Cordova({ observable: true })
static init(appId: string,
options: {
googleProjectNumber: string,
autoRegister: boolean
}): Promise<any> { return; }
}): Observable<any> { return; }
/**
@@ -252,4 +253,4 @@ export class OneSignal {
visualLevel: number
}): void { }
}
}

View File

@@ -0,0 +1,28 @@
import { Plugin, Cordova } from './plugin';
/**
* @name Photo Viewer
* @description This plugin can display your image in full screen with the ability to pan, zoom, and share the image.
* @usage
* ```typescript
* import { PhotoViewer } from 'ionic-native';
*
* PhotoViewer.show('https://mysite.com/path/to/image.jpg');
*
* PhotoViewer.show('https://mysite.com/path/to/image.jpg', 'My image title', {share: false});
* ```
*/
@Plugin({
plugin: 'com-sarriaroman-photoviewer',
pluginRef: 'PhotoViewer',
repo: 'https://github.com/sarriaroman/photoviewer'
})
export class PhotoViewer {
/**
* Shows an image in full screen
* @param url {string} URL or path to image
* @param title {string}
* @param options {any}
*/
@Cordova({sync: true})
show(url: string, title?: string, options?: {share?: boolean; }): void { }
}

View File

@@ -7,14 +7,13 @@ import { Cordova, Plugin } from './plugin';
*
* @usage
* ```typescript
* import {PinDialog} from 'ionic-native';
* import { PinDialog } from 'ionic-native';
*
* ...
*
* PinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel'])
* .then(
* (result: any) => {
* if(result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1);
* if (result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1);
* else if(result.buttonIndex == 2) console.log('User cancelled');
* }
* );

View File

@@ -1,10 +1,10 @@
import { get } from '../util';
import { Observable } from 'rxjs/Observable';
declare var window;
declare var Promise;
declare var $q;
import {Observable} from 'rxjs/Observable';
/**
* @private
@@ -88,15 +88,15 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
}
function getPromise(cb) {
if (window.Promise) {
return new Promise((resolve, reject) => {
cb(resolve, reject);
});
} else if (window.angular) {
if (window.angular) {
let $q = window.angular.injector(['ng']).get('$q');
return $q((resolve, reject) => {
cb(resolve, reject);
});
} else if (window.Promise) {
return new Promise((resolve, reject) => {
cb(resolve, reject);
});
} else {
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.');
}
@@ -230,7 +230,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
* Class decorator specifying Plugin metadata. Required for all plugins.
*
* @usage
* ```ts
* ```typescript
* @Plugin({
* name: 'MyPlugin',
* plugin: 'cordova-plugin-myplugin',

View File

@@ -40,8 +40,26 @@ export interface PrintOptions {
*/
bounds?: number[] | any;
}
/**
* @name Printer
* @description Prints documents or HTML rendered content
* @usage
* ```typescript
* import {Printer, PrintOptions} from 'ionic-native';
*
* Printer.isAvailable().then(onSuccess, onError);
*
* let options: PrintOptions = {
* name: 'MyDocument',
* printerId: 'printer007',
* duplex: true,
* landscape: true,
* grayscale: true
* };
*
* Printer.print(content, options).then(onSuccess, onError);
* ```
*/
@Plugin({
plugin: 'de.appplant.cordova.plugin.printer',
pluginRef: 'cordova.plugins.printer',

View File

@@ -65,19 +65,19 @@ export interface PushNotification {
* @param event
* @param callback
*/
on(event: "registration", callback: (response: RegistrationEventResponse) => any): void;
on(event: 'registration', callback: (response: RegistrationEventResponse) => any): void;
/**
* The event notification will be triggered each time a push notification is received by a 3rd party push service on the device.
* @param event
* @param callback
*/
on(event: "notification", callback: (response: NotificationEventResponse) => any): void;
on(event: 'notification', callback: (response: NotificationEventResponse) => any): void;
/**
* The event error will trigger when an internal error occurs and the cache is aborted.
* @param event
* @param callback
*/
on(event: "error", callback: (response: Error) => any): void;
on(event: 'error', callback: (response: Error) => any): void;
/**
*
* @param event Name of the event to listen to. See below(above) for all the event names.
@@ -87,9 +87,9 @@ export interface PushNotification {
*/
on(event: string, callback: (response: EventResponse) => any): void;
off(event: "registration", callback: (response: RegistrationEventResponse) => any): void;
off(event: "notification", callback: (response: NotificationEventResponse) => any): void;
off(event: "error", callback: (response: Error) => any): void;
off(event: 'registration', callback: (response: RegistrationEventResponse) => any): void;
off(event: 'notification', callback: (response: NotificationEventResponse) => any): void;
off(event: 'error', callback: (response: Error) => any): void;
/**
* As stated in the example, you will have to store your event handler if you are planning to remove it.
* @param event Name of the event type. The possible event names are the same as for the push.on function.
@@ -279,11 +279,8 @@ declare var PushNotification: {
* For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md).
*
* @usage
* ```js
* import {Push} from 'ionic-native';
*
*
*
* ```typescript
* import { Push } from 'ionic-native';
* ```
*/
@Plugin({
@@ -299,10 +296,10 @@ export class Push {
* ```
* var push = Push.init({
* android: {
* senderID: "12345679"
* senderID: '12345679'
* },
* ios: {
* alert: "true",
* alert: 'true',
* badge: true,
* sound: 'false'
* },

View File

@@ -6,13 +6,12 @@ import { Cordova, Plugin } from './plugin';
* @description
* @usage
* ```
* import {SafariViewController} from 'ionic-native';
* import { SafariViewController } from 'ionic-native';
*
* ...
*
* SafariViewController.isAvailable()
* .then(
* (available) => {
* (available: boolean) => {
* if(available){
*
* SafariViewController.show({
@@ -25,9 +24,9 @@ import { Cordova, Plugin } from './plugin';
* })
* .then(
* (result: any) => {
* if(result.event === 'opened') console.log("Opened");
* else if(result.event === 'loaded') console.log("Loaded");
* else if(result.event === 'closed') console.log("Closed");
* if(result.event === 'opened') console.log('Opened');
* else if(result.event === 'loaded') console.log('Loaded');
* else if(result.event === 'closed') console.log('Closed');
* },
* (error: any) => console.error(error)
* );

View File

@@ -0,0 +1,65 @@
import { Cordova, CordovaProperty, Plugin } from './plugin';
declare var window;
/**
* @name Screen Orientation
* @description
* Cordova plugin to set/lock the screen orientation in a common way for iOS, Android, WP8 and Blackberry 10.
* This plugin is based on an early version of Screen Orientation API so the api does not currently match the current spec.
*
* Requires Cordova plugin: `cordova-plugin-screen-orientation`. For more info, please see the [Screen Orientation plugin docs](https://github.com/apache/cordova-plugin-screen-orientation).
*
* @usage
* ```typescript
* import { ScreenOrientation } from 'ionic-native';
*
*
* // set to either landscape
* ScreenOrientation.lockOrientation('landscape');
*
* // allow user rotate
* ScreenOrientation.unlockOrientation();
* ```
*
*/
@Plugin({
plugin: 'cordova-plugin-screen-orientation',
pluginRef: 'window.screen',
repo: 'https://github.com/apache/cordova-plugin-screen-orientation',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
export class ScreenOrientation {
/**
* Lock the orientation to the passed value.
*
* Accepted orientation values:
* | Value | Description |
* |-------------------------------|------------------------------------------------------------------------------|
* | portrait-primary | The orientation is in the primary portrait mode. |
* | portrait-secondary | The orientation is in the secondary portrait mode. |
* | landscape-primary | The orientation is in the primary landscape mode. |
* | landscape-secondary | The orientation is in the secondary landscape mode. |
* | portrait | The orientation is either portrait-primary or portrait-secondary (sensor). |
* | landscape | The orientation is either landscape-primary or landscape-secondary (sensor). |
*
* @param {orientation} The orientation which should be locked. Accepted values see table above.
*/
@Cordova({ sync: true })
static lockOrientation(orientation: string): void { }
/**
* Unlock and allow all orientations.
*/
@Cordova({ sync: true })
static unlockOrientation(): void { }
/*
* Get the current orientation of the device.
*/
@CordovaProperty
static get orientation() {
return window.screen.orientation;
}
}

View File

@@ -2,7 +2,20 @@ import { Cordova, Plugin } from './plugin';
declare var navigator: any;
/**
* @name Screenshot
* @description Captures a screen shot
* @usage
* ```typescript
* import {Screenshot} from 'ionic-native';
*
* // Take a screenshot and save to file
* Screneshot.save('jpg', 80, 'myscreenshot.jpg').then(onSuccess, onError);
*
* // Take a screenshot and get temporary file URI
* Screneshot.URI(80).then(onSuccess, onError);
* ```
*/
@Plugin({
plugin: 'https://github.com/gitawego/cordova-screenshot.git',
pluginRef: 'navigator.screenshot',

View File

@@ -0,0 +1,90 @@
import { CordovaInstance, Plugin } from './plugin';
declare var cordova: any;
/**
* @name Secure Storage
* @description
* This plugin gets, sets and removes key,value pairs from a device's secure storage.
*
* Requires Cordova plugin: `cordova-plugin-secure-storage`. For more info, please see the [Cordova Secure Storage docs](https://github.com/Crypho/cordova-plugin-secure-storage).
*
* @usage
*
* ```typescript
* import { SecureStorage } from 'ionic-native';
*
* let secureStorage: SecureStorage = new SecureStorage();
* secureStorage.create('my_store_name')
* .then(
* () => console.log('Storage is ready!'),
* error => console.log(error)
* );
*
* secureStorage.get('myitem')
* .then(
* data => console.log(data),
* error => console.log(error)
* );
*
* secureStorage.set('myitem', 'myvalue')
* .then(
* data => console.log(data),
* error => console.log(error)
* );
*
* secureStorage.remove('myitem')
* .then(
* data => console.log(data),
* error => console.log(error)
* );
* ```
*/
@Plugin({
plugin: 'cordova-plugin-secure-storage',
pluginRef: 'plugins.securestorage',
repo: 'https://github.com/Crypho/cordova-plugin-secure-storage',
platforms: ['Android', 'iOS', 'Windows Phone', 'Browser']
})
export class SecureStorage {
private _objectInstance: any;
constructor() {}
/**
* Creates a namespaced storage.
* @param store {string}
*/
create(store: string): Promise<any> {
return new Promise((res, rej) => {
this._objectInstance = new cordova.plugins.SecureStorage(res, rej, store);
});
}
/**
* Gets a stored item
* @param reference {string}
*/
@CordovaInstance({
callbackOrder: 'reverse'
})
get(reference: string): Promise<any> { return; }
/**
* Stores a value
* @param reference {string}
* @param value {string}
*/
@CordovaInstance({
callbackOrder: 'reverse'
})
set(reference: string, value: string): Promise<any> { return; }
/**
* Removes a single stored item
* @param reference {string}
*/
@CordovaInstance({
callbackOrder: 'reverse'
})
remove(reference: string): Promise<any> { return; }
}

View File

@@ -9,13 +9,13 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `cordova-plugin-sim`. For more info, please see the [Cordova Sim docs](https://github.com/pbakondy/cordova-plugin-sim).
*
* @usage
* ```js
* import {Sim} from 'ionic-native';
* ```typescript
* import { Sim } from 'ionic-native';
*
*
* Sim.getSimInfo().then(
* (info) => console.log('Sim info:', info),
* (err) => console.log('Unable to get sim info:', err)
* (info) => console.log('Sim info: ', info),
* (err) => console.log('Unable to get sim info: ', err)
* );
* ```
*/

View File

@@ -31,14 +31,12 @@ export interface SmsOptionsAndroid {
* Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin).
*
* @usage
* ```ts
* import {SMS} from 'ionic-native';
*
* ```typescript
* import { SMS } from 'ionic-native';
*
*
* // Send a text message using default options
* SMS.send('416123456','Hello world!');
*
* SMS.send('416123456', 'Hello world!');
* ```
*/
@Plugin({

View File

@@ -1,12 +1,13 @@
import { Cordova, Plugin } from './plugin';
/**
* @name Social Sharing
* @description
* Share text, files, images, and links via social networks, sms, and email.
* @usage
* ```ts
* import {SocialSharing} from 'ionic-native';
* ```typescript
* import { SocialSharing } from 'ionic-native';
*
* // Check if sharing via email is supported
* SocialSharing.canShareViaEmail().then(() => {

View File

@@ -5,9 +5,8 @@ import { Cordova, Plugin } from './plugin';
* @name Spinner Dialog
* @description
* @usage
* ```js
* import {SpinnerDialog} from 'ionic-native';
*
* ```typescript
* import { SpinnerDialog } from 'ionic-native';
*
*
* SpinnerDialog.show();

View File

@@ -5,9 +5,8 @@ import { Cordova, Plugin } from './plugin';
* @name Splashscreen
* @description This plugin displays and hides a splash screen during application launch. The methods below allows showing and hiding the splashscreen after the app has loaded.
* @usage
* ```ts
* import {Splashscreen} from 'ionic-native';
*
* ```typescript
* import { Splashscreen } from 'ionic-native';
*
*
* Splashscreen.show();

View File

@@ -11,21 +11,21 @@ declare var sqlitePlugin;
*
* @usage
*
* ```ts
* ```typescript
* import { SQLite } from 'ionic-native';
*
* let db = new SQLite();
* db.openDatabse({
* db.openDatabase({
* name: 'data.db',
* location: 'default' // the location field is required
* }).then(() => {
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
*
* }, (err) => {
* console.error('Unable to execute sql', err);
* })
* console.error('Unable to execute sql: ', err);
* });
* }, (err) => {
* console.error('Unable to open database', err);
* console.error('Unable to open database: ', err);
* });
* ```
*
@@ -52,7 +52,7 @@ export class SQLite {
* @param config the config for opening the database.
* @usage
*
* ```ts
* ```typescript
* import { SQLite } from 'ionic-native';
*
* let db = new SQLite();
@@ -112,7 +112,7 @@ export class SQLite {
*
* @usage
*
* ```ts
* ```typescript
* db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => {
* // Access the items through resultSet.rows
* // resultSet.rows.item(i)

View File

@@ -11,12 +11,11 @@ declare var window;
* Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar).
*
* @usage
* ```ts
* import {StatusBar} from 'ionic-native';
* ```typescript
* import { StatusBar } from 'ionic-native';
*
* ...
*
* StatuBar.overlaysWebView(true); // let status var overlay webview
* StatusBar.overlaysWebView(true); // let status var overlay webview
*
* StatusBar.backgroundColorByHexString('#ffffff'); // set status bar to white
* ```

View File

@@ -43,12 +43,11 @@ export interface ToastOptions {
* Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin).
*
* @usage
* ```ts
* import {Toast} from 'ionic-native';
* ```typescript
* import { Toast } from 'ionic-native';
*
*
*
* Toast.show("I'm a toast", "5000", "center").subscribe(
* Toast.show("I'm a toast", '5000', 'center').subscribe(
* toast => {
* console.log(toast);
* }

View File

@@ -8,6 +8,29 @@ import { Cordova, Plugin } from './plugin';
*
* Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id).
*
* @usage
* ### Import Touch ID Plugin into Project
* ```typescript
* import { TouchID } from 'ionic-native';
* ```
* ### Check for Touch ID Availability
* ```typescript
* TouchID.isAvailable()
* .then(
* res => console.log('TouchID is available!'),
* err => console.error('TouchID is not available', err)
* );
* ```
* ### Invoke Touch ID w/ Custom Message
*
* ```typescript
* TouchID.verifyFingerprint('Scan your fingerprint please')
* .then(
* res => console.log('Ok', res),
* err => console.error('Error', err)
* );
* ```
*
* ### Error Codes
*
* The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently.
@@ -20,25 +43,6 @@ import { Cordova, Plugin } from './plugin';
* - `-4` - The scan was cancelled by the system (Home button for example)
* - `-6` - TouchID is not Available
* - `-8` - TouchID is locked out from too many tries
* @usage
* ```js
* import {TouchID} from 'ionic-native';
*
* ...
*
* TouchID.isAvailable()
* .then(
* res => console.log("TouchID is available!"),
* err => console.error("TouchID isn't available", err)
* );
*
* TouchID.verifyFingerprint('Scan your fingerprint please')
* .then(
* res => console.log("Ok", res),
* err => console.error("Error", err)
* );
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-touch-id',
@@ -49,7 +53,7 @@ import { Cordova, Plugin } from './plugin';
export class TouchID {
/**
* Whether TouchID is available or not.
* Checks Whether TouchID is available or not.
*
* @return {Promise} Returns a Promise that resolves if yes, rejects if no.
*/

View File

@@ -1,15 +1,36 @@
import { Plugin, Cordova } from './plugin';
/**
* @name Twitter Connect
* @description
* Plugin to use Twitter Single Sign On
* Uses Twitter's Fabric SDK
* ```typescript
* import {TwitterConnect} from 'ionic-native';
*
* function onSuccess(response) {
* console.log(response);
*
* // Will console log something like:
* // {
* // userName: 'myuser',
* // userId: '12358102',
* // secret: 'tokenSecret'
* // token: 'accessTokenHere'
* // }
* }
*
* TwitterConnect.login().then(onSuccess, onError);
*
* TwitterConnect.logout().then(onLogoutSuccess, onLogoutError);
* ```
*/
@Plugin({
plugin: 'twitter-connect-plugin',
pluginRef: 'TwitterConnect',
repo: '',
install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=<Fabric API Key>'
repo: 'https://github.com/ManifestWebDesign/twitter-connect-plugin',
install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=fabric_API_key'
})
export class TwitterConnect {
/**

View File

@@ -5,12 +5,12 @@ import { Cordova, Plugin } from './plugin';
* @name Vibration
* @description Vibrates the device
* @usage
* ```ts
* import {Vibration} from 'ionic-native';
*
* ```typescript
* import { Vibration } from 'ionic-native';
*
*
* // Vibrate the device for a second
* // Duration is ignored on iOS.
* Vibration.vibrate(1000);
*
* // Vibrate 2 seconds

View File

@@ -0,0 +1,62 @@
import { Cordova, Plugin } from './plugin';
/**
* Options for the video playback using the `play` function.
*/
export interface VideoOptions {
/**
* Set the initial volume of the video playback, where 0.0 is 0% volume and 1.0 is 100%.
* For example: for a volume of 30% set the value to 0.3.
*/
volume?: number;
/**
* There are to options for the scaling mode. SCALE_TO_FIT which is default and SCALE_TO_FIT_WITH_CROPPING.
* These strings are the only ones which can be passed as option.
*/
scalingMode?: string;
}
/**
* @name VideoPlayer
* @description
* A Codova plugin that simply allows you to immediately play a video in fullscreen mode.
*
* Requires Cordova plugin: `com.moust.cordova.videoplayer`. For more info, please see the [VideoPlayer plugin docs](https://github.com/moust/cordova-plugin-videoplayer).
*
* @usage
* ```typescript
* import { VideoPlayer } from 'ionic-native';
*
*
* // Playing a video.
* VideoPlayer.play("file:///android_asset/www/movie.mp4").then(() => {
* console.log('video completed');
* }).catch(err => {
* console.log(err);
* });
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-videoplayer',
pluginRef: 'VideoPlayer',
repo: 'https://github.com/moust/cordova-plugin-videoplayer',
platforms: ['Android']
})
export class VideoPlayer {
/**
* Plays the video from the passed url.
* @param fileUrl {string} File url to the video.
* @param options {VideoOptions?} Optional video playback settings. See options above.
* @returns {Promise<any>} Resolves promise when the video was played successfully.
*/
@Cordova()
static play(fileUrl: string, options?: VideoOptions): Promise<any> { return; }
/**
* Stops the video playback immediatly.
*/
@Cordova({ sync: true })
static close(): void { }
}

View File

@@ -8,6 +8,13 @@ declare var window;
* @description
* @usage
* For usage information please refer to the plugin's Github repo.
*
* ```typescript
* import {WebIntent} from 'ionic-native';
*
* WebIntent.startActivity(options).then(onSuccess, onError);
*
* ```
*/
@Plugin({
plugin: 'https://github.com/Initsogar/cordova-webintent.git',