Compare commits

..
58 Commits
Author SHA1 Message Date
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 ManouvrierandIbrahim Hadeed 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 HadeedandGitHub e34f94e0c1 feat(zip): add zip plugin (#430)
closes #421
2016-08-15 05:10:43 -04:00
Ibrahim HadeedandGitHub 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 HadeedandGitHub 203d4c7669 feat(shake): add Shake plugin (#426)
closes #313
2016-08-15 03:58:34 -04:00
Ibrahim HadeedandGitHub 8cd6686803 feat(native-audio): Add native audio plugin (#427)
closes #315
2016-08-15 03:58:20 -04:00
Ibrahim HadeedandGitHub 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
GuillermoandIbrahim Hadeed 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
KessilerandIbrahim Hadeed c60c3b7671 fix(camera): camera options should be optional. Fixes #413 (#417) 2016-08-11 07:29:14 -04:00
Ibrahim HadeedandGitHub 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 HadeedandGitHub 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 HadeedandGitHub 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
KessilerandIbrahim Hadeed 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
KessilerandIbrahim Hadeed cf3f0f63c3 feat(GoogleAnalytics): Add campaign measurement tracking (#405) 2016-08-09 01:30:53 -04:00
Ibrahim HadeedandGitHub 7a84262fee feat(keyboard): enable hideKeyboardAccessoryBar function (#398)
closes #394
2016-08-09 01:30:15 -04:00
Keith D. MooreandGitHub 3748bccad2 Network: Changed connection to return a Typescript string 2016-08-06 09:56:34 -05:00
cither1andIbrahim Hadeed 0c486b0965 fix(index): export Geolocation interfaces. (#404) 2016-08-06 03:20:38 -04:00
Markus WagnerandIbrahim Hadeed 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 KeynerandIbrahim Hadeed b413f21d4b docs(): remove unnecessary semicolumn (#400) 2016-08-06 02:45:53 -04:00
Brian DennisandGitHub 36624aff9c docs(flashlight): fix isSwitchedOn return type 2016-08-05 10:44:33 -05:00
Alex MuramotoandIbrahim Hadeed 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 CzichonandIbrahim Hadeed 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 LynchandGitHub 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 LynchandGitHub 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 LynchandGitHub 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 CallaghanandGitHub 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 LaverdureandGitHub 8242c88cbb Update googlemaps.ts 2016-08-04 08:37:45 -04:00
Thiery LaverdureandGitHub 484f9a0076 Extra space. 2016-08-04 08:36:59 -04:00
Thiery LaverdureandGitHub 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 CallaghanandGitHub 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 CallebautandIbrahim Hadeed 2503ef2ee5 docs(): Update nativestorage.ts (#384) 2016-08-02 18:52:37 -04:00
Saurabh VyasandIbrahim Hadeed 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
44 changed files with 1671 additions and 654 deletions
+1
View File
@@ -1,3 +1,4 @@
node_modules/
.idea
dist/
scripts/ionic-native-bower
+64
View File
@@ -1,3 +1,67 @@
<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)
+10
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):
```
+19 -2
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);
});
@@ -49,6 +49,23 @@ angular.module('myApp', ['ionic', 'ionic.native'])
});
```
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.
@@ -57,7 +74,7 @@ Spent way too long diagnosing an issue only to realize a plugin wasn't firing or
## 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
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
}
}
+13
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");
}
});
+5 -2
View File
@@ -1,6 +1,6 @@
{
"name": "ionic-native",
"version": "1.3.10",
"version": "1.3.15",
"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
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
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"
+23 -5
View File
@@ -56,10 +56,12 @@ 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';
@@ -67,6 +69,7 @@ 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';
@@ -77,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';
@@ -92,8 +98,9 @@ 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';
@@ -111,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,
@@ -134,22 +142,24 @@ export {
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,
@@ -157,8 +167,10 @@ export {
StatusBar,
TouchID,
Transfer,
TextToSpeech,
Vibration,
WebIntent
WebIntent,
Zip
}
export * from './plugins/plugin';
@@ -216,16 +228,19 @@ window['IonicNative'] = {
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,
@@ -237,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']);
+3 -6
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);
}
}
}
}
+1 -1
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);
* });
* ```
*
+4 -4
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();
* ```
*
+21 -18
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; }
/**
+18 -34
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; }
+1 -1
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({
+2 -2
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.
+3 -3
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
+2 -1
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
+1
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
+782 -419
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -53,7 +53,7 @@ export class Flashlight {
/**
* Checks if the flashlight is turned on.
* Returns a boolean
* @returns {boolean}
*/
@Cordova({
sync: true
+27 -5
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; }
/**
+53 -14
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);
}
});
}
}
+15 -1
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
+25 -25
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; }
}
+75 -77
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,68 +12,35 @@ 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.
@@ -82,24 +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.
*/
/**
* @name InAppBrowser
* @description
* @usage
* ```typescript
* import { InAppBrowser } from 'ionic-native';
*
*
*
* InAppBrowser.open(url, target, options);
*
*
* ```
*/
@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));
});
}
}
+2 -3
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.
+1 -1
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 }
* });
*
+91
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; }
}
+5 -5
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; }
+1 -1
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
+28
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 { }
}
+20 -2
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',
+14 -1
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',
+1 -1
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
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; }
}
+47
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;
}
}
+24 -18
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.
*/
+20 -1
View File
@@ -6,11 +6,30 @@ 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: '',
repo: 'https://github.com/ManifestWebDesign/twitter-connect-plugin',
install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=fabric_API_key'
})
export class TwitterConnect {
+1
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
+62
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 { }
}
+7
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
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; }
}