mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-04 00:06:19 +08:00
Compare commits
73 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
115c167cfa | ||
|
|
b8d7806843 | ||
|
|
4c2bb9e052 | ||
|
|
618d866bfe | ||
|
|
66d1da2b55 | ||
|
|
ecbe5faef8 | ||
|
|
2160a2d9e8 | ||
|
|
39385135de | ||
|
|
014038a678 | ||
|
|
c60c3b7671 | ||
|
|
154c029f79 | ||
|
|
4b8ab4a00f | ||
|
|
9b86ac637f | ||
|
|
6ed32efe27 | ||
|
|
43e8a6d3d2 | ||
|
|
cf3f0f63c3 | ||
|
|
7a84262fee | ||
|
|
3748bccad2 | ||
|
|
0c486b0965 | ||
|
|
306cb5d2a3 | ||
|
|
b413f21d4b | ||
|
|
36624aff9c | ||
|
|
225a44ca4d | ||
|
|
cabeeb8dab | ||
|
|
9d03a6009b | ||
|
|
93fb978a5c | ||
|
|
6a6c256e05 | ||
|
|
9ca38cd8a1 | ||
|
|
066821dbec | ||
|
|
8242c88cbb | ||
|
|
484f9a0076 | ||
|
|
049903222a | ||
|
|
7ae82f471d | ||
|
|
2503ef2ee5 | ||
|
|
899c695414 | ||
|
|
990c9c2a49 | ||
|
|
f23436fe6d | ||
|
|
29816f7ab5 | ||
|
|
09e6fc9738 | ||
|
|
4e206812f0 | ||
|
|
53b6d813d5 | ||
|
|
06c749ffab | ||
|
|
5162411b38 | ||
|
|
ea049ff82f | ||
|
|
838629db3a | ||
|
|
bd9366bdfe | ||
|
|
206fa625fd | ||
|
|
58c3fda956 | ||
|
|
ccf7fb56c8 | ||
|
|
eeb5393a3f | ||
|
|
8dfe0dbaf2 | ||
|
|
817a4340e7 | ||
|
|
5506e8a2e2 | ||
|
|
aa51c03c5c | ||
|
|
40bd9bb20d | ||
|
|
41c9adf55a | ||
|
|
2c9245c06c | ||
|
|
d3d14d0b86 | ||
|
|
2c01d1998f | ||
|
|
08fe04e87e | ||
|
|
8b9e317519 | ||
|
|
e20c411dff | ||
|
|
c854c5a18c | ||
|
|
af97b7a362 | ||
|
|
cfcf9fbfd1 | ||
|
|
971ee4adda | ||
|
|
df326f773f | ||
|
|
b8f475f188 | ||
|
|
cb24876f23 | ||
|
|
075842d69d | ||
|
|
77d31cdf42 | ||
|
|
b95191af06 | ||
|
|
7952f9ef60 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
node_modules/
|
||||
.idea
|
||||
dist/
|
||||
scripts/ionic-native-bower
|
||||
|
||||
61
CHANGELOG.md
61
CHANGELOG.md
@@ -1,3 +1,64 @@
|
||||
<a name="1.3.12"></a>
|
||||
## [1.3.12](https://github.com/driftyco/ionic-native/compare/v1.3.10...v1.3.12) (2016-08-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **backgroundGeolocation:** update config and move to sync. Fixes [#331](https://github.com/driftyco/ionic-native/issues/331) ([4e20681](https://github.com/driftyco/ionic-native/commit/4e20681)), closes [#331](https://github.com/driftyco/ionic-native/issues/331)
|
||||
* **camera:** camera options should be optional. Fixes [#413](https://github.com/driftyco/ionic-native/issues/413) ([#417](https://github.com/driftyco/ionic-native/issues/417)) ([c60c3b7](https://github.com/driftyco/ionic-native/commit/c60c3b7)), closes [#413](https://github.com/driftyco/ionic-native/issues/413) [#417](https://github.com/driftyco/ionic-native/issues/417)
|
||||
* **inappbrowser:** fix event listener ([618d866](https://github.com/driftyco/ionic-native/commit/618d866))
|
||||
* **index:** export Geolocation interfaces. ([#404](https://github.com/driftyco/ionic-native/issues/404)) ([0c486b0](https://github.com/driftyco/ionic-native/commit/0c486b0))
|
||||
* **ng1:** Copy object properly. Fixes [#357](https://github.com/driftyco/ionic-native/issues/357) ([9ca38cd](https://github.com/driftyco/ionic-native/commit/9ca38cd)), closes [#357](https://github.com/driftyco/ionic-native/issues/357)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **file:** alternate file implementation ([#283](https://github.com/driftyco/ionic-native/issues/283)) ([6ed32ef](https://github.com/driftyco/ionic-native/commit/6ed32ef))
|
||||
* **GoogleAnalytics:** Add campaign measurement tracking ([#405](https://github.com/driftyco/ionic-native/issues/405)) ([cf3f0f6](https://github.com/driftyco/ionic-native/commit/cf3f0f6))
|
||||
* **GoogleMaps:** Allow specify enableHighAccuracy option that attempt to get your location with highest accuracy ([#410](https://github.com/driftyco/ionic-native/issues/410)) ([43e8a6d](https://github.com/driftyco/ionic-native/commit/43e8a6d))
|
||||
* **ibeacon:** using option otherPromise instead of sync ([#388](https://github.com/driftyco/ionic-native/issues/388)) ([306cb5d](https://github.com/driftyco/ionic-native/commit/306cb5d))
|
||||
* **inappbrowser:** implement instance based wrapper ([#305](https://github.com/driftyco/ionic-native/issues/305)) ([4b8ab4a](https://github.com/driftyco/ionic-native/commit/4b8ab4a))
|
||||
* **keyboard:** enable hideKeyboardAccessoryBar function ([#398](https://github.com/driftyco/ionic-native/issues/398)) ([7a84262](https://github.com/driftyco/ionic-native/commit/7a84262)), closes [#394](https://github.com/driftyco/ionic-native/issues/394)
|
||||
* **photo-viewer:** add wrapper for plugin ([#359](https://github.com/driftyco/ionic-native/issues/359)) ([154c029](https://github.com/driftyco/ionic-native/commit/154c029))
|
||||
* **video-player:** Added video player plugin ([#391](https://github.com/driftyco/ionic-native/issues/391)) ([cabeeb8](https://github.com/driftyco/ionic-native/commit/cabeeb8)), closes [#342](https://github.com/driftyco/ionic-native/issues/342)
|
||||
|
||||
|
||||
|
||||
<a name="1.3.10"></a>
|
||||
## [1.3.10](https://github.com/driftyco/ionic-native/compare/v1.3.9...v1.3.10) (2016-08-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **brightness:** use correct pluginRef ([e20c411](https://github.com/driftyco/ionic-native/commit/e20c411))
|
||||
* **diagnostics:** Corrects isEnabled functions to isAvailable ([#373](https://github.com/driftyco/ionic-native/issues/373)) ([ccf7fb5](https://github.com/driftyco/ionic-native/commit/ccf7fb5))
|
||||
* **ng1:** use $q promises instead of the native Promise ([#378](https://github.com/driftyco/ionic-native/issues/378)) ([817a434](https://github.com/driftyco/ionic-native/commit/817a434))
|
||||
* **one-signal:** return Observable instead of promise ([#352](https://github.com/driftyco/ionic-native/issues/352)) ([08fe04e](https://github.com/driftyco/ionic-native/commit/08fe04e))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **crop:** add crop plugin ([#284](https://github.com/driftyco/ionic-native/issues/284)) ([41c9adf](https://github.com/driftyco/ionic-native/commit/41c9adf))
|
||||
* **screen-orientation:** Added Screen Orientation Plugin [#342](https://github.com/driftyco/ionic-native/issues/342) ([#366](https://github.com/driftyco/ionic-native/issues/366)) ([bd9366b](https://github.com/driftyco/ionic-native/commit/bd9366b)), closes [#342](https://github.com/driftyco/ionic-native/issues/342)
|
||||
|
||||
|
||||
|
||||
<a name="1.3.9"></a>
|
||||
## [1.3.9](https://github.com/driftyco/ionic-native/compare/v1.3.8...v1.3.9) (2016-07-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **file:** readAsText() and adds readAsDataURL() in File plugin ([#346](https://github.com/driftyco/ionic-native/issues/346)) ([77d31cd](https://github.com/driftyco/ionic-native/commit/77d31cd))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **android-fingerprint-auth:** add wrapper for plugin ([df326f7](https://github.com/driftyco/ionic-native/commit/df326f7)), closes [#334](https://github.com/driftyco/ionic-native/issues/334)
|
||||
* **secure-storage:** Add Secure Storage Wrapper ([#347](https://github.com/driftyco/ionic-native/issues/347)) ([075842d](https://github.com/driftyco/ionic-native/commit/075842d))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.8"></a>
|
||||
## [1.3.8](https://github.com/driftyco/ionic-native/compare/v1.3.7...v1.3.8) (2016-07-20)
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ You need to run `npm run build` in the `ionic-native` project, this will create
|
||||
|
||||
### Cleaning the code
|
||||
|
||||
You need to run `npm run tslint` to analyze the code and ensure it's consistency with the repository style. Fix any errors before submitting a PR.
|
||||
You need to run `npm run lint` to analyze the code and ensure it's consistency with the repository style. Fix any errors before submitting a PR.
|
||||
|
||||
### 'Wrapping' Up
|
||||
|
||||
|
||||
43
README.md
43
README.md
@@ -17,9 +17,9 @@ For the full Ionic Native documentation, please visit [http://ionicframework.com
|
||||
Ionic Native wraps plugin callbacks in a Promise or [Observable](https://gist.github.com/staltz/868e7e9bc2a7b8c1f754), providing a common interface for all plugins and ensuring that native events trigger change detection in Angular 2.
|
||||
|
||||
```
|
||||
import {Geolocation} from 'ionic-native';
|
||||
import { Geolocation } from 'ionic-native';
|
||||
|
||||
Geolocation.getCurrentPosition().then(pos => {
|
||||
Geolocation.getCurrentPosition().then(pos => {
|
||||
console.log('lat: ' + pos.coords.latitude + ', lon: ' + pos.coords.longitude);
|
||||
});
|
||||
|
||||
@@ -31,13 +31,50 @@ let watch = Geolocation.watchPosition().subscribe(pos => {
|
||||
watch.unsubscribe();
|
||||
```
|
||||
|
||||
### Angular 1
|
||||
|
||||
Ionic Native works as a stand-in for [ngCordova](http://ngcordova.com/). In many cases, the usage is identical, but we import `ionic.native` instead of `ngCordova` as our module.
|
||||
|
||||
As a rule of thumb: take the ES6 class name of the plugin and add `$cordova` to get the service name. For example, `Geolocation` would be `$cordovaGeolocation`, and `Camera` will be `$cordovaCamera`:
|
||||
|
||||
```javascript
|
||||
angular.module('myApp', ['ionic', 'ionic.native'])
|
||||
|
||||
.controller('MyCtrl', function($scope, $cordovaCamera) {
|
||||
$scope.takePicture = function() {
|
||||
$cordovaCamera.getPicture(opts).then(function(p) {
|
||||
}, function(err) {
|
||||
});
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
For services that return observables, the Angular 1 digest cycle must be done manually (currently):
|
||||
|
||||
```javascript
|
||||
angular.module('myApp', ['ionic', 'ionic.native'])
|
||||
|
||||
.controller('MyCtrl', function($scope, $cordovaGeolocation) {
|
||||
$scope.takePicture = function() {
|
||||
$cordovaGeolocation.watchPosition(opts).subscribe(function(p) {
|
||||
$scope.$apply(function() {
|
||||
$scope.position = p.coords;
|
||||
});
|
||||
}, function(err) {
|
||||
});
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
### Runtime Diagnostics
|
||||
|
||||
Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it.
|
||||
|
||||

|
||||
|
||||
## 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
|
||||
```
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "1.3.8",
|
||||
"version": "1.3.12",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
|
||||
26
scripts/bower.json
Normal file
26
scripts/bower.json
Normal 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
28
scripts/bower.sh
Normal 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"
|
||||
27
src/index.ts
27
src/index.ts
@@ -6,6 +6,7 @@ declare var window;
|
||||
|
||||
import {ActionSheet} from './plugins/actionsheet';
|
||||
import {AdMob} from './plugins/admob';
|
||||
import { AndroidFingerprintAuth } from './plugins/android-fingerprint-auth';
|
||||
import {AppAvailability} from './plugins/appavailability';
|
||||
import {AppRate} from './plugins/apprate';
|
||||
import {AppVersion} from './plugins/appversion';
|
||||
@@ -24,6 +25,7 @@ import {CameraPreview} from './plugins/camera-preview';
|
||||
import {CardIO} from './plugins/card-io';
|
||||
import {Clipboard} from './plugins/clipboard';
|
||||
import {Contacts} from './plugins/contacts';
|
||||
import {Crop} from './plugins/crop';
|
||||
import {DatePicker} from './plugins/datepicker';
|
||||
import {DBMeter} from './plugins/dbmeter';
|
||||
import {Deeplinks} from './plugins/deeplinks';
|
||||
@@ -47,6 +49,7 @@ import {Hotspot} from './plugins/hotspot';
|
||||
import {Httpd} from './plugins/httpd';
|
||||
import {IBeacon} from './plugins/ibeacon';
|
||||
import {ImagePicker} from './plugins/imagepicker';
|
||||
import {ImageResizer} from './plugins/imageresizer';
|
||||
import {InAppBrowser} from './plugins/inappbrowser';
|
||||
import {Insomnia} from './plugins/insomnia';
|
||||
import {Keyboard} from './plugins/keyboard';
|
||||
@@ -57,11 +60,14 @@ import {NativeStorage} from './plugins/nativestorage';
|
||||
import {MediaPlugin} from './plugins/media';
|
||||
import {Network} from './plugins/network';
|
||||
import {OneSignal} from './plugins/onesignal';
|
||||
import { PhotoViewer } from './plugins/photo-viewer';
|
||||
import {ScreenOrientation} from './plugins/screen-orientation';
|
||||
import {PinDialog} from './plugins/pin-dialog';
|
||||
import {Printer} from './plugins/printer';
|
||||
import {Push} from './plugins/push';
|
||||
import {SafariViewController} from './plugins/safari-view-controller';
|
||||
import {Screenshot} from './plugins/screenshot';
|
||||
import {SecureStorage} from './plugins/securestorage';
|
||||
import {Sim} from './plugins/sim';
|
||||
import {SMS} from './plugins/sms';
|
||||
import {SocialSharing} from './plugins/socialsharing';
|
||||
@@ -74,6 +80,7 @@ import {Toast} from './plugins/toast';
|
||||
import {TouchID} from './plugins/touchid';
|
||||
import {TwitterConnect} from './plugins/twitter-connect';
|
||||
import {Vibration} from './plugins/vibration';
|
||||
import {VideoPlayer} from './plugins/video-player';
|
||||
import {WebIntent} from './plugins/webintent';
|
||||
export * from './plugins/3dtouch';
|
||||
export * from './plugins/background-geolocation';
|
||||
@@ -87,11 +94,14 @@ export * from './plugins/datepicker';
|
||||
export * from './plugins/device';
|
||||
export * from './plugins/devicemotion';
|
||||
export * from './plugins/deviceorientation';
|
||||
export * from './plugins/file';
|
||||
export * from './plugins/filetransfer';
|
||||
export * from './plugins/geolocation';
|
||||
export * from './plugins/googlemaps';
|
||||
export * from './plugins/httpd';
|
||||
export * from './plugins/ibeacon';
|
||||
export * from './plugins/imagepicker';
|
||||
export * from './plugins/imageresizer';
|
||||
export * from './plugins/inappbrowser';
|
||||
export * from './plugins/launchnavigator';
|
||||
export * from './plugins/localnotifications';
|
||||
@@ -103,9 +113,12 @@ export * from './plugins/safari-view-controller';
|
||||
export * from './plugins/sms';
|
||||
export * from './plugins/spinnerdialog';
|
||||
export * from './plugins/toast';
|
||||
export * from './plugins/twitter-connect';
|
||||
export * from './plugins/video-player';
|
||||
export {
|
||||
ActionSheet,
|
||||
AdMob,
|
||||
AndroidFingerprintAuth,
|
||||
AppAvailability,
|
||||
AppRate,
|
||||
AppVersion,
|
||||
@@ -118,6 +131,7 @@ export {
|
||||
BluetoothSerial,
|
||||
CameraPreview,
|
||||
Clipboard,
|
||||
Crop,
|
||||
DBMeter,
|
||||
Deeplinks,
|
||||
DeviceAccounts,
|
||||
@@ -125,9 +139,7 @@ export {
|
||||
Diagnostic,
|
||||
EmailComposer,
|
||||
Facebook,
|
||||
File,
|
||||
Flashlight,
|
||||
Geolocation,
|
||||
Globalization,
|
||||
GooglePlus,
|
||||
GoogleAnalytics,
|
||||
@@ -137,8 +149,11 @@ export {
|
||||
NativeStorage,
|
||||
Network,
|
||||
OneSignal,
|
||||
PhotoViewer,
|
||||
ScreenOrientation,
|
||||
PinDialog,
|
||||
Screenshot,
|
||||
SecureStorage,
|
||||
SocialSharing,
|
||||
Sim,
|
||||
Splashscreen,
|
||||
@@ -146,7 +161,6 @@ export {
|
||||
StatusBar,
|
||||
TouchID,
|
||||
Transfer,
|
||||
TwitterConnect,
|
||||
Vibration,
|
||||
WebIntent
|
||||
}
|
||||
@@ -157,6 +171,7 @@ export * from './plugins/plugin';
|
||||
window['IonicNative'] = {
|
||||
ActionSheet: ActionSheet,
|
||||
AdMob: AdMob,
|
||||
AndroidFingerprintAuth: AndroidFingerprintAuth,
|
||||
AppAvailability: AppAvailability,
|
||||
AppRate: AppRate,
|
||||
AppVersion: AppVersion,
|
||||
@@ -175,6 +190,7 @@ window['IonicNative'] = {
|
||||
CardIO: CardIO,
|
||||
Clipboard: Clipboard,
|
||||
Contacts: Contacts,
|
||||
Crop: Crop,
|
||||
DatePicker: DatePicker,
|
||||
DBMeter: DBMeter,
|
||||
Deeplinks: Deeplinks,
|
||||
@@ -197,6 +213,7 @@ window['IonicNative'] = {
|
||||
Httpd: Httpd,
|
||||
IBeacon: IBeacon,
|
||||
ImagePicker: ImagePicker,
|
||||
ImageResizer: ImageResizer,
|
||||
InAppBrowser: InAppBrowser,
|
||||
Keyboard: Keyboard,
|
||||
LaunchNavigator: LaunchNavigator,
|
||||
@@ -208,9 +225,12 @@ window['IonicNative'] = {
|
||||
Printer: Printer,
|
||||
Push: Push,
|
||||
OneSignal: OneSignal,
|
||||
PhotoViewer: PhotoViewer,
|
||||
ScreenOrientation: ScreenOrientation,
|
||||
PinDialog: PinDialog,
|
||||
SafariViewController: SafariViewController,
|
||||
Screenshot: Screenshot,
|
||||
SecureStorage: SecureStorage,
|
||||
Sim: Sim,
|
||||
SMS: SMS,
|
||||
SocialSharing: SocialSharing,
|
||||
@@ -223,6 +243,7 @@ window['IonicNative'] = {
|
||||
TouchID: TouchID,
|
||||
Transfer: Transfer,
|
||||
TwitterConnect: TwitterConnect,
|
||||
VideoPlayer: VideoPlayer,
|
||||
Vibration: Vibration,
|
||||
WebIntent: WebIntent
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@ declare var window: any;
|
||||
* @usage
|
||||
* Please do refer to the original plugin's repo for detailed usage. The usage example here might not be sufficient.
|
||||
* ```
|
||||
* import {ThreeDeeTouch} from 'ionic-native';
|
||||
* import { ThreeDeeTouch } from 'ionic-native';
|
||||
*
|
||||
* // import for type completion on variables
|
||||
* import {ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch} from 'ionic-native';
|
||||
* import { ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch } from 'ionic-native';
|
||||
* ...
|
||||
*
|
||||
* ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable)):
|
||||
* ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable));
|
||||
*
|
||||
* ThreeDeeTouch.watchForceTouches()
|
||||
* .subscribe(
|
||||
@@ -57,7 +57,7 @@ declare var window: any;
|
||||
* ThreeDeeTouchForceTouch.onHomeIconPressed().subscribe(
|
||||
* (payload) => {
|
||||
* // returns an object that is the button you presed
|
||||
* console.log(`Pressed the ${payload.title} button`)
|
||||
* console.log('Pressed the ${payload.title} button')
|
||||
* console.log(payload.type)
|
||||
*
|
||||
* }
|
||||
@@ -130,13 +130,16 @@ export class ThreeDeeTouch {
|
||||
sync: true
|
||||
})
|
||||
static disableLinkPreview(): void { }
|
||||
|
||||
}
|
||||
|
||||
export interface ThreeDeeTouchQuickAction {
|
||||
type?: string;
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
iconType?: string;
|
||||
}
|
||||
|
||||
export interface ThreeDeeTouchForceTouch {
|
||||
force: number;
|
||||
timestamp: number;
|
||||
|
||||
@@ -9,8 +9,9 @@ import { Cordova, Plugin } from './plugin';
|
||||
* Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {ActionSheet} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { ActionSheet } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
|
||||
* ActionSheet.show({
|
||||
@@ -18,8 +19,8 @@ import { Cordova, Plugin } from './plugin';
|
||||
* 'buttonLabels': buttonLabels,
|
||||
* 'addCancelButtonWithLabel': 'Cancel',
|
||||
* 'addDestructiveButtonWithLabel' : 'Delete'
|
||||
* }).then(buttonIndex => {
|
||||
* console.log('Button pressed: ' + buttonLabels[buttonIndex - 1]);
|
||||
* }).then((buttonIndex: number) => {
|
||||
* console.log('Button pressed: ' + buttonIndex);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
@@ -72,4 +73,5 @@ export class ActionSheet {
|
||||
*/
|
||||
@Cordova()
|
||||
static hide(options?: any): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
77
src/plugins/android-fingerprint-auth.ts
Normal file
77
src/plugins/android-fingerprint-auth.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
/**
|
||||
* @name Android Fingerprint Auth
|
||||
* @description
|
||||
* This plugin will open a native dialog fragment prompting the user to authenticate using their fingerprint. If the device has a secure lockscreen (pattern, PIN, or password), the user may opt to authenticate using that method as a backup.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AndroidFingerprintAuth } from 'ionic-native';
|
||||
*
|
||||
* AndroidFingerprintAuth.isAvailable()
|
||||
* .then((result)=> {
|
||||
* if(result.isAvailable){
|
||||
* // it is available
|
||||
*
|
||||
* AndroidFingerprintAuth.show({ clientId: "myAppName", clientSecret: "so_encrypted_much_secure_very_secret" })
|
||||
* .then(result => {
|
||||
* if(result.withFingerprint) {
|
||||
* console.log('Successfully authenticated with fingerprint!');
|
||||
* } else if(result.withPassword) {
|
||||
* console.log('Successfully authenticated with backup password!');
|
||||
* } else console.log('Didn\'t authenticate!');
|
||||
* })
|
||||
* .catch(error => console.error(error));
|
||||
*
|
||||
* } else {
|
||||
* // fingerprint auth isn't available
|
||||
* }
|
||||
* })
|
||||
* .catch(error => console.error(error));
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-android-fingerprint-auth',
|
||||
pluginRef: 'FingerprintAuth',
|
||||
repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth'
|
||||
})
|
||||
export class AndroidFingerprintAuth {
|
||||
/**
|
||||
* Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
|
||||
* @param params {any}
|
||||
*/
|
||||
@Cordova()
|
||||
static show(params: {
|
||||
/**
|
||||
* Used as the alias for your key in the Android Key Store.
|
||||
*/
|
||||
clientId: string;
|
||||
/**
|
||||
* Used to encrypt the token returned upon successful fingerprint authentication.
|
||||
*/
|
||||
clientSecret: string;
|
||||
/**
|
||||
* Set to true to remove the "USE BACKUP" button
|
||||
*/
|
||||
disableBackup?: boolean;
|
||||
/**
|
||||
* Change the language. (en_US or es)
|
||||
*/
|
||||
locale?: string
|
||||
}): Promise<{
|
||||
/**
|
||||
* Base64 encoded string
|
||||
*/
|
||||
withFingerprint: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
withPassword: boolean;
|
||||
}> {return; }
|
||||
|
||||
/**
|
||||
* Check if service is available
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<{isAvailable: boolean}> {return; }
|
||||
|
||||
}
|
||||
@@ -8,22 +8,22 @@ import { Cordova, Plugin } from './plugin';
|
||||
* Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {AppAvailability} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { AppAvailability } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* var app;
|
||||
* let app;
|
||||
*
|
||||
* if(device.platform === 'iOS') {
|
||||
* if (device.platform === 'iOS') {
|
||||
* app = 'twitter://';
|
||||
* }else if(device.platform === 'Android'){
|
||||
* } else if (device.platform === 'Android') {
|
||||
* app = 'com.twitter.android';
|
||||
* }
|
||||
*
|
||||
* AppAvailability.check(app)
|
||||
* .then(
|
||||
* yes => console.log(app + " is available"),
|
||||
* no => console.log(app + " is NOT available")
|
||||
* (yes: string) => console.log(app + ' is available'),
|
||||
* (no: string) => console.log(app + ' is NOT available')
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -11,14 +11,14 @@ declare var window;
|
||||
* Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [AppRate plugin docs](https://github.com/pushandplay/cordova-plugin-apprate).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {AppRate} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { AppRate } from 'ionic-native';
|
||||
*
|
||||
* AppRate.preferences.storeAppURL = {
|
||||
* ios: '<my_app_id>',
|
||||
* android: 'market://details?id=<package_name>',
|
||||
* };
|
||||
*
|
||||
* AppRate.preferences.storeAppURL.ios = '<my_app_id>';
|
||||
* AppRate.preferences.storeAppURL.android = 'market://details?id=<package_name>';
|
||||
* AppRate.preferences.storeAppURL.blackberry = 'appworld://content/[App Id]/';
|
||||
* AppRate.preferences.storeAppURL.windows8 = 'ms-windows-store:Review?name=<the Package Family Name of the application>';
|
||||
* AppRate.promptForRating();
|
||||
* ```
|
||||
*
|
||||
|
||||
@@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin';
|
||||
* Requires Cordova plugin: `cordova-plugin-app-version`. For more info, please see the [Cordova App Version docs](https://github.com/whiteoctober/cordova-plugin-app-version).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {AppVersion} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { AppVersion } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* AppVersion.getAppName();
|
||||
|
||||
@@ -89,7 +89,7 @@ export interface Config {
|
||||
* When enabled, the plugin will emit sounds for life-cycle events of
|
||||
* background-geolocation! See debugging sounds table.
|
||||
*/
|
||||
debug: boolean;
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* The minimum distance (measured in meters) a device must move horizontally
|
||||
@@ -100,7 +100,9 @@ export interface Config {
|
||||
/**
|
||||
* IOS, ANDROID ONLY
|
||||
* Enable this in order to force a stop() when the application terminated
|
||||
* (e.g. on iOS, double-tap home button, swipe away the app).
|
||||
* (e.g. on iOS, double-tap home button, swipe away the app).o
|
||||
*
|
||||
* Defaults to true
|
||||
*/
|
||||
stopOnTerminate?: boolean;
|
||||
|
||||
@@ -111,7 +113,7 @@ export interface Config {
|
||||
* and the MS doc (http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator.reportinterval)
|
||||
* for more information
|
||||
*/
|
||||
locationTimeout?: number;
|
||||
interval?: number;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
@@ -142,7 +144,7 @@ export interface Config {
|
||||
* ANDROID ONLY
|
||||
* Set location service provider @see wiki (https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers)
|
||||
*/
|
||||
locationService?: number;
|
||||
locationProvider?: number;
|
||||
|
||||
/**
|
||||
* IOS ONLY
|
||||
@@ -162,9 +164,8 @@ export interface Config {
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* import {BackgroundGeolocation} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* import { BackgroundGeolocation } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // When device is ready :
|
||||
@@ -179,18 +180,19 @@ export interface Config {
|
||||
* stopOnTerminate: false, // enable this to clear background location settings when the app terminates
|
||||
* };
|
||||
*
|
||||
* BackgroundGeolocation.configure(config)
|
||||
* .then((location) => {
|
||||
* console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
|
||||
*
|
||||
* // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
|
||||
* // and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
|
||||
* // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
|
||||
* BackgroundGeolocation.finish(); // FOR IOS ONLY
|
||||
* })
|
||||
* .catch((error) => {
|
||||
* console.log('BackgroundGeolocation error');
|
||||
* });
|
||||
* BackgroundGeolocation.configure((location) => {
|
||||
console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
|
||||
|
||||
// IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
|
||||
// and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
|
||||
// IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
|
||||
BackgroundGeolocation.finish(); // FOR IOS ONLY
|
||||
|
||||
* }, (error) => {
|
||||
* console.log('BackgroundGeolocation error');
|
||||
* }, {
|
||||
* //options
|
||||
* });
|
||||
*
|
||||
* // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
|
||||
* BackgroundGeolocation.start();
|
||||
@@ -220,9 +222,9 @@ export class BackgroundGeolocation {
|
||||
* Options a json object of type Config
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
sync: true
|
||||
})
|
||||
static configure(options: Config): Promise<Location> { return; }
|
||||
static configure(callback: Function, errorCallback: Function, options: Config): void { return; }
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,8 +6,8 @@ import { Cordova, Plugin } from './plugin';
|
||||
* Cordova plugin to prevent the app from going to sleep while in background.
|
||||
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode#android-customization
|
||||
*@usage
|
||||
* ```js
|
||||
* import {BackgroundMode} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { BackgroundMode } from 'ionic-native';
|
||||
*
|
||||
* BackgroundMode.enable();
|
||||
* ```
|
||||
@@ -91,6 +91,7 @@ export class BackgroundMode {
|
||||
sync: true
|
||||
})
|
||||
static on(eventName: string, callback: any): void { }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin';
|
||||
* Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Badge} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Badge } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* Badge.set(10);
|
||||
@@ -74,4 +74,5 @@ export class Badge {
|
||||
*/
|
||||
@Cordova()
|
||||
static registerPermission(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin';
|
||||
* Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {BarcodeScanner} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { BarcodeScanner } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* BarcodeScanner.scan().then((barcodeData) => {
|
||||
|
||||
@@ -3,13 +3,13 @@ import { Cordova, Plugin } from './plugin';
|
||||
* @name Base64 To Gallery
|
||||
* @description This plugin allows you to save base64 data as a png image into the device
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {Base64ToGallery} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Base64ToGallery } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* Base64ToGallery.base64ToGallery(base64Data, 'img_').then(
|
||||
* res => console.log("Saved image to gallery ", res),
|
||||
* err => console.log("Error saving image to gallery ", err)
|
||||
* res => console.log('Saved image to gallery ', res),
|
||||
* err => console.log('Error saving image to gallery ', err)
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
@@ -24,7 +24,7 @@ export class Base64ToGallery {
|
||||
/**
|
||||
* Converts a base64 string to an image file in the device gallery
|
||||
* @param {string} data The actual base64 string that you want to save
|
||||
* @param {any} options (optional) An object with properties: prefix, mediaScanner
|
||||
* @param {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS.
|
||||
* @returns {Promise} returns a promise that resolves when the image is saved.
|
||||
*/
|
||||
@Cordova()
|
||||
|
||||
@@ -7,14 +7,13 @@ import { Observable } from 'rxjs/Observable';
|
||||
* Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {BatteryStatus} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* import { BatteryStatus } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // watch change in battery status
|
||||
* let subscription = BatteryStatus.onChange().subscribe(
|
||||
* status => {
|
||||
* (status: StatusObject) => {
|
||||
* console.log(status.level, status.isPlugged);
|
||||
* }
|
||||
* );
|
||||
|
||||
@@ -24,7 +24,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
*
|
||||
* Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning.
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* {
|
||||
* "name": "Battery Demo",
|
||||
* "id": "20:FF:D0:FF:D1:C0",
|
||||
@@ -34,7 +34,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
* ```
|
||||
* After connecting, the peripheral object also includes service, characteristic and descriptor information.
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* {
|
||||
* "name": "Battery Demo",
|
||||
* "id": "20:FF:D0:FF:D1:C0",
|
||||
@@ -93,7 +93,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
*
|
||||
* ### Android
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* {
|
||||
* "name": "demo",
|
||||
* "id": "00:1A:7D:DA:71:13",
|
||||
@@ -108,7 +108,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
*
|
||||
* Note that iOS uses the string value of the constants for the [Advertisement Data Retrieval Keys](https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBCentralManagerDelegate_Protocol/index.html#//apple_ref/doc/constant_group/Advertisement_Data_Retrieval_Keys). This will likely change in the future.
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* {
|
||||
* "name": "demo",
|
||||
* "id": "D8479A4F-7517-BCD3-91B5-3302B2F81802",
|
||||
@@ -137,7 +137,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
*
|
||||
* This means that you need convert your data to ArrayBuffers before sending and from ArrayBuffers when receiving.
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* // ASCII only
|
||||
* function stringToBytes(string) {
|
||||
* var array = new Uint8Array(string.length);
|
||||
|
||||
@@ -5,12 +5,15 @@ import { Observable } from 'rxjs/Observable';
|
||||
* @name Bluetooth Serial
|
||||
* @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { BluetoothSerial } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Write a string
|
||||
* Bluetooth.write("hello world").then(success, failure);
|
||||
* BluetoothSerial.write("hello world").then(success, failure);
|
||||
*
|
||||
* // Array of int or bytes
|
||||
* Bluetooth.write([186, 220, 222]).then(success, failure);
|
||||
* BluetoothSerial.write([186, 220, 222]).then(success, failure);
|
||||
*
|
||||
* // Typed Array
|
||||
* var data = new Uint8Array(4);
|
||||
@@ -18,10 +21,10 @@ import { Observable } from 'rxjs/Observable';
|
||||
* data[1] = 0x42;
|
||||
* data[2] = 0x43;
|
||||
* data[3] = 0x44;
|
||||
* Bluetooth.write(data).then(success, failure);
|
||||
* BluetoothSerial.write(data).then(success, failure);
|
||||
*
|
||||
* // Array Buffer
|
||||
* Bluetooth.write(data.buffer).then(success, failure);
|
||||
* BluetoothSerial.write(data.buffer).then(success, failure);
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -218,4 +221,5 @@ export class BluetoothSerial {
|
||||
sync: true
|
||||
})
|
||||
static setDiscoverable(discoverableDuration: number): void { }
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,9 @@ import { Cordova, Plugin } from './plugin';
|
||||
* Requires Cordova plugin: `cordova-plugin-brightness`. For more info, please see the [Brightness plugin docs](https://github.com/mgcrea/cordova-plugin-brightness).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {Brightness} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Brightness } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* let brightnessValue: number = 0.8;
|
||||
* Brightness.setBrightness(brightnessValue);
|
||||
@@ -18,7 +19,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-brightness',
|
||||
pluginRef: 'plugins.brightness',
|
||||
pluginRef: 'cordova.plugins.brightness',
|
||||
repo: 'https://github.com/mgcrea/cordova-plugin-brightness',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@@ -47,4 +48,5 @@ export class Brightness {
|
||||
*/
|
||||
@Cordova()
|
||||
static setKeepScreenOn(value: boolean): void { }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface CalendarOptions {
|
||||
firstReminderMinutes?: number;
|
||||
secondReminderMinutes?: number;
|
||||
@@ -12,11 +15,6 @@ export interface CalendarOptions {
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface Calendar {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Calendar
|
||||
* @description
|
||||
@@ -24,7 +22,18 @@ export interface Calendar {
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin).
|
||||
*
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Calendar} from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* Calendar.createCalendar('MyCalendar').then(
|
||||
* (msg) => { console.log(msg); },
|
||||
* (err) => { console.log(err); }
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -87,23 +96,8 @@ export class Calendar {
|
||||
/**
|
||||
* Create a calendar. (iOS only)
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Calendar} from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* Calendar.createCalendar('MyCalendar').then(
|
||||
* (msg) => { console.log(msg); },
|
||||
* (err) => { console.log(err); }
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @param {string | Object} nameOrOptions either a string name or a options object.
|
||||
* options:
|
||||
* calendarName: string the name of the calendar
|
||||
* calendarColor: string the hex color of the calendar
|
||||
* @return Returns a Promise
|
||||
* @param {string | Object} nameOrOptions either a string name or a options object. If string, provide the calendar name. IF an object, provide a calendar name as a string and a calendar color in hex format as a string
|
||||
* @return {Promise} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static createCalendar(
|
||||
@@ -112,15 +106,6 @@ export class Calendar {
|
||||
|
||||
/**
|
||||
* Delete a calendar. (iOS only)
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* Calendar.deleteCalendar('MyCalendar').then(
|
||||
* (msg) => { console.log(msg); },
|
||||
* (err) => { console.log(err); }
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @param {string} name Name of the calendar to delete.
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@@ -158,7 +143,6 @@ export class Calendar {
|
||||
|
||||
/**
|
||||
* Silently create an event.
|
||||
*
|
||||
* @param {string} [title] The event title
|
||||
* @param {string} [location] The event location
|
||||
* @param {string} [notes] The event notes
|
||||
@@ -268,7 +252,6 @@ export class Calendar {
|
||||
|
||||
/**
|
||||
* Find an event with additional options.
|
||||
*
|
||||
* @param {string} [title] The event title
|
||||
* @param {string} [location] The event location
|
||||
* @param {string} [notes] The event notes
|
||||
@@ -413,8 +396,10 @@ export class Calendar {
|
||||
|
||||
/**
|
||||
* Open the calendar at the specified date.
|
||||
* @return {Date} date
|
||||
* @param {Date} date The date you want to open the calendar on
|
||||
* @return {Promise<any>} Promise returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
static openCalendar(date: Date): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
export interface CameraPreviewOptions {
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
/**
|
||||
* Choose the camera to use (front- or back-facing).
|
||||
* 'front' for front camera
|
||||
* 'rear' for rear camera
|
||||
*/
|
||||
camera: string;
|
||||
/** Take photo on tap */
|
||||
tapPhoto: boolean;
|
||||
/** */
|
||||
previewDrag: boolean;
|
||||
/** */
|
||||
toBack: boolean;
|
||||
/** Alpha use when toBack is set to true */
|
||||
alpha: number;
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
/**
|
||||
* Choose the camera to use (front- or back-facing).
|
||||
* 'front' for front camera
|
||||
* 'rear' for rear camera
|
||||
*/
|
||||
camera: string;
|
||||
/** Take photo on tap */
|
||||
tapPhoto: boolean;
|
||||
/** */
|
||||
previewDrag: boolean;
|
||||
/** */
|
||||
toBack: boolean;
|
||||
/** Alpha use when toBack is set to true */
|
||||
alpha: number;
|
||||
}
|
||||
|
||||
export interface CameraPreviewSize {
|
||||
maxWidth: number;
|
||||
maxHeight: number;
|
||||
maxWidth: number;
|
||||
maxHeight: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,13 +33,13 @@ export interface CameraPreviewSize {
|
||||
* @description
|
||||
* Showing camera preview in HTML
|
||||
*
|
||||
* Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera-preview`. For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/westonganger/cordova-plugin-camera-preview).
|
||||
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-camera-preview',
|
||||
pluginRef: 'cordova.plugins.camerapreview',
|
||||
repo: 'https://github.com/westonganger/cordova-plugin-camera-preview',
|
||||
repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class CameraPreview {
|
||||
@@ -50,7 +51,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static startCamera(options: CameraPreviewOptions): void {};
|
||||
static startCamera(options: CameraPreviewOptions): void { };
|
||||
|
||||
/**
|
||||
* Stops the camera preview instance.
|
||||
@@ -58,7 +59,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static stopCamera(): void {};
|
||||
static stopCamera(): void { };
|
||||
|
||||
/**
|
||||
* Take the picture, the parameter size is optional
|
||||
@@ -66,7 +67,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static takePicture(size: CameraPreviewSize): void {};
|
||||
static takePicture(size: CameraPreviewSize): void { };
|
||||
|
||||
/**
|
||||
* Register a callback function that receives the original picture and the image captured from the preview box.
|
||||
@@ -82,7 +83,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static switchCamera(): void {};
|
||||
static switchCamera(): void { };
|
||||
|
||||
/**
|
||||
* Show the camera preview box.
|
||||
@@ -90,7 +91,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static show(): void {};
|
||||
static show(): void { };
|
||||
|
||||
/**
|
||||
* Hide the camera preview box.
|
||||
@@ -98,15 +99,15 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static hide(): void {};
|
||||
static hide(): void { };
|
||||
|
||||
/**
|
||||
* Set the default mode for the Flash.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static setFlashMode(mode: number): void {};
|
||||
// @Cordova({
|
||||
// sync: true
|
||||
// })
|
||||
// static setFlashMode(mode: number): void { };
|
||||
|
||||
/**
|
||||
* Set camera color effect.
|
||||
@@ -114,7 +115,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static setColorEffect(effect: string): void {};
|
||||
static setColorEffect(effect: string): void { };
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -93,14 +93,16 @@ export interface CameraPopoverOptions {
|
||||
* Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Camera} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Camera } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* Camera.getPicture(options).then((imageData) => {
|
||||
* // imageData is either a base64 encoded string or a file URI
|
||||
* // If it's base64:
|
||||
* let base64Image = "data:image/jpeg;base64," + imageData;
|
||||
* let base64Image = 'data:image/jpeg;base64,' + imageData;
|
||||
* }, (err) => {
|
||||
* // Handle error
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
@@ -186,13 +188,13 @@ export class Camera {
|
||||
|
||||
/**
|
||||
* Take a picture or video, or load one from the library.
|
||||
* @param {CameraOptions} options Options that you want to pass to the camera. Encoding type, quality, etc.
|
||||
* @param {CameraOptions?} options Options that you want to pass to the camera. Encoding type, quality, etc. Optional
|
||||
* @return {Promise} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getPicture(options: CameraOptions): Promise<any> { return; }
|
||||
static getPicture(options?: CameraOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name CardIO
|
||||
* @description
|
||||
* @usage
|
||||
* ```
|
||||
* import {CardIO} from 'ionic-native';
|
||||
* import { CardIO } from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* CardIO.canScan()
|
||||
* .then(
|
||||
@@ -51,6 +51,7 @@ export class CardIO {
|
||||
*/
|
||||
@Cordova()
|
||||
static version(): Promise<string> { return; }
|
||||
|
||||
}
|
||||
|
||||
export interface CardIOOptions {
|
||||
|
||||
@@ -10,19 +10,18 @@ import { Cordova, Plugin } from './plugin';
|
||||
* For more info, please see the [Clipboard plugin docs](https://github.com/VersoSolutions/CordovaClipboard.git).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Clipboard} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Clipboard } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* Clipboard.copy("Hello world");
|
||||
* Clipboard.copy('Hello world');
|
||||
*
|
||||
* Clipboard.paste().then(
|
||||
* (resolve : string) => {
|
||||
* (resolve: string) => {
|
||||
* alert(resolve);
|
||||
* },
|
||||
* (reject : string) => {
|
||||
* alert("Error: " + reject);
|
||||
* (reject: string) => {
|
||||
* alert('Error: ' + reject);
|
||||
* }
|
||||
* );
|
||||
* );
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Cordova, CordovaInstance, Plugin, InstanceProperty } from './plugin';
|
||||
import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var window: any,
|
||||
@@ -257,16 +257,15 @@ export class ContactFindOptions implements IContactFindOptions {
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```js
|
||||
* import {Contact} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* import { Contact } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* let contact = new Contact();
|
||||
* contact.displayName = "Mr. Ionitron";
|
||||
* contact.displayName = 'Mr. Ionitron';
|
||||
* contact.save().then(
|
||||
* () => console.log("Contact saved!", contact),
|
||||
* (error: any) => console.error("Error saving contact.", error)
|
||||
* () => console.log('Contact saved!', contact),
|
||||
* (error: any) => console.error('Error saving contact.', error)
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
@@ -308,4 +307,5 @@ export class Contacts {
|
||||
*/
|
||||
@Cordova()
|
||||
static pickContact(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
34
src/plugins/crop.ts
Normal file
34
src/plugins/crop.ts
Normal 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; }
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
export interface DatePickerOptions {
|
||||
/**
|
||||
* Platforms: iOS, Android, Windows
|
||||
@@ -73,16 +74,16 @@ export interface DatePickerOptions {
|
||||
* Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {DatePicker} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { DatePicker } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* DatePicker.show({
|
||||
* date: new Date(),
|
||||
* mode: 'date'
|
||||
* }).then(
|
||||
* date => console.log("Got date: ", date),
|
||||
* err => console.log("Error occurred while getting date:", err)
|
||||
* date => console.log('Got date: ', date),
|
||||
* err => console.log('Error occurred while getting date: ', err)
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
|
||||
@@ -6,9 +6,8 @@ import { Observable } from 'rxjs/Observable';
|
||||
* @name DB Meter
|
||||
* @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {DBMeter} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* import { DBMeter } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Start listening
|
||||
@@ -18,7 +17,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
*
|
||||
* // Check if we are listening
|
||||
* DBMeter.isListening().then(
|
||||
* (isListening : boolean) => console.log(isListening)
|
||||
* (isListening: boolean) => console.log(isListening)
|
||||
* );
|
||||
*
|
||||
* // Stop listening
|
||||
@@ -26,8 +25,8 @@ import { Observable } from 'rxjs/Observable';
|
||||
*
|
||||
* // Delete DBMeter instance from memory
|
||||
* DBMeter.delete().then(
|
||||
* () => console.log("Deleted DB Meter instance"),
|
||||
* error => console.log("Error occurred while deleting DB Meter instance")
|
||||
* () => console.log('Deleted DB Meter instance'),
|
||||
* error => console.log('Error occurred while deleting DB Meter instance')
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -27,8 +27,8 @@ export interface DeeplinkMatch {
|
||||
* and Universal App Links.
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {IonicDeeplinks} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { IonicDeeplinks } from 'ionic-native';
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@@ -77,4 +77,5 @@ export class Deeplinks {
|
||||
observable: true
|
||||
})
|
||||
static routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -33,9 +33,8 @@ export interface Device {
|
||||
* Access information about the underlying device and platform.
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Device} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* import { Device } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* console.log('Device UUID is: ' + Device.device.uuid);
|
||||
@@ -55,4 +54,5 @@ export class Device {
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get device() { return window.device; }
|
||||
|
||||
}
|
||||
|
||||
@@ -32,4 +32,5 @@ export class DeviceAccounts {
|
||||
*/
|
||||
@Cordova()
|
||||
static getEmail(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -41,19 +41,18 @@ export interface AccelerometerOptions {
|
||||
* Requires Cordova plugin: `cordova-plugin-device-motion`. For more info, please see the [Device Motion docs](https://github.com/apache/cordova-plugin-device-motion).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {DeviceMotion} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* import { DeviceMotion } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Get the device current acceleration
|
||||
* DeviceMotion.getCurrentAcceleration().then(
|
||||
* acceleration => console.log(acceleration),
|
||||
* error => console.log(error)
|
||||
* (acceleration: AccelerationData) => console.log(acceleration),
|
||||
* (error: any) => console.log(error)
|
||||
* );
|
||||
*
|
||||
* // Watch device acceleration
|
||||
* var subscription = DeviceMotion.watchAcceleration().subscribe(acceleration => {
|
||||
* var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: AccelerationData) => {
|
||||
* console.log(acceleration);
|
||||
* });
|
||||
*
|
||||
@@ -87,4 +86,5 @@ export class DeviceMotion {
|
||||
clearFunction: 'clearWatch'
|
||||
})
|
||||
static watchAcceleration(options?: AccelerometerOptions): Observable<AccelerationData> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -46,20 +46,20 @@ export interface CompassOptions {
|
||||
* Requires Cordova plugin: `cordova-plugin-device-orientation`. For more info, please see the [Device Orientation docs](https://github.com/apache/cordova-plugin-device-orientation).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {DeviceOrientation} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* // CompassHeading is an interface for compass
|
||||
* import { DeviceOrientation, CompassHeading } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Get the device current compass heading
|
||||
* DeviceOrientation.getCurrentHeading().then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* (data: CompassHeading) => console.log(data),
|
||||
* (error: any) => console.log(error)
|
||||
* );
|
||||
*
|
||||
* // Watch the device compass heading change
|
||||
* var subscription = DeviceOrientation.watchHeading().subscribe(
|
||||
* data => console.log(data)
|
||||
* (data: CompassHeading) => console.log(data)
|
||||
* );
|
||||
*
|
||||
* // Stop watching heading change
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Diagnostic
|
||||
* @description
|
||||
* Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Diagnostic } from 'ionic-native';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova.plugins.diagnostic',
|
||||
pluginRef: 'cordova.plugins.diagnostic',
|
||||
@@ -11,28 +20,28 @@ export class Diagnostic {
|
||||
* Checks if app is able to access device location.
|
||||
*/
|
||||
@Cordova()
|
||||
static isLocationEnabled(): Promise<any> { return; }
|
||||
static isLocationAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
|
||||
* On Android this requires permission. `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />`
|
||||
*/
|
||||
@Cordova()
|
||||
static isWifiEnabled(): Promise<any> { return; }
|
||||
static isWifiAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
|
||||
* application is authorized to use it.
|
||||
*/
|
||||
@Cordova()
|
||||
static isCameraEnabled(): Promise<any> { return; }
|
||||
static isCameraAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
|
||||
* On Android this requires permission <uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
*/
|
||||
@Cordova()
|
||||
static isBluetoothEnabled(): Promise<any> { return; }
|
||||
static isBluetoothAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the location authorization status for the application.
|
||||
@@ -95,4 +104,5 @@ export class Diagnostic {
|
||||
*/
|
||||
@Cordova()
|
||||
static isRegisteredForRemoteNotifications(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ export interface PromptCallback {
|
||||
* Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the [Dialogs plugin docs](https://github.com/apache/cordova-plugin-dialogs).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Dialogs} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Dialogs } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
|
||||
@@ -10,13 +10,14 @@ declare var cordova: any;
|
||||
* Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/katzer/cordova-plugin-email-composer).
|
||||
*
|
||||
* DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version.
|
||||
* A good alternative to this plugin is the social sharing plugin.
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {EmailComposer} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { EmailComposer } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* EmailComposer.isAvailable().then((available) =>{
|
||||
* EmailComposer.isAvailable().then((available: boolean) =>{
|
||||
* if(available) {
|
||||
* //Now we know we can send
|
||||
* }
|
||||
|
||||
@@ -69,8 +69,8 @@ import { Cordova, Plugin } from './plugin';
|
||||
* For tracking events, see `logEvent` and `logPurchase`.
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Facebook} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Facebook } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -98,7 +98,7 @@ export class Facebook {
|
||||
/**
|
||||
* Login to Facebook to authenticate this app.
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* {
|
||||
* status: "connected",
|
||||
* authResponse: {
|
||||
@@ -245,7 +245,9 @@ export class Facebook {
|
||||
url: string,
|
||||
picture: string
|
||||
}): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
export interface FacebookLoginResponse {
|
||||
status: string;
|
||||
authResponse: {
|
||||
|
||||
1159
src/plugins/file.ts
1159
src/plugins/file.ts
File diff suppressed because it is too large
Load Diff
@@ -112,25 +112,42 @@ export interface FileTransferError {
|
||||
* This plugin allows you to upload and download files.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Transfer } from 'ionic-native';
|
||||
*
|
||||
* Create instance:
|
||||
* ```ts
|
||||
*
|
||||
* // Create instance:
|
||||
* const fileTransfer = new Transfer();
|
||||
* ```
|
||||
*
|
||||
* Upload a file:
|
||||
* ```ts
|
||||
* // Upload a file:
|
||||
* fileTransfer.upload(..).then(..).catch(..);
|
||||
* ```
|
||||
*
|
||||
* Download a file:
|
||||
* ```ts
|
||||
* // Download a file:
|
||||
* fileTransfer.download(..).then(..).catch(..);
|
||||
* ```
|
||||
*
|
||||
* Abort active transfer:
|
||||
* ```ts
|
||||
* // Abort active transfer:
|
||||
* fileTransfer.abort();
|
||||
*
|
||||
* E.g
|
||||
*
|
||||
* upload(){
|
||||
* const fileTransfer = new Transfer();
|
||||
* var options: any;
|
||||
*
|
||||
* options = {
|
||||
* fileKey: 'file',
|
||||
* fileName: 'name.jpg',
|
||||
* headers: {}
|
||||
* .....
|
||||
* }
|
||||
* fileTransfer.upload("<file path>", "<api endpoint>", options)
|
||||
* .then((data) => {
|
||||
* // success
|
||||
* }, (err) => {
|
||||
* // error
|
||||
* })
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin';
|
||||
* Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Flashlight} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Flashlight } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -53,7 +53,7 @@ export class Flashlight {
|
||||
|
||||
/**
|
||||
* Checks if the flashlight is turned on.
|
||||
* Returns a boolean
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
|
||||
@@ -102,20 +102,19 @@ export interface GeolocationOptions {
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* import {Geolocation} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* import { Geolocation } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* Geolocation.getCurrentPosition().then((resp) => {
|
||||
* //resp.coords.latitude
|
||||
* //resp.coords.longitude
|
||||
* // resp.coords.latitude
|
||||
* // resp.coords.longitude
|
||||
* })
|
||||
*
|
||||
* let watch = Geolocation.watchPosition();
|
||||
* watch.subscribe((data) => {
|
||||
* //data.coords.latitude
|
||||
* //data.coords.longitude
|
||||
* // data.coords.latitude
|
||||
* // data.coords.longitude
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
@@ -140,7 +139,7 @@ export class Geolocation {
|
||||
* Watch the current device's position. Clear the watch by unsubscribing from
|
||||
* Observable changes.
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* var subscription = Geolocation.watchPosition().subscribe(position => {
|
||||
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
|
||||
* });
|
||||
|
||||
@@ -4,9 +4,8 @@ import { Cordova, Plugin } from './plugin';
|
||||
* @name Globalization
|
||||
* @description
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Globalization} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* import { Globalization } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* ```
|
||||
|
||||
@@ -5,7 +5,9 @@ import { Cordova, Plugin } from './plugin';
|
||||
* @name Google Plus
|
||||
* @description
|
||||
* @usage
|
||||
* ```
|
||||
* ```typescript
|
||||
* import { GooglePlus } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -46,14 +46,16 @@ export const GoogleMapsAnimation = {
|
||||
* @description This plugin uses the native Google Maps SDK
|
||||
* @usage
|
||||
* ```
|
||||
* import {GoogleMap, GoogleMapsEvent} from 'ionic-native';
|
||||
* import { GoogleMap, GoogleMapsEvent } from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // somewhere in your component
|
||||
* let map = new GoogleMap('elementID');
|
||||
* let map = new GoogleMap('elementID', {
|
||||
* // Map Options: https://developers.google.com/maps/documentation/javascript/3.exp/reference#MapOptions
|
||||
});
|
||||
*
|
||||
* map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log("Map is ready!"));
|
||||
* map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!'));
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -65,8 +67,9 @@ export class GoogleMap {
|
||||
_objectInstance: any;
|
||||
|
||||
/**
|
||||
* Checks if a map object has been created.
|
||||
* @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates if the plugin is available.
|
||||
* Checks if a map object has been created and is available.
|
||||
*
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<boolean> {
|
||||
@@ -77,6 +80,11 @@ export class GoogleMap {
|
||||
this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId), options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to a map event.
|
||||
*
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
on(event: any): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
@@ -86,13 +94,17 @@ export class GoogleMap {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to a map event only once.
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
one(event: any): Promise<any> {
|
||||
return new Promise<any>(
|
||||
resolve => this._objectInstance.one(event, resolve)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setDebuggable(isDebuggable: boolean): void {
|
||||
}
|
||||
@@ -102,7 +114,9 @@ export class GoogleMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the position of the camera
|
||||
* Get the position of the camera.
|
||||
*
|
||||
* @return {Promise<CameraPosition>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getCameraPosition(): Promise<CameraPosition> {
|
||||
@@ -110,15 +124,19 @@ export class GoogleMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the location of the user
|
||||
* Get the location of the user.
|
||||
*
|
||||
* @return {Promise<MyLocation>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getMyLocation(): Promise<MyLocation> {
|
||||
getMyLocation(options?: MyLocationOptions): Promise<MyLocation> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the visible region
|
||||
* Get the visible region.
|
||||
*
|
||||
* @return {Promise<VisibleRegion>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getVisibleRegion(): Promise<VisibleRegion> {
|
||||
@@ -343,6 +361,13 @@ export interface MyLocation {
|
||||
bearing?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface MyLocationOptions {
|
||||
enableHighAccuracy?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@@ -1013,13 +1038,24 @@ export interface GeocoderRequest {
|
||||
* @private
|
||||
*/
|
||||
export interface GeocoderResult {
|
||||
adminArea?: string;
|
||||
country?: string;
|
||||
countryCode?: string;
|
||||
extra?: {
|
||||
featureName?: string;
|
||||
lines?: Array<string>;
|
||||
permises?: string;
|
||||
phone?: string;
|
||||
url?: string
|
||||
},
|
||||
locale?: string;
|
||||
locality?: string;
|
||||
position?: { lat: number; lng: number };
|
||||
postalCode?: string;
|
||||
subAdminArea?: string;
|
||||
subLocality?: string;
|
||||
subThoroughfare?: string;
|
||||
thoroughfare?: string;
|
||||
locality?: string;
|
||||
adminArea?: string;
|
||||
postalCode?: string;
|
||||
country?: string;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
@@ -1032,8 +1068,11 @@ export class Geocoder {
|
||||
*/
|
||||
static geocode(request: GeocoderRequest): Promise<GeocoderResult[]> {
|
||||
return new Promise<GeocoderResult[]>((resolve, reject) => {
|
||||
if (!plugin || !plugin.google || !plugin.google.maps || !plugin.google.maps.Geocoder) reject({ error: 'plugin_not_installed' });
|
||||
else plugin.google.maps.Geocoder.geocode(request, resolve);
|
||||
if (!plugin || !plugin.google || !plugin.google.maps || !plugin.google.maps.Geocoder) {
|
||||
reject({ error: 'plugin_not_installed' });
|
||||
} else {
|
||||
plugin.google.maps.Geocoder.geocode(request, resolve);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,13 @@ import { Cordova, Plugin } from './plugin';
|
||||
* @name Hotspot
|
||||
* @description
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Hotspot, Network} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Hotspot, Network } from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
* Hotspot.scanWifi().then((networks: Array<Network>) => {
|
||||
* console.log(networks);
|
||||
* });
|
||||
* ...
|
||||
*
|
||||
* Hotspot.scanWifi().then((networks: Array<Network>) => {
|
||||
* console.log(networks);
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -231,8 +231,8 @@ export interface Delegate {
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* import {IBeacon} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { IBeacon } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Request permission to use location on iOS
|
||||
@@ -243,13 +243,13 @@ export interface Delegate {
|
||||
* // Subscribe to some of the delegate's event handlers
|
||||
* delegate.didRangeBeaconsInRegion()
|
||||
* .subscribe(
|
||||
* data => {console.log('didRangeBeaconsInRegion: ', data)},
|
||||
* error => console.error
|
||||
* data => console.log('didRangeBeaconsInRegion: ', data),
|
||||
* error => console.error();
|
||||
* );
|
||||
* delegate.didStartMonitoringForRegion()
|
||||
* .subscribe(
|
||||
* data => {console.log('didStartMonitoringForRegion: ', data)},
|
||||
* error => console.error
|
||||
* data => console.log('didStartMonitoringForRegion: ', data),
|
||||
* error => console.error();
|
||||
* );
|
||||
* delegate.didEnterRegion()
|
||||
* .subscribe(
|
||||
@@ -419,7 +419,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the request and started to send events.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static onDomDelegateReady(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@@ -427,7 +427,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether bluetooth is active.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static isBluetoothEnabled(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
@@ -436,7 +436,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved when Bluetooth
|
||||
* could be enabled. If not, the promise will be rejected with an error.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static enableBluetooth(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@@ -445,7 +445,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved when Bluetooth
|
||||
* could be enabled. If not, the promise will be rejected with an error.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static disableBluetooth(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@@ -465,7 +465,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the monitoring request.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static startMonitoringForRegion(region: BeaconRegion): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
@@ -482,7 +482,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static stopMonitoringForRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@@ -498,7 +498,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static requestStateForRegion(region: Region): Promise<void> { return; }
|
||||
|
||||
|
||||
@@ -516,7 +516,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the monitoring request.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static startRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@@ -533,7 +533,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static stopRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@@ -542,7 +542,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with the
|
||||
* requested authorization status.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static getAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
@@ -554,7 +554,7 @@ export class IBeacon {
|
||||
* If you are using this plugin on Android devices only, you will never have to use this, nor {@code requestAlwaysAuthorization}
|
||||
* @returns Returns a promise that is resolved when the request dialog is shown.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static requestWhenInUseAuthorization(): Promise<void> { return; }
|
||||
|
||||
|
||||
@@ -564,7 +564,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved when the native layer
|
||||
* shows the request dialog.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static requestAlwaysAuthorization(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@@ -572,7 +572,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with an {Array}
|
||||
* of {Region} instances that are being monitored by the native layer.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static getMonitoredRegions(): Promise<Region[]> { return; }
|
||||
|
||||
/**
|
||||
@@ -580,7 +580,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with an {Array}
|
||||
* of {Region} instances that are being ranged by the native layer.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static getRangedRegions(): Promise<Region[]> { return; }
|
||||
|
||||
/**
|
||||
@@ -588,7 +588,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether ranging is available or not.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static isRangingAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
@@ -600,7 +600,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether the region type is supported or not.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static isMonitoringAvailableForClass(region: Region): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
@@ -620,7 +620,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the advertising request.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static startAdvertising(region: Region, measuredPower: number): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@@ -631,7 +631,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the request to stop advertising.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static stopAdvertising(region: Region): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@@ -639,7 +639,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether advertising is available or not.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static isAdvertisingAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
@@ -647,7 +647,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether advertising is active.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static isAdvertising(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
@@ -657,7 +657,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved as soon as the
|
||||
* native layer has set the logging level accordingly.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static disableDebugLogs(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@@ -668,7 +668,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved as soon as the
|
||||
* native layer has set the flag to enabled.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static enableDebugNotifications(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@@ -678,7 +678,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved as soon as the
|
||||
* native layer has set the flag to disabled.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static disableDebugNotifications(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@@ -688,7 +688,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved as soon as the
|
||||
* native layer has set the logging level accordingly.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static enableDebugLogs(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@@ -701,7 +701,7 @@ export class IBeacon {
|
||||
* message received by the native layer for appending. The returned message
|
||||
* is expected to be equivalent to the one provided in the original call.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static appendToDeviceLog(message: string): Promise<void> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ export interface ImagePickerOptions {
|
||||
* For more info, please see the https://github.com/wymsee/cordova-imagePicker
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {ImagePicker} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { ImagePicker } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -36,8 +36,7 @@ export interface ImagePickerOptions {
|
||||
* for (var i = 0; i < results.length; i++) {
|
||||
* console.log('Image URI: ' + results[i]);
|
||||
* }
|
||||
* }, (err) => {
|
||||
* });
|
||||
* }, (err) => { });
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
|
||||
77
src/plugins/imageresizer.ts
Normal file
77
src/plugins/imageresizer.ts
Normal 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; }
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
import { Plugin, CordovaInstance } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
declare var cordova: any;
|
||||
|
||||
export interface InAppBrowserEvent extends Event {
|
||||
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
|
||||
@@ -11,66 +12,36 @@ export interface InAppBrowserEvent extends Event {
|
||||
/** the error message, only in the case of loaderror. */
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface InAppBrowserRef {
|
||||
/**
|
||||
* Adds a listener for an event from the InAppBrowser.
|
||||
* @param type the event to listen for
|
||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
||||
* exit: event fires when the InAppBrowser window is closed.
|
||||
* @param callback the function that executes when the event fires. The function is
|
||||
* passed an InAppBrowserEvent object as a parameter.
|
||||
*/
|
||||
addEventListener(type: string, callback: (event: InAppBrowserEvent) => void);
|
||||
|
||||
/**
|
||||
* Removes a listener for an event from the InAppBrowser.
|
||||
* @param type The event to stop listening for.
|
||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
||||
* exit: event fires when the InAppBrowser window is closed.
|
||||
* @param callback the function that executes when the event fires. The function is
|
||||
* passed an InAppBrowserEvent object as a parameter.
|
||||
*/
|
||||
removeEventListener(type: string, callback: (event: InAppBrowserEvent) => void);
|
||||
|
||||
/** Closes the InAppBrowser window. */
|
||||
close();
|
||||
|
||||
/**
|
||||
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
|
||||
* if the InAppBrowser was already visible.
|
||||
*/
|
||||
show();
|
||||
|
||||
/**
|
||||
* Injects JavaScript code into the InAppBrowser window.
|
||||
* @param script Details of the script to run, specifying either a file or code key.
|
||||
* @param callback The function that executes after the JavaScript code is injected.
|
||||
* If the injected script is of type code, the callback executes with
|
||||
* a single parameter, which is the return value of the script, wrapped in an Array.
|
||||
* For multi-line scripts, this is the return value of the last statement,
|
||||
* or the last expression evaluated.
|
||||
*/
|
||||
executeScript(script: { file?: string, code?: string }, callback?: (result?: any) => void);
|
||||
|
||||
/**
|
||||
* Injects CSS into the InAppBrowser window.
|
||||
* @param css Details of the script to run, specifying either a file or code key.
|
||||
* @param callback The function that executes after the CSS is injected.
|
||||
*/
|
||||
insertCSS(css: { file?: string, code?: string }, callback?: () => void);
|
||||
}
|
||||
|
||||
/**
|
||||
* @name InAppBrowser
|
||||
* @description Launches in app Browser
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {InAppBrowser} from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* let browser = new InAppBrowser('https://ionic.io', '_system');
|
||||
* browser.executeScript(...);
|
||||
* browser.insertCSS(...);
|
||||
* browser.close();
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-inappbrowser',
|
||||
pluginRef: 'cordova.InAppBrowser'
|
||||
pluginRef: 'cordova.InAppBrowser',
|
||||
repo: 'https://github.com/apache/cordova-plugin-inappbrowser'
|
||||
})
|
||||
export class InAppBrowser {
|
||||
|
||||
static open(url: string, target?: string, options?: string): void {
|
||||
console.warn('Native: Your current usage of the InAppBrowser plugin is depreciated as of ionic-native@1.3.8. Please check the Ionic Native docs for the latest usage details.');
|
||||
}
|
||||
|
||||
private _objectInstance: any;
|
||||
|
||||
/**
|
||||
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
|
||||
* @param url The URL to load.
|
||||
@@ -79,9 +50,54 @@ export class InAppBrowser {
|
||||
* The options string must not contain any blank space, and each feature's
|
||||
* name/value pairs must be separated by a comma. Feature names are case insensitive.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static open(url: string, target?: string, options?: string): InAppBrowserRef { return; }
|
||||
constructor(url: string, target?: string, options?: string) {
|
||||
try {
|
||||
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
|
||||
} catch (e) {
|
||||
window.open(url);
|
||||
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open, all instance methods will NOT work.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
|
||||
* if the InAppBrowser was already visible.
|
||||
*/
|
||||
@CordovaInstance({sync: true})
|
||||
show(): void { }
|
||||
|
||||
/**
|
||||
* Closes the InAppBrowser window.
|
||||
*/
|
||||
@CordovaInstance({sync: true})
|
||||
close(): void { }
|
||||
|
||||
/**
|
||||
* Injects JavaScript code into the InAppBrowser window.
|
||||
* @param script Details of the script to run, specifying either a file or code key.
|
||||
*/
|
||||
@CordovaInstance()
|
||||
executeScript(script: {file?: string, code?: string}): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Injects CSS into the InAppBrowser window.
|
||||
* @param css Details of the script to run, specifying either a file or code key.
|
||||
*/
|
||||
@CordovaInstance()
|
||||
insertCss(css: {file?: string, code?: string}): Promise<any> {return; }
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A method that allows you to listen to events happening in the browser.
|
||||
* @param event Event name
|
||||
* @returns {Observable<any>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
|
||||
*/
|
||||
on(event: string): Observable<InAppBrowserEvent> {
|
||||
return new Observable<InAppBrowserEvent>((observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind);
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,9 @@ import { Cordova, Plugin } from './plugin';
|
||||
* Prevent the screen of the mobile device from falling asleep.
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Insomnia} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Insomnia } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* Insomnia.keepAwake()
|
||||
* .then(
|
||||
|
||||
@@ -6,8 +6,8 @@ import { Observable } from 'rxjs/Observable';
|
||||
* @name Keyboard
|
||||
* @description
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Keyboard} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Keyboard } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -24,9 +24,8 @@ export class Keyboard {
|
||||
* Hide the keyboard accessory bar with the next, previous and done buttons.
|
||||
* @param hide {boolean}
|
||||
*/
|
||||
static hideKeyboardAccessoryBar(hide: boolean): void {
|
||||
console.log('hideKeyboardAccessoryBar method has been removed temporarily.');
|
||||
}
|
||||
@Cordova({sync: true})
|
||||
static hideKeyboardAccessoryBar(hide: boolean): void { }
|
||||
|
||||
/**
|
||||
* Force keyboard to be shown.
|
||||
|
||||
@@ -66,18 +66,18 @@ export interface LaunchNavigatorOptions {
|
||||
* @usage
|
||||
* Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper.
|
||||
*
|
||||
* ```js
|
||||
* import {LaunchNavigator, LaunchNavigatorOptions} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { LaunchNavigator, LaunchNavigatorOptions } from 'ionic-native';
|
||||
*
|
||||
* let options: LaunchNavigatorOptions = {
|
||||
* start: 'London, ON',
|
||||
* app: LaunchNavigator.APPS.UBER
|
||||
* };
|
||||
*
|
||||
* LaunchNavigator.navigate("Toronto, ON", options)
|
||||
* LaunchNavigator.navigate('Toronto, ON', options)
|
||||
* .then(
|
||||
* success => console.log("Launched navigator"),
|
||||
* error => console.log("Error launching navigator", error)
|
||||
* success => console.log('Launched navigator'),
|
||||
* error => console.log('Error launching navigator', error)
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -7,16 +7,15 @@ import { Cordova, Plugin } from './plugin';
|
||||
* This plugin allows you to display local notifications on the device
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {LocalNotifications} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* import { LocalNotifications } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Schedule a single notification
|
||||
* LocalNotifications.schedule({
|
||||
* id: 1,
|
||||
* text: "Single Notification",
|
||||
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf'
|
||||
* text: 'Single Notification',
|
||||
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf',
|
||||
* data: { secret: key }
|
||||
* });
|
||||
*
|
||||
@@ -24,22 +23,22 @@ import { Cordova, Plugin } from './plugin';
|
||||
* // Schedule multiple notifications
|
||||
* LocalNotifications.schedule([{
|
||||
* id: 1,
|
||||
* text: "Multi Notification 1",
|
||||
* text: 'Multi Notification 1',
|
||||
* sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf',
|
||||
* data: { secret:key }
|
||||
* },{
|
||||
* id: 2,
|
||||
* title: "Local Notification Example",
|
||||
* text: "Multi Notification 2",
|
||||
* icon: "http://example.com/icon.png"
|
||||
* title: 'Local Notification Example',
|
||||
* text: 'Multi Notification 2',
|
||||
* icon: 'http://example.com/icon.png'
|
||||
* }]);
|
||||
*
|
||||
*
|
||||
* // Schedule delayed notification
|
||||
* LocalNotifications.schedule({
|
||||
* text: "Delayed Notification",
|
||||
* text: 'Delayed Notification',
|
||||
* at: new Date(new Date().getTime() + 3600),
|
||||
* led: "FF0000",
|
||||
* led: 'FF0000',
|
||||
* sound: null
|
||||
* });
|
||||
* ```
|
||||
|
||||
@@ -9,9 +9,8 @@ declare var navigator: any;
|
||||
* @description
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {MediaCapture} from 'ionic-native';
|
||||
* import { MediaCapture } from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let options: CaptureImageOptions = { limit: 3 };
|
||||
* MediaCapture.captureImage(options)
|
||||
|
||||
@@ -8,22 +8,22 @@ declare var Media: any;
|
||||
* @name MediaPlugin
|
||||
* @description
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {MediaPlugin} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { MediaPlugin } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* // Create a MediaPlugin instance. Expects path to file or url as argument
|
||||
* var file = new MediaPlugin("path/to/file.mp3");
|
||||
* var file = new MediaPlugin('path/to/file.mp3');
|
||||
*
|
||||
* // Catch the Success & Error Output
|
||||
* // Platform Quirks
|
||||
* // iOS calls success on completion of playback only
|
||||
* // Android calls success on completion of playback AND on release()
|
||||
* file.init.then(() => {
|
||||
* console.log("Playback Finished");
|
||||
* console.log('Playback Finished');
|
||||
* }, (err) => {
|
||||
* console.log("somthing went wrong! error code: "+err.code+" message: "+err.message);
|
||||
* console.log('somthing went wrong! error code: ' + err.code + ' message: ' + err.message);
|
||||
* });
|
||||
*
|
||||
* // play the file
|
||||
@@ -55,7 +55,7 @@ declare var Media: any;
|
||||
* file.release();
|
||||
*
|
||||
* // Recording to a file
|
||||
* var newFile = new MediaPlugin("path/to/file.mp3");
|
||||
* var newFile = new MediaPlugin('path/to/file.mp3');
|
||||
* newFile.startRecord();
|
||||
*
|
||||
* newFile.stopRecord();
|
||||
|
||||
@@ -2,12 +2,12 @@ import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Native Storage
|
||||
* @description
|
||||
* @name NativeStorage
|
||||
* @description Native storage of variables in Android and iOS
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {NativeStorage} from 'ionic-native';
|
||||
* import { NativeStorage } from 'ionic-native';
|
||||
*
|
||||
* NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
|
||||
* .then(
|
||||
@@ -30,7 +30,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
export class NativeStorage {
|
||||
/**
|
||||
* Stores a value
|
||||
* @param reference
|
||||
* @param reference {string}
|
||||
* @param value
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -38,14 +38,14 @@ export class NativeStorage {
|
||||
|
||||
/**
|
||||
* Gets a stored item
|
||||
* @param reference
|
||||
* @param reference {string}
|
||||
*/
|
||||
@Cordova()
|
||||
static getItem(reference: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Removes a single stored item
|
||||
* @param reference
|
||||
* @param reference {string}
|
||||
*/
|
||||
@Cordova()
|
||||
static remove(reference: string): Promise<any> {return; }
|
||||
|
||||
@@ -10,12 +10,12 @@ declare var navigator: any;
|
||||
* Requires Cordova plugin: cordova-plugin-network-information. For more info, please see the [Network plugin docs](https://github.com/apache/cordova-plugin-network-information).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Network} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Network } from 'ionic-native';
|
||||
*
|
||||
* // watch network for a disconnect
|
||||
* let disconnectSubscription = Network.onDisconnect().subscribe(() => {
|
||||
* console.log('network was disconnected :-( ')
|
||||
* console.log('network was disconnected :-(');
|
||||
* });
|
||||
*
|
||||
* // stop disconnect watch
|
||||
@@ -24,9 +24,9 @@ declare var navigator: any;
|
||||
*
|
||||
* // watch network for a connection
|
||||
* let connectSubscription = Network.onConnect().subscribe(() => {
|
||||
* console.log('network connected!');
*
|
||||
* console.log('network connected!');
|
||||
* // We just got a connection but we need to wait briefly
|
||||
*
// before we determine the connection type. Might need to wait
|
||||
*
// before we determine the connection type. Might need to wait
|
||||
* // prior to doing any api requests as well.
|
||||
* setTimeout(() => {
|
||||
* if (Network.connection === 'wifi') {
|
||||
@@ -54,7 +54,7 @@ export class Network {
|
||||
* Return the network connection type
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get connection(): String { return navigator.connection.type; }
|
||||
static get connection(): string { return navigator.connection.type; }
|
||||
|
||||
/**
|
||||
* Get notified when the device goes offline
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
/**
|
||||
@@ -10,15 +11,16 @@ import { Cordova, Plugin } from './plugin';
|
||||
* Requires Cordova plugin: `onesignal-cordova-plugin`. For more info, please see the [OneSignal Cordova Docs](https://documentation.onesignal.com/docs/phonegap-sdk-installation).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {OneSignal} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { OneSignal } from 'ionic-native';
|
||||
*
|
||||
* let notificationOpenedCallback(jsonData: any) {
|
||||
* console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
|
||||
* };
|
||||
* OneSignal.init("b2f7f966-d8cc-11e4-bed1-df8f05be55ba",
|
||||
* {googleProjectNumber: "703322744261"},
|
||||
* notificationOpenedCallback);
|
||||
*
|
||||
* OneSignal.init('b2f7f966-d8cc-11e4-bed1-df8f05be55ba',
|
||||
* {googleProjectNumber: '703322744261'},
|
||||
* notificationOpenedCallback);
|
||||
*
|
||||
* OneSignal.enableInAppAlertNotification(true);
|
||||
* ```
|
||||
@@ -27,8 +29,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
@Plugin({
|
||||
plugin: 'onesignal-cordova-plugin',
|
||||
pluginRef: 'plugins.OneSignal',
|
||||
repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK'
|
||||
})
|
||||
export class OneSignal {
|
||||
|
||||
@@ -37,14 +38,14 @@ export class OneSignal {
|
||||
*
|
||||
* @param {appId} Your AppId from your OneSignal app
|
||||
* @param {options} The Google Project Number (which you can get from the Google Developer Potal) and the autoRegister option.
|
||||
* @returns {Promise} Returns a Promise that resolves when remote notification was recieved.
|
||||
* @returns {Observable} when a notification is received. Handle your notification action here.
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({ observable: true })
|
||||
static init(appId: string,
|
||||
options: {
|
||||
googleProjectNumber: string,
|
||||
autoRegister: boolean
|
||||
}): Promise<any> { return; }
|
||||
}): Observable<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
@@ -252,4 +253,4 @@ export class OneSignal {
|
||||
visualLevel: number
|
||||
}): void { }
|
||||
|
||||
}
|
||||
}
|
||||
28
src/plugins/photo-viewer.ts
Normal file
28
src/plugins/photo-viewer.ts
Normal 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 { }
|
||||
}
|
||||
@@ -7,14 +7,13 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {PinDialog} from 'ionic-native';
|
||||
* import { PinDialog } from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* PinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel'])
|
||||
* .then(
|
||||
* (result: any) => {
|
||||
* if(result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1);
|
||||
* if (result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1);
|
||||
* else if(result.buttonIndex == 2) console.log('User cancelled');
|
||||
* }
|
||||
* );
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { get } from '../util';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window;
|
||||
declare var Promise;
|
||||
declare var $q;
|
||||
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -88,15 +88,15 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
|
||||
}
|
||||
|
||||
function getPromise(cb) {
|
||||
if (window.Promise) {
|
||||
return new Promise((resolve, reject) => {
|
||||
cb(resolve, reject);
|
||||
});
|
||||
} else if (window.angular) {
|
||||
if (window.angular) {
|
||||
let $q = window.angular.injector(['ng']).get('$q');
|
||||
return $q((resolve, reject) => {
|
||||
cb(resolve, reject);
|
||||
});
|
||||
} else if (window.Promise) {
|
||||
return new Promise((resolve, reject) => {
|
||||
cb(resolve, reject);
|
||||
});
|
||||
} else {
|
||||
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.');
|
||||
}
|
||||
@@ -230,7 +230,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
|
||||
* Class decorator specifying Plugin metadata. Required for all plugins.
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* @Plugin({
|
||||
* name: 'MyPlugin',
|
||||
* plugin: 'cordova-plugin-myplugin',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -65,19 +65,19 @@ export interface PushNotification {
|
||||
* @param event
|
||||
* @param callback
|
||||
*/
|
||||
on(event: "registration", callback: (response: RegistrationEventResponse) => any): void;
|
||||
on(event: 'registration', callback: (response: RegistrationEventResponse) => any): void;
|
||||
/**
|
||||
* The event notification will be triggered each time a push notification is received by a 3rd party push service on the device.
|
||||
* @param event
|
||||
* @param callback
|
||||
*/
|
||||
on(event: "notification", callback: (response: NotificationEventResponse) => any): void;
|
||||
on(event: 'notification', callback: (response: NotificationEventResponse) => any): void;
|
||||
/**
|
||||
* The event error will trigger when an internal error occurs and the cache is aborted.
|
||||
* @param event
|
||||
* @param callback
|
||||
*/
|
||||
on(event: "error", callback: (response: Error) => any): void;
|
||||
on(event: 'error', callback: (response: Error) => any): void;
|
||||
/**
|
||||
*
|
||||
* @param event Name of the event to listen to. See below(above) for all the event names.
|
||||
@@ -87,9 +87,9 @@ export interface PushNotification {
|
||||
*/
|
||||
on(event: string, callback: (response: EventResponse) => any): void;
|
||||
|
||||
off(event: "registration", callback: (response: RegistrationEventResponse) => any): void;
|
||||
off(event: "notification", callback: (response: NotificationEventResponse) => any): void;
|
||||
off(event: "error", callback: (response: Error) => any): void;
|
||||
off(event: 'registration', callback: (response: RegistrationEventResponse) => any): void;
|
||||
off(event: 'notification', callback: (response: NotificationEventResponse) => any): void;
|
||||
off(event: 'error', callback: (response: Error) => any): void;
|
||||
/**
|
||||
* As stated in the example, you will have to store your event handler if you are planning to remove it.
|
||||
* @param event Name of the event type. The possible event names are the same as for the push.on function.
|
||||
@@ -279,11 +279,8 @@ declare var PushNotification: {
|
||||
* For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Push} from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* ```typescript
|
||||
* import { Push } from 'ionic-native';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -299,10 +296,10 @@ export class Push {
|
||||
* ```
|
||||
* var push = Push.init({
|
||||
* android: {
|
||||
* senderID: "12345679"
|
||||
* senderID: '12345679'
|
||||
* },
|
||||
* ios: {
|
||||
* alert: "true",
|
||||
* alert: 'true',
|
||||
* badge: true,
|
||||
* sound: 'false'
|
||||
* },
|
||||
|
||||
@@ -6,13 +6,12 @@ import { Cordova, Plugin } from './plugin';
|
||||
* @description
|
||||
* @usage
|
||||
* ```
|
||||
* import {SafariViewController} from 'ionic-native';
|
||||
* import { SafariViewController } from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* SafariViewController.isAvailable()
|
||||
* .then(
|
||||
* (available) => {
|
||||
* (available: boolean) => {
|
||||
* if(available){
|
||||
*
|
||||
* SafariViewController.show({
|
||||
@@ -25,9 +24,9 @@ import { Cordova, Plugin } from './plugin';
|
||||
* })
|
||||
* .then(
|
||||
* (result: any) => {
|
||||
* if(result.event === 'opened') console.log("Opened");
|
||||
* else if(result.event === 'loaded') console.log("Loaded");
|
||||
* else if(result.event === 'closed') console.log("Closed");
|
||||
* if(result.event === 'opened') console.log('Opened');
|
||||
* else if(result.event === 'loaded') console.log('Loaded');
|
||||
* else if(result.event === 'closed') console.log('Closed');
|
||||
* },
|
||||
* (error: any) => console.error(error)
|
||||
* );
|
||||
|
||||
65
src/plugins/screen-orientation.ts
Normal file
65
src/plugins/screen-orientation.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -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',
|
||||
|
||||
90
src/plugins/securestorage.ts
Normal file
90
src/plugins/securestorage.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import { CordovaInstance, Plugin } from './plugin';
|
||||
declare var cordova: any;
|
||||
/**
|
||||
* @name Secure Storage
|
||||
* @description
|
||||
* This plugin gets, sets and removes key,value pairs from a device's secure storage.
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-secure-storage`. For more info, please see the [Cordova Secure Storage docs](https://github.com/Crypho/cordova-plugin-secure-storage).
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```typescript
|
||||
* import { SecureStorage } from 'ionic-native';
|
||||
*
|
||||
* let secureStorage: SecureStorage = new SecureStorage();
|
||||
* secureStorage.create('my_store_name')
|
||||
* .then(
|
||||
* () => console.log('Storage is ready!'),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
*
|
||||
* secureStorage.get('myitem')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
*
|
||||
* secureStorage.set('myitem', 'myvalue')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
*
|
||||
* secureStorage.remove('myitem')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-secure-storage',
|
||||
pluginRef: 'plugins.securestorage',
|
||||
repo: 'https://github.com/Crypho/cordova-plugin-secure-storage',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone', 'Browser']
|
||||
})
|
||||
export class SecureStorage {
|
||||
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* Creates a namespaced storage.
|
||||
* @param store {string}
|
||||
*/
|
||||
create(store: string): Promise<any> {
|
||||
return new Promise((res, rej) => {
|
||||
this._objectInstance = new cordova.plugins.SecureStorage(res, rej, store);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a stored item
|
||||
* @param reference {string}
|
||||
*/
|
||||
@CordovaInstance({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
get(reference: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Stores a value
|
||||
* @param reference {string}
|
||||
* @param value {string}
|
||||
*/
|
||||
@CordovaInstance({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
set(reference: string, value: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Removes a single stored item
|
||||
* @param reference {string}
|
||||
*/
|
||||
@CordovaInstance({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
remove(reference: string): Promise<any> { return; }
|
||||
}
|
||||
@@ -9,13 +9,13 @@ import { Cordova, Plugin } from './plugin';
|
||||
* Requires Cordova plugin: `cordova-plugin-sim`. For more info, please see the [Cordova Sim docs](https://github.com/pbakondy/cordova-plugin-sim).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {Sim} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Sim } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* Sim.getSimInfo().then(
|
||||
* (info) => console.log('Sim info:', info),
|
||||
* (err) => console.log('Unable to get sim info:', err)
|
||||
* (info) => console.log('Sim info: ', info),
|
||||
* (err) => console.log('Unable to get sim info: ', err)
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -31,14 +31,12 @@ export interface SmsOptionsAndroid {
|
||||
* Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {SMS} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* import { SMS } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Send a text message using default options
|
||||
* SMS.send('416123456','Hello world!');
|
||||
*
|
||||
* SMS.send('416123456', 'Hello world!');
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Social Sharing
|
||||
* @description
|
||||
* Share text, files, images, and links via social networks, sms, and email.
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {SocialSharing} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { SocialSharing } from 'ionic-native';
|
||||
*
|
||||
* // Check if sharing via email is supported
|
||||
* SocialSharing.canShareViaEmail().then(() => {
|
||||
|
||||
@@ -5,9 +5,8 @@ import { Cordova, Plugin } from './plugin';
|
||||
* @name Spinner Dialog
|
||||
* @description
|
||||
* @usage
|
||||
* ```js
|
||||
* import {SpinnerDialog} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* import { SpinnerDialog } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* SpinnerDialog.show();
|
||||
|
||||
@@ -5,9 +5,8 @@ import { Cordova, Plugin } from './plugin';
|
||||
* @name Splashscreen
|
||||
* @description This plugin displays and hides a splash screen during application launch. The methods below allows showing and hiding the splashscreen after the app has loaded.
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {Splashscreen} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* import { Splashscreen } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* Splashscreen.show();
|
||||
|
||||
@@ -11,21 +11,21 @@ declare var sqlitePlugin;
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { SQLite } from 'ionic-native';
|
||||
*
|
||||
* let db = new SQLite();
|
||||
* db.openDatabse({
|
||||
* db.openDatabase({
|
||||
* name: 'data.db',
|
||||
* location: 'default' // the location field is required
|
||||
* }).then(() => {
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
|
||||
*
|
||||
* }, (err) => {
|
||||
* console.error('Unable to execute sql', err);
|
||||
* })
|
||||
* console.error('Unable to execute sql: ', err);
|
||||
* });
|
||||
* }, (err) => {
|
||||
* console.error('Unable to open database', err);
|
||||
* console.error('Unable to open database: ', err);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
@@ -52,7 +52,7 @@ export class SQLite {
|
||||
* @param config the config for opening the database.
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { SQLite } from 'ionic-native';
|
||||
*
|
||||
* let db = new SQLite();
|
||||
@@ -112,7 +112,7 @@ export class SQLite {
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => {
|
||||
* // Access the items through resultSet.rows
|
||||
* // resultSet.rows.item(i)
|
||||
|
||||
@@ -11,12 +11,11 @@ declare var window;
|
||||
* Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {StatusBar} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { StatusBar } from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* StatuBar.overlaysWebView(true); // let status var overlay webview
|
||||
* StatusBar.overlaysWebView(true); // let status var overlay webview
|
||||
*
|
||||
* StatusBar.backgroundColorByHexString('#ffffff'); // set status bar to white
|
||||
* ```
|
||||
|
||||
@@ -43,12 +43,11 @@ export interface ToastOptions {
|
||||
* Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {Toast} from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { Toast } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* Toast.show("I'm a toast", "5000", "center").subscribe(
|
||||
* Toast.show("I'm a toast", '5000', 'center').subscribe(
|
||||
* toast => {
|
||||
* console.log(toast);
|
||||
* }
|
||||
|
||||
@@ -8,6 +8,29 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id).
|
||||
*
|
||||
* @usage
|
||||
* ### Import Touch ID Plugin into Project
|
||||
* ```typescript
|
||||
* import { TouchID } from 'ionic-native';
|
||||
* ```
|
||||
* ### Check for Touch ID Availability
|
||||
* ```typescript
|
||||
* TouchID.isAvailable()
|
||||
* .then(
|
||||
* res => console.log('TouchID is available!'),
|
||||
* err => console.error('TouchID is not available', err)
|
||||
* );
|
||||
* ```
|
||||
* ### Invoke Touch ID w/ Custom Message
|
||||
*
|
||||
* ```typescript
|
||||
* TouchID.verifyFingerprint('Scan your fingerprint please')
|
||||
* .then(
|
||||
* res => console.log('Ok', res),
|
||||
* err => console.error('Error', err)
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* ### Error Codes
|
||||
*
|
||||
* The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently.
|
||||
@@ -20,25 +43,6 @@ import { Cordova, Plugin } from './plugin';
|
||||
* - `-4` - The scan was cancelled by the system (Home button for example)
|
||||
* - `-6` - TouchID is not Available
|
||||
* - `-8` - TouchID is locked out from too many tries
|
||||
* @usage
|
||||
* ```js
|
||||
* import {TouchID} from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* TouchID.isAvailable()
|
||||
* .then(
|
||||
* res => console.log("TouchID is available!"),
|
||||
* err => console.error("TouchID isn't available", err)
|
||||
* );
|
||||
*
|
||||
* TouchID.verifyFingerprint('Scan your fingerprint please')
|
||||
* .then(
|
||||
* res => console.log("Ok", res),
|
||||
* err => console.error("Error", err)
|
||||
* );
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-touch-id',
|
||||
@@ -49,7 +53,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
export class TouchID {
|
||||
|
||||
/**
|
||||
* Whether TouchID is available or not.
|
||||
* Checks Whether TouchID is available or not.
|
||||
*
|
||||
* @return {Promise} Returns a Promise that resolves if yes, rejects if no.
|
||||
*/
|
||||
|
||||
@@ -1,15 +1,36 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Twitter Connect
|
||||
* @description
|
||||
* Plugin to use Twitter Single Sign On
|
||||
* Uses Twitter's Fabric SDK
|
||||
* ```typescript
|
||||
* import {TwitterConnect} from 'ionic-native';
|
||||
*
|
||||
* function onSuccess(response) {
|
||||
* console.log(response);
|
||||
*
|
||||
* // Will console log something like:
|
||||
* // {
|
||||
* // userName: 'myuser',
|
||||
* // userId: '12358102',
|
||||
* // secret: 'tokenSecret'
|
||||
* // token: 'accessTokenHere'
|
||||
* // }
|
||||
* }
|
||||
*
|
||||
* TwitterConnect.login().then(onSuccess, onError);
|
||||
*
|
||||
* TwitterConnect.logout().then(onLogoutSuccess, onLogoutError);
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'twitter-connect-plugin',
|
||||
pluginRef: 'TwitterConnect',
|
||||
repo: '',
|
||||
install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=<Fabric API Key>'
|
||||
repo: 'https://github.com/ManifestWebDesign/twitter-connect-plugin',
|
||||
install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=fabric_API_key'
|
||||
})
|
||||
export class TwitterConnect {
|
||||
/**
|
||||
|
||||
@@ -5,12 +5,12 @@ import { Cordova, Plugin } from './plugin';
|
||||
* @name Vibration
|
||||
* @description Vibrates the device
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {Vibration} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* import { Vibration } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Vibrate the device for a second
|
||||
* // Duration is ignored on iOS.
|
||||
* Vibration.vibrate(1000);
|
||||
*
|
||||
* // Vibrate 2 seconds
|
||||
|
||||
62
src/plugins/video-player.ts
Normal file
62
src/plugins/video-player.ts
Normal 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 { }
|
||||
}
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user