mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-16 00:00:02 +08:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b060345d2 | ||
|
|
1784036ef7 | ||
|
|
7a8577007c | ||
|
|
7c6e6d8b6b | ||
|
|
c5fd83ddb6 | ||
|
|
7b2fe69c7c | ||
|
|
f0961c7b23 | ||
|
|
35c8bbd49e | ||
|
|
1a343c1ea5 | ||
|
|
4fef8ff326 | ||
|
|
13681756ae | ||
|
|
4a798281e4 | ||
|
|
79670b7878 | ||
|
|
720084578d | ||
|
|
3dd6a92ccf | ||
|
|
7d1686ef93 | ||
|
|
b40b0fff98 | ||
|
|
4dba0580ac | ||
|
|
11653ce752 | ||
|
|
d3e6f3ba41 | ||
|
|
2c6cc37a5f |
48
CHANGELOG.md
48
CHANGELOG.md
@@ -1,3 +1,51 @@
|
||||
<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)
|
||||
|
||||
|
||||
## BREAKING CHANGES
|
||||
|
||||
### OneSignal
|
||||
The wrapper for this plugin has been updated to the match latest version of the plugin (2.x). If you are still using and older version of the plugin (1.x), you should use ionic-native v.2.1.x.
|
||||
|
||||
### ThemeableBrowser
|
||||
The wrapper for this plugin (and related interfaces) has been refactored to replace "Themable" with "Themeable". Please fix your existing code to match the new class and interfaces names.
|
||||
|
||||
----
|
||||
|
||||
### 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)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "2.1.7",
|
||||
"version": "2.2.0",
|
||||
"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",
|
||||
|
||||
@@ -100,7 +100,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 +158,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 +205,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';
|
||||
@@ -314,7 +315,7 @@ window['IonicNative'] = {
|
||||
TouchID,
|
||||
Transfer,
|
||||
TextToSpeech,
|
||||
ThemableBrowser,
|
||||
ThemeableBrowser,
|
||||
TwitterConnect,
|
||||
VideoEditor,
|
||||
VideoPlayer,
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
158
src/plugins/http.ts
Normal file
158
src/plugins/http.ts
Normal file
@@ -0,0 +1,158 @@
|
||||
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'
|
||||
})
|
||||
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 fileParameter {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, fileParameter: 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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -6,15 +6,47 @@ 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
|
||||
@@ -31,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.
|
||||
@@ -85,7 +127,6 @@ export class PayPal {
|
||||
**/
|
||||
@Cordova()
|
||||
static renderProfileSharingUI(scopes: string[]): Promise<any> {return; }
|
||||
|
||||
}
|
||||
|
||||
export interface PayPalEnvironment {
|
||||
@@ -97,19 +138,12 @@ export interface PayPalEnvironment {
|
||||
* @private
|
||||
*/
|
||||
export class 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} currency: The ISO 4217 currency for the payment.
|
||||
* @param {String} shortDescription: A short description of the payment.
|
||||
* @param {String} intent: "Sale" for an immediate payment.
|
||||
*/
|
||||
constructor(amount: string, currency: string, shortDescription: string, intent: string) {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,6 +191,11 @@ export class PayPalPayment {
|
||||
* Optional customer shipping address, if your app wishes to provide this to the SDK.
|
||||
*/
|
||||
shippingAddress: string;
|
||||
|
||||
/**
|
||||
* Optional PayPalPaymentDetails object
|
||||
*/
|
||||
details: PayPalPaymentDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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]
|
||||
@@ -77,10 +82,8 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func
|
||||
} else {
|
||||
// Otherwise, let's tack them on to the end of the argument list
|
||||
// which is 90% of cases
|
||||
if (!opts.sync) {
|
||||
args.push(resolve);
|
||||
args.push(reject);
|
||||
}
|
||||
args.push(resolve);
|
||||
args.push(reject);
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
@@ -1,22 +1,79 @@
|
||||
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;
|
||||
};
|
||||
title?: { color: string; };
|
||||
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;
|
||||
|
||||
// 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 +140,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 +187,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 +200,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;
|
||||
}
|
||||
Reference in New Issue
Block a user