diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..82da0b16 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# http://editorconfig.org + +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index a02384e6..1ed43944 100644 --- a/src/index.ts +++ b/src/index.ts @@ -52,6 +52,7 @@ import {LaunchNavigator} from './plugins/launchnavigator'; import {LocalNotifications} from './plugins/localnotifications'; import {MediaPlugin} from './plugins/media'; import {Network, Connection} from './plugins/network'; +import {Printer} from './plugins/printer'; import {Push} from './plugins/push'; import {SafariViewController} from './plugins/safari-view-controller'; import {Screenshot} from './plugins/screenshot'; @@ -85,6 +86,7 @@ export * from './plugins/inappbrowser'; export * from './plugins/launchnavigator'; export * from './plugins/localnotifications'; export * from './plugins/media'; +export * from './plugins/printer'; export * from './plugins/push'; export * from './plugins/safari-view-controller'; export * from './plugins/sms'; @@ -183,6 +185,7 @@ window['IonicNative'] = { LocalNotifications: LocalNotifications, MediaPlugin: MediaPlugin, Network: Network, + Printer: Printer, Push: Push, SafariViewController: SafariViewController, Screenshot: Screenshot, diff --git a/src/plugins/backgroundmode.ts b/src/plugins/backgroundmode.ts index 6cfad074..ab9e5a0e 100644 --- a/src/plugins/backgroundmode.ts +++ b/src/plugins/backgroundmode.ts @@ -8,8 +8,9 @@ import {Plugin, Cordova} from './plugin'; *@usage * ```js * import {BackgroundMode} from 'ionic-native'; -* +* * BackgroundMode.enable(); +* ``` */ @Plugin({ plugin: 'de.appplant.cordova.plugin.background-mode', diff --git a/src/plugins/deeplinks.ts b/src/plugins/deeplinks.ts index d27d7da6..05ab2fd2 100644 --- a/src/plugins/deeplinks.ts +++ b/src/plugins/deeplinks.ts @@ -34,7 +34,7 @@ export interface DeeplinkMatch { @Plugin({ plugin: 'ionic-plugin-deeplinks', pluginRef: 'IonicDeeplink', - repo: 'https://github.com/driftyo/ionic-plugin-deeplinks', + repo: 'https://github.com/driftyco/ionic-plugin-deeplinks', platforms: ['iOS', 'Android'] }) export class Deeplinks { diff --git a/src/plugins/globalization.ts b/src/plugins/globalization.ts index c616a2ee..bd43c954 100644 --- a/src/plugins/globalization.ts +++ b/src/plugins/globalization.ts @@ -14,7 +14,7 @@ import {Plugin, Cordova} from './plugin'; @Plugin({ plugin: 'cordova-plugin-globalization', pluginRef: 'navigator.globalization', - repo: 'https: //github.com/apache/cordova-plugin-globalization' + repo: 'https://github.com/apache/cordova-plugin-globalization' }) export class Globalization { @@ -125,4 +125,4 @@ export class Globalization { @Cordova() static getCurrencyPattern(currencyCode: string): Promise<{pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string}> {return; } -} \ No newline at end of file +} diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index c1a4fc99..11758dec 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -1,6 +1,5 @@ -import {Cordova, Plugin} from './plugin'; -import {Observable} from 'rxjs/Observable'; -import {CordovaInstance} from './plugin'; +import { Cordova, CordovaInstance, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; /** * @private * Created by Ibrahim on 3/29/2016. @@ -11,32 +10,32 @@ declare var plugin: any; * 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', - 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', - INFO_CLICK: 'info_click', - MARKER_DRAG: 'drag', - MARKER_DRAG_START: 'drag_start', - MARKER_DRAG_END: 'drag_end' + MAP_CLICK: 'click', + MAP_LONG_CLICK: 'long_click', + MY_LOCATION_CHANGE: 'my_location_change', + 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', + INFO_CLICK: 'info_click', + MARKER_DRAG: 'drag', + MARKER_DRAG_START: 'drag_start', + MARKER_DRAG_END: 'drag_end' }; /** * @private */ export const GoogleMapsAnimation = { - BOUNCE: 'BOUNCE', - DROP: 'DROP' + BOUNCE: 'BOUNCE', + DROP: 'DROP' }; /** @@ -55,307 +54,259 @@ export const GoogleMapsAnimation = { * ``` */ @Plugin({ - pluginRef: 'plugin.google.maps.Map', - plugin: 'cordova-plugin-googlemaps', - repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps' + pluginRef: 'plugin.google.maps.Map', + plugin: 'cordova-plugin-googlemaps', + repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps' }) export class GoogleMap { - _objectInstance: any; + _objectInstance: any; - /** - * Checks if a map object has been created. - * @return {Promise} returns a promise that resolves with a boolean that indicates if the plugin is available. - */ - @Cordova() - static isAvailable(): Promise { - return; - } + /** + * Checks if a map object has been created. + * @return {Promise} returns a promise that resolves with a boolean that indicates if the plugin is available. + */ + @Cordova() + static isAvailable(): Promise { + return; + } - constructor(elementId: string, options?: any) { - this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId), options); - } + constructor(elementId: string, options?: any) { + this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId), options); + } - on(event: any): Observable { - return new Observable( - (observer) => { - let cb = data => observer.next(data); - this._objectInstance.on(event, cb); - return () => this._objectInstance.off(event); - } - ); - } + on(event: any): Observable { + return new Observable( + (observer) => { + let cb = data => observer.next(data); + this._objectInstance.on(event, cb); + return () => this._objectInstance.off(event); + } + ); + } - one(event: any): Promise { - return new Promise( - resolve => this._objectInstance.one(event, resolve) - ); - } + one(event: any): Promise { + return new Promise( + resolve => this._objectInstance.one(event, resolve) + ); + } - @CordovaInstance({ - sync: true - }) - setDebuggable(isDebuggable: boolean): void { - } + @CordovaInstance({ sync: true }) + setDebuggable(isDebuggable: boolean): void { + } - @CordovaInstance({ - sync: true - }) - setClickable(isClickable: boolean): void { - } + @CordovaInstance({ sync: true }) + setClickable(isClickable: boolean): void { + } - /** - * Get the position of the camera - */ - @CordovaInstance() - getCameraPosition(): Promise { - return; - } + /** + * Get the position of the camera + */ + @CordovaInstance() + getCameraPosition(): Promise { + return; + } - /** - * Get the location of the user - */ - @CordovaInstance() - getMyLocation(): Promise { - return; - } + /** + * Get the location of the user + */ + @CordovaInstance() + getMyLocation(): Promise { + return; + } - /** - * Get the visible region - */ - @CordovaInstance() - getVisibleRegion(): Promise { - return; - } + /** + * Get the visible region + */ + @CordovaInstance() + getVisibleRegion(): Promise { + return; + } - @CordovaInstance({ - sync: true - }) - showDialog(): void { - } + @CordovaInstance({ sync: true }) + showDialog(): void { + } - @CordovaInstance({ - sync: true - }) - closeDialog(): void { - } + @CordovaInstance({ sync: true }) + closeDialog(): void { + } - @CordovaInstance() - getLicenseInfo(): Promise { - return; - } + @CordovaInstance() + getLicenseInfo(): Promise { + return; + } - @CordovaInstance({ - sync: true - }) - setCenter(latLng: GoogleMapsLatLng): void { - } + @CordovaInstance({ sync: true }) + setCenter(latLng: GoogleMapsLatLng): void { + } - @CordovaInstance({ - sync: true - }) - setZoom(zoomLevel: number): void { - } + @CordovaInstance({ sync: true }) + setZoom(zoomLevel: number): void { + } - @CordovaInstance({ - sync: true - }) - setMapTypeId(typeId: string): void { - } + @CordovaInstance({ sync: true }) + setMapTypeId(typeId: string): void { + } - @CordovaInstance({ - sync: true - }) - setTilt(tiltLevel: number): void { - } + @CordovaInstance({ sync: true }) + setTilt(tiltLevel: number): void { + } - @CordovaInstance({ - sync: true - }) - animateCamera(animateCameraOptions: AnimateCameraOptions): void { - } + @CordovaInstance({ sync: true }) + animateCamera(animateCameraOptions: AnimateCameraOptions): void { + } - @CordovaInstance({ - sync: true - }) - moveCamera(cameraPosition: CameraPosition): void { - } + @CordovaInstance({ sync: true }) + moveCamera(cameraPosition: CameraPosition): void { + } - @CordovaInstance({ - sync: true - }) - setMyLocationEnabled(enabled: boolean): void { - } + @CordovaInstance({ sync: true }) + setMyLocationEnabled(enabled: boolean): void { + } - @CordovaInstance({ - sync: true - }) - setIndoorEnabled(enabled: boolean): void { - } + @CordovaInstance({ sync: true }) + setIndoorEnabled(enabled: boolean): void { + } - @CordovaInstance({ - sync: true - }) - setTrafficEnabled(enabled: boolean): void { - } + @CordovaInstance({ sync: true }) + setTrafficEnabled(enabled: boolean): void { + } - @CordovaInstance({ - sync: true - }) - setCompassEnabled(enabled: boolean): void { - } + @CordovaInstance({ sync: true }) + setCompassEnabled(enabled: boolean): void { + } - @CordovaInstance({ - sync: true - }) - setAllGesturesEnabled(enabled: boolean): void { - } + @CordovaInstance({ sync: true }) + setAllGesturesEnabled(enabled: boolean): void { + } - addMarker(options: GoogleMapsMarkerOptions): Promise { - return new Promise( - (resolve, reject) => { - this._objectInstance.addMarker(options, (marker: any) => { - if (marker) resolve(new GoogleMapsMarker(marker)); - else reject(); - }); - } - ); - } + addMarker(options: GoogleMapsMarkerOptions): Promise { + return new Promise( + (resolve, reject) => { + this._objectInstance.addMarker(options, (marker: any) => { + if (marker) resolve(new GoogleMapsMarker(marker)); + else reject(); + }); + } + ); + } - addCircle(options: GoogleMapsCircleOptions): Promise { - return new Promise( - (resolve, reject) => { - this._objectInstance.addCircle(options, (circle: any) => { - if (circle) resolve(new GoogleMapsCircle(circle)); - else reject(); - }); - } - ); - } + addCircle(options: GoogleMapsCircleOptions): Promise { + return new Promise( + (resolve, reject) => { + this._objectInstance.addCircle(options, (circle: any) => { + if (circle) resolve(new GoogleMapsCircle(circle)); + else reject(); + }); + } + ); + } - addPolygon(options: GoogleMapsPolygonOptions): Promise { - return new Promise( - (resolve, reject) => { - this._objectInstance.addPolygon(options, (polygon: any) => { - if (polygon) resolve(new GoogleMapsPolygon(polygon)); - else reject(); - }); - } - ); - } + addPolygon(options: GoogleMapsPolygonOptions): Promise { + return new Promise( + (resolve, reject) => { + this._objectInstance.addPolygon(options, (polygon: any) => { + if (polygon) resolve(new GoogleMapsPolygon(polygon)); + else reject(); + }); + } + ); + } - addPolyline(options: GoogleMapsPolylineOptions): Promise { - return new Promise( - (resolve, reject) => { - this._objectInstance.addPolyline(options, (polyline: any) => { - if (polyline) resolve(new GoogleMapsPolyline(polyline)); - else reject(); - }); - } - ); - } + addPolyline(options: GoogleMapsPolylineOptions): Promise { + return new Promise( + (resolve, reject) => { + this._objectInstance.addPolyline(options, (polyline: any) => { + if (polyline) resolve(new GoogleMapsPolyline(polyline)); + else reject(); + }); + } + ); + } - addTileOverlay(options: GoogleMapsTileOverlayOptions): Promise { - return new Promise( - (resolve, reject) => { - this._objectInstance.addTileOverlay(options, (tileOverlay: any) => { - if (tileOverlay) resolve(new GoogleMapsTileOverlay(tileOverlay)); - else reject(); - }); - } - ); - } + addTileOverlay(options: GoogleMapsTileOverlayOptions): Promise { + return new Promise( + (resolve, reject) => { + this._objectInstance.addTileOverlay(options, (tileOverlay: any) => { + if (tileOverlay) resolve(new GoogleMapsTileOverlay(tileOverlay)); + else reject(); + }); + } + ); + } - addGroundOverlay(options: GoogleMapsGroundOverlayOptions): Promise { - return new Promise( - (resolve, reject) => { - this._objectInstance.addTileOverlay(options, (groundOverlay: any) => { - if (groundOverlay) resolve(new GoogleMapsGroundOverlay(groundOverlay)); - else reject(); - }); - } - ); - } + addGroundOverlay(options: GoogleMapsGroundOverlayOptions): Promise { + return new Promise( + (resolve, reject) => { + this._objectInstance.addTileOverlay(options, (groundOverlay: any) => { + if (groundOverlay) resolve(new GoogleMapsGroundOverlay(groundOverlay)); + else reject(); + }); + } + ); + } - addKmlOverlay(options: GoogleMapsKmlOverlayOptions): Promise { - return new Promise( - (resolve, reject) => { - this._objectInstance.addTileOverlay(options, (kmlOverlay: any) => { - if (kmlOverlay) resolve(new GoogleMapsKmlOverlay(kmlOverlay)); - else reject(); - }); - } - ); - } + addKmlOverlay(options: GoogleMapsKmlOverlayOptions): Promise { + return new Promise( + (resolve, reject) => { + this._objectInstance.addTileOverlay(options, (kmlOverlay: any) => { + if (kmlOverlay) resolve(new GoogleMapsKmlOverlay(kmlOverlay)); + else reject(); + }); + } + ); + } - @CordovaInstance({ - sync: true - }) - setDiv(domNode: HTMLElement): void { - } + @CordovaInstance({ sync: true }) + setDiv(domNode: HTMLElement): void { + } - @CordovaInstance({ - sync: true - }) - setVisible(visible: boolean): void { - } + @CordovaInstance({ sync: true }) + setVisible(visible: boolean): void { + } - @CordovaInstance({ - sync: true - }) - setOptions(options: any): void { - } + @CordovaInstance({ sync: true }) + setOptions(options: any): void { + } - @CordovaInstance({ - sync: true - }) - setBackgroundColor(backgroundColor: string): void { - } + @CordovaInstance({ sync: true }) + setBackgroundColor(backgroundColor: string): void { + } - @CordovaInstance({ - sync: true - }) - setPadding(top?: number, right?: number, bottom?: number, left?: number): void { - } + @CordovaInstance({ sync: true }) + setPadding(top?: number, right?: number, bottom?: number, left?: number): void { + } - @CordovaInstance({ - sync: true - }) - clear(): void { - } + @CordovaInstance({ sync: true }) + clear(): void { + } - @CordovaInstance({ - sync: true - }) - refreshLayout(): void { - } + @CordovaInstance({ sync: true }) + refreshLayout(): void { + } - @CordovaInstance() - fromLatLngToPoint(latLng: GoogleMapsLatLng, point: any): Promise { - return; - } + @CordovaInstance() + fromLatLngToPoint(latLng: GoogleMapsLatLng, point: any): Promise { + return; + } - @CordovaInstance() - fromPointToLatLng(point: any, latLng: GoogleMapsLatLng): Promise { - return; - } + @CordovaInstance() + fromPointToLatLng(point: any, latLng: GoogleMapsLatLng): Promise { + return; + } - @CordovaInstance() - toDataURL(): Promise { - return; - } + @CordovaInstance() + toDataURL(): Promise { + return; + } - @CordovaInstance({ - sync: true - }) - remove(): void { - } + @CordovaInstance({ sync: true }) + remove(): void { + } - @CordovaInstance({ - sync: true - }) - panBy(): void { - } + @CordovaInstance({ sync: true }) + panBy(): void { + } } @@ -363,68 +314,68 @@ export class GoogleMap { * @private */ export interface AnimateCameraOptions { - target?: GoogleMapsLatLng; - tilt?: number; - zoom?: number; - bearing?: number; - duration?: number; + target?: GoogleMapsLatLng; + tilt?: number; + zoom?: number; + bearing?: number; + duration?: number; } /** * @private */ export interface CameraPosition { - target?: GoogleMapsLatLng; - zoom?: number; - tilt?: number; - bearing?: number; + target?: GoogleMapsLatLng; + zoom?: number; + tilt?: number; + bearing?: number; } /** * @private */ export interface MyLocation { - latLng?: GoogleMapsLatLng; - speed?: number; - time?: string; - bearing?: number; + latLng?: GoogleMapsLatLng; + speed?: number; + time?: string; + bearing?: number; } /** * @private */ export interface VisibleRegion { - northeast?: any; - southwest?: any; + northeast?: any; + southwest?: any; } /** * @private */ export interface GoogleMapsMarkerOptions { - icon?: any; - title?: string; - snippet?: string; - position?: GoogleMapsLatLng; - infoWindowAnchor?: number[]; - draggable?: boolean; - flat?: boolean; - rotation?: number; - visible?: boolean; - styles?: any; - animation?: string; - zIndex?: number; + icon?: any; + title?: string; + snippet?: string; + position?: GoogleMapsLatLng; + infoWindowAnchor?: number[]; + draggable?: boolean; + flat?: boolean; + rotation?: number; + visible?: boolean; + styles?: any; + animation?: string; + zIndex?: number; } /** * @private */ export interface GoogleMapsMarkerIcon { - url?: string; - size?: { - width?: number; - height?: number; - }; + url?: string; + size?: { + width?: number; + height?: number; + }; } /** @@ -432,178 +383,132 @@ export interface GoogleMapsMarkerIcon { */ export class GoogleMapsMarker { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { + } - addEventListener(event: any): Observable { - return new Observable( - (observer) => { - let cb = (data: any) => { - observer.next(data); - }; - this._objectInstance.addEventListener(event, cb); - return () => this._objectInstance.removeEventListener(event, cb); - } - ); - } + addEventListener(event: any): Observable { + return new Observable( + (observer) => { + let cb = (data: any) => { + observer.next(data); + }; + this._objectInstance.addEventListener(event, cb); + return () => this._objectInstance.removeEventListener(event, cb); + } + ); + } - @CordovaInstance({ - sync: true - }) - isVisible(): boolean { - return; - } + @CordovaInstance({ sync: true }) + isVisible(): boolean { + return; + } - @CordovaInstance() - setVisible(visible: boolean): void { - } + @CordovaInstance() + setVisible(visible: boolean): void { + } - @CordovaInstance({ - sync: true - }) - getHashCode(): string { - return; - } + @CordovaInstance({ sync: true }) + getHashCode(): string { + return; + } - @CordovaInstance({ - sync: true - }) - remove(): void { - } + @CordovaInstance({ sync: true }) + remove(): void { + } - @CordovaInstance({ - sync: true - }) - setOpacity(alpha: number): void { - } + @CordovaInstance({ sync: true }) + setOpacity(alpha: number): void { + } - @CordovaInstance({ - sync: true - }) - getOpacity(): number { - return; - } + @CordovaInstance({ sync: true }) + getOpacity(): number { + return; + } - @CordovaInstance({ - sync: true - }) - setZIndex(): void { - } + @CordovaInstance({ sync: true }) + setZIndex(): void { + } - @CordovaInstance({ - sync: true - }) - setIconAnchor(x: number, y: number): void { - } + @CordovaInstance({ sync: true }) + setIconAnchor(x: number, y: number): void { + } - @CordovaInstance({ - sync: true - }) - setInfoWindowAnchor(x: number, y: number): void { - } + @CordovaInstance({ sync: true }) + setInfoWindowAnchor(x: number, y: number): void { + } - @CordovaInstance({ - sync: true - }) - setDraggable(draggable: boolean): void { - } + @CordovaInstance({ sync: true }) + setDraggable(draggable: boolean): void { + } - @CordovaInstance({ - sync: true - }) - isDraggable(): boolean { - return; - } + @CordovaInstance({ sync: true }) + isDraggable(): boolean { + return; + } - @CordovaInstance({ - sync: true - }) - setFlat(flat: boolean): void { - return; - } + @CordovaInstance({ sync: true }) + setFlat(flat: boolean): void { + return; + } - @CordovaInstance({ - sync: true - }) - setIcon(icon: GoogleMapsMarkerIcon): void { - } + @CordovaInstance({ sync: true }) + setIcon(icon: GoogleMapsMarkerIcon): void { + } - @CordovaInstance({ - sync: true - }) - setTitle(title: string): void { - } + @CordovaInstance({ sync: true }) + setTitle(title: string): void { + } - @CordovaInstance({ - sync: true - }) - getTitle(): string { - return; - } + @CordovaInstance({ sync: true }) + getTitle(): string { + return; + } - @CordovaInstance({ - sync: true - }) - setSnippet(snippet: string): void { - } + @CordovaInstance({ sync: true }) + setSnippet(snippet: string): void { + } - @CordovaInstance({ - sync: true - }) - getSnippet(): string { - return; - } + @CordovaInstance({ sync: true }) + getSnippet(): string { + return; + } - @CordovaInstance({ - sync: true - }) - setRotation(rotation: number): void { - } + @CordovaInstance({ sync: true }) + setRotation(rotation: number): void { + } - @CordovaInstance({ - sync: true - }) - getRotation(): number { - return; - } + @CordovaInstance({ sync: true }) + getRotation(): number { + return; + } - @CordovaInstance({ - sync: true - }) - showInfoWindow(): number { - return; - } + @CordovaInstance({ sync: true }) + showInfoWindow(): number { + return; + } - @CordovaInstance({ - sync: true - }) - hideInfoWindow(): number { - return; - } + @CordovaInstance({ sync: true }) + hideInfoWindow(): number { + return; + } - @CordovaInstance({ - sync: true - }) - setPosition(latLng: GoogleMapsLatLng): void { - } + @CordovaInstance({ sync: true }) + setPosition(latLng: GoogleMapsLatLng): void { + } - @CordovaInstance() - getPosition(): Promise { - return; - } + @CordovaInstance() + getPosition(): Promise { + return; + } - @CordovaInstance({ - sync: true - }) - getMap(): GoogleMap { - return; - } + @CordovaInstance({ sync: true }) + getMap(): GoogleMap { + return; + } - @CordovaInstance({ - sync: true - }) - setAnimation(animation: string): void { - } + @CordovaInstance({ sync: true }) + setAnimation(animation: string): void { + } } @@ -612,13 +517,13 @@ export class GoogleMapsMarker { * @private */ export interface GoogleMapsCircleOptions { - center?: GoogleMapsLatLng; - radius?: number; - strokeColor?: string; - strokeWidth?: number; - fillColor?: string; - visible?: boolean; - zIndex?: number; + center?: GoogleMapsLatLng; + radius?: number; + strokeColor?: string; + strokeWidth?: number; + fillColor?: string; + visible?: boolean; + zIndex?: number; } /** @@ -626,198 +531,168 @@ export interface GoogleMapsCircleOptions { */ export class GoogleMapsCircle { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { + } - addEventListener(event: any): Observable { - return new Observable( - (observer) => { - let cb = data => observer.next(data); - this._objectInstance.addEventListener(event, cb); - return () => this._objectInstance.removeEventListener(event, cb); - } - ); - } + addEventListener(event: any): Observable { + return new Observable( + (observer) => { + let cb = data => observer.next(data); + this._objectInstance.addEventListener(event, cb); + return () => this._objectInstance.removeEventListener(event, cb); + } + ); + } - @CordovaInstance({ - sync: true - }) - getCenter(): GoogleMapsLatLng { - return; - } + @CordovaInstance({ sync: true }) + getCenter(): GoogleMapsLatLng { + return; + } - @CordovaInstance({ - sync: true - }) - getRadius(): number { - return; - } + @CordovaInstance({ sync: true }) + getRadius(): number { + return; + } - @CordovaInstance({ - sync: true - }) - getStrokeColor(): string { - return; - } + @CordovaInstance({ sync: true }) + getStrokeColor(): string { + return; + } - @CordovaInstance({ - sync: true - }) - getVisible(): boolean { - return; - } + @CordovaInstance({ sync: true }) + getVisible(): boolean { + return; + } - @CordovaInstance({ - sync: true - }) - getZIndex(): number { - return; - } + @CordovaInstance({ sync: true }) + getZIndex(): number { + return; + } - @CordovaInstance({ - sync: true - }) - remove(): void { - } + @CordovaInstance({ sync: true }) + remove(): void { + } - @CordovaInstance({ - sync: true - }) - setCenter(latLng: GoogleMapsLatLng): void { - } + @CordovaInstance({ sync: true }) + setCenter(latLng: GoogleMapsLatLng): void { + } - @CordovaInstance({ - sync: true - }) - setFillColor(fillColor: string): void { - } + @CordovaInstance({ sync: true }) + setFillColor(fillColor: string): void { + } - @CordovaInstance({ - sync: true - }) - setStrokeColor(strokeColor: string): void { - } + @CordovaInstance({ sync: true }) + setStrokeColor(strokeColor: string): void { + } - @CordovaInstance({ - sync: true - }) - setStrokeWidth(strokeWidth: number): void { - } + @CordovaInstance({ sync: true }) + setStrokeWidth(strokeWidth: number): void { + } - @CordovaInstance({ - sync: true - }) - setVisible(visible: boolean): void { - } + @CordovaInstance({ sync: true }) + setVisible(visible: boolean): void { + } - @CordovaInstance({ - sync: true - }) - setZIndex(zIndex: number): void { - } - - @CordovaInstance({ - sync: true - }) - setRadius(radius: number): void { - } - - @CordovaInstance({ - sync: true - }) - getMap(): GoogleMap { - return; - } + @CordovaInstance({ sync: true }) + setZIndex(zIndex: number): void { + } + @CordovaInstance({ sync: true }) + setRadius(radius: number): void { + } + @CordovaInstance({ sync: true }) + getMap(): GoogleMap { + return; + } } /** * @private */ export interface GoogleMapsPolylineOptions { - points?: Array; - visible?: boolean; - googledesic?: boolean; - color?: string; - width?: number; - zIndex?: number; + points?: Array; + visible?: boolean; + googledesic?: boolean; + color?: string; + width?: number; + zIndex?: number; } /** * @private */ export class GoogleMapsPolyline { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { + } - addEventListener(event: any): Observable { - return new Observable( - (observer) => { - let cb = data => observer.next(data); - this._objectInstance.addEventListener(event, cb); - return () => this._objectInstance.removeEventListener(event, cb); - } - ); - } + addEventListener(event: any): Observable { + return new Observable( + (observer) => { + let cb = data => observer.next(data); + this._objectInstance.addEventListener(event, cb); + return () => this._objectInstance.removeEventListener(event, cb); + } + ); + } - @CordovaInstance({sync: true}) - getPoints(): Array { - return; - } + @CordovaInstance({ sync: true }) + getPoints(): Array { + return; + } - @CordovaInstance({sync: true}) - getCOlor(): string { - return; - } + @CordovaInstance({ sync: true }) + getCOlor(): string { + return; + } - @CordovaInstance({sync: true}) - getWidth(): number { - return; - } + @CordovaInstance({ sync: true }) + getWidth(): number { + return; + } - @CordovaInstance({sync: true}) - getGeodesic(): boolean { - return; - } + @CordovaInstance({ sync: true }) + getGeodesic(): boolean { + return; + } - @CordovaInstance({sync: true}) - getZIndex(): number { - return; - } + @CordovaInstance({ sync: true }) + getZIndex(): number { + return; + } - @CordovaInstance({sync: true}) - remove(): void { - } + @CordovaInstance({ sync: true }) + remove(): void { + } - @CordovaInstance({sync: true}) - setPoints(points: Array): void { - } + @CordovaInstance({ sync: true }) + setPoints(points: Array): void { + } - @CordovaInstance({sync: true}) - setColor(color: string): void { - } + @CordovaInstance({ sync: true }) + setColor(color: string): void { + } - @CordovaInstance({sync: true}) - setWidth(width: number): void { - } + @CordovaInstance({ sync: true }) + setWidth(width: number): void { + } - @CordovaInstance({sync: true}) - setVisible(visible: boolean): void { - } + @CordovaInstance({ sync: true }) + setVisible(visible: boolean): void { + } - @CordovaInstance({sync: true}) - setZIndex(zIndex: number): void { - } + @CordovaInstance({ sync: true }) + setZIndex(zIndex: number): void { + } - @CordovaInstance({sync: true}) - setGeoDesic(geoDesic: boolean): void { - } + @CordovaInstance({ sync: true }) + setGeoDesic(geoDesic: boolean): void { + } - @CordovaInstance({sync: true}) - getMap(): GoogleMap { - return; - } + @CordovaInstance({ sync: true }) + getMap(): GoogleMap { + return; + } } @@ -825,14 +700,14 @@ export class GoogleMapsPolyline { * @private */ export interface GoogleMapsPolygonOptions { - points?: Array; - geodesic?: boolean; - strokeColor?: string; - strokeWidth?: number; - fillColor?: string; - visible?: boolean; - zIndex?: number; - addHole?: Array; + points?: Array; + geodesic?: boolean; + strokeColor?: string; + strokeWidth?: number; + fillColor?: string; + visible?: boolean; + zIndex?: number; + addHole?: Array; } /** @@ -840,96 +715,96 @@ export interface GoogleMapsPolygonOptions { */ export class GoogleMapsPolygon { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { + } - addEventListener(event: any): Observable { - return new Observable( - (observer) => { - let cb = data => observer.next(data); - this._objectInstance.addEventListener(event, cb); - return () => this._objectInstance.removeEventListener(event, cb); - } - ); - } + addEventListener(event: any): Observable { + return new Observable( + (observer) => { + let cb = data => observer.next(data); + this._objectInstance.addEventListener(event, cb); + return () => this._objectInstance.removeEventListener(event, cb); + } + ); + } - @CordovaInstance({sync: true}) - getPoints(): Array { - return; - } + @CordovaInstance({ sync: true }) + getPoints(): Array { + return; + } - @CordovaInstance({sync: true}) - getStrokeColor(): string { - return; - } + @CordovaInstance({ sync: true }) + getStrokeColor(): string { + return; + } - @CordovaInstance({sync: true}) - getFillColor(): string { - return; - } + @CordovaInstance({ sync: true }) + getFillColor(): string { + return; + } - @CordovaInstance({sync: true}) - getStrokeWidth(): number { - return; - } + @CordovaInstance({ sync: true }) + getStrokeWidth(): number { + return; + } - @CordovaInstance({sync: true}) - getGeodesic(): boolean { - return; - } + @CordovaInstance({ sync: true }) + getGeodesic(): boolean { + return; + } - @CordovaInstance({sync: true}) - getVisible(): boolean { - return; - } + @CordovaInstance({ sync: true }) + getVisible(): boolean { + return; + } - @CordovaInstance({sync: true}) - getZIndex(): boolean { - return; - } + @CordovaInstance({ sync: true }) + getZIndex(): boolean { + return; + } - @CordovaInstance({sync: true}) - remove(): void { - } + @CordovaInstance({ sync: true }) + remove(): void { + } - @CordovaInstance({sync: true}) - setPoints(points: Array): void { - } + @CordovaInstance({ sync: true }) + setPoints(points: Array): void { + } - @CordovaInstance({sync: true}) - setStrokeColor(strokeColor: string): void { - } + @CordovaInstance({ sync: true }) + setStrokeColor(strokeColor: string): void { + } - @CordovaInstance({sync: true}) - setFillColor(fillColor: string): void { - } + @CordovaInstance({ sync: true }) + setFillColor(fillColor: string): void { + } - @CordovaInstance({sync: true}) - setStrokeWidth(strokeWidth: number): void { - } + @CordovaInstance({ sync: true }) + setStrokeWidth(strokeWidth: number): void { + } - @CordovaInstance({sync: true}) - setVisible(visible: boolean): void { - } + @CordovaInstance({ sync: true }) + setVisible(visible: boolean): void { + } - @CordovaInstance({sync: true}) - setZIndex(zIndex: number): void { - } + @CordovaInstance({ sync: true }) + setZIndex(zIndex: number): void { + } - @CordovaInstance({sync: true}) - setGeodesic(geodesic: boolean): void { - } + @CordovaInstance({ sync: true }) + setGeodesic(geodesic: boolean): void { + } } /** * @private */ export interface GoogleMapsTileOverlayOptions { - titleUrilFormat?: string; - visible?: boolean; - zIndex?: number; - tileSize?: number; - opacity?: number; + titleUrilFormat?: string; + visible?: boolean; + zIndex?: number; + tileSize?: number; + opacity?: number; } /** @@ -937,52 +812,52 @@ export interface GoogleMapsTileOverlayOptions { */ export class GoogleMapsTileOverlay { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { + } - @CordovaInstance({sync: true}) - getVisible(): boolean { - return; - } + @CordovaInstance({ sync: true }) + getVisible(): boolean { + return; + } - @CordovaInstance({sync: true}) - setVisible(visible: boolean): void { - } + @CordovaInstance({ sync: true }) + setVisible(visible: boolean): void { + } - @CordovaInstance({sync: true}) - getFadeIn(): boolean { - return; - } + @CordovaInstance({ sync: true }) + getFadeIn(): boolean { + return; + } - @CordovaInstance({sync: true}) - setFadeIn(fadeIn: boolean): void { - } + @CordovaInstance({ sync: true }) + setFadeIn(fadeIn: boolean): void { + } - @CordovaInstance({sync: true}) - getZIndex(): number { - return; - } + @CordovaInstance({ sync: true }) + getZIndex(): number { + return; + } - @CordovaInstance({sync: true}) - setZIndex(zIndex: number): void { - } + @CordovaInstance({ sync: true }) + setZIndex(zIndex: number): void { + } - @CordovaInstance({sync: true}) - getOpacity(): number { - return; - } + @CordovaInstance({ sync: true }) + getOpacity(): number { + return; + } - @CordovaInstance({sync: true}) - setOpacity(opacity: number): void { - } + @CordovaInstance({ sync: true }) + setOpacity(opacity: number): void { + } - @CordovaInstance({sync: true}) - clearTileCache(): void { - } + @CordovaInstance({ sync: true }) + clearTileCache(): void { + } - @CordovaInstance({sync: true}) - remove(): void { - } + @CordovaInstance({ sync: true }) + remove(): void { + } } @@ -990,12 +865,12 @@ export class GoogleMapsTileOverlay { * @private */ export interface GoogleMapsGroundOverlayOptions { - url?: string; - bounds?: Array; - visible?: boolean; - opacity?: number; - bearing?: number; - zIndex?: number; + url?: string; + bounds?: Array; + visible?: boolean; + opacity?: number; + bearing?: number; + zIndex?: number; } /** @@ -1003,43 +878,43 @@ export interface GoogleMapsGroundOverlayOptions { */ export class GoogleMapsGroundOverlay { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { + } - @CordovaInstance({sync: true}) - setBearing(bearing: number): void { - } + @CordovaInstance({ sync: true }) + setBearing(bearing: number): void { + } - @CordovaInstance({sync: true}) - getBearing(): number { - return; - } + @CordovaInstance({ sync: true }) + getBearing(): number { + return; + } - @CordovaInstance({sync: true}) - setOpacity(opacity: number): void { - } + @CordovaInstance({ sync: true }) + setOpacity(opacity: number): void { + } - @CordovaInstance({sync: true}) - getOpacity(): number { - return; - } + @CordovaInstance({ sync: true }) + getOpacity(): number { + return; + } - @CordovaInstance({sync: true}) - setVisible(visible: boolean): void { - } + @CordovaInstance({ sync: true }) + setVisible(visible: boolean): void { + } - @CordovaInstance({sync: true}) - getVisible(): boolean { - return; - } + @CordovaInstance({ sync: true }) + getVisible(): boolean { + return; + } - @CordovaInstance({sync: true}) - setImage(image: string): void { - }; + @CordovaInstance({ sync: true }) + setImage(image: string): void { + }; - @CordovaInstance({sync: true}) - remove(): void { - } + @CordovaInstance({ sync: true }) + remove(): void { + } } @@ -1047,9 +922,9 @@ export class GoogleMapsGroundOverlay { * @private */ export interface GoogleMapsKmlOverlayOptions { - url?: string; - preserveViewport?: boolean; - animation?: boolean; + url?: string; + preserveViewport?: boolean; + animation?: boolean; } /** @@ -1057,43 +932,76 @@ export interface GoogleMapsKmlOverlayOptions { */ export class GoogleMapsKmlOverlay { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { + } - @CordovaInstance({sync: true}) - remove(): void { - } + @CordovaInstance({ sync: true }) + remove(): void { + } - @CordovaInstance({sync: true}) - getOverlays(): Array { - return; - } + @CordovaInstance({ sync: true }) + getOverlays(): Array { + return; + } +} + +/** + * @private + */ +export class GoogleMapsLatLngBounds { + private _objectInstance: any; + + constructor(public southwest: GoogleMapsLatLng, public northeast: GoogleMapsLatLng) { + this._objectInstance = new plugin.google.maps.LatLngBounds([southwest, northeast]); + } + + @CordovaInstance({ sync: true }) + toString(): string { + return; + } + + @CordovaInstance({ sync: true }) + toUrlValue(precision?: number): string { + return; + } + + @CordovaInstance({ sync: true }) + extend(LatLng: GoogleMapsLatLng): void { + } + + @CordovaInstance({ sync: true }) + contains(LatLng: GoogleMapsLatLng): boolean { + return; + } + + @CordovaInstance({ sync: true }) + getCenter(): GoogleMapsLatLng { + return; + } } /** * @private */ export class GoogleMapsLatLng { - private _objectInstance: any; + private _objectInstance: any; - constructor(public lat: number, public lng: number) { - this._objectInstance = new plugin.google.maps.LatLng(lat, lng); - } + constructor(public lat: number, public lng: number) { + this._objectInstance = new plugin.google.maps.LatLng(lat, lng); + } - equals(other: GoogleMapsLatLng): boolean { - return this.lat === other.lat && this.lng === other.lng; - } + equals(other: GoogleMapsLatLng): boolean { + return this.lat === other.lat && this.lng === other.lng; + } - @CordovaInstance({ - sync: true - }) - toString(): string { - return; - } + @CordovaInstance({ sync: true }) + toString(): string { + return; + } - toUrlValue(precision?: number): string { - precision = precision || 6; + toUrlValue(precision?: number): string { + precision = precision || 6; - return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision); - } + return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision); + } } diff --git a/src/plugins/printer.ts b/src/plugins/printer.ts new file mode 100644 index 00000000..cfa35ef1 --- /dev/null +++ b/src/plugins/printer.ts @@ -0,0 +1,64 @@ +import {Plugin, Cordova} from './plugin'; +declare var cordova: any; + +export interface PrintOptions { + /** + * The name of the print job and the document + */ + name?: string; + + /** + * The network URL of the printer. + * Only supported on iOS. + */ + printerId?: string; + + /** + * Specifies the duplex mode to use for the print job. + * Either double-sided (duplex:true) or single-sided (duplex:false). + * Double-sided by default. + * Only supported on iOS + */ + duplex?: boolean; + + /** + * The orientation of the printed content, portrait or landscape + * Portrait by default. + */ + landscape?: boolean; + + /** + * If your application only prints black text, setting this property to true can result in better performance in many cases. + * False by default. + */ + grayscale?: boolean; + + /** + * The Size and position of the print view + */ + bounds?: number[] | any; +} + + +@Plugin({ + plugin: 'de.appplant.cordova.plugin.printer', + pluginRef: 'cordova.plugins.printer', + repo: 'https://github.com/katzer/cordova-plugin-printer.git', + platforms: ['Android', 'iOS'] +}) +export class Printer { + + /** + * Checks whether to device is capable of printing. + */ + @Cordova() + static isAvailable(): Promise { return; } + + /** + * Sends content to the printer. + * @param {content} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used. + * @param {options} The options to pass to the printer + */ + @Cordova() + static print(content: string | HTMLElement, options?: PrintOptions): Promise { return; } +} diff --git a/src/plugins/safari-view-controller.ts b/src/plugins/safari-view-controller.ts index 5af60f6f..397748f6 100644 --- a/src/plugins/safari-view-controller.ts +++ b/src/plugins/safari-view-controller.ts @@ -59,7 +59,7 @@ export class SafariViewController { @Cordova({ callbackOrder: 'reverse' }) - static show(options?: SafariViewControllerOptions): void {} + static show(options?: SafariViewControllerOptions): Promise {return; } /** * Hides Safari View Controller @@ -98,4 +98,4 @@ export interface SafariViewControllerOptions { enterReaderModeIfAvailable?: boolean; tintColor?: string; transition?: string; -} \ No newline at end of file +} diff --git a/src/plugins/sqlite.ts b/src/plugins/sqlite.ts index 554e1d8f..ee509091 100644 --- a/src/plugins/sqlite.ts +++ b/src/plugins/sqlite.ts @@ -2,6 +2,30 @@ import {CordovaInstance, Plugin, Cordova} from './plugin'; declare var sqlitePlugin; /** * @name SQLite + * + * @description + * Access SQLite databases on the device. + * + * @usage + * + * ```ts + * import { SQLite } from 'ionic-native'; + * + * let db = new SQLite(); + * db.openDatabse({ + * name: 'data.db', + * location: 'default' // the location field is required + * }).then(() => { + * db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => { + * + * }, (err) => { + * console.error('Unable to execute sql', err); + * }) + * }, (err) => { + * console.error('Unable to open database', err); + * }); + * ``` + * */ @Plugin({ pluginRef: 'sqlitePlugin', @@ -15,13 +39,44 @@ export class SQLite { return this._objectInstance.databaseFeatures; } - constructor (config: any) { - new Promise((resolve, reject) => { - sqlitePlugin.openDatabase(config, resolve, reject); - }).then( - db => this._objectInstance = db, - error => console.warn(error) - ); + constructor () {} + + /** + * Open or create a SQLite database file. + * + * See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database + * + * @param config the config for opening the database. + * @usage + * + * ```ts + * import { SQLite } from 'ionic-native'; + * + * let db = new SQLite(); + * db.openDatabse({ + * name: 'data.db', + * location: 'default' // the location field is required + * }).then(() => { + * db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => { + * + * }, (err) => { + * console.error('Unable to execute sql', err); + * }) + * }, (err) => { + * console.error('Unable to open database', err); + * }); + * ``` + */ + openDatabase (config: any) : Promise { + return new Promise((resolve, reject) => { + sqlitePlugin.openDatabase(config, db => { + this._objectInstance = db; + resolve(db); + }, error => { + console.warn(error) + reject(error); + }); + }); } @CordovaInstance({ @@ -48,6 +103,19 @@ export class SQLite { }) start (): void {} + /** + * Execute SQL on the opened database. Note, you must call `openDatabase` first, and + * ensure it resolved and successfully opened the database. + * + * @usage + * + * ```ts + * db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => { + * // Access the items through resultSet.rows + * // resultSet.rows.item(i) + * }, (err) => {}) + * ``` + */ @CordovaInstance() executeSql (statement: string, params: any): Promise {return; } @@ -104,4 +172,4 @@ export class SQLite { @Cordova() static deleteDatabase (first): Promise {return; } -} \ No newline at end of file +} diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index 99d9723e..2606a330 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -47,7 +47,7 @@ export interface ToastOptions { * * * - * Toast.show("I'm a toast", 5000, "center").subscribe( + * Toast.show("I'm a toast", "5000", "center").subscribe( * toast => { * console.log(toast); * }