Compare commits

..

63 Commits

Author SHA1 Message Date
Ibby
ceb4217415 chore(): update changelog 2016-10-11 21:03:52 -04:00
Ibby
798625698d 2.2.2 2016-10-11 21:03:23 -04:00
Ibby
5cfb3b033b refractor(): remove unused import 2016-10-11 21:02:53 -04:00
Ibrahim Hadeed
95d666c348 Merge pull request #682 from driftyco/fix/file
fix(file): fix writeFile method
2016-10-11 18:01:55 -07:00
Ibby
276d61bf3a fix(file): read methods can accept Blobs too 2016-10-11 20:48:53 -04:00
Ibby
397a209ad2 docs(file): improve docs 2016-10-11 20:46:05 -04:00
Ibby
d2f42ef33a fix(file): getFreeDiskSpace now works 2016-10-11 20:44:27 -04:00
Ibby
fe46907aaa docs(file): document getFreeDiskspace 2016-10-11 20:39:26 -04:00
Ibby
5c92455ee9 feat(file): getFile and getDirectory are now public
closes #657
2016-10-11 20:30:14 -04:00
Ibby
046cbe7fca chore(): update changelog 2016-10-11 20:18:33 -04:00
Ibby
32f09275aa 2.2.1 2016-10-11 20:18:17 -04:00
Ibby
542ff4cf95 feat(file): resolveLocalFilesystemUrl and resolveDirectoryUrl are now public methods
closes #657
2016-10-11 20:16:39 -04:00
Ibby
5710eb78a8 fix(file): last parameter for writeFile now only accepts options 2016-10-11 20:13:21 -04:00
Ibby
842a80d493 fix(file): fix writeFile method
addresses #464 #552 #666
2016-10-11 20:10:47 -04:00
Ibby
c2d4f1c0da fix(location-accuracy): accuracy param is number
closes #676
2016-10-11 19:35:54 -04:00
Xueron Nee
e28e5b0f5f fix(themeablebrowser): add missed options (#680) 2016-10-11 16:33:35 -07:00
Job
bff4862979 fix(diagnostic): misspelled getContactsAuthorizationStatus method (#678) 2016-10-11 16:32:24 -07:00
Ibby
6bcef44d42 Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-10-11 09:14:22 -04:00
Ibby
69c9b6f555 docs(): set ANDROID_THEMES to private 2016-10-11 09:14:17 -04:00
Ibby
7f38cb5a16 docs(datepicker): improve docs 2016-10-11 09:13:56 -04:00
Ramon Henrique Ornelas
cf7abe110d fix(http): export via window.IonicNative (#675)
* fix(http): fix export system module

* style(http): fix angular style

* style(http): delete multiline

* chore(http): add attribute platforms to decorator Plugin

* fix(http): typo param uploadFile()

* fix(http): typo commit ba6a7e9930
2016-10-11 03:25:15 -07:00
Ibby
5b060345d2 chore(): update changelog 2016-10-11 04:30:55 -04:00
Ibby
1784036ef7 chore(): update changelog 2016-10-11 04:22:46 -04:00
Ibby
7a8577007c 2.2.0 2016-10-11 04:19:02 -04:00
Ibrahim Hadeed
7c6e6d8b6b fix(onesignal): update to match latest api (#671)
closes #667
2016-10-11 01:12:43 -07:00
Ramon Henrique Ornelas
c5fd83ddb6 style(onesignal): add semicolon fix lint (#672) 2016-10-11 01:12:32 -07:00
Ramon Henrique Ornelas
7b2fe69c7c docs(camera-preview): change repo no longer maintaned fix #360
* docs(camera-preview): change repo no longer maintaned  fix #360

* refactor(camera-preview): delete dead code
2016-10-11 01:11:05 -07:00
Ibrahim Hadeed
f0961c7b23 feat(http): add cordovaHTTP wrapper (#674) 2016-10-11 01:06:41 -07:00
Ibby
35c8bbd49e fix(native-transitions): add missing interface properties 2016-10-10 20:50:10 -04:00
Ibby
1a343c1ea5 Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-10-10 20:10:43 -04:00
Ibby
4fef8ff326 refractor(onesignal): add OneSignalNotification interface 2016-10-10 20:10:14 -04:00
Xueron Nee
13681756ae fix(thmeable-browser): fix the name of the plugin (#663) 2016-10-09 04:33:54 -04:00
Ibby
4a798281e4 chore(): update changelog 2016-10-08 20:57:54 -04:00
Ibby
79670b7878 2.1.9 2016-10-08 20:57:47 -04:00
Ibby
720084578d fix(paypal): add optional details param to paypalpayment 2016-10-08 20:44:32 -04:00
Patrick Bußmann
3dd6a92ccf fix(paypal): problems with selection of PayPal environment (#662)
* Fixed bugs with selection of environment and added missing prepareToRender function

* Updated PayPal usage example
2016-10-08 20:34:27 -04:00
Ramon Henrique Ornelas
7d1686ef93 refactor(googlemaps): throw warnings plugin_not_installed (#655)
* refactor(googlemaps): adjust imports to warnings console and delete @author comments

* refactor(googlemaps): throw warnings plugin_not_installed

* refactor(googlemaps): delete warnings of the methods added Promise.reject case plugin_not_instalet
2016-10-08 20:29:53 -04:00
Ibby
b40b0fff98 chore(): update changelog 2016-10-08 18:50:49 -04:00
Ibby
4dba0580ac 2.1.8 2016-10-08 18:50:36 -04:00
Ibby
11653ce752 fix(googlemaps): fixes GoogleMapsLatLng class
closes 658
2016-10-08 18:48:28 -04:00
Ramon Henrique Ornelas
d3e6f3ba41 refactor(plugin): improvement pull #654 (#661) 2016-10-08 15:07:01 -04:00
Thiery Laverdure
2c6cc37a5f docs(calendar): fix typo (#660) 2016-10-08 14:54:02 -04:00
Ibby
4c7defb2ec chore(): update changelog 2016-10-06 20:38:32 -04:00
Ibby
2da02e6d46 2.1.7 2016-10-06 20:38:21 -04:00
Ibby
7a91c87a72 test(): sync methods no longer get resolve/reject 2016-10-06 20:37:41 -04:00
Patrick Bußmann
598f8a9e7c fix(paypal): fixed currency code not found issue (#653) 2016-10-06 20:34:45 -04:00
ziggyJ
6f0f02bb66 fix google maps setPadding not working issue #573 (#654) 2016-10-06 20:33:42 -04:00
Ramon Henrique Ornelas
e4bde77bd4 chore(): deleted ionic-gulp-tslint change for gulp-tslint directly (#611) 2016-10-06 00:37:34 -04:00
Ibby
c24b331866 chore(): update changelog 2016-10-06 00:27:24 -04:00
Ibby
4ac348bd0f 2.1.6 2016-10-06 00:27:04 -04:00
Ibby
f0026572e7 fix(paypal): fix helper classes 2016-10-06 00:26:59 -04:00
Ibby
e30ccabf7b 2.1.5 2016-10-05 23:19:55 -04:00
Ibby
6b286db51a chore(): add successIndex at the correct position if we have optional params 2016-10-05 23:19:45 -04:00
Ibby
d79d62bfa0 docs(hotspot): remove unecessary doc tags 2016-10-05 22:46:22 -04:00
Ibby
2bdd3a3868 chore(): update changelog 2016-10-05 22:43:59 -04:00
Ibby
09d481e1d6 2.1.4 2016-10-05 22:43:31 -04:00
Ibby
6f23bef5d1 fix(google-analytics): specify successIndex and errorIndex for methods with optional params 2016-10-05 22:43:20 -04:00
Ibby
84f54d64aa chore(): update changelog 2016-10-05 22:42:35 -04:00
Ibby
c9ddec3bb5 2.1.3 2016-10-05 22:36:10 -04:00
Ibby
f62e1081e1 fix(google-analytics): add newSession param 2016-10-05 22:35:52 -04:00
Ibby
7dba41cbe1 docs(google-analytics): add missing docs 2016-10-05 22:30:40 -04:00
Ibby
77b0277290 fix(google-analytics): add missing methods, fix return types 2016-10-05 22:27:28 -04:00
Ibby
40325cad9f fix(google-analytics): fix depreciated plugin reference 2016-10-05 22:20:55 -04:00
20 changed files with 1016 additions and 467 deletions

View File

@@ -1,3 +1,124 @@
<a name="2.2.2"></a>
## [2.2.2](https://github.com/driftyco/ionic-native/compare/v2.2.1...v2.2.2) (2016-10-12)
### Bug Fixes
* **file:** getFreeDiskSpace now works ([d2f42ef](https://github.com/driftyco/ionic-native/commit/d2f42ef))
* **file:** read methods can accept Blobs too ([276d61b](https://github.com/driftyco/ionic-native/commit/276d61b))
### Features
* **file:** getFile and getDirectory are now public ([5c92455](https://github.com/driftyco/ionic-native/commit/5c92455)), closes [#657](https://github.com/driftyco/ionic-native/issues/657)
<a name="2.2.1"></a>
## [2.2.1](https://github.com/driftyco/ionic-native/compare/v2.2.0...v2.2.1) (2016-10-12)
### Bug Fixes
* **diagnostic:** misspelled getContactsAuthorizationStatus method ([#678](https://github.com/driftyco/ionic-native/issues/678)) ([bff4862](https://github.com/driftyco/ionic-native/commit/bff4862))
* **file:** fix writeFile method ([842a80d](https://github.com/driftyco/ionic-native/commit/842a80d))
* **file:** last parameter for writeFile now only accepts options ([5710eb7](https://github.com/driftyco/ionic-native/commit/5710eb7))
* **http:** export via window.IonicNative ([#675](https://github.com/driftyco/ionic-native/issues/675)) ([cf7abe1](https://github.com/driftyco/ionic-native/commit/cf7abe1))
* **location-accuracy:** accuracy param is number ([c2d4f1c](https://github.com/driftyco/ionic-native/commit/c2d4f1c)), closes [#676](https://github.com/driftyco/ionic-native/issues/676)
* **themeablebrowser:** add missed options ([#680](https://github.com/driftyco/ionic-native/issues/680)) ([e28e5b0](https://github.com/driftyco/ionic-native/commit/e28e5b0))
### Features
* **file:** resolveLocalFilesystemUrl and resolveDirectoryUrl are now public methods ([542ff4c](https://github.com/driftyco/ionic-native/commit/542ff4c)), closes [#657](https://github.com/driftyco/ionic-native/issues/657)
<a name="2.2.0"></a>
# [2.2.0](https://github.com/driftyco/ionic-native/compare/v2.1.9...v2.2.0) (2016-10-11)
### Bug Fixes
* **native-transitions:** add missing interface properties ([35c8bbd](https://github.com/driftyco/ionic-native/commit/35c8bbd))
* **onesignal:** update to match latest api ([#671](https://github.com/driftyco/ionic-native/issues/671)) ([7c6e6d8](https://github.com/driftyco/ionic-native/commit/7c6e6d8)), closes [#667](https://github.com/driftyco/ionic-native/issues/667)
* **thmeable-browser:** fix the name of the plugin ([#663](https://github.com/driftyco/ionic-native/issues/663)) ([1368175](https://github.com/driftyco/ionic-native/commit/1368175))
### Features
* **http:** add cordovaHTTP wrapper ([#674](https://github.com/driftyco/ionic-native/issues/674)) ([f0961c7](https://github.com/driftyco/ionic-native/commit/f0961c7))
<a name="2.1.9"></a>
## [2.1.9](https://github.com/driftyco/ionic-native/compare/v2.1.8...v2.1.9) (2016-10-09)
### Bug Fixes
* **paypal:** add optional details param to paypalpayment ([7200845](https://github.com/driftyco/ionic-native/commit/7200845))
* **paypal:** problems with selection of PayPal environment ([#662](https://github.com/driftyco/ionic-native/issues/662)) ([3dd6a92](https://github.com/driftyco/ionic-native/commit/3dd6a92))
<a name="2.1.8"></a>
## [2.1.8](https://github.com/driftyco/ionic-native/compare/v2.1.7...v2.1.8) (2016-10-08)
### Bug Fixes
* **googlemaps:** fixes GoogleMapsLatLng class ([11653ce](https://github.com/driftyco/ionic-native/commit/11653ce))
<a name="2.1.7"></a>
## [2.1.7](https://github.com/driftyco/ionic-native/compare/v2.1.6...v2.1.7) (2016-10-07)
### Bug Fixes
* **paypal:** fixed currency code not found issue ([#653](https://github.com/driftyco/ionic-native/issues/653)) ([598f8a9](https://github.com/driftyco/ionic-native/commit/598f8a9))
<a name="2.1.6"></a>
## [2.1.6](https://github.com/driftyco/ionic-native/compare/v2.1.5...v2.1.6) (2016-10-06)
### Bug Fixes
* **paypal:** fix helper classes ([f002657](https://github.com/driftyco/ionic-native/commit/f002657))
<a name="2.1.5"></a>
## [2.1.5](https://github.com/driftyco/ionic-native/compare/v2.1.4...v2.1.5) (2016-10-06)
<a name="2.1.4"></a>
## [2.1.4](https://github.com/driftyco/ionic-native/compare/v2.1.3...v2.1.4) (2016-10-06)
### Bug Fixes
* **google-analytics:** specify successIndex and errorIndex for methods with optional params ([6f23bef](https://github.com/driftyco/ionic-native/commit/6f23bef))
<a name="2.1.3"></a>
## [2.1.3](https://github.com/driftyco/ionic-native/compare/v2.1.2...v2.1.3) (2016-10-06)
### Bug Fixes
* **google-analytics:** add missing methods, fix return types ([77b0277](https://github.com/driftyco/ionic-native/commit/77b0277))
* **google-analytics:** add newSession param ([f62e108](https://github.com/driftyco/ionic-native/commit/f62e108))
* **google-analytics:** fix depreciated plugin reference ([40325ca](https://github.com/driftyco/ionic-native/commit/40325ca))
<a name="2.1.2"></a>
## [2.1.2](https://github.com/driftyco/ionic-native/compare/v2.1.1...v2.1.2) (2016-10-06)

View File

@@ -2,7 +2,7 @@ var gulp = require('gulp');
var minimist = require('minimist');
var uglify = require('gulp-uglify');
var rename = require("gulp-rename");
var tslint = require('ionic-gulp-tslint');
var tslint = require('gulp-tslint');
var decamelize = require('decamelize');
var replace = require('gulp-replace');
@@ -28,7 +28,12 @@ gulp.task("minify:dist", function(){
});
gulp.task('lint', function() {
tslint({src: 'src/**/*.ts'});
gulp.src('src/**/*.ts')
.pipe(tslint({
formatter: "verbose",
configuration: 'tslint.json'
}))
.pipe(tslint.report())
});
gulp.task('plugin:create', function(){

View File

@@ -1,6 +1,6 @@
{
"name": "ionic-native",
"version": "2.1.2",
"version": "2.2.2",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"main": "dist/es5/index.js",
"module": "dist/esm/index.js",
@@ -26,9 +26,8 @@
"gulp": "^3.9.1",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.4",
"gulp-tslint": "^5.0.0",
"gulp-tslint": "^6.1.2",
"gulp-uglify": "^1.5.4",
"ionic-gulp-tslint": "^1.0.0",
"jasmine-core": "~2.5.0",
"karma": "~1.2.0",
"karma-browserify": "~5.1.0",
@@ -41,7 +40,7 @@
"q": "1.4.1",
"semver": "^5.0.1",
"tsify": "~1.0.4",
"tslint": "^3.8.1",
"tslint": "^3.15.1",
"tslint-ionic-rules": "0.0.5",
"typescript": "^2.0.1",
"watchify": "~3.7.0"

View File

@@ -52,6 +52,7 @@ import { GooglePlus } from './plugins/google-plus';
import { GoogleMap } from './plugins/googlemaps';
import { GoogleAnalytics } from './plugins/googleanalytics';
import { Hotspot } from './plugins/hotspot';
import { HTTP } from './plugins/http';
import { Httpd } from './plugins/httpd';
import { IBeacon } from './plugins/ibeacon';
import { ImagePicker } from './plugins/imagepicker';
@@ -100,7 +101,7 @@ import { ThreeDeeTouch } from './plugins/3dtouch';
import { Toast } from './plugins/toast';
import { TouchID } from './plugins/touchid';
import { TextToSpeech } from './plugins/text-to-speech';
import { ThemableBrowser } from './plugins/themable-browser';
import { ThemeableBrowser } from './plugins/themeable-browser';
import { TwitterConnect } from './plugins/twitter-connect';
import { Vibration } from './plugins/vibration';
import { VideoEditor } from './plugins/video-editor';
@@ -158,6 +159,7 @@ export * from './plugins/google-plus';
export * from './plugins/googleanalytics';
export * from './plugins/googlemaps';
export * from './plugins/hotspot';
export * from './plugins/http';
export * from './plugins/httpd';
export * from './plugins/ibeacon';
export * from './plugins/imagepicker';
@@ -204,7 +206,7 @@ export * from './plugins/statusbar';
export * from './plugins/stepcounter';
export * from './plugins/streaming-media';
export * from './plugins/text-to-speech';
export * from './plugins/themable-browser';
export * from './plugins/themeable-browser';
export * from './plugins/toast';
export * from './plugins/touchid';
export * from './plugins/twitter-connect';
@@ -265,6 +267,7 @@ window['IonicNative'] = {
GoogleMap,
GoogleAnalytics,
Hotspot,
HTTP,
Httpd,
IBeacon,
ImagePicker,
@@ -314,7 +317,7 @@ window['IonicNative'] = {
TouchID,
Transfer,
TextToSpeech,
ThemableBrowser,
ThemeableBrowser,
TwitterConnect,
VideoEditor,
VideoPlayer,

View File

@@ -53,7 +53,7 @@ export class Calendar {
* - You're using Android < 6, or
* - You've already granted permission
*
* If this returns false, you should call `requestReadWritePermissions` function
* If this returns false, you should call the `requestReadWritePermission` function
* @returns {Promise<boolean>}
*/
@Cordova()

View File

@@ -19,7 +19,7 @@ export interface CameraPreviewSize {
* @description
* Showing camera preview in HTML
*
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/westonganger/cordova-plugin-camera-preview').
*
* @usage
* ```
@@ -71,7 +71,7 @@ export interface CameraPreviewSize {
@Plugin({
plugin: 'cordova-plugin-camera-preview',
pluginRef: 'cordova.plugins.camerapreview',
repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
repo: 'https://github.com/westonganger/cordova-plugin-camera-preview',
platforms: ['Android', 'iOS']
})
export class CameraPreview {
@@ -139,14 +139,6 @@ export class CameraPreview {
})
static hide(): void { };
/**
* Set the default mode for the Flash.
*/
// @Cordova({
// sync: true
// })
// static setFlashMode(mode: number): void { };
/**
* Set camera color effect.
*/
@@ -154,15 +146,4 @@ export class CameraPreview {
sync: true
})
static setColorEffect(effect: string): void { };
/**
* @private
* @enum {number}
*/
static FlashMode = {
OFF: 0,
ON: 1,
AUTO: 2
};
}

View File

@@ -1,66 +1,104 @@
import { Cordova, Plugin } from './plugin';
import {Cordova, Plugin} from './plugin';
export interface DatePickerOptions {
/**
* Platforms: iOS, Android, Windows
* The mode of the date picker
* Values: date | time | datetime
*/
mode: string;
/**
* Platforms: iOS, Android, Windows
* Selected date
*/
date: Date | string | number;
/**
* Platforms: iOS, Android, Windows
* Minimum date
* Type: Date | empty String
* Default: empty String
*/
minDate?: Date | string | number;
/**
* Platforms?: iOS, Android, Windows
* Maximum date
* Type?: Date | empty String
* Default?: empty String
*/
maxDate?: Date | string | number;
/**
* Platforms?: Android
* Label for the dialog title. If empty, uses android default (Set date/Set time).
* Type?: String
* Default?: empty String
*/
titleText?: string;
/**
* Platforms?: Android
* Label of BUTTON_POSITIVE (done button) on Android
*/
okText?: string;
// TODO complete documentation here, and copy params & docs to main plugin docs
/**
* Label of BUTTON_NEGATIVE (cancel button). If empty, uses android.R.string.cancel.
*/
cancelText?: string;
/**
* Label of today button. If empty, doesn't show the option to select current date.
*/
todayText?: string;
/**
* Label of now button. If empty, doesn't show the option to select current time.
*/
nowText?: string;
/**
* Shows time dialog in 24 hours format.
*/
is24Hour?: boolean;
/**
* Choose the Android theme for the picker. You can use the DatePicker.ANDROID_THEMES property.
* Values: 1: THEME_TRADITIONAL | 2: THEME_HOLO_DARK | 3: THEME_HOLO_LIGHT | 4: THEME_DEVICE_DEFAULT_DARK | 5: THEME_DEVICE_DEFAULT_LIGHT
*/
androidTheme?: number;
/**
* Shows or hide dates earlier then selected date.
*/
allowOldDate?: boolean;
/**
* Shows or hide dates after selected date.
*/
allowFutureDates?: boolean;
/**
* Label of done button.
*/
doneButtonLabel?: string;
/**
* Hex color of done button.
*/
doneButtonColor?: string;
/**
* Label of cancel button.
*/
cancelButtonLabel?: string;
/**
* Hex color of cancel button.
*/
cancelButtonColor?: string;
/**
* X position of date picker. The position is absolute to the root view of the application.
*/
x?: number;
/**
* Y position of date picker. The position is absolute to the root view of the application.
*/
y?: number;
/**
* Interval between options in the minute section of the date picker.
*/
minuteInterval?: number;
/**
* Force the UIPopoverArrowDirection enum. The value any will revert to default UIPopoverArrowDirectionAny and let the app choose the proper direction itself.
*/
popoverArrowDirection?: string;
/**
* Force locale for datePicker.
*/
locale?: string;
}
@@ -86,7 +124,8 @@ export interface DatePickerOptions {
* err => console.log('Error occurred while getting date: ', err)
* );
* ```
*
* @interfaces
* DatePickerOptions
*/
@Plugin({
plugin: 'cordova-plugin-datepicker',
@@ -95,12 +134,25 @@ export interface DatePickerOptions {
})
export class DatePicker {
/**
* @private
*/
static ANDROID_THEMES = {
THEME_TRADITIONAL: 1,
THEME_HOLO_DARK: 2,
THEME_HOLO_LIGHT: 3,
THEME_DEVICE_DEFAULT_DARK: 4,
THEME_DEVICE_DEFAULT_LIGHT: 5
};
/**
* Shows the date and/or time picker dialog(s)
* @param {DatePickerOptions} options Options for the date picker.
* @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
*/
@Cordova()
static show(options: DatePickerOptions): Promise<Date> { return; }
static show(options: DatePickerOptions): Promise<Date> {
return;
}
}

View File

@@ -279,7 +279,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static getContactsAuthroizationStatus(): Promise<any> { return; }
static getContactsAuthorizationStatus(): Promise<any> { return; }
/**
* Requests contacts authorization for the application.

View File

@@ -1,4 +1,4 @@
import { Plugin, Cordova } from './plugin';
import {Plugin, pluginWarn} from './plugin';
declare var window: any;
declare var cordova: any;
@@ -301,10 +301,10 @@ export interface FileReader {
onabort: (evt: ProgressEvent) => void;
abort(): void;
readAsText(fe: File, encoding?: string): void;
readAsDataURL(fe: File): void;
readAsBinaryString(fe: File): void;
readAsArrayBuffer(fe: File): void;
readAsText(fe: File | Blob, encoding?: string): void;
readAsDataURL(fe: File | Blob): void;
readAsBinaryString(fe: File | Blob): void;
readAsArrayBuffer(fe: File | Blob): void;
}
declare var FileReader: {
@@ -337,6 +337,12 @@ declare var FileError: {
PATH_EXISTS_ERR: number;
};
let pluginMeta = {
plugin: 'cordova-plugin-file',
pluginRef: 'cordova.file',
repo: 'https://github.com/apache/cordova-plugin-file'
};
/**
* @name File
* @description
@@ -358,11 +364,7 @@ declare var FileError: {
* Although most of the plugin code was written when an earlier spec was current: http://www.w3.org/TR/2011/WD-file-system-api-20110419/
* It also implements the FileWriter spec : http://dev.w3.org/2009/dap/file-system/file-writer.html
*/
@Plugin({
plugin: 'cordova-plugin-file',
pluginRef: 'cordova.file',
repo: 'https://github.com/apache/cordova-plugin-file'
})
@Plugin(pluginMeta)
export class File {
static cordovaFileError: {} = {
1: 'NOT_FOUND_ERR',
@@ -381,9 +383,19 @@ export class File {
14: 'DIR_READ_ERR',
};
@Cordova()
/**
* Get free disk space
* @returns {Promise<number>} Returns a promise that resolves with the remaining free disk space
*/
static getFreeDiskSpace(): Promise<number> {
return;
return new Promise<any>((resolve, reject) => {
if (!cordova || !cordova.exec) {
pluginWarn(pluginMeta);
reject({ error: 'plugin_not_installed' });
} else {
cordova.exec(resolve, reject, 'File', 'getFreeDiskSpace', []);
}
});
}
/**
@@ -393,7 +405,6 @@ export class File {
* @param {string} dir Name of directory to check
* @return {Promise<boolean|FileError>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
*/
static checkDir(path: string, dir: string): Promise<boolean|FileError> {
if ((/^\//.test(dir))) {
let err = new FileError(5);
@@ -418,7 +429,6 @@ export class File {
* @param {boolean} replace If true, replaces file with same name. If false returns error
* @return {Promise<DirectoryEntry|FileError>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
*/
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry|FileError> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
@@ -447,7 +457,6 @@ export class File {
* @param {string} dirName The directory name
* @return {Promise<RemoveResult|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
*/
static removeDir(path: string, dirName: string): Promise<RemoveResult|FileError> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
@@ -473,7 +482,6 @@ export class File {
* @param {string} newDirName The destination directory name
* @return {Promise<DirectoryEntry|Entry|FileError>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
*/
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry|FileError> {
newDirName = newDirName || dirName;
@@ -530,7 +538,6 @@ export class File {
* @param {string} dirName Name of directory
* @return {Promise<Entry[]>} Returns a Promise that resolves to an array of Entry objects or rejects with an error.
*/
static listDir(path: string, dirName: string): Promise<Entry[]> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
@@ -555,7 +562,6 @@ export class File {
* @param {string} dirName Name of directory
* @return {Promise<RemoveResult>} Returns a Promise that resolves with a RemoveResult or rejects with an error.
*/
static removeRecursively(path: string, dirName: string): Promise<RemoveResult> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
@@ -579,7 +585,6 @@ export class File {
* @param {string} file Name of file to check
* @return {Promise<boolean|FileError>} Returns a Promise that resolves with a boolean or rejects with an error.
*/
static checkFile(path: string, file: string): Promise<boolean|FileError> {
if ((/^\//.test(file))) {
let err = new FileError(5);
@@ -637,7 +642,6 @@ export class File {
* @param {string} fileName Name of file to remove
* @return {Promise<RemoveResult|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
*/
static removeFile(path: string, fileName: string): Promise<RemoveResult|FileError> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
@@ -659,38 +663,37 @@ export class File {
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} fileName path relative to base path
* @param {string | Blob} text content or blob to write
* @param {boolean | WriteOptions} replaceOrOptions replace file if set to true. See WriteOptions for more information.
* @param {WriteOptions} options replace file if set to true. See WriteOptions for more information.
* @returns {Promise<void>} Returns a Promise that resolves or rejects with an error.
*/
static writeFile(path: string, fileName: string,
text: string | Blob, replaceOrOptions: boolean | WriteOptions): Promise<void> {
text: string | Blob, options: WriteOptions): Promise<void> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject(err);
}
let opts: WriteOptions = {};
if (replaceOrOptions) {
if (typeof(replaceOrOptions) === 'boolean') {
opts.replace = <boolean>replaceOrOptions;
}
}
let getFileOpts: Flags = {
create: true,
exclusive: options.replace
};
return File.resolveDirectoryUrl(path)
.then((fse) => {
return File.getFile(fse, fileName, opts);
return File.getFile(fse, fileName, getFileOpts);
})
.then((fe) => {
return File.createWriter(fe);
})
.then((writer) => {
if (opts.append) {
if (options.append) {
writer.seek(writer.length);
}
if (opts.hasOwnProperty('truncate')) {
writer.truncate(opts.truncate);
if (options.truncate) {
writer.truncate(options.truncate);
}
return File.write(writer, text);
@@ -959,12 +962,14 @@ export class File {
}
/**
* @private
* Resolves a local file system URL
* @param fileUrl {string} file system url
* @returns {Promise<Entry>}
*/
private static resolveLocalFilesystemUrl(furl: string): Promise<Entry> {
static resolveLocalFilesystemUrl(fileUrl: string): Promise<Entry> {
return new Promise<Entry>((resolve, reject) => {
try {
window.resolveLocalFileSystemURL(furl, (entry) => {
window.resolveLocalFileSystemURL(fileUrl, (entry) => {
resolve(entry);
}, (err) => {
File.fillErrorMessage(err);
@@ -978,10 +983,12 @@ export class File {
}
/**
* @private
* Resolves a local directory url
* @param directoryUrl {string} directory system url
* @returns {Promise<DirectoryEntry>}
*/
private static resolveDirectoryUrl(durl: string): Promise<DirectoryEntry> {
return File.resolveLocalFilesystemUrl(durl)
static resolveDirectoryUrl(directoryUrl: string): Promise<DirectoryEntry> {
return File.resolveLocalFilesystemUrl(directoryUrl)
.then((de) => {
if (de.isDirectory) {
return <DirectoryEntry>de;
@@ -994,12 +1001,16 @@ export class File {
}
/**
* @private
* Get a directory
* @param directoryEntry {DirectoryEntry} Directory entry, obtained by resolveDirectoryUrl method
* @param directoryName {string} Directory name
* @param flags {Flags} Options
* @returns {Promise<DirectoryEntry>}
*/
private static getDirectory(fse: DirectoryEntry, dn: string, flags: Flags): Promise<DirectoryEntry> {
static getDirectory(directoryEntry: DirectoryEntry, directoryName: string, flags: Flags): Promise<DirectoryEntry> {
return new Promise<DirectoryEntry>((resolve, reject) => {
try {
fse.getDirectory(dn, flags, (de) => {
directoryEntry.getDirectory(directoryName, flags, (de) => {
resolve(de);
}, (err) => {
File.fillErrorMessage(err);
@@ -1013,14 +1024,16 @@ export class File {
}
/**
* @private
* Get a file
* @param directoryEntry {DirectoryEntry} Directory entry, obtained by resolveDirectoryUrl method
* @param fileName {string} File name
* @param flags {Flags} Options
* @returns {Promise<FileEntry>}
*/
private static getFile(fse: DirectoryEntry, fn: string, flags: Flags): Promise<FileEntry> {
static getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise<FileEntry> {
return new Promise<FileEntry>((resolve, reject) => {
try {
fse.getFile(fn, flags, (fe) => {
resolve(fe);
}, (err) => {
directoryEntry.getFile(fileName, flags, resolve, (err) => {
File.fillErrorMessage(err);
reject(err);
});
@@ -1123,12 +1136,12 @@ export class File {
return this.writeFileInChunks(writer, gu);
}
return new Promise<void>((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
writer.onwriteend = (evt) => {
if (writer.error) {
reject(writer.error);
} else {
resolve();
resolve(evt);
}
};
writer.write(gu);

View File

@@ -14,7 +14,7 @@ declare var window;
*/
@Plugin({
plugin: 'cordova-plugin-google-analytics',
pluginRef: 'analytics',
pluginRef: 'ga',
repo: 'https://github.com/danwilson/google-analytics-plugin',
platforms: ['Android', 'iOS']
})
@@ -23,45 +23,128 @@ export class GoogleAnalytics {
* In your 'deviceready' handler, set up your Analytics tracker.
* https://developers.google.com/analytics/devguides/collection/analyticsjs/
* @param {string} id Your Google Analytics Mobile App property
* @return {Promise<any>}
*/
@Cordova()
static startTrackerWithId(id: string): Promise<any> { return; }
/**
* Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
* @param allow {boolean}
* @return {Promise<any>}
*/
@Cordova()
static setAllowIDFACollection(allow: boolean): Promise<any> { return; }
/**
* Set a UserId
* https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
* @param {string} id User ID
* @return {Promise<any>}
*/
@Cordova()
static setUserId(id: string): Promise<any> { return; }
/**
* Set a anonymize Ip address
* @param anonymize {boolean} Set to true to anonymize the IP Address
* @return {Promise<any>}
*/
@Cordova()
static setAnonymizeIp(anonymize: boolean): Promise<any> { return; }
/**
* Sets the app version
* @param appVersion {string} App version
* @return {Promise<any>}
*/
@Cordova()
static setAppVersion(appVersion: string): Promise<any> { return; }
/**
* Set OptOut
* @param optout {boolean}
* @return {Promise<any>}
*/
@Cordova()
static setOptOut(optout: boolean): Promise<any> { return; }
/**
* Enable verbose logging
* @return {Promise<any>}
*/
@Cordova()
static debugMode(): Promise<any> { return; }
/**
* Track custom metric
* @param key {string}
* @param value {any}
* @return {Promise<any>}
*/
@Cordova({
successIndex: 2,
errorIndex: 3
})
static trackMetric(key: string, value?: any): Promise<any> { return; }
/**
* Track a screen
* https://developers.google.com/analytics/devguides/collection/analyticsjs/screens
*
* @param {string} title Screen title
* @param {string} campaignUrl Campaign url for measuring referrals
* @param title {string} Screen title
* @param campaignUrl {string} Campaign url for measuring referrals
* @param newSession {boolean} Set to true to create a new session
* @return {Promise<any>}
*/
@Cordova({
successIndex: 3,
errorIndex: 4
})
static trackView(title: string, campaignUrl?: string, newSession?: boolean): Promise<any> { return; }
/**
* Add a Custom Dimension
* https://developers.google.com/analytics/devguides/platform/customdimsmets
* @param key {string}
* @param value {string}
* @return {Promise<any>}
*/
@Cordova()
static trackView(title: string, campaignUrl?: string): Promise<any> { return; }
static addCustomDimension(key: number, value: string): Promise<any> { return; }
/**
* Track an event
* https://developers.google.com/analytics/devguides/collection/analyticsjs/events
* @param {string} category
* @param {string} action
* @param {string} label
* @param {number} value
* @param category {string}
* @param action {string}
* @param label {string}
* @param value {number}
* @param newSession {boolean} Set to true to create a new session
* @return {Promise<any>}
*/
@Cordova()
static trackEvent(category: string, action: string, label?: string, value?: number): Promise<any> { return; }
@Cordova({
successIndex: 5,
errorIndex: 6
})
static trackEvent(category: string, action: string, label?: string, value?: number, newSession?: boolean): Promise<any> { return; }
/**
* Track an exception
* @param {string} description
* @param {boolean} fatal
* @param description {string}
* @param fatal {boolean}
* @return {Promise<any>}
*/
@Cordova()
static trackException(description: string, fatal: boolean): Promise<any> { return; }
/**
* Track User Timing (App Speed)
* @param {string} category
* @param {number} intervalInMilliseconds
* @param {string} variable
* @param {string} label
* @param category {string}
* @param intervalInMilliseconds {number}
* @param variable {string}
* @param label {string}
* @return {Promise<any>}
*/
@Cordova()
static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise<any> { return; }
@@ -69,12 +152,13 @@ export class GoogleAnalytics {
/**
* Add a Transaction (Ecommerce)
* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addTrans
* @param {string} id
* @param {string} affiliation
* @param {number} revenue
* @param {number} tax
* @param {number} shipping
* @param {string} currencyCode
* @param id {string}
* @param affiliation {string}
* @param revenue {number}
* @param tax {number}
* @param shipping {number}
* @param currencyCode {string}
* @return {Promise<any>}
*/
@Cordova()
static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise<any> { return; }
@@ -89,57 +173,15 @@ export class GoogleAnalytics {
* @param {number} price
* @param {number} quantity
* @param {string} currencyCode
* @return {Promise<any>}
*/
@Cordova()
static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise<any> { return; }
/**
* Add a Custom Dimension
* https://developers.google.com/analytics/devguides/platform/customdimsmets
* @param {string} key
* @param {string} value
*/
@Cordova()
static addCustomDimension(key: number, value: string): Promise<any> { return; }
/**
* Set a UserId
* https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
* @param {string} id
*/
@Cordova({sync: true})
static setUserId(id: string): void { }
/**
* Sets the app version
* @param appVersion
*/
@Cordova({sync: true})
static setAppVersion(appVersion: string): void { }
/**
* Set a anonymize Ip address
* @param anonymize
*/
@Cordova({sync: true})
static setAnonymizeIp(anonymize: boolean): void { }
/**
* Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
* @param allow
*/
@Cordova({sync: true})
static setAllowIDFACollection(allow: boolean): void { }
/**
* Enable verbose logging
*/
@Cordova({sync: true})
static debugMode(): Promise<any> { return; }
/**
* Enable/disable automatic reporting of uncaught exceptions
* @param {boolean} shouldEnable
* @param shouldEnable {boolean}
* @return {Promise<any>}
*/
@Cordova()
static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise<any> { return; }

View File

@@ -1,11 +1,6 @@
import {Cordova, CordovaInstance, Plugin, InstanceProperty} from './plugin';
import { Cordova, CordovaInstance, Plugin, InstanceProperty, getPlugin, pluginWarn } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @private
* Created by Ibrahim on 3/29/2016.
*/
declare var plugin: any;
/**
@@ -88,12 +83,13 @@ export const GoogleMapsAnimation = {
* });
* ```
*/
@Plugin({
let pluginMap = {
pluginRef: 'plugin.google.maps.Map',
plugin: 'cordova-plugin-googlemaps',
repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps',
install: 'ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"'
})
};
@Plugin(pluginMap)
export class GoogleMap {
_objectInstance: any;
@@ -106,8 +102,14 @@ export class GoogleMap {
static isAvailable(): Promise<boolean> { return; }
constructor(element: string|HTMLElement, options?: any) {
if (typeof element === 'string') element = document.getElementById(<string>element);
this._objectInstance = plugin.google.maps.Map.getMap(element, options);
if (!!getPlugin('plugin.google.maps.Map')) {
if (typeof element === 'string') {
element = document.getElementById(<string>element);
}
this._objectInstance = plugin.google.maps.Map.getMap(element, options);
} else {
pluginWarn(pluginMap);
}
}
/**
@@ -116,6 +118,12 @@ export class GoogleMap {
* @return {Observable<any>}
*/
on(event: any): Observable<any> {
if (!this._objectInstance) {
return new Observable((observer) => {
observer.error({ error: 'plugin_not_installed' });
});
}
return new Observable(
(observer) => {
this._objectInstance.on(event, observer.next.bind(observer));
@@ -130,6 +138,9 @@ export class GoogleMap {
* @return {Promise<any>}
*/
one(event: any): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.one(event, resolve)
);
@@ -207,7 +218,10 @@ export class GoogleMap {
@CordovaInstance({ sync: true })
setAllGesturesEnabled(enabled: boolean): void { }
addMarker(options: GoogleMapsMarkerOptions): Promise<GoogleMapsMarker> {
addMarker(options: GoogleMapsMarkerOptions): Promise<GoogleMapsMarker | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsMarker>(
(resolve, reject) => {
this._objectInstance.addMarker(options, (marker: any) => {
@@ -221,7 +235,10 @@ export class GoogleMap {
);
}
addCircle(options: GoogleMapsCircleOptions): Promise<GoogleMapsCircle> {
addCircle(options: GoogleMapsCircleOptions): Promise<GoogleMapsCircle | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsCircle>(
(resolve, reject) => {
this._objectInstance.addCircle(options, (circle: any) => {
@@ -235,7 +252,10 @@ export class GoogleMap {
);
}
addPolygon(options: GoogleMapsPolygonOptions): Promise<GoogleMapsPolygon> {
addPolygon(options: GoogleMapsPolygonOptions): Promise<GoogleMapsPolygon | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsPolygon>(
(resolve, reject) => {
this._objectInstance.addPolygon(options, (polygon: any) => {
@@ -249,7 +269,10 @@ export class GoogleMap {
);
}
addPolyline(options: GoogleMapsPolylineOptions): Promise<GoogleMapsPolyline> {
addPolyline(options: GoogleMapsPolylineOptions): Promise<GoogleMapsPolyline | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsPolyline>(
(resolve, reject) => {
this._objectInstance.addPolyline(options, (polyline: any) => {
@@ -263,7 +286,10 @@ export class GoogleMap {
);
}
addTileOverlay(options: GoogleMapsTileOverlayOptions): Promise<GoogleMapsTileOverlay> {
addTileOverlay(options: GoogleMapsTileOverlayOptions): Promise<GoogleMapsTileOverlay | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsTileOverlay>(
(resolve, reject) => {
this._objectInstance.addTileOverlay(options, (tileOverlay: any) => {
@@ -277,7 +303,10 @@ export class GoogleMap {
);
}
addGroundOverlay(options: GoogleMapsGroundOverlayOptions): Promise<GoogleMapsGroundOverlay> {
addGroundOverlay(options: GoogleMapsGroundOverlayOptions): Promise<GoogleMapsGroundOverlay | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsGroundOverlay>(
(resolve, reject) => {
this._objectInstance.addGroundOverlay(options, (groundOverlay: any) => {
@@ -291,7 +320,10 @@ export class GoogleMap {
);
}
addKmlOverlay(options: GoogleMapsKmlOverlayOptions): Promise<GoogleMapsKmlOverlay> {
addKmlOverlay(options: GoogleMapsKmlOverlayOptions): Promise<GoogleMapsKmlOverlay | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsKmlOverlay>(
(resolve, reject) => {
this._objectInstance.addKmlOverlay(options, (kmlOverlay: any) => {
@@ -879,21 +911,22 @@ export class GoogleMapsLatLngBounds {
* @private
*/
export class GoogleMapsLatLng {
private _objectInstance: any;
@InstanceProperty get lat(): number { return; }
@InstanceProperty get lng(): number { return; }
lat: number;
lng: number;
constructor(lat: number, lng: number) {
this._objectInstance = new plugin.google.maps.LatLng(lat, lng);
this.lat = lat;
this.lng = lng;
}
equals(other: GoogleMapsLatLng): boolean {
return this.lat === other.lat && this.lng === other.lng;
}
@CordovaInstance({ sync: true })
toString(): string { return; }
toString(): string {
return this.lat + ',' + this.lng;
}
toUrlValue(precision?: number): string {
precision = precision || 6;
@@ -941,9 +974,10 @@ export class Geocoder {
* @param {GeocoderRequest} request Request object with either an address or a position
* @returns {Promise<GeocoderResult[]>}
*/
static geocode(request: GeocoderRequest): Promise<GeocoderResult[]> {
static geocode(request: GeocoderRequest): Promise<GeocoderResult[] | any> {
return new Promise<GeocoderResult[]>((resolve, reject) => {
if (!plugin || !plugin.google || !plugin.google.maps || !plugin.google.maps.Geocoder) {
pluginWarn(pluginMap);
reject({ error: 'plugin_not_installed' });
} else {
plugin.google.maps.Geocoder.geocode(request, resolve);

View File

@@ -217,27 +217,27 @@ export class Hotspot {
export interface ConnectionInfo {
/**
* @property {string} SSID
* SSID
* The service set identifier (SSID) of the current 802.11 network.
*/
SSID: string;
/**
* @property {string} BSSID
* BSSID
* The basic service set identifier (BSSID) of the current access point.
*/
BSSID: string;
/**
* @property {string} linkSpeed
* linkSpeed
* The current link speed in Mbps
*/
linkSpeed: string;
/**
* @property {string} IPAddress
* IPAddress
* The IP Address
*/
IPAddress: string;
/**
* @property {string} networkID
* networkID
* Each configured network has a unique small integer ID, used to identify the network when performing operations on the supplicant.
*/
networkID: string;
@@ -245,62 +245,62 @@ export interface ConnectionInfo {
export interface HotspotNetwork {
/**
* @property {string} SSID
* SSID
* Human readable network name
*/
SSID: string;
/**
* @property {string} BSSID
* BSSID
* MAC Address of the access point
*/
BSSID: string;
/**
* @property {number (int)} frequency
* frequency
* The primary 20 MHz frequency (in MHz) of the channel over which the client is communicating with the access point.
*/
frequency: number;
/**
* @property {number} level
* level
* The detected signal level in dBm, also known as the RSSI.
*/
level: number;
/**
* @property {number} timestamp
* timestamp
* Timestamp in microseconds (since boot) when this result was last seen.
*/
timestamp: number;
/**
* @property {string} capabilities
* capabilities
* Describes the authentication, key management, and encryption schemes supported by the access point.
*/
capabilities: string;
}
export interface HotspotNetworkConfig {
/**
* @property {string} deviceIPAddress - Device IP Address
* deviceIPAddress - Device IP Address
*/
deviceIPAddress: string;
/**
* @property {string} deviceMacAddress - Device MAC Address
* deviceMacAddress - Device MAC Address
*/
deviceMacAddress: string;
/**
* @property {string} gatewayIPAddress - Gateway IP Address
* gatewayIPAddress - Gateway IP Address
*/
gatewayIPAddress: string;
/**
* @property {string} gatewayMacAddress - Gateway MAC Address
* gatewayMacAddress - Gateway MAC Address
*/
gatewayMacAddress: string;
}
export interface HotspotDevice {
/**
* @property {string} ip
* ip
* Hotspot IP Address
*/
ip: string;
/**
* @property {string} mac
* mac
* Hotspot MAC Address
*/
mac: string;

157
src/plugins/http.ts Normal file
View File

@@ -0,0 +1,157 @@
import { Plugin, Cordova } from './plugin';
/**
* @name HTTP
* @description
* Cordova / Phonegap plugin for communicating with HTTP servers. Supports iOS and Android.
*
* Advantages over Javascript requests:
* - Background threading - all requests are done in a background thread
* - SSL Pinning
*
* @usage
* ```
* import { HTTP } from 'ionic-native';
*
* HTTP.get('http://ionic.io', {}, {})
* .then(data => {
*
* console.log(data.status);
* console.log(data.data); // data received by server
* console.log(data.headers);
*
* })
* .catch(error => {
*
* console.log(error.status);
* console.log(error.error); // error message as string
* console.log(error.headers);
*
* });
*
* ```
* @interfaces
* HTTPResponse
*/
@Plugin({
plugin: 'cordova-plugin-http',
pluginRef: 'cordovaHTTP',
repo: 'https://github.com/wymsee/cordova-HTTP',
platforms: ['Android', 'iOS']
})
export class HTTP {
/**
* This returns an object representing a basic HTTP Authorization header of the form.
* @param username {string} Username
* @param password {string} Password
* @return {Object} an object representing a basic HTTP Authorization header of the form {'Authorization': 'Basic base64encodedusernameandpassword'}
*/
@Cordova({ sync: true })
static getBasicAuthHeader(username: string, password: string): { Authorization: string; } { return; }
/**
* This sets up all future requests to use Basic HTTP authentication with the given username and password.
* @param username {string} Username
* @param password {string} Password
*/
@Cordova({ sync: true })
static useBasicAuth(username: string, password: string): void { }
/**
* Set a header for all future requests. Takes a header and a value.
* @param header {string} The name of the header
* @param value {string} The value of the header
*/
@Cordova({ sync: true })
static setHeader(header: string, value: string): void { }
/**
* Enable or disable SSL Pinning. This defaults to false.
*
* To use SSL pinning you must include at least one .cer SSL certificate in your app project. You can pin to your server certificate or to one of the issuing CA certificates. For ios include your certificate in the root level of your bundle (just add the .cer file to your project/target at the root level). For android include your certificate in your project's platforms/android/assets folder. In both cases all .cer files found will be loaded automatically. If you only have a .pem certificate see this stackoverflow answer. You want to convert it to a DER encoded certificate with a .cer extension.
*
* As an alternative, you can store your .cer files in the www/certificates folder.
* @param enable {boolean} Set to true to enable
* @return {Promise<any>} returns a promise that will resolve on success, and reject on failure
*/
@Cordova()
static enableSSLPinning(enable: boolean): Promise<void> { return; }
/**
* Accept all SSL certificates. Or disabled accepting all certificates. Defaults to false.
* @param accept {boolean} Set to true to accept
* @return {Promise<any>} returns a promise that will resolve on success, and reject on failure
*/
@Cordova()
static acceptAllCerts(accept: boolean): Promise<void> { return; }
/**
* Whether or not to validate the domain name in the certificate. This defaults to true.
* @param validate {boolean} Set to true to validate
* @return {Promise<any>} returns a promise that will resolve on success, and reject on failure
*/
@Cordova()
static validateDomainName(validate: boolean): Promise<void> { return; }
/**
* Make a POST request
* @param url {string} The url to send the request to
* @param body {Object} The body of the request
* @param headers {Object} The headers to set for this request
* @return {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
static post(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
/**
*
* @param url {string} The url to send the request to
* @param parameters {Object} Parameters to send with the request
* @param headers {Object} The headers to set for this request
* @return {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
static get(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
/**
*
* @param url {string} The url to send the request to
* @param body {Object} The body of the request
* @param headers {Object} The headers to set for this request
* @param filePath {string} The local path of the file to upload
* @param name {string} The name of the parameter to pass the file along as
* @return {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
static uploadFile(url: string, body: any, headers: any, filePath: string, name: string): Promise<HTTPResponse> { return; }
/**
*
* @param url {string} The url to send the request to
* @param body {Object} The body of the request
* @param headers {Object} The headers to set for this request
* @param filePath {string} The path to donwload the file to, including the file name.
* @return {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
static downloadFile(url: string, body: any, headers: any, filePath: string): Promise<HTTPResponse> { return; }
}
export interface HTTPResponse {
/**
* The status number of the response
*/
status: number;
/**
* The data that is in the response. This property usually exists when a promise returned by a request method resolves.
*/
data?: any;
/**
* The headers of the response
*/
headers: any;
/**
* Error response from the server. This property usually exists when a promise returned by a request method rejects.
*/
error?: string;
}

View File

@@ -44,10 +44,11 @@ export class LocationAccuracy {
/**
* Requests accurate location
* @param accuracy {number} Accuracy, from 0 to 4. You can use the static properties of this class that start with REQUEST_PRIORITY_
* @returns {Promise<any>} Returns a promise that resolves on success and rejects if an error occurred
*/
@Cordova({ callbackOrder: 'reverse' })
static request(accuracy: string): Promise<any> { return; }
static request(accuracy: number): Promise<any> { return; }
static REQUEST_PRIORITY_NO_POWER = 0;
static REQUEST_PRIORITY_LOW_POWER = 1;

View File

@@ -81,6 +81,9 @@ export interface TransitionOptions {
iosdelay?: number;
androiddelay?: number;
winphonedelay?: number;
fixedPixelsTops?: number;
fixedPixelsTop?: number;
fixedPixelsBottom?: number;
action?: string;
origin?: string;
href?: string;
}

View File

@@ -14,13 +14,19 @@ import { Observable } from 'rxjs/Observable';
* ```typescript
* import { OneSignal } from 'ionic-native';
*
* OneSignal.init('b2f7f966-d8cc-11e4-bed1-df8f05be55ba',
* {googleProjectNumber: '703322744261'})
* .subscribe(jsonData => {
* console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
* });
* OneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261');
*
* OneSignal.enableInAppAlertNotification(true);
*
* OneSignal.handleNotificationReceived().subscribe(() => {
* // do something when notification is received
* });
*
* OneSignal.handleNotificationOpened().subscribe(() => {
* // do something when a notification is opened
* });
*
* OneSignal.endInit();
* ```
*
*/
@@ -32,26 +38,71 @@ import { Observable } from 'rxjs/Observable';
export class OneSignal {
/**
* Only required method you need to call to setup OneSignal to receive push notifications. Call this from the `deviceready` event.
*
* @param {string} 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 {Observable} when a notification is received. Handle your notification action here.
* @private
*/
@Cordova({ observable: true })
static init(appId: string,
options: {
googleProjectNumber: string,
autoRegister: boolean
}): Observable<any> { return; }
static OSInFocusDisplayOption = {
None: 0,
InAppAlert : 1,
Notification : 2
};
/**
* Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt.
* Only use if you passed false to autoRegister when calling init.
* Start the initialization process. Once you are done configuring OneSignal, call the endInit function.
*
* @param {string} appId Your AppId from your OneSignal app
* @param {string} googleProjectNumber The Google Project Number (which you can get from the Google Developer Portal) and the autoRegister option.
*/
@Cordova({ sync: true })
static registerForPushNotifications(): void { }
static startInit(appId: string, googleProjectNumber: string): any { return; }
/**
* Callback to run when a notification is received
* @return {Observable<any>}
*/
@Cordova({
observable: true
})
static handleNotificationReceived(): Observable<any> { return; }
/**
* Callback to run when a notification is opened
* @return {Observable<any>}
*/
@Cordova({
observable: true
})
static handleNotificationOpened(): Observable<any> { return; }
/**
*
* @param settings
*/
@Cordova({ sync: true })
static iOSSettings(settings: {
kOSSettingsKeyInAppLaunchURL: boolean;
kOSSettingsKeyAutoPrompt: boolean;
}): any { return; }
@Cordova({ sync: true })
static endInit(): any { return; }
/**
* Retrieve a list of tags that have been set on the user from the OneSignal server.
*
* @returns {Promise} Returns a Promise that resolves when tags are recieved.
*/
@Cordova()
static getTags(): Promise<any> { return; }
/**
* Lets you retrieve the OneSignal user id and device token.
* Your handler is called after the device is successfully registered with OneSignal.
*
* @returns {Promise} Returns a Promise that reolves if the device was successfully registered.
* It returns a JSON with `userId`and `pushToken`.
*/
@Cordova()
static getIds(): Promise<any> { return; }
/**
@@ -65,47 +116,36 @@ export class OneSignal {
static sendTag(key: string, value: string): void { }
/**
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
*
* @param {string} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
*/
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
*
* @param {string} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
*/
@Cordova({ sync: true })
static sendTags(json: any): void { }
/**
* Retrieve a list of tags that have been set on the user from the OneSignal server.
*
* @returns {Promise} Returns a Promise that resolves when tags are recieved.
*/
@Cordova()
static getTags(): Promise<any> { return; }
/**
* Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one.
*
* @param {string} Key to remove.
*/
* Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one.
*
* @param {string} Key to remove.
*/
@Cordova({ sync: true })
static deleteTag(key: string): void { }
/**
* Deletes tags that were previously set on a user with `sendTag` or `sendTags`.
*
* @param {Array<string>} Keys to remove.
*/
* Deletes tags that were previously set on a user with `sendTag` or `sendTags`.
*
* @param {Array<string>} Keys to remove.
*/
@Cordova({ sync: true })
static deleteTags(keys: string[]): void { }
/**
* Lets you retrieve the OneSignal user id and device token.
* Your handler is called after the device is successfully registered with OneSignal.
*
* @returns {Promise} Returns a Promise that reolves if the device was successfully registered.
* It returns a JSON with `userId`and `pushToken`.
*/
@Cordova()
static getIds(): Promise<any> { return; }
* Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt.
* Only use if you passed false to autoRegister when calling init.
*/
@Cordova({ sync: true })
static registerForPushNotifications(): void { }
/**
* Warning:
@@ -143,15 +183,6 @@ export class OneSignal {
@Cordova({ sync: true })
static enableNotificationsWhenActive(enable: boolean): void { }
/**
* By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired.
* If set to true notifications will be shown as native alert boxes if a notification is received when the user is in your app.
* The notificationOpenedCallback is then fired after the alert box is closed.
*
* @param {boolean} enable
*/
@Cordova({ sync: true })
static enableInAppAlertNotification(enable: boolean): void { }
/**
* You can call this method with false to opt users out of receiving all notifications through OneSignal.
@@ -168,68 +199,7 @@ export class OneSignal {
* @returns {Promise} Returns a Promise that resolves if the notification was send successfully.
*/
@Cordova()
static postNotification(notificationObj: {
app_id: string,
contents: any,
headings?: any,
isIos?: boolean,
isAndroid?: boolean,
isWP?: boolean,
isWP_WNS?: boolean,
isAdm?: boolean,
isChrome?: boolean,
isChromeWeb?: boolean,
isSafari?: boolean,
isAnyWeb?: boolean,
included_segments?: string[],
excluded_segments?: string[],
include_player_ids?: string[],
include_ios_tokens?: string[],
include_android_reg_ids?: string[],
include_wp_uris?: string[],
include_wp_wns_uris?: string[],
include_amazon_reg_ids?: string[],
include_chrome_reg_ids?: string[],
include_chrome_web_reg_ids?: string[],
app_ids?: string[];
tags?: any[],
ios_badgeType?: string,
ios_badgeCount?: number,
ios_sound?: string,
android_sound?: string,
adm_sound?: string,
wp_sound?: string,
wp_wns_sound?: string,
data?: any,
buttons?: any,
small_icon?: string,
large_icon?: string,
big_picture?: string,
adm_small_icon?: string,
adm_large_icon?: string,
adm_big_picture?: string,
chrome_icon?: string,
chrome_big_picture?: string,
chrome_web_icon?: string,
firefox_icon?: string,
url?: string,
send_after?: string,
delayed_option?: string,
delivery_time_of_day?: string,
android_led_color?: string,
android_accent_color?: string,
android_visibility?: number,
content_available?: boolean,
amazon_background_data?: boolean,
template_id?: string,
android_group?: string,
android_group_message?: any,
adm_group?: string,
adm_group_message?: any,
ttl?: number,
priority?: number,
ios_category?: string
}): Promise<any> { return; }
static postNotification(notificationObj: OneSignalNotification): Promise<any> { return; }
/**
* Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard.
@@ -237,6 +207,13 @@ export class OneSignal {
@Cordova({ sync: true })
static promptLocation(): void { }
/**
*
* @param email {string}
*/
@Cordova({ sync: true })
static syncHashedEmail(email: string): void { }
/**
* Enable logging to help debug if you run into an issue setting up OneSignal.
* The logging levels are as follows: 0 = None, 1= Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose
@@ -252,3 +229,66 @@ export class OneSignal {
}): void { }
}
export interface OneSignalNotification {
app_id: string;
contents: any;
headings?: any;
isIos?: boolean;
isAndroid?: boolean;
isWP?: boolean;
isWP_WNS?: boolean;
isAdm?: boolean;
isChrome?: boolean;
isChromeWeb?: boolean;
isSafari?: boolean;
isAnyWeb?: boolean;
included_segments?: string[];
excluded_segments?: string[];
include_player_ids?: string[];
include_ios_tokens?: string[];
include_android_reg_ids?: string[];
include_wp_uris?: string[];
include_wp_wns_uris?: string[];
include_amazon_reg_ids?: string[];
include_chrome_reg_ids?: string[];
include_chrome_web_reg_ids?: string[];
app_ids?: string[];
tags?: any[];
ios_badgeType?: string;
ios_badgeCount?: number;
ios_sound?: string;
android_sound?: string;
adm_sound?: string;
wp_sound?: string;
wp_wns_sound?: string;
data?: any;
buttons?: any;
small_icon?: string;
large_icon?: string;
big_picture?: string;
adm_small_icon?: string;
adm_large_icon?: string;
adm_big_picture?: string;
chrome_icon?: string;
chrome_big_picture?: string;
chrome_web_icon?: string;
firefox_icon?: string;
url?: string;
send_after?: string;
delayed_option?: string;
delivery_time_of_day?: string;
android_led_color?: string;
android_accent_color?: string;
android_visibility?: number;
content_available?: boolean;
amazon_background_data?: boolean;
template_id?: string;
android_group?: string;
android_group_message?: any;
adm_group?: string;
adm_group_message?: any;
ttl?: number;
priority?: number;
ios_category?: string;
}

View File

@@ -6,22 +6,55 @@ import { Plugin, Cordova } from './plugin';
*
* @usage
* ```
* import {PayPal} from 'ionic-native';
* import {PayPal, PayPalPayment, PayPalConfiguration} from "ionic-native";
*
* PayPal.init({
* "PayPalEnvironmentProduction": "YOUR_PRODUCTION_CLIENT_ID",
"PayPalEnvironmentSandbox": "YOUR_SANDBOX_CLIENT_ID"
})
* .then(onSuccess)
* .catch(onError);
* "PayPalEnvironmentProduction": "YOUR_PRODUCTION_CLIENT_ID",
* "PayPalEnvironmentSandbox": "YOUR_SANDBOX_CLIENT_ID"
* }).then(() => {
* // Environments: PayPalEnvironmentNoNetwork, PayPalEnvironmentSandbox, PayPalEnvironmentProduction
* PayPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({
* // Only needed if you get an "Internal Service Error" after PayPal login!
* //payPalShippingAddressOption: 2 // PayPalShippingAddressOptionPayPal
* })).then(() => {
* let payment = new PayPalPayment('3.33', 'USD', 'Description', 'sale');
* PayPal.renderSinglePaymentUI(payment).then(() => {
* // Successfully paid
*
* // Example sandbox response
* //
* // {
* // "client": {
* // "environment": "sandbox",
* // "product_name": "PayPal iOS SDK",
* // "paypal_sdk_version": "2.16.0",
* // "platform": "iOS"
* // },
* // "response_type": "payment",
* // "response": {
* // "id": "PAY-1AB23456CD789012EF34GHIJ",
* // "state": "approved",
* // "create_time": "2016-10-03T13:33:33Z",
* // "intent": "sale"
* // }
* // }
* }, () => {
* // Error or render dialog closed without being successful
* });
* }, () => {
* // Error in configuration
* });
* }, () => {
* // Error in initialization, maybe PayPal isn't supported or something else
* });
* ```
* @interfaces
* PayPalEnvironment
* PayPalConfigurationOptions
* @classes
* PayPalPayment
* PayPalItem
* PayPalPaymentDetails
* PayPalConfigurationOptions
* PayPalShippingAddress
*/
@Plugin({
@@ -30,23 +63,33 @@ import { Plugin, Cordova } from './plugin';
repo: 'https://github.com/paypal/PayPal-Cordova-Plugin'
})
export class PayPal {
/**
* Retrieve the version of the PayPal iOS SDK library. Useful when contacting support.
*/
@Cordova()
static version(): Promise<string> {return; }
/**
* You must preconnect to PayPal to prepare the device for processing payments.
* This improves the user experience, by making the presentation of the
* UI faster. The preconnect is valid for a limited time, so
* the recommended time to preconnect is on page load.
*
* @param {String} environment available options are "PayPalEnvironmentNoNetwork", "PayPalEnvironmentProduction" and "PayPalEnvironmentSandbox"
* @param {PayPalConfiguration} configuration For Future Payments merchantName, merchantPrivacyPolicyURL and merchantUserAgreementURL must be set be set
* @param {PayPalEnvironment} clientIdsForEnvironments: set of client ids for environments
*/
@Cordova()
static init(environment: PayPalEnvironment, configuration?: PayPalConfiguration): Promise<any> {return; }
static init(clientIdsForEnvironments: PayPalEnvironment): Promise<any> {return; }
/**
* Retreive the version of PayPal iOS SDK Library.
*/
* You must preconnect to PayPal to prepare the device for processing payments.
* This improves the user experience, by making the presentation of the UI faster.
* The preconnect is valid for a limited time, so the recommended time to preconnect is on page load.
*
* @param {String} environment: available options are "PayPalEnvironmentNoNetwork", "PayPalEnvironmentProduction" and "PayPalEnvironmentSandbox"
* @param {PayPalConfiguration} configuration: PayPalConfiguration object, for Future Payments merchantName, merchantPrivacyPolicyURL and merchantUserAgreementURL must be set be set
**/
@Cordova()
static version(): Promise<string> {return; }
static prepareToRender(environment: string, configuration: PayPalConfiguration): Promise<any> {return; }
/**
* Start PayPal UI to collect payment from the user.
@@ -84,28 +127,25 @@ export class PayPal {
**/
@Cordova()
static renderProfileSharingUI(scopes: string[]): Promise<any> {return; }
}
export interface PayPalEnvironment {
PayPalEnvironmentProduction: string;
PayPalEnvironmentSandbox: string;
}
export declare var PayPalPayment: {
/**
* Convenience constructor.
* Returns a PayPalPayment with the specified amount, currency code, and short description.
* @param {String} amount: The amount of the payment.
* @param {String} currencyCode: The ISO 4217 currency for the payment.
* @param {String} shortDescription: A short description of the payment.
* @param {String} intent: "Sale" for an immediate payment.
*/
new(amount: string, currencyCode: string, shortDescription: string, intent: string): PayPalPayment;
};
/**
* @private
*/
export interface PayPalPayment {
export class PayPalPayment {
constructor(amount: string, currency: string, shortDescription: string, intent: string, details?: PayPalPaymentDetails) {
this.amount = amount;
this.currency = currency;
this.shortDescription = shortDescription;
this.intent = intent;
this.details = details;
}
/**
* The amount of the payment.
*/
@@ -113,7 +153,7 @@ export interface PayPalPayment {
/**
* The ISO 4217 currency for the payment.
*/
currencyCode: string;
currency: string;
/**
* A short description of the payment.
*/
@@ -126,7 +166,7 @@ export interface PayPalPayment {
* Optional Build Notation code ("BN code"), obtained from partnerprogram@paypal.com,
* for your tracking purposes.
*/
bnCode: string;
bnCode: string = 'PhoneGap_SP';
/**
* Optional invoice number, for your tracking purposes. (up to 256 characters)
*/
@@ -151,9 +191,34 @@ export interface PayPalPayment {
* Optional customer shipping address, if your app wishes to provide this to the SDK.
*/
shippingAddress: string;
/**
* Optional PayPalPaymentDetails object
*/
details: PayPalPaymentDetails;
}
export interface PayPalItem {
/**
* @private
*/
export class PayPalItem {
/**
* The PayPalItem class defines an optional itemization for a payment.
* @see https://developer.paypal.com/docs/api/#item-object for more details.
* @param {String} name: Name of the item. 127 characters max
* @param {Number} quantity: Number of units. 10 characters max.
* @param {String} price: Unit price for this item 10 characters max.
* May be negative for "coupon" etc
* @param {String} currency: ISO standard currency code.
* @param {String} sku: The stock keeping unit for this item. 50 characters max (optional)
*/
constructor(name: string, quantity: number, price: string, currency: string, sku: string) {
this.name = name;
this.quantity = quantity;
this.price = price;
this.currency = currency;
this.sku = sku;
}
/**
* Name of the item. 127 characters max
*/
@@ -176,21 +241,21 @@ export interface PayPalItem {
sku: string;
}
export declare var PayPalItem: {
/**
* @private
*/
export class PayPalPaymentDetails {
/**
* The PayPalItem class defines an optional itemization for a payment.
* @see https://developer.paypal.com/docs/api/#item-object for more details.
* @param {String} name: Name of the item. 127 characters max
* @param {Number} quantity: Number of units. 10 characters max.
* @param {String} price: Unit price for this item 10 characters max.
* May be negative for "coupon" etc
* @param {String} currency: ISO standard currency code.
* @param {String} sku: The stock keeping unit for this item. 50 characters max (optional)
* The PayPalPaymentDetails class defines optional amount details.
* @param {String} subtotal: Sub-total (amount) of items being paid for. 10 characters max with support for 2 decimal places.
* @param {String} shipping: Amount charged for shipping. 10 characters max with support for 2 decimal places.
* @param {String} tax: Amount charged for tax. 10 characters max with support for 2 decimal places.
*/
new(name: string, quantity: number, price: string, currency: string, sku: string): PayPalItem;
};
export interface PayPalPaymentDetails {
constructor(subtotal: string, shipping: string, tax: string) {
this.subtotal = subtotal;
this.shipping = shipping;
this.tax = tax;
}
/**
* Sub-total (amount) of items being paid for. 10 characters max with support for 2 decimal places.
*/
@@ -205,16 +270,6 @@ export interface PayPalPaymentDetails {
tax: string;
}
export declare var PayPalPaymentDetails: {
/**
* The PayPalPaymentDetails class defines optional amount details.
* @param {String} subtotal: Sub-total (amount) of items being paid for. 10 characters max with support for 2 decimal places.
* @param {String} shipping: Amount charged for shipping. 10 characters max with support for 2 decimal places.
* @param {String} tax: Amount charged for tax. 10 characters max with support for 2 decimal places.
*/
new(subtotal: string, shipping: string, tax: string): PayPalPaymentDetails;
};
/**
* @private
*/
@@ -238,11 +293,11 @@ export interface PayPalConfigurationOptions {
/**
* URL of your company's privacy policy, which will be offered to the user when requesting consent via a PayPalFuturePaymentViewController.
*/
merchantPrivacyPolicyUrl?: string;
merchantPrivacyPolicyURL?: string;
/**
* URL of your company's user agreement, which will be offered to the user when requesting consent via a PayPalFuturePaymentViewController.
*/
merchantUserAgreementUrl?: string;
merchantUserAgreementURL?: string;
/**
* If set to NO, the SDK will only support paying with PayPal, not with credit cards.
* This applies only to single payments (via PayPalPaymentViewController).
@@ -316,35 +371,47 @@ export interface PayPalConfigurationOptions {
/**
* @private
*/
export declare var PayPalConfiguration: {
export class PayPalConfiguration implements PayPalConfigurationOptions {
/**
* You use a PayPalConfiguration object to configure many aspects of how the SDK behaves.
* see defaults for options available
*/
new(options: PayPalConfigurationOptions): PayPalConfiguration;
};
constructor(options?: PayPalConfigurationOptions) {
export interface PayPalConfiguration {
defaultUserEmail: string;
defaultUserPhoneCountryCode: string;
defaultUserPhoneNumber: string;
merchantName: string;
merchantPrivacyPolicyUrl: string;
merchantUserAgreementUrl: string;
acceptCreditCards: boolean;
payPalShippingAddressOption: number;
rememberUser: boolean;
languageOrLocale: string;
disableBlurWhenBackgrounding: boolean;
presentingInPopover: boolean;
forceDefaultsInSandbox: boolean;
sandboxUserPassword: string;
sandboxUserPin: string;
let defaults: PayPalConfigurationOptions = {
defaultUserEmail: null,
defaultUserPhoneCountryCode: null,
defaultUserPhoneNumber: null,
merchantName: null,
merchantPrivacyPolicyURL: null,
merchantUserAgreementURL: null,
acceptCreditCards: true,
payPalShippingAddressOption: 0,
rememberUser: true,
languageOrLocale: null,
disableBlurWhenBackgrounding: false,
presentingInPopover: false,
forceDefaultsInSandbox: false,
sandboxUserPassword: null,
sandboxUserPin: null
};
if (options && typeof options === 'object') {
for (var i in options) {
if (defaults.hasOwnProperty(i)) {
defaults[i] = options[i];
}
}
}
return defaults;
}
}
/**
* @private
*/
export declare var PayPalShippingAddress: {
export class PayPalShippingAddress {
/**
* See the documentation of the individual properties for more detail.
* @param {String} recipientName: Name of the recipient at this address. 50 characters max.
@@ -355,10 +422,15 @@ export declare var PayPalShippingAddress: {
* @param {String} postalCode: ZIP code or equivalent is usually required for countries that have them. 20 characters max. Required in certain countries.
* @param {String} countryCode: 2-letter country code. 2 characters max.
*/
new(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string): PayPalShippingAddress;
};
export interface PayPalShippingAddress {
constructor(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string) {
this.recipientName = recipientName;
this.line1 = line1;
this.line2 = line2;
this.city = city;
this.state = state;
this.postalCode = postalCode;
this.countryCode = countryCode;
}
/**
* Name of the recipient at this address. 50 characters max.
*/

View File

@@ -41,6 +41,11 @@ export const cordovaWarn = function(pluginName: string, method: string) {
}
};
function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any {
// ignore resolve and reject in case sync
if (opts.sync) {
return args;
}
// If the plugin method expects myMethod(success, err, options)
if (opts.callbackOrder === 'reverse') {
// Get those arguments in the order [resolve, reject, ...restOfArgs]
@@ -61,7 +66,12 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func
args.push(obj);
} else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
// If we've specified a success/error index
args.splice(opts.successIndex, 0, resolve);
if (opts.successIndex > args.length) {
args[opts.successIndex] = resolve;
} else {
args.splice(opts.successIndex, 0, resolve);
}
// We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour.
if (opts.errorIndex > args.length) {

View File

@@ -1,22 +1,87 @@
import { Plugin, CordovaInstance } from './plugin';
import { Observable } from 'rxjs/Observable';
import { InAppBrowserEvent } from './inappbrowser';
declare var cordova: any;
export interface ThemeableBrowserButton {
wwwImage?: string;
image?: string;
wwwImagePressed?: string;
imagePressed?: string;
wwwImageDensity?: number;
align?: string;
event?: string;
}
export interface ThemeableBrowserOptions {
statusbar?: {
color: string;
};
toolbar?: {
height?: number;
color?: string;
image?: string;
};
title?: {
color?: string;
staticText?: string;
showPageTitle?: boolean;
};
backButton?: ThemeableBrowserButton;
forwardButton?: ThemeableBrowserButton;
closeButton?: ThemeableBrowserButton;
customButtons?: ThemeableBrowserButton[];
menu?: {
image?: string;
imagePressed?: string;
title?: string;
cancel?: string;
align?: string;
items?: {
event: string;
label: string;
}[];
};
backButtonCanClose?: boolean;
disableAnimation?: boolean;
// inAppBrowser options
location?: string;
hidden?: string;
clearcache?: string;
clearsessioncache?: string;
zoom?: string;
hardwareback?: string;
mediaPlaybackRequiresUserAction?: string;
shouldPauseOnSuspsend?: string;
closebuttoncaption?: string;
disallowoverscroll?: string;
enableViewportScale?: string;
allowInlineMediaPlayback?: string;
keyboardDisplayRequiresUserAction?: string;
suppressesIncrementalRendering?: string;
presentationstyle?: string;
transitionstyle?: string;
toolbarposition?: string;
fullscreen?: string;
}
/**
* @name ThemableBrowser
* @name ThemeableBrowser
* @description
* In-app browser that allows styling.
*
* @usage
* ```
* import { ThemableBrowser } from 'ionic-native';
* import { ThemeableBrowser } from 'ionic-native';
*
* // can add options from the original InAppBrowser in a JavaScript object form (not string)
* // This options object also takes additional parameters introduced by the ThemableBrowser plugin
* // This example only shows the additional parameters for ThemableBrowser
* // This options object also takes additional parameters introduced by the ThemeableBrowser plugin
* // This example only shows the additional parameters for ThemeableBrowser
* // Note that that `image` and `imagePressed` values refer to resources that are stored in your app
* let options = {
* statusbar: {
* statusbar: {
* color: '#ffffffff'
* },
* toolbar: {
@@ -83,11 +148,16 @@ declare var cordova: any;
pluginRef: 'cordova.ThemeableBrowser',
repo: 'https://github.com/initialxy/cordova-plugin-themeablebrowser'
})
export class ThemableBrowser {
export class ThemeableBrowser {
private _objectInstance: any;
constructor(url: string, target: string, styleOptions: ThemeableBrowserOptions) {
this._objectInstance = cordova.ThemableBrowser.open(arguments);
try {
this._objectInstance = cordova.ThemeableBrowser.open(url, target, styleOptions);
} catch (e) {
window.open(url);
console.warn('Native: ThemeableBrowser is not installed or you are running on a browser. Falling back to window.open, all instance methods will NOT work.');
}
}
/**
@@ -125,7 +195,7 @@ export class ThemableBrowser {
/**
* A method that allows you to listen to events happening in the browser.
* Available events are: `ThemableBrowserError`, `ThemableBrowserWarning`, `critical`, `loadfail`, `unexpected`, `undefined`
* Available events are: `ThemeableBrowserError`, `ThemeableBrowserWarning`, `critical`, `loadfail`, `unexpected`, `undefined`
* @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.
*/
@@ -138,57 +208,3 @@ export class ThemableBrowser {
}
export interface ThemeableBrowserOptions {
statusbar?: { color: string; };
toobar?: {
height?: number;
color?: string;
};
title?: { color: string; };
backButton?: ThemableBrowserButton;
forwardButton?: ThemableBrowserButton;
closeButton?: ThemableBrowserButton;
customButtons?: ThemableBrowserButton[];
menu?: {
image?: string;
imagePressed?: string;
title?: string;
cancel?: string;
align?: string;
items?: {
event: string;
label: string;
}[];
};
backButtonCanClose?: boolean;
// inAppBrowser options
location?: string;
hidden?: string;
clearcache?: string;
clearsessioncache?: string;
zoom?: string;
hardwareback?: string;
mediaPlaybackRequiresUserAction?: string;
shouldPauseOnSuspsend?: string;
closebuttoncaption?: string;
disallowoverscroll?: string;
enableViewportScale?: string;
allowInlineMediaPlayback?: string;
keyboardDisplayRequiresUserAction?: string;
suppressesIncrementalRendering?: string;
presentationstyle?: string;
transitionstyle?: string;
toolbarposition?: string;
fullscreen?: string;
}
export interface ThemableBrowserButton {
wwwImage?: string;
image?: string;
wwwImagePressed?: string;
imagePressed?: string;
wwwImageDensity?: number;
align?: string;
event?: string;
}

View File

@@ -36,7 +36,7 @@ describe('plugin', () => {
const spy = spyOn(window.plugins.test, 'syncMethod').and.callThrough();
const result = Test.syncMethod('foo');
expect(result).toEqual('syncResult');
expect(spy).toHaveBeenCalledWith('foo', undefined, undefined);
expect(spy).toHaveBeenCalledWith('foo');
});
@@ -138,4 +138,4 @@ describe('plugin', () => {
});
});
});