diff --git a/CHANGELOG.md b/CHANGELOG.md
index 186c212ae..756d90a10 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,29 @@
+
+# [3.14.0](https://github.com/ionic-team/ionic-native/compare/v3.13.1...v3.14.0) (2017-07-07)
+
+
+### Features
+
+* **in-app-purchase2:** add a second InAppPurchase plugin ([#1775](https://github.com/ionic-team/ionic-native/issues/1775)) ([398d0ee](https://github.com/ionic-team/ionic-native/commit/398d0ee)), closes [#1705](https://github.com/ionic-team/ionic-native/issues/1705)
+
+
+
+
+## [3.13.1](https://github.com/ionic-team/ionic-native/compare/v3.13.0...v3.13.1) (2017-07-05)
+
+
+### Bug Fixes
+
+* **document-viewer:** make config properties optional ([#1767](https://github.com/ionic-team/ionic-native/issues/1767)) ([5b914d7](https://github.com/ionic-team/ionic-native/commit/5b914d7))
+
+
+### Features
+
+* **app-rate:** add function handleNegativeFeedback() ([#1748](https://github.com/ionic-team/ionic-native/issues/1748)) ([e64cc0c](https://github.com/ionic-team/ionic-native/commit/e64cc0c))
+* **app-rate:** add function navigateToAppStore() ([#1719](https://github.com/ionic-team/ionic-native/issues/1719)) ([0c79ac1](https://github.com/ionic-team/ionic-native/commit/0c79ac1))
+
+
+
# [3.13.0](https://github.com/ionic-team/ionic-native/compare/v3.12.2...v3.13.0) (2017-07-03)
diff --git a/README.md b/README.md
index 6aa9dde5a..d5232669e 100644
--- a/README.md
+++ b/README.md
@@ -171,9 +171,9 @@ Spent way too long diagnosing an issue only to realize a plugin wasn't firing or
## Plugin Missing?
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
-## Ionic V1/Angular 1 support
+## Ionic v1 (AngularJS, Angular 1.x) support
-For Ionic V1/Angular 1 support, please use version 2 of Ionic Native. See the [2.x README](https://github.com/ionic-team/ionic-native/blob/8cd648db5cddd7bdbe2bd78839b19c620cc8c04c/README.md) for usage information.
+For Ionic v1 (AngularJS, Angular 1.x) support, please use version 2 of Ionic Native. See the [2.x README](https://github.com/ionic-team/ionic-native/blob/v2.x/README.md) for usage information.
# Credits
diff --git a/package.json b/package.json
index 8c1820e57..d7ba18d2a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ionic-native",
- "version": "3.13.0",
+ "version": "3.14.0",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"homepage": "https://ionicframework.com/",
"author": "Ionic Team (https://ionic.io)",
@@ -39,12 +39,12 @@
"q": "1.5.0",
"queue": "4.2.1",
"rimraf": "2.6.1",
- "rxjs": "5.1.1",
+ "rxjs": "5.4.0",
"semver": "5.3.0",
"tslint": "3.15.1",
"tslint-ionic-rules": "0.0.8",
"typescript": "2.3.3",
- "zone.js": "^0.8.11"
+ "zone.js": "0.8.12"
},
"scripts": {
"start": "npm run test:watch",
diff --git a/scripts/build/build.js b/scripts/build/build.js
index dd8353427..5065e6ae7 100644
--- a/scripts/build/build.js
+++ b/scripts/build/build.js
@@ -19,7 +19,7 @@ const ROOT = path.resolve(path.join(__dirname, '../../')), // root ionic-native
// dependency versions
const ANGULAR_VERSION = '*',
RXJS_VERSION = '^5.0.1',
- MIN_CORE_VERSION = '^3.6.0',
+ MIN_CORE_VERSION = '^3.6.0 || >=4.0.0',
IONIC_NATIVE_VERSION = require(path.resolve(ROOT, 'package.json')).version;
// package dependencies
diff --git a/src/@ionic-native/plugins/admob/index.ts b/src/@ionic-native/plugins/admob-pro/index.ts
similarity index 91%
rename from src/@ionic-native/plugins/admob/index.ts
rename to src/@ionic-native/plugins/admob-pro/index.ts
index ee193bb58..94c360561 100644
--- a/src/@ionic-native/plugins/admob/index.ts
+++ b/src/@ionic-native/plugins/admob-pro/index.ts
@@ -32,7 +32,7 @@ export interface AdMobOptions {
overlap?: boolean;
/**
- * Position of banner ad. Defaults to `TOP_CENTER`. You can use the `AdMob.AD_POSITION` property to select other values.
+ * Position of banner ad. Defaults to `TOP_CENTER`. You can use the `AdMobPro.AD_POSITION` property to select other values.
*/
position?: number;
@@ -93,14 +93,15 @@ export interface AdExtras {
* @paid
* @name AdMob
* @description
- * Plugin for Google Ads, including AdMob / DFP (doubleclick for publisher) and mediations to other Ad networks.
+ * Plugin for Google Ads, including AdMob / DFP (DoubleClick for publisher) and mediations to other Ad networks.
*
+ * IMPORTANT NOTICE: this plugin takes a percentage out of your earnings if you profit more than $1,000. Read more about this on the plugin's repo. For a completely free alternative, see [AdMobPro Free](../admob-free).
* @usage
* ```typescript
- * import { AdMob } from '@ionic-native/admob';
+ * import { AdMobPro } from '@ionic-native/admob-pro';
* import { Platform } from 'ionic-angular';
*
- * constructor(private admob: AdMob, private platform: Platform ) { }
+ * constructor(private admob: AdMobPro, private platform: Platform ) { }
*
* ionViewDidLoad() {
* this.admob.onAdDismiss()
@@ -125,14 +126,14 @@ export interface AdExtras {
* AdExtras
*/
@Plugin({
- pluginName: 'AdMob',
+ pluginName: 'AdMob Pro',
plugin: 'cordova-plugin-admobpro',
pluginRef: 'AdMob',
repo: 'https://github.com/floatinghotpot/cordova-admob-pro',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
@Injectable()
-export class AdMob extends IonicNativePlugin {
+export class AdMobPro extends IonicNativePlugin {
AD_POSITION: {
NO_CHANGE: number;
@@ -178,7 +179,7 @@ export class AdMob extends IonicNativePlugin {
/**
* Show banner at position
- * @param position {number} Position. Use `AdMob.AD_POSITION` to set values.
+ * @param position {number} Position. Use `AdMobPro.AD_POSITION` to set values.
*/
@Cordova({
sync: true
diff --git a/src/@ionic-native/plugins/email-composer/index.ts b/src/@ionic-native/plugins/email-composer/index.ts
index 1deac3f72..ad148fd14 100644
--- a/src/@ionic-native/plugins/email-composer/index.ts
+++ b/src/@ionic-native/plugins/email-composer/index.ts
@@ -1,28 +1,46 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
-interface Cordova {
- plugins: CordovaPlugins & { email: any };
-}
-
-declare const cordova: Cordova;
-
export interface EmailComposerOptions {
+ /**
+ * App to send the email with
+ */
app?: string;
+ /**
+ * Email address(es) for To field
+ */
to?: string | Array;
+ /**
+ * Email address(es) for CC field
+ */
cc?: string | Array;
+ /**
+ * Email address(es) for BCC field
+ */
bcc?: string | Array;
- attachments?: Array;
+ /**
+ * File paths or base64 data streams
+ */
+ attachments?: string[];
+ /**
+ * Subject of the email
+ */
subject?: string;
+ /**
+ * Email body (for HTML, set isHtml to true)
+ */
body?: string;
+ /**
+ * Indicates if the body is HTML or plain text
+ */
isHtml?: boolean;
}
@@ -67,16 +85,27 @@ export interface EmailComposerOptions {
*
* // Send a text message using default options
* this.emailComposer.open(email);
+ * ```
*
+ * You can also assign aliases to email apps
+ * ```ts
+ * // add alias
+ * this.email.addAlias('gmail', 'com.google.android.gm');
+ *
+ * // then use alias when sending email
+ * this.email.open({
+ * app: 'gmail',
+ * ...
+ * });
* ```
* @interfaces
* EmailComposerOptions
*/
@Plugin({
pluginName: 'EmailComposer',
- plugin: 'cordova-plugin-email',
+ plugin: 'cordova-plugin-email-composer',
pluginRef: 'cordova.plugins.email',
- repo: 'https://github.com/hypery2k/cordova-email-plugin',
+ repo: 'https://github.com/katzer/cordova-plugin-email-composer',
platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Windows']
})
@Injectable()
@@ -92,7 +121,7 @@ export class EmailComposer extends IonicNativePlugin {
isAvailable(app?: string): Promise {
return new Promise((resolve, reject) => {
if (app) {
- cordova.plugins.email.isAvailable(app, (isAvailable: boolean) => {
+ EmailComposer.getPlugin().isAvailable(app, (isAvailable: boolean) => {
if (isAvailable) {
resolve();
} else {
@@ -100,7 +129,7 @@ export class EmailComposer extends IonicNativePlugin {
}
});
} else {
- cordova.plugins.email.isAvailable((isAvailable: boolean) => {
+ EmailComposer.getPlugin().isAvailable((isAvailable: boolean) => {
if (isAvailable) {
resolve();
} else {
@@ -111,6 +140,26 @@ export class EmailComposer extends IonicNativePlugin {
});
}
+ /**
+ * Request permission to access email accounts information
+ * @return {Promise} returns a promise that resolves with a boolean that indicates if the permission was granted
+ */
+ @Cordova({
+ successIndex: 0,
+ errorIndex: 2
+ })
+ requestPermission(): Promise { return; }
+
+ /**
+ * Checks if the app has a permission to access email accounts information
+ * @return {Promise} returns a promise that resolves with a boolean that indicates if the permission was granted
+ */
+ @Cordova({
+ successIndex: 0,
+ errorIndex: 2
+ })
+ hasPermission(): Promise { return; }
+
/**
* Adds a new mail app alias.
*
diff --git a/src/@ionic-native/plugins/transfer/index.ts b/src/@ionic-native/plugins/file-transfer/index.ts
similarity index 89%
rename from src/@ionic-native/plugins/transfer/index.ts
rename to src/@ionic-native/plugins/file-transfer/index.ts
index 8a66f39a7..1dd4355ca 100644
--- a/src/@ionic-native/plugins/transfer/index.ts
+++ b/src/@ionic-native/plugins/file-transfer/index.ts
@@ -1,8 +1,6 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, Plugin, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
-declare const FileTransfer: any;
-
export interface FileUploadOptions {
/**
@@ -109,21 +107,21 @@ export interface FileTransferError {
}
/**
- * @name Transfer
+ * @name File Transfer
*
* @description
* This plugin allows you to upload and download files.
*
* @usage
* ```typescript
- * import { Transfer, FileUploadOptions, TransferObject } from '@ionic-native/transfer';
+ * import { FileTransfer, FileUploadOptions, FileTransferObject } from '@ionic-native/transfer';
* import { File } from '@ionic-native/file';
*
- * constructor(private transfer: Transfer, private file: File) { }
+ * constructor(private transfer: FileTransfer, private file: File) { }
*
* ...
*
- * const fileTransfer: TransferObject = this.transfer.create();
+ * const fileTransfer: FileTransferObject = this.transfer.create();
*
* // Upload a file:
* fileTransfer.upload(..).then(..).catch(..);
@@ -170,7 +168,7 @@ export interface FileTransferError {
* FileUploadResult
* FileTransferError
* @classes
- * TransferObject
+ * FileTransferObject
*/
@Plugin({
pluginName: 'FileTransfer',
@@ -180,7 +178,7 @@ export interface FileTransferError {
platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone']
})
@Injectable()
-export class Transfer extends IonicNativePlugin {
+export class FileTransfer extends IonicNativePlugin {
/**
* Error code rejected from upload with FileTransferError
@@ -202,10 +200,10 @@ export class Transfer extends IonicNativePlugin {
/**
* Creates a new FileTransfer object
- * @return {TransferObject}
+ * @return {FileTransferObject}
*/
- create(): TransferObject {
- return new TransferObject();
+ create(): FileTransferObject {
+ return new FileTransferObject();
}
}
@@ -217,12 +215,12 @@ export class Transfer extends IonicNativePlugin {
plugin: 'cordova-plugin-file-transfer',
pluginName: 'FileTransfer'
})
-export class TransferObject {
+export class FileTransferObject {
private _objectInstance: any;
constructor() {
- if (checkAvailability('FileTransfer', null, 'FileTransfer') === true) {
- this._objectInstance = new FileTransfer();
+ if (checkAvailability(FileTransfer.getPluginRef(), null, FileTransfer.getPluginName()) === true) {
+ this._objectInstance = new (FileTransfer.getPlugin())();
}
}
@@ -239,9 +237,7 @@ export class TransferObject {
successIndex: 2,
errorIndex: 3
})
- upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise {
- return;
- }
+ upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise { return; }
/**
* Downloads a file from server.
@@ -256,9 +252,7 @@ export class TransferObject {
successIndex: 2,
errorIndex: 3
})
- download(source: string, target: string, trustAllHosts?: boolean, options?: { [s: string]: any; }): Promise {
- return;
- }
+ download(source: string, target: string, trustAllHosts?: boolean, options?: { [s: string]: any; }): Promise { return; }
/**
* Registers a listener that gets called whenever a new chunk of data is transferred.
@@ -276,5 +270,5 @@ export class TransferObject {
@CordovaInstance({
sync: true
})
- abort(): void { }
+ abort(): void {}
}
diff --git a/src/@ionic-native/plugins/google-analytics/index.ts b/src/@ionic-native/plugins/google-analytics/index.ts
index 06b4ddacc..9af3c62e5 100644
--- a/src/@ionic-native/plugins/google-analytics/index.ts
+++ b/src/@ionic-native/plugins/google-analytics/index.ts
@@ -102,7 +102,7 @@ export class GoogleAnalytics extends IonicNativePlugin {
/**
* Track custom metric
- * @param key {string}
+ * @param key {number}
* @param value {any}
* @returns {Promise}
*/
@@ -110,7 +110,7 @@ export class GoogleAnalytics extends IonicNativePlugin {
successIndex: 2,
errorIndex: 3
})
- trackMetric(key: string, value?: any): Promise { return; }
+ trackMetric(key: number, value?: number): Promise { return; }
/**
* Track a screen
diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts
index 68a4933d5..aae3a6739 100644
--- a/src/@ionic-native/plugins/google-maps/index.ts
+++ b/src/@ionic-native/plugins/google-maps/index.ts
@@ -1,39 +1,292 @@
import { Injectable } from '@angular/core';
-import { Cordova, CordovaInstance, CordovaCheck, Plugin, InstanceProperty, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
+import { Cordova, CordovaInstance, Plugin, InstanceProperty, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
+import { Observer } from 'rxjs/Observer';
import 'rxjs/add/observable/fromEvent';
-declare const plugin: any;
+
+export type MapType = 'MAP_TYPE_NORMAL' | 'MAP_TYPE_ROADMAP' | 'MAP_TYPE_SATELLITE' | 'MAP_TYPE_HYBRID' | 'MAP_TYPE_TERRAIN' | 'MAP_TYPE_NONE';
+
+export interface GoogleMapOptions {
+ mapType: MapType;
+ controls: {
+ compass: boolean;
+ myLocationButton: boolean;
+ indoorPicker: boolean;
+ zoom: boolean;
+ };
+ gestures: {
+ scroll: boolean;
+ tilt: boolean;
+ zoom: boolean;
+ rotate: boolean;
+ };
+ styles: any[];
+ camera: CameraPosition;
+ preferences: {
+ zoom: {
+ minZoom: number;
+ maxZoom: number;
+ },
+ building: boolean;
+ };
+}
+
+export interface AnimateCameraOptions {
+ target?: LatLng | Array | LatLngBounds;
+ tilt?: number;
+ zoom?: number;
+ bearing?: number;
+ duration?: number;
+}
+
+export interface CameraPosition {
+ /**
+ * The center location of the camera view.
+ */
+ target?: LatLng | LatLngBounds | LatLng[];
+ /**
+ * View angle
+ */
+ tilt?: number;
+ /**
+ * Zoom level
+ */
+ zoom?: number;
+ /**
+ * Map orientation
+ */
+ bearing?: number;
+ /**
+ * The duration of animation in milliseconds
+ */
+ duration?: number;
+}
+
+export interface CircleOptions {
+ center?: LatLng;
+ radius?: number;
+ strokeColor?: string;
+ strokeWidth?: number;
+ fillColor?: string;
+ visible?: boolean;
+ zIndex?: number;
+}
+
+export interface GeocoderRequest {
+ address?: string | string[];
+ position?: ILatLng | ILatLng[];
+}
+
+export interface GeocoderResult {
+ adminArea?: string;
+ country?: string;
+ countryCode?: string;
+ extra?: {
+ featureName?: string;
+ lines?: Array;
+ permises?: string;
+ phone?: string;
+ url?: string
+ };
+ locale?: string;
+ locality?: string;
+ position?: { lat: number; lng: number };
+ postalCode?: string;
+ subAdminArea?: string;
+ subLocality?: string;
+ subThoroughfare?: string;
+ thoroughfare?: string;
+}
+
+export interface GroundOverlayOptions {
+ /**
+ * URL of overlay
+ */
+ url?: string;
+ /**
+ * Bounds, array of LatLng
+ */
+ bounds?: Array;
+ /**
+ * Set to false to hide
+ */
+ visible?: boolean;
+ /**
+ * Opacity. From 0 to 1.
+ */
+ opacity?: number;
+ /**
+ * Bearing
+ */
+ bearing?: number;
+ /**
+ * Z-index
+ */
+ zIndex?: number;
+}
+
+export interface ILatLng {
+ lat: number;
+ lng: number;
+}
+
+export interface MarkerIcon {
+ url?: string;
+ size?: {
+ width?: number;
+ height?: number;
+ };
+}
+
+export interface MarkerOptions {
+ /**
+ * The icon image url or properties. Also you can specify HTML Color values. Alternatively you can specify the image as Base64
+ */
+ icon?: any;
+
+ /**
+ * The content of the infoWindow.
+ */
+ title?: string;
+
+ /**
+ * The snippet of the infoWindow.
+ */
+ snippet?: string;
+
+ /**
+ * The position of the marker.
+ */
+ position?: LatLng;
+
+ /**
+ * Specify the anchor of the InfoWindow
+ */
+ infoWindowAnchor?: number[];
+
+ /**
+ * Set true if you want to enable to drag the marker. (Default: false) Important! Drag starts after long pressed on the marker.
+ */
+ draggable?: boolean;
+
+ /**
+ * Set true if you want to use a flat marker. (Default: false)
+ */
+ flat?: boolean;
+
+ /**
+ * Set rotation angle. (Default: 0)
+ */
+ rotation?: number;
+
+ /**
+ * Set false if you want to hide. (Default: true)
+ */
+ visible?: boolean;
+
+ /**
+ * Specify the options for title.
+ */
+ styles?: any;
+
+ /**
+ * Which animation to play when marker is added to a map.
+ */
+ animation?: string;
+
+ /**
+ * iOS only, Plugin Version >= 1.3.3 Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. (You're able to run this on Android, but it will have no effect)
+ */
+ zIndex?: number;
+
+ /**
+ * Set to true to disable auto panning when the marker is clicked.
+ */
+ disableAutoPan?: boolean;
+}
+
+export interface MyLocation {
+ latLng?: LatLng;
+ elapsedRealtimeNanos?: any;
+ time?: string;
+ accuracy?: any;
+ bearing?: number;
+ altitude?: any;
+ speed?: number;
+ provider?: any;
+ hashCode?: any;
+}
+
+export interface MyLocationOptions {
+ enableHighAccuracy?: boolean;
+}
+
+export interface PolygonOptions {
+ points?: Array;
+ geodesic?: boolean;
+ strokeColor?: string;
+ strokeWidth?: number;
+ fillColor?: string;
+ visible?: boolean;
+ zIndex?: number;
+ addHole?: Array;
+}
+
+export interface PolylineOptions {
+ points?: Array;
+ visible?: boolean;
+ geodesic?: boolean;
+ color?: string;
+ width?: number;
+ zIndex?: number;
+}
+
+export interface TileOverlayOptions {
+ getTile: (x: number, y: number, zoom: number) => string;
+ visible?: boolean;
+ zIndex?: number;
+ tileSize?: number;
+ opacity?: number;
+}
+
+export interface VisibleRegion {
+ northeast?: any;
+ southwest?: any;
+}
/**
* @hidden
* You can listen to these events where appropriate
*/
-export const GoogleMapsEvent = {
- MAP_CLICK: 'click',
- MAP_LONG_CLICK: 'long_click',
- MY_LOCATION_CHANGE: 'my_location_change',
+export const GoogleMapsEvent: { [eventName: string]: string; } = {
+ MAP_READY: 'map_ready',
+ MAP_CLICK: 'map_click',
+ MAP_LONG_CLICK: 'map_long_click',
MY_LOCATION_BUTTON_CLICK: 'my_location_button_click',
INDOOR_BUILDING_FOCUSED: 'indoor_building_focused',
INDOOR_LEVEL_ACTIVATED: 'indoor_level_activated',
- CAMERA_CHANGE: 'camera_change',
- CAMERA_IDLE: 'camera_idle',
- MAP_READY: 'map_ready',
- MAP_LOADED: 'map_loaded',
- MAP_WILL_MOVE: 'will_move',
- MAP_CLOSE: 'map_close',
- MARKER_CLICK: 'click',
- OVERLAY_CLICK: 'overlay_click',
+ CAMERA_MOVE_START: 'camera_move_start',
+ CAMERA_MOVE: 'camera_move',
+ CAMERA_MOVE_END: 'camera_move_end',
+ POLYGON_CLICK: 'polygon_click',
+ POLYLINE_CLICK: 'polyline_click',
+ CIRCLE_CLICK: 'circle_click',
+ GROUND_OVERLAY_CLICK: 'ground_overlay_click',
INFO_CLICK: 'info_click',
- MARKER_DRAG: 'drag',
- MARKER_DRAG_START: 'drag_start',
- MARKER_DRAG_END: 'drag_end'
+ INFO_LONG_CLICK: 'info_long_click',
+ INFO_CLOSE: 'info_close',
+ INFO_OPEN: 'info_open',
+ MARKER_CLICK: 'marker_click',
+ MARKER_DRAG: 'marker_drag',
+ MARKER_DRAG_START: 'marker_drag_start',
+ MARKER_DRAG_END: 'marker_drag_end'
};
/**
* @hidden
*/
-export const GoogleMapsAnimation = {
+export const GoogleMapsAnimation: { [animationName: string]: string; } = {
BOUNCE: 'BOUNCE',
DROP: 'DROP'
};
@@ -41,331 +294,15 @@ export const GoogleMapsAnimation = {
/**
* @hidden
*/
-export const GoogleMapsMapTypeId = {
- HYBRID: 'MAP_TYPE_HYBRID',
- NONE: 'MAP_TYPE_NONE',
+export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = {
NORMAL: 'MAP_TYPE_NORMAL',
ROADMAP: 'MAP_TYPE_ROADMAP',
SATELLITE: 'MAP_TYPE_SATELLITE',
- TERAIN: 'MAP_TYPE_TERRAIN'
+ HYBRID: 'MAP_TYPE_HYBRID',
+ TERRAIN: 'MAP_TYPE_TERRAIN',
+ NONE: 'MAP_TYPE_NONE'
};
-/**
- * @hidden
- */
-@Plugin({
- pluginName: 'GoogleMaps',
- plugin: 'cordova-plugin-googlemaps'
-})
-export class GoogleMap {
- _objectInstance: any;
-
- constructor(element: string | HTMLElement, options?: any) {
- if (checkAvailability('plugin.google.maps.Map', null, 'GoogleMaps') === true) {
- if (typeof element === 'string') {
- element = document.getElementById(element);
- }
- this._objectInstance = plugin.google.maps.Map.getMap(element, options);
- }
- }
-
- /**
- * Adds an event listener.
- *
- * @returns {Observable}
- */
- @InstanceCheck()
- addEventListener(eventName: string): Observable {
- return Observable.fromEvent(this._objectInstance, eventName);
- }
-
- /**
- * Adds an event listener that works once.
- *
- * @returns {Promise}
- */
- @InstanceCheck()
- addListenerOnce(eventName: string): Promise {
- return new Promise(resolve => this._objectInstance.addListenerOnce(eventName, resolve));
- }
-
- /**
- * Gets a value
- * @param key
- */
- @CordovaInstance({ sync: true })
- get(key: string): any { return; }
-
- /**
- * Sets a value
- * @param key
- * @param value
- */
- @CordovaInstance({ sync: true })
- set(key: string, value: any): void { }
-
- /**
- * Listen to a map event.
- *
- * @returns {Observable}
- */
- @InstanceCheck({ observable: true })
- on(eventName: string): Observable {
- return Observable.fromEvent(this._objectInstance, eventName);
- }
-
- /**
- * Listen to a map event only once.
- *
- * @returns {Promise}
- */
- @InstanceCheck()
- one(eventName: string): Promise {
- return new Promise(resolve => this._objectInstance.one(eventName, resolve));
- }
-
- /**
- * Clears all stored values
- */
- @CordovaInstance({ sync: true })
- empty(): void { }
-
- @CordovaInstance({ sync: true })
- setDebuggable(isDebuggable: boolean): void { }
-
- @CordovaInstance({ sync: true })
- setClickable(isClickable: boolean): void { }
-
- /**
- * Get the position of the camera.
- *
- * @returns {Promise}
- */
- @CordovaInstance()
- getCameraPosition(): Promise { return; }
-
- /**
- * Get the location of the user.
- *
- * @returns {Promise}
- */
- @CordovaInstance()
- getMyLocation(options?: MyLocationOptions): Promise { return; }
-
- /**
- * Get the visible region.
- *
- * @returns {Promise}
- */
- @CordovaInstance()
- getVisibleRegion(): Promise { return; }
-
- @CordovaInstance({ sync: true })
- showDialog(): void { }
-
- @CordovaInstance({ sync: true })
- closeDialog(): void { }
-
- @CordovaInstance()
- getLicenseInfo(): Promise { return; }
-
- @CordovaInstance({ sync: true })
- setCenter(latLng: LatLng): void { }
-
- @CordovaInstance({ sync: true })
- setZoom(zoomLevel: number): void { }
-
- @CordovaInstance({ sync: true })
- setMapTypeId(mapTypeId: string): void { }
-
- @CordovaInstance({ sync: true })
- setTilt(tiltLevel: number): void { }
-
- /**
- * @returns {Promise}
- */
- @CordovaInstance()
- animateCamera(animateCameraOptions: AnimateCameraOptions): Promise { return; }
-
- /**
- * @returns {Promise}
- */
- @CordovaInstance()
- moveCamera(cameraPosition: CameraPosition): Promise { return; }
-
- @CordovaInstance({ sync: true })
- setMyLocationEnabled(enabled: boolean): void { }
-
- @CordovaInstance({ sync: true })
- setIndoorEnabled(enabled: boolean): void { }
-
- @CordovaInstance({ sync: true })
- setTrafficEnabled(enabled: boolean): void { }
-
- @CordovaInstance({ sync: true })
- setCompassEnabled(enabled: boolean): void { }
-
- @CordovaInstance({ sync: true })
- setAllGesturesEnabled(enabled: boolean): void { }
-
- /**
- * @returns {Promise}
- */
- @InstanceCheck()
- addMarker(options: MarkerOptions): Promise {
- return new Promise((resolve, reject) => {
- this._objectInstance.addMarker(options, (marker: any) => {
- if (marker) {
- resolve(new Marker(marker));
- } else {
- reject();
- }
- });
- });
- }
-
- /**
- * @returns {Promise}
- */
- @InstanceCheck()
- addCircle(options: CircleOptions): Promise {
- return new Promise((resolve, reject) => {
- this._objectInstance.addCircle(options, (circle: any) => {
- if (circle) {
- resolve(new Circle(circle));
- } else {
- reject();
- }
- });
- });
- }
-
- /**
- * @returns {Promise}
- */
- @InstanceCheck()
- addPolygon(options: PolygonOptions): Promise {
- return new Promise((resolve, reject) => {
- this._objectInstance.addPolygon(options, (polygon: any) => {
- if (polygon) {
- resolve(new Polygon(polygon));
- } else {
- reject();
- }
- });
- });
- }
-
- /**
- * @returns {Promise}
- */
- @InstanceCheck()
- addPolyline(options: PolylineOptions): Promise {
- return new Promise((resolve, reject) => {
- this._objectInstance.addPolyline(options, (polyline: any) => {
- if (polyline) {
- resolve(new Polyline(polyline));
- } else {
- reject();
- }
- });
- });
- }
-
- /**
- * @returns {Promise}
- */
- @InstanceCheck()
- addTileOverlay(options: TileOverlayOptions): Promise {
- return new Promise((resolve, reject) => {
- this._objectInstance.addTileOverlay(options, (tileOverlay: any) => {
- if (tileOverlay) {
- resolve(new TileOverlay(tileOverlay));
- } else {
- reject();
- }
- });
- });
- }
-
- /**
- * @returns {Promise}
- */
- @InstanceCheck()
- addGroundOverlay(options: GroundOverlayOptions): Promise {
- return new Promise((resolve, reject) => {
- this._objectInstance.addGroundOverlay(options, (groundOverlay: any) => {
- if (groundOverlay) {
- resolve(new GroundOverlay(groundOverlay));
- } else {
- reject();
- }
- });
- });
- }
-
- /**
- * @returns {Promise}
- */
- @InstanceCheck()
- addKmlOverlay(options: KmlOverlayOptions): Promise {
- return new Promise((resolve, reject) => {
- this._objectInstance.addKmlOverlay(options, (kmlOverlay: any) => {
- if (kmlOverlay) {
- resolve(new KmlOverlay(kmlOverlay));
- } else {
- reject();
- }
- });
- });
- }
-
- @CordovaInstance({ sync: true })
- setDiv(domNode: HTMLElement): void { }
-
- @CordovaInstance({ sync: true })
- setVisible(visible: boolean): void { }
-
- @CordovaInstance({ sync: true })
- setOptions(options: any): void { }
-
- @CordovaInstance({ sync: true })
- setBackgroundColor(backgroundColor: string): void { }
-
- @CordovaInstance({ sync: true })
- setPadding(top?: number, right?: number, bottom?: number, left?: number): void { }
-
- @CordovaInstance({ sync: true })
- clear(): void { }
-
- @CordovaInstance({ sync: true })
- refreshLayout(): void { }
-
- /**
- * @returns {Promise}
- */
- @CordovaInstance()
- fromLatLngToPoint(latLng: LatLng, point: any): Promise { return; }
-
- /**
- * @returns {Promise}
- */
- @CordovaInstance()
- fromPointToLatLng(point: any): Promise { return; }
-
- /**
- * @returns {Promise}
- */
- @CordovaInstance()
- toDataURL(): Promise { return; }
-
- @CordovaInstance({ sync: true })
- remove(): void { }
-
- @CordovaInstance({ sync: true })
- panBy(x: string | number, y: string | number): void { }
-}
-
/**
* @name Google Maps
* @description This plugin uses the native Google Maps SDK
@@ -439,29 +376,55 @@ export class GoogleMap {
* ```
* @classes
* GoogleMap
- * Marker
- * LatLng
+ * Circle
+ * Environment
* Geocoder
+ * GroundOverlay
+ * HtmlInfoWindow
+ * Geocoder
+ * LatLng
+ * LatLngBounds
+ * Marker
+ * Polygon
+ * Polyline
+ * TileOverlay
+ * BaseClass
+ * BaseArrayClass
* @interfaces
+ * GoogleMapOptions
* AnimateCameraOptions
+ * CameraPosition
+ * CircleOptions
+ * GeocoderRequest
+ * GeocoderResult
+ * GroundOverlayOptions
+ * ILatLng
+ * MarkerIcon
* MarkerOptions
* MyLocation
* MyLocationOptions
+ * PolygonOptions
+ * PolylineOptions
+ * TileOverlayOptions
* VisibleRegion
- *
*/
@Plugin({
pluginName: 'GoogleMaps',
- pluginRef: 'plugin.google.maps.Map',
+ pluginRef: 'plugin.google.maps',
plugin: 'cordova-plugin-googlemaps',
- repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps',
- install: 'ionic cordova 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"',
+ repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps',
+ install: 'ionic cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"',
installVariables: ['API_KEY_FOR_ANDROID', 'API_KEY_FOR_IOS'],
platforms: ['Android', 'iOS']
})
@Injectable()
export class GoogleMaps extends IonicNativePlugin {
+ /**
+ * @hidden
+ */
+ _environment: Environment = new Environment();
+
/**
* Checks if a map object has been created and is available.
*
@@ -476,161 +439,142 @@ export class GoogleMaps extends IonicNativePlugin {
* @param options {any} Options
* @returns {GoogleMap}
*/
- create(element: string | HTMLElement, options?: any): GoogleMap {
+ create(element: string | HTMLElement, options?: GoogleMapOptions): GoogleMap {
return new GoogleMap(element, options);
}
+ /**
+ * Convenience method that returns an instance of Environment class
+ * @return {Object}
+ */
+ environment(): Environment {
+ return this._environment;
+ }
+
}
/**
* @hidden
*/
-export interface AnimateCameraOptions {
- target?: LatLng | Array | LatLngBounds;
- tilt?: number;
- zoom?: number;
- bearing?: number;
- duration?: number;
+@Plugin({
+ plugin: 'cordova-plugin-googlemaps',
+ pluginName: 'GoogleMaps',
+ pluginRef: 'plugin.google.maps.BaseArrayClass',
+ repo: ''
+})
+export class BaseArrayClass extends IonicNativePlugin {
+ private _objectInstance: any;
+
+ constructor(initialData: T[]) {
+ super();
+ if (checkAvailability(BaseArrayClass.getPluginRef(), null, BaseArrayClass.getPluginName()) === true) {
+ this._objectInstance = new (BaseArrayClass.getPlugin())(initialData);
+ }
+ }
+
+ /**
+ * Add an event listener
+ * @param event {string} name of the event. Can be `insert_at`, `remove_at`, `set_at`, or `finish`.
+ * @returns {Observable} returns an Observable
+ */
+ @InstanceCheck({ observable: true })
+ on(event: 'insert_at' | 'remove_at' | 'set_at' | 'finish') {
+ return new Observable((observer: Observer) => {
+ this._objectInstance.on(event, observer.next.bind(observer));
+ return () => this._objectInstance.off(event, observer.next.bind(observer));
+ });
+ }
+
+ /**
+ * Removes all elements from the array.
+ */
+ @CordovaInstance({ sync: true })
+ empty(): void {}
+
+ /**
+ * Iterate over each element, calling the provided callback.
+ * @param fn {Function}
+ * @param callback {Function}
+ */
+ @CordovaInstance({ sync: true })
+ forEach(fn: ((element: T, index?: number) => void) | ((element: T, callback: () => void) => void), callback?: () => void): void {}
+
+ /**
+ * Iterate over each element, calling the provided callback.
+ * Then you can get the results of each callback.
+ * @param fn {Function}
+ * @param callback {Function}
+ * @return {Array