Compare commits

..

81 Commits

Author SHA1 Message Date
Ibrahim Hadeed
560e5ce7bb chore(): update changelog 2016-08-15 13:39:43 -04:00
Ibrahim Hadeed
dc0039b820 1.3.16 2016-08-15 13:37:56 -04:00
Ibrahim Hadeed
8bc499f221 fix(photo-viewer): method is static 2016-08-15 13:37:24 -04:00
Ibrahim Hadeed
93ce443467 chore(): update changelog 2016-08-15 11:50:16 -04:00
Ibrahim Hadeed
f3c5ebd28b 1.3.15 2016-08-15 11:49:32 -04:00
Ibrahim Hadeed
bcd46eea9d Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-08-15 11:49:08 -04:00
Ibrahim Hadeed
689bfd9568 feat(google-analytics): add missing functions 2016-08-15 11:48:40 -04:00
Christopher Manouvrier
dcf3ab2787 feat(TTS): add tts plugin (#431)
* Initial Pass at TTS

* Rename and fix index

* Remove unnecessary window in reference

closes #311
2016-08-15 09:29:51 -04:00
Ibrahim Hadeed
b4158f4f85 chore(): update changelog 2016-08-15 05:14:06 -04:00
Ibrahim Hadeed
0a54929169 1.3.14 2016-08-15 05:13:31 -04:00
Ibrahim Hadeed
e34f94e0c1 feat(zip): add zip plugin (#430)
closes #421
2016-08-15 05:10:43 -04:00
Ibrahim Hadeed
d4c6ea46e6 chore(): add plugin template and generator (#429)
* chore(): add plugin template and generator

* docs(): add instructions to use plugin generator
2016-08-15 04:46:54 -04:00
Ibrahim Hadeed
203d4c7669 feat(shake): add Shake plugin (#426)
closes #313
2016-08-15 03:58:34 -04:00
Ibrahim Hadeed
8cd6686803 feat(native-audio): Add native audio plugin (#427)
closes #315
2016-08-15 03:58:20 -04:00
Ibrahim Hadeed
aaddd9eea2 fix(datepicker): date now accepts Date, string, or number (#428)
closes #354
2016-08-15 03:58:06 -04:00
Ibby Hadeed
c9b76c4a9a chore(): update changelog 2016-08-13 11:33:48 -04:00
Ibby Hadeed
0e5bdc2f1e 1.3.13 2016-08-13 11:30:59 -04:00
Ibby Hadeed
4b08d854bd fix(inappbrowser): fix event listener 2016-08-13 11:30:52 -04:00
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
54 changed files with 1936 additions and 658 deletions

BIN
.DS_Store vendored

Binary file not shown.

1
.gitignore vendored
View File

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

View File

@@ -1,3 +1,96 @@
<a name="1.3.16"></a>
## [1.3.16](https://github.com/driftyco/ionic-native/compare/v1.3.15...v1.3.16) (2016-08-15)
### Bug Fixes
* **photo-viewer:** method is static ([8bc499f](https://github.com/driftyco/ionic-native/commit/8bc499f))
<a name="1.3.15"></a>
## [1.3.15](https://github.com/driftyco/ionic-native/compare/v1.3.14...v1.3.15) (2016-08-15)
### Features
* **google-analytics:** add missing functions ([689bfd9](https://github.com/driftyco/ionic-native/commit/689bfd9))
* **TTS:** add tts plugin ([#431](https://github.com/driftyco/ionic-native/issues/431)) ([dcf3ab2](https://github.com/driftyco/ionic-native/commit/dcf3ab2)), closes [#311](https://github.com/driftyco/ionic-native/issues/311)
<a name="1.3.14"></a>
## [1.3.14](https://github.com/driftyco/ionic-native/compare/v1.3.13...v1.3.14) (2016-08-15)
### Bug Fixes
* **datepicker:** date now accepts Date, string, or number ([#428](https://github.com/driftyco/ionic-native/issues/428)) ([aaddd9e](https://github.com/driftyco/ionic-native/commit/aaddd9e)), closes [#354](https://github.com/driftyco/ionic-native/issues/354)
### Features
* **native-audio:** Add native audio plugin ([#427](https://github.com/driftyco/ionic-native/issues/427)) ([8cd6686](https://github.com/driftyco/ionic-native/commit/8cd6686)), closes [#315](https://github.com/driftyco/ionic-native/issues/315)
* **shake:** add Shake plugin ([#426](https://github.com/driftyco/ionic-native/issues/426)) ([203d4c7](https://github.com/driftyco/ionic-native/commit/203d4c7)), closes [#313](https://github.com/driftyco/ionic-native/issues/313)
* **zip:** add zip plugin ([#430](https://github.com/driftyco/ionic-native/issues/430)) ([e34f94e](https://github.com/driftyco/ionic-native/commit/e34f94e)), closes [#421](https://github.com/driftyco/ionic-native/issues/421)
<a name="1.3.13"></a>
## [1.3.13](https://github.com/driftyco/ionic-native/compare/v1.3.12...v1.3.13) (2016-08-13)
### Bug Fixes
* **inappbrowser:** fix event listener ([4b08d85](https://github.com/driftyco/ionic-native/commit/4b08d85))
<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)

View File

@@ -5,6 +5,16 @@ This is a short guide on creating new plugin wrappers for Ionic Native.
## Creating Plugin Wrappers
First, let's start by creating a new plugin wrapper from template.
```
// Call this command, and replace PluginName with the name of the plugin you wish to add
// Make sure to capitalize the first letter, or use CamelCase if necessary.
gulp plugin:create -n PluginName
```
Let's take a look at the existing plugin wrapper for Geolocation to see what goes into an Ionic Native plugin (comments have been removed for clarity):
```

View File

@@ -19,7 +19,7 @@ Ionic Native wraps plugin callbacks in a Promise or [Observable](https://gist.gi
```
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
```

50
TEMPLATE Normal file
View File

@@ -0,0 +1,50 @@
/**
* This is a template for new plugin wrappers
*
* TODO:
* - Add/Change information below
* - Document usage (importing, executing main functionality)
* - Remove any imports that you are not using
* - Add this file to /src/index.ts (follow style of other plugins)
* - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs.
* - Remove this note
*
*/
import {Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty} from './plugin';
import {Observable} from 'rxjs/Observable';
/**
* @name PluginName
* @description
* This plugin does something
*
* @usage
* ```
* import {PluginName} from 'ionic-native';
*
* PluginName.functionName('Hello', 123)
* .then((something: any) => doSomething(something))
* .catch((error: any) => console.log(error));
*
* ```
*/
@Plugin({
plugin: '', // npm package name, example: cordova-plugin-camera
pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation
repo: '', // the github repository URL for the plugin
install: '' // OPTIONAL install command, in case the plugin requires variables
})
export class PluginName {
/**
* This function does something
* @param arg1 {string} Some param to configure something
* @param arg2 {number} Another param to configure something
* @return {Promise<any>} Returns a promise that resolves when something happens
*/
@Cordova()
static functionName(arg1: string, arg2: number): Promise<any> {
return; // We add return; here to avoid any IDE / Compiler errors
}
}

View File

@@ -3,6 +3,8 @@ var minimist = require('minimist');
var uglify = require('gulp-uglify');
var rename = require("gulp-rename");
var tslint = require('ionic-gulp-tslint');
var decamelize = require('decamelize');
var replace = require('gulp-replace');
var flagConfig = {
string: ['port', 'version', 'ngVersion', 'animations'],
@@ -26,3 +28,14 @@ gulp.task("minify:dist", function(){
});
gulp.task('lint', tslint);
gulp.task('plugin:create', function(){
if(flags.n && flags.n !== ''){
return gulp.src('./TEMPLATE')
.pipe(replace('PluginName', flags.n))
.pipe(rename(decamelize(flags.n, '-') + '.ts'))
.pipe(gulp.dest('./src/plugins/'));
} else {
console.log("Usage is: gulp plugin:create -n PluginName");
}
});

View File

@@ -1,6 +1,6 @@
{
"name": "ionic-native",
"version": "1.3.9",
"version": "1.3.16",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"main": "dist/index.js",
"files": [
@@ -16,11 +16,13 @@
"conventional-github-releaser": "^1.1.3",
"cpr": "^1.0.0",
"cz-conventional-changelog": "^1.1.6",
"decamelize": "^1.2.0",
"dgeni": "^0.4.2",
"dgeni-packages": "^0.10.18",
"glob": "^6.0.4",
"gulp": "^3.9.1",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.4",
"gulp-tslint": "^5.0.0",
"gulp-uglify": "^1.5.4",
"ionic-gulp-tslint": "^1.0.0",
@@ -42,7 +44,8 @@
"build:js": "./node_modules/.bin/tsc",
"build:bundle": "./node_modules/.bin/browserify dist/index.js > dist/ionic.native.js",
"build:minify": "./node_modules/.bin/gulp minify:dist",
"changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
"changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"plugin:create": "gulp plugin:create"
},
"repository": {
"type": "git",

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

@@ -25,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';
@@ -48,22 +49,27 @@ 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';
import {LaunchNavigator} from './plugins/launchnavigator';
import {LocalNotifications} from './plugins/localnotifications';
import {MediaCapture} from './plugins/media-capture';
import {NativeAudio} from './plugins/native-audio';
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 {Shake} from './plugins/shake';
import {Sim} from './plugins/sim';
import {SMS} from './plugins/sms';
import {SocialSharing} from './plugins/socialsharing';
@@ -74,9 +80,12 @@ import {StatusBar} from './plugins/statusbar';
import {ThreeDeeTouch} from './plugins/3dtouch';
import {Toast} from './plugins/toast';
import {TouchID} from './plugins/touchid';
import {TextToSpeech} from './plugins/text-to-speech';
import {TwitterConnect} from './plugins/twitter-connect';
import {Vibration} from './plugins/vibration';
import {VideoPlayer} from './plugins/video-player';
import {WebIntent} from './plugins/webintent';
import {Zip} from './plugins/zip';
export * from './plugins/3dtouch';
export * from './plugins/background-geolocation';
export * from './plugins/backgroundmode';
@@ -89,12 +98,14 @@ export * from './plugins/datepicker';
export * from './plugins/device';
export * from './plugins/devicemotion';
export * from './plugins/deviceorientation';
export * from './plugins/facebook';
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';
@@ -107,6 +118,7 @@ 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,
@@ -123,27 +135,31 @@ export {
BluetoothSerial,
CameraPreview,
Clipboard,
Crop,
DBMeter,
Deeplinks,
DeviceAccounts,
Dialogs,
Diagnostic,
EmailComposer,
File,
Facebook,
Flashlight,
Geolocation,
Globalization,
GooglePlus,
GoogleAnalytics,
Hotspot,
Insomnia,
Keyboard,
NativeAudio,
NativeStorage,
Network,
OneSignal,
PhotoViewer,
ScreenOrientation,
PinDialog,
Screenshot,
SecureStorage,
Shake,
SocialSharing,
Sim,
Splashscreen,
@@ -151,8 +167,10 @@ export {
StatusBar,
TouchID,
Transfer,
TextToSpeech,
Vibration,
WebIntent
WebIntent,
Zip
}
export * from './plugins/plugin';
@@ -180,6 +198,7 @@ window['IonicNative'] = {
CardIO: CardIO,
Clipboard: Clipboard,
Contacts: Contacts,
Crop: Crop,
DatePicker: DatePicker,
DBMeter: DBMeter,
Deeplinks: Deeplinks,
@@ -202,21 +221,26 @@ window['IonicNative'] = {
Httpd: Httpd,
IBeacon: IBeacon,
ImagePicker: ImagePicker,
ImageResizer: ImageResizer,
InAppBrowser: InAppBrowser,
Keyboard: Keyboard,
LaunchNavigator: LaunchNavigator,
LocalNotifications: LocalNotifications,
MediaCapture: MediaCapture,
MediaPlugin: MediaPlugin,
NativeAudio: NativeAudio,
NativeStorage: NativeStorage,
Network: Network,
Printer: Printer,
Push: Push,
OneSignal: OneSignal,
PhotoViewer: PhotoViewer,
ScreenOrientation: ScreenOrientation,
PinDialog: PinDialog,
SafariViewController: SafariViewController,
Screenshot: Screenshot,
SecureStorage: SecureStorage,
Shake: Shake,
Sim: Sim,
SMS: SMS,
SocialSharing: SocialSharing,
@@ -228,9 +252,12 @@ window['IonicNative'] = {
Toast: Toast,
TouchID: TouchID,
Transfer: Transfer,
TextToSpeech: TextToSpeech,
TwitterConnect: TwitterConnect,
VideoPlayer: VideoPlayer,
Vibration: Vibration,
WebIntent: WebIntent
WebIntent: WebIntent,
Zip: Zip
};
initAngular1(window['IonicNative']);

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

@@ -20,7 +20,7 @@ import { Cordova, Plugin } from './plugin';
* 'addCancelButtonWithLabel': 'Cancel',
* 'addDestructiveButtonWithLabel' : 'Delete'
* }).then((buttonIndex: number) => {
* console.log('Button pressed: ' + buttonLabels[buttonIndex - 1]);
* console.log('Button pressed: ' + buttonIndex);
* });
* ```
*

View File

@@ -14,11 +14,11 @@ declare var window;
* ```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

@@ -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
@@ -178,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();
@@ -219,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

@@ -19,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']
})

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,7 +396,8 @@ 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

@@ -33,7 +33,7 @@ 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/cordova-plugin-camera-preview/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({

View File

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

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

@@ -13,7 +13,7 @@ export interface DatePickerOptions {
* Platforms: iOS, Android, Windows
* Selected date
*/
date: Date;
date: Date | string | number;
/**
* Platforms: iOS, Android, Windows
@@ -21,7 +21,7 @@ export interface DatePickerOptions {
* Type: Date | empty String
* Default: empty String
*/
minDate?: Date;
minDate?: Date | string | number;
/**
* Platforms?: iOS, Android, Windows
@@ -29,7 +29,7 @@ export interface DatePickerOptions {
* Type?: Date | empty String
* Default?: empty String
*/
maxDate?: Date;
maxDate?: Date | string | number;
/**
* Platforms?: Android

View File

@@ -47,7 +47,8 @@ export interface CompassOptions {
*
* @usage
* ```typescript
* import { DeviceOrientation } from 'ionic-native';
* // CompassHeading is an interface for compass
* import { DeviceOrientation, CompassHeading } from 'ionic-native';
*
*
* // Get the device current compass heading

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.

View File

@@ -10,6 +10,7 @@ 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
* ```typescript

File diff suppressed because it is too large Load Diff

View File

@@ -53,7 +53,7 @@ export class Flashlight {
/**
* Checks if the flashlight is turned on.
* Returns a boolean
* @returns {boolean}
*/
@Cordova({
sync: true

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
@@ -106,13 +107,34 @@ export class GoogleAnalytics {
* https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
* @param {string} id
*/
@Cordova()
static setUserId(id: string): Promise<any> { return; }
@Cordova({sync: true})
static setUserId(id: string): void { }
/**
* Sets the app version
* @param appVersion
*/
@Cordova({sync: true})
static setAppVersion(appVersion: string): void { }
/**
* Set a anonymize Ip address
* @param anonymize
*/
@Cordova({sync: true})
static setAnonymizeIp(anonymize: boolean): void { }
/**
* Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
* @param allow
*/
@Cordova({sync: true})
static setAllowIDFACollection(allow: boolean): void { }
/**
* Enable verbose logging
*/
@Cordova()
@Cordova({sync: true})
static debugMode(): Promise<any> { return; }
/**

View File

@@ -51,7 +51,9 @@ export const GoogleMapsAnimation = {
* ...
*
* // 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!'));
* ```
@@ -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

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

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

@@ -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(observer));
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
});
}
}

View File

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

@@ -15,7 +15,7 @@ import { Cordova, Plugin } from './plugin';
* LocalNotifications.schedule({
* id: 1,
* text: 'Single Notification',
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf'
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf',
* data: { secret: key }
* });
*

View File

@@ -0,0 +1,91 @@
import {Plugin, Cordova} from './plugin';
/**
* @name NativeAudio
* @description Native Audio Playback
* @usage
* ```typescript
* import {NativeAudio} from 'ionic-native';
*
* NativeAudio.preloadSimple('uniqueId1', 'path/to/file.mp3').then(onSuccess, onError);
* NativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError);
*
* NativeAudio.play('uniqueId1').then(onSuccess, onError);
* NativeAudio.loop('uniqueId2').then(onSuccess, onError);
*
* NativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError);
*
* NativeAudio.stop('uniqueId1').then(onSuccess,onError);
*
* NativeAudio.unload('uniqueId1').then(onSuccess,onError);
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-nativeaudio',
pluginRef: 'NativeAudio',
repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio'
})
export class NativeAudio {
/**
* Loads an audio file into memory. Optimized for short clips / single shots (up to five seconds). Cannot be stopped / looped.
* @param id {string} unique ID for the audio file
* @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset.
* @returns {Promise<any>}
*/
@Cordova()
static preloadSimple(id: string, assetPath: string): Promise<any> {return; }
/**
* Loads an audio file into memory. Optimized for background music / ambient sound. Uses highlevel native APIs with a larger footprint. (iOS: AVAudioPlayer). Can be stopped / looped and used with multiple voices. Can be faded in and out using the delay parameter.
* @param id {string} unique ID for the audio file
* @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset.
* @param volume {number} the volume of the preloaded sound (0.1 to 1.0)
* @param voices {number} the number of multichannel voices available
* @param delay {number}
* @returns {Promise<any>}
*/
@Cordova()
static preloadComplex(id: string, assetPath: string, volume: number, voices: number, delay: number): Promise<any> {return; }
/**
* Plays an audio asset
* @param id {string} unique ID for the audio file
* @param completeCallback {Function} callback to be invoked when audio is done playing
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static play(id: string, completeCallback: Function): Promise<any> {return; }
/**
* Stops playing an audio
* @param id {string} unique ID for the audio file
*/
@Cordova()
static stop(id: string): Promise<any> {return; }
/**
* Loops an audio asset infinitely, this only works for complex assets
* @param id {string} unique ID for the audio file
* @return {Promise<any>}
*/
@Cordova()
static loop(id: string): Promise<any> {return; }
/**
* Unloads an audio file from memory
* @param id {string} unique ID for the audio file
*/
@Cordova()
static unload(id: string): Promise<any> {return; }
/**
* Changes the volume for preloaded complex assets.
* @param id {string} unique ID for the audio file
* @param volume {number} the volume of the audio asset (0.1 to 1.0)
*/
@Cordova()
static setVolumeForComplexAsset(id: string, volume: number): Promise<any> {return; }
}

View File

@@ -2,8 +2,8 @@ import { Cordova, Plugin } from './plugin';
/**
* @name Native Storage
* @description
* @name NativeStorage
* @description Native storage of variables in Android and iOS
*
* @usage
* ```typescript
@@ -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

@@ -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';
/**
@@ -28,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 {
@@ -38,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; }
/**
@@ -253,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})
static show(url: string, title?: string, options?: {share?: boolean; }): void { }
}

View File

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

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

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

@@ -16,7 +16,7 @@ declare var cordova: any;
* secureStorage.create('my_store_name')
* .then(
* () => console.log('Storage is ready!'),
* error => console.log(error);
* error => console.log(error)
* );
*
* secureStorage.get('myitem')

35
src/plugins/shake.ts Normal file
View File

@@ -0,0 +1,35 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
/**
* @name Shake
* @description Handles shake gesture
* @usage
* ```typescript
* import {Shake} from 'ionic-native';
*
* let watch = Shake.startWatch(60).subscribe(() => {
* // do something
* });
*
* watch.unsubscribe();
* ```
*/
@Plugin({
plugin: 'cordova-plugin-shake',
pluginRef: 'shake',
repo: 'https://github.com/leecrossley/cordova-plugin-shake'
})
export class Shake {
/**
* Watch for shake gesture
* @param sensitivity {number} Optional sensitivity parameter. Defaults to 40
*/
@Cordova({
observable: true,
clearFunction: 'stopWatch',
successIndex: 0,
errorIndex: 2
})
static startWatch(sensitivity?: number): Observable<any> {return; }
}

View File

@@ -15,7 +15,7 @@ declare var sqlitePlugin;
* import { SQLite } from 'ionic-native';
*
* let db = new SQLite();
* db.openDatabse({
* db.openDatabase({
* name: 'data.db',
* location: 'default' // the location field is required
* }).then(() => {

View File

@@ -15,7 +15,7 @@ declare var window;
* 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

@@ -0,0 +1,47 @@
import {Plugin, Cordova} from './plugin';
export interface TTSOptions {
/** text to speak */
text: string;
/** a string like 'en-US', 'zh-CN', etc */
locale?: string;
/** speed rate, 0 ~ 1 */
rate?: number;
}
/**
* @name TTS
* @description
* Text to Speech plugin
*
* @usage
* ```
* import {TTS} from 'ionic-native';
*
* TTS.speak('Hello World')
* .then(() => console.log('Success'))
* .catch((reason: any) => console.log(reason));
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-tts',
pluginRef: 'TTS',
repo: 'https://github.com/vilic/cordova-plugin-tts'
})
export class TextToSpeech {
/**
* This function speaks
* @param options {string | TTSOptions} Text to speak or TTSOptions
* @return {Promise<any>} Returns a promise that resolves when the speaking finishes
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static speak(options: string | TTSOptions): Promise<any> {
return;
}
}

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,23 +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
* ```typescript
* 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',
@@ -47,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

@@ -6,12 +6,31 @@ import { Plugin, Cordova } from './plugin';
* @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

@@ -10,6 +10,7 @@ import { Cordova, Plugin } from './plugin';
*
*
* // 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',

39
src/plugins/zip.ts Normal file
View File

@@ -0,0 +1,39 @@
import {Plugin, Cordova} from './plugin';
/**
* @name Zip
* @description
* A Cordova plugin to unzip files in Android and iOS.
*
* @usage
* ```
* import {Zip} from 'ionic-native';
*
* Zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%'))
* .then((result) => {
* if(result === 0) console.log('SUCCESS');
* if(result === -1) console.log('FAILED');
* });
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-zip',
pluginRef: 'zip',
repo: 'https://github.com/MobileChromeApps/cordova-plugin-zip',
})
export class Zip {
/**
* Extracts files from a ZIP archive
* @param sourceZip {string} Source ZIP file
* @param destUrl {string} Destination folder
* @param onProgress {Function} optional callback to be called on progress update
* @return {Promise<number>} returns a promise that resolves with a number. 0 is success, -1 is error
*/
@Cordova({
successIndex: 2,
errorIndex: 4
})
static unzip(sourceZip: string, destUrl: string, onProgress: Function): Promise<number> {return; }
}