mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-16 00:00:02 +08:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebda055444 | ||
|
|
7cf9bd8e5e | ||
|
|
ce710117f7 | ||
|
|
fcda04acf1 | ||
|
|
83ac4c7bbe | ||
|
|
2be7872cd6 | ||
|
|
97a7f1a4e7 | ||
|
|
e9e37f33f9 | ||
|
|
344ce11a3e | ||
|
|
7fcd1f85a3 | ||
|
|
5d13ba03d8 | ||
|
|
a99b753d2d | ||
|
|
8f26f4b3ef | ||
|
|
624bc1d9b5 | ||
|
|
0a07bef2d2 | ||
|
|
96bb4d38dc | ||
|
|
58a99a14d5 | ||
|
|
66e9e46458 | ||
|
|
d6060a95d7 | ||
|
|
80ff2f3bfa | ||
|
|
16f05c3b0d | ||
|
|
2ed84b1b71 | ||
|
|
8d21f5f225 | ||
|
|
be2c198259 | ||
|
|
47112c7c24 | ||
|
|
1b87af86bf | ||
|
|
d45a2b5407 | ||
|
|
49bf9b7cc5 | ||
|
|
79f0a3fc7b | ||
|
|
60b7c7469a | ||
|
|
c377489aba | ||
|
|
8bb22fb576 | ||
|
|
310e0942fd | ||
|
|
df06a24746 | ||
|
|
b9151bc062 | ||
|
|
972d63b2d2 | ||
|
|
440786a4f7 | ||
|
|
3a6ec05bef | ||
|
|
c5733326a9 | ||
|
|
f36b1c03cb |
30
CHANGELOG.md
30
CHANGELOG.md
@@ -1,3 +1,33 @@
|
||||
<a name="2.1.0"></a>
|
||||
# [2.1.0](https://github.com/driftyco/ionic-native/compare/v2.0.3...v2.1.0) (2016-10-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **calendar:** fixed modifyEventWithOptions and related interface ([80ff2f3](https://github.com/driftyco/ionic-native/commit/80ff2f3))
|
||||
* **googlemaps:** CameraPosition target can now be GoogleMapsLatLng[] ([#587](https://github.com/driftyco/ionic-native/issues/587)) ([8d21f5f](https://github.com/driftyco/ionic-native/commit/8d21f5f))
|
||||
* **googlemaps:** typo in GoogleMapsTileOverlayOptions ([#589](https://github.com/driftyco/ionic-native/issues/589)) ([be2c198](https://github.com/driftyco/ionic-native/commit/be2c198))
|
||||
* **isdebug:** export IsDebug class ([#578](https://github.com/driftyco/ionic-native/issues/578)) ([c573332](https://github.com/driftyco/ionic-native/commit/c573332))
|
||||
* **media:** add status as a parmeter instead of property of instance ([58a99a1](https://github.com/driftyco/ionic-native/commit/58a99a1))
|
||||
* **paypal:** fix typings, add PayPalItem and PayPalPaymentDetails ([5d13ba0](https://github.com/driftyco/ionic-native/commit/5d13ba0))
|
||||
* **power-management:** fix repo and pluginref ([#603](https://github.com/driftyco/ionic-native/issues/603)) ([d6060a9](https://github.com/driftyco/ionic-native/commit/d6060a9))
|
||||
* **push:** Add support for passing notification id into finish ([#600](https://github.com/driftyco/ionic-native/issues/600)) ([16f05c3](https://github.com/driftyco/ionic-native/commit/16f05c3))
|
||||
* **social-sharing:** shareWithOptions method signature ([#598](https://github.com/driftyco/ionic-native/issues/598)) ([2ed84b1](https://github.com/driftyco/ionic-native/commit/2ed84b1)), closes [/github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/src/android/nl/xservices/plugins/SocialSharing.java#L209](https://github.com//github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/src/android/nl/xservices/plugins/SocialSharing.java/issues/L209)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **ble:** add startScanWithOptions ([79f0a3f](https://github.com/driftyco/ionic-native/commit/79f0a3f)), closes [#539](https://github.com/driftyco/ionic-native/issues/539)
|
||||
* **googlemaps:** support bounds in Geocoder ([#599](https://github.com/driftyco/ionic-native/issues/599)) ([66e9e46](https://github.com/driftyco/ionic-native/commit/66e9e46))
|
||||
* **location-accuracy:** add location accuracy plugin ([#583](https://github.com/driftyco/ionic-native/issues/583)) ([60b7c74](https://github.com/driftyco/ionic-native/commit/60b7c74)), closes [#484](https://github.com/driftyco/ionic-native/issues/484)
|
||||
* **plugin:** add getPlugin to plugin interface. Fixes [#582](https://github.com/driftyco/ionic-native/issues/582) ([d45a2b5](https://github.com/driftyco/ionic-native/commit/d45a2b5))
|
||||
* **plugin:** checkInstall w/ warning msg ([47112c7](https://github.com/driftyco/ionic-native/commit/47112c7))
|
||||
* **stepcounter:** add stepcounter plugin ([#607](https://github.com/driftyco/ionic-native/issues/607)) ([a99b753](https://github.com/driftyco/ionic-native/commit/a99b753))
|
||||
* **themable-browser:** add ThemableBrowser plugin ([b9151bc](https://github.com/driftyco/ionic-native/commit/b9151bc)), closes [#549](https://github.com/driftyco/ionic-native/issues/549)
|
||||
* **themable-browser:** add ThemableBrowser plugin ([972d63b](https://github.com/driftyco/ionic-native/commit/972d63b)), closes [#549](https://github.com/driftyco/ionic-native/issues/549)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.3"></a>
|
||||
## [2.0.3](https://github.com/driftyco/ionic-native/compare/v1.3.21...v2.0.3) (2016-09-24)
|
||||
|
||||
|
||||
23
LICENSE
Normal file
23
LICENSE
Normal file
@@ -0,0 +1,23 @@
|
||||
Copyright 2015-present Drifty Co.
|
||||
http://drifty.com/
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,8 +1,8 @@
|
||||
[](https://circleci.com/gh/driftyco/ionic-native) [](http://commitizen.github.io/cz-cli/)
|
||||
[](https://www.npmjs.com/package/ionic-native-playground)
|
||||
[](https://www.npmjs.com/package/ionic-native)
|
||||
|
||||
[](https://nodei.co/npm/ionic-native/)
|
||||
|
||||
[](https://nodei.co/npm/ionic-native/)
|
||||
|
||||
# Ionic Native
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ gulp.task('lint', function() {
|
||||
|
||||
gulp.task('plugin:create', function(){
|
||||
if(flags.n && flags.n !== ''){
|
||||
var src = flags.m?'./TEMPLATE-MIN':'./TEMPLATE';
|
||||
var src = flags.m?'./scripts/templates/wrap-min.tmpl':'./scripts/templates/wrap.tmpl';
|
||||
return gulp.src(src)
|
||||
.pipe(replace('PluginName', flags.n))
|
||||
.pipe(rename(decamelize(flags.n, '-') + '.ts'))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "2.0.3",
|
||||
"version": "2.1.0",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"main": "dist/es5/index.js",
|
||||
"typings": "dist/es5/index.d.ts",
|
||||
|
||||
10
src/index.ts
10
src/index.ts
@@ -64,6 +64,7 @@ import { IsDebug } from './plugins/is-debug';
|
||||
import { Keyboard } from './plugins/keyboard';
|
||||
import { LaunchNavigator } from './plugins/launchnavigator';
|
||||
import { LocalNotifications } from './plugins/localnotifications';
|
||||
import { LocationAccuracy } from './plugins/location-accuracy';
|
||||
import { MediaCapture } from './plugins/media-capture';
|
||||
import { NativeAudio } from './plugins/native-audio';
|
||||
import { NativePageTransitions } from './plugins/native-page-transitions';
|
||||
@@ -93,11 +94,13 @@ import { SpinnerDialog } from './plugins/spinnerdialog';
|
||||
import { Splashscreen } from './plugins/splashscreen';
|
||||
import { SQLite } from './plugins/sqlite';
|
||||
import { StatusBar } from './plugins/statusbar';
|
||||
import { Stepcounter } from './plugins/stepcounter';
|
||||
import { StreamingMedia } from './plugins/streaming-media';
|
||||
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 { TwitterConnect } from './plugins/twitter-connect';
|
||||
import { Vibration } from './plugins/vibration';
|
||||
import { VideoEditor } from './plugins/video-editor';
|
||||
@@ -142,6 +145,7 @@ export * from './plugins/safari-view-controller';
|
||||
export * from './plugins/sms';
|
||||
export * from './plugins/spinnerdialog';
|
||||
export * from './plugins/streaming-media';
|
||||
export * from './plugins/themable-browser';
|
||||
export * from './plugins/toast';
|
||||
export * from './plugins/twitter-connect';
|
||||
export * from './plugins/video-editor';
|
||||
@@ -184,7 +188,9 @@ Hotspot,
|
||||
InAppPurchase,
|
||||
Insomnia,
|
||||
Instagram,
|
||||
IsDebug,
|
||||
Keyboard,
|
||||
LocationAccuracy,
|
||||
MusicControls,
|
||||
NativeAudio,
|
||||
NativeStorage,
|
||||
@@ -203,6 +209,7 @@ Sim,
|
||||
Splashscreen,
|
||||
SQLite,
|
||||
StatusBar,
|
||||
Stepcounter,
|
||||
TouchID,
|
||||
Transfer,
|
||||
TextToSpeech,
|
||||
@@ -275,6 +282,7 @@ window['IonicNative'] = {
|
||||
Keyboard,
|
||||
LaunchNavigator,
|
||||
LocalNotifications,
|
||||
LocationAccuracy,
|
||||
Market,
|
||||
MediaCapture,
|
||||
MediaPlugin,
|
||||
@@ -304,12 +312,14 @@ window['IonicNative'] = {
|
||||
Splashscreen,
|
||||
SQLite,
|
||||
StatusBar,
|
||||
Stepcounter,
|
||||
StreamingMedia,
|
||||
ThreeDeeTouch,
|
||||
Toast,
|
||||
TouchID,
|
||||
Transfer,
|
||||
TextToSpeech,
|
||||
ThemableBrowser,
|
||||
TwitterConnect,
|
||||
VideoEditor,
|
||||
VideoPlayer,
|
||||
|
||||
@@ -207,6 +207,19 @@ export class BLE {
|
||||
})
|
||||
static startScan(services: string[]): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Scans for BLE devices. This function operates similarly to the `startScan` function, but allows you to specify extra options (like allowing duplicate device reports).
|
||||
* @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices
|
||||
* @param options {any}
|
||||
* @return Returns an Observable that notifies of each peripheral discovered.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopScan',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static startScanWithOptions(services: string[], options: {reportDuplicates?: boolean} | any): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop a scan started by `startScan`.
|
||||
*
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* @private
|
||||
*/
|
||||
export interface CalendarOptions {
|
||||
id?: string;
|
||||
firstReminderMinutes?: number;
|
||||
secondReminderMinutes?: number;
|
||||
recurrence?: string; // options are: 'daily', 'weekly', 'monthly', 'yearly'
|
||||
@@ -336,7 +337,8 @@ export class Calendar {
|
||||
* @param {string} [newNotes] The new event notes
|
||||
* @param {Date} [newStartDate] The new event start date
|
||||
* @param {Date} [newEndDate] The new event end date
|
||||
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
|
||||
* @param {CalendarOptions} [filterOptions] Event Options, see `getCalendarOptions`
|
||||
* @param {CalendarOptions} [newOptions] New event options, see `getCalendarOptions`
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -351,8 +353,9 @@ export class Calendar {
|
||||
newNotes?: string,
|
||||
newStartDate?: Date,
|
||||
newEndDate?: Date,
|
||||
options?: CalendarOptions
|
||||
) { return; }
|
||||
filterOptions?: CalendarOptions,
|
||||
newOptions?: CalendarOptions
|
||||
): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Delete an event.
|
||||
|
||||
@@ -7,7 +7,7 @@ declare var cordova: any;
|
||||
* @name Email Composer
|
||||
* @description
|
||||
*
|
||||
* Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/katzer/cordova-plugin-email-composer).
|
||||
* Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/hypery2k/cordova-email-plugin).
|
||||
*
|
||||
* DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version.
|
||||
* A good alternative to this plugin is the social sharing plugin.
|
||||
|
||||
@@ -60,7 +60,7 @@ export const GoogleMapsAnimation = {
|
||||
* let map = new GoogleMap(mapElement);
|
||||
*
|
||||
* // listen to MAP_READY event
|
||||
* map.one(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!'));
|
||||
* map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!'));
|
||||
*
|
||||
*
|
||||
* // create LatLng object
|
||||
@@ -103,9 +103,7 @@ export class GoogleMap {
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
static isAvailable(): Promise<boolean> { return; }
|
||||
|
||||
constructor(element: string|HTMLElement, options?: any) {
|
||||
if (typeof element === 'string') element = document.getElementById(<string>element);
|
||||
@@ -138,12 +136,10 @@ export class GoogleMap {
|
||||
}
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setDebuggable(isDebuggable: boolean): void {
|
||||
}
|
||||
setDebuggable(isDebuggable: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setClickable(isClickable: boolean): void {
|
||||
}
|
||||
setClickable(isClickable: boolean): void { }
|
||||
|
||||
/**
|
||||
* Get the position of the camera.
|
||||
@@ -151,9 +147,7 @@ export class GoogleMap {
|
||||
* @return {Promise<CameraPosition>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getCameraPosition(): Promise<CameraPosition> {
|
||||
return;
|
||||
}
|
||||
getCameraPosition(): Promise<CameraPosition> { return; }
|
||||
|
||||
/**
|
||||
* Get the location of the user.
|
||||
@@ -161,9 +155,7 @@ export class GoogleMap {
|
||||
* @return {Promise<MyLocation>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getMyLocation(options?: MyLocationOptions): Promise<MyLocation> {
|
||||
return;
|
||||
}
|
||||
getMyLocation(options?: MyLocationOptions): Promise<MyLocation> { return; }
|
||||
|
||||
/**
|
||||
* Get the visible region.
|
||||
@@ -171,38 +163,28 @@ export class GoogleMap {
|
||||
* @return {Promise<VisibleRegion>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getVisibleRegion(): Promise<VisibleRegion> {
|
||||
return;
|
||||
}
|
||||
getVisibleRegion(): Promise<VisibleRegion> { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
showDialog(): void {
|
||||
}
|
||||
showDialog(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
closeDialog(): void {
|
||||
}
|
||||
closeDialog(): void { }
|
||||
|
||||
@CordovaInstance()
|
||||
getLicenseInfo(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
getLicenseInfo(): Promise<string> { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setCenter(latLng: GoogleMapsLatLng): void {
|
||||
}
|
||||
setCenter(latLng: GoogleMapsLatLng): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setZoom(zoomLevel: number): void {
|
||||
}
|
||||
setZoom(zoomLevel: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setMapTypeId(typeId: string): void {
|
||||
}
|
||||
setMapTypeId(typeId: string): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setTilt(tiltLevel: number): void {
|
||||
}
|
||||
setTilt(tiltLevel: number): void { }
|
||||
|
||||
@CordovaInstance()
|
||||
animateCamera(animateCameraOptions: AnimateCameraOptions): Promise<any> { return; }
|
||||
@@ -211,24 +193,19 @@ export class GoogleMap {
|
||||
moveCamera(cameraPosition: CameraPosition): Promise<any> { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setMyLocationEnabled(enabled: boolean): void {
|
||||
}
|
||||
setMyLocationEnabled(enabled: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setIndoorEnabled(enabled: boolean): void {
|
||||
}
|
||||
setIndoorEnabled(enabled: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setTrafficEnabled(enabled: boolean): void {
|
||||
}
|
||||
setTrafficEnabled(enabled: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setCompassEnabled(enabled: boolean): void {
|
||||
}
|
||||
setCompassEnabled(enabled: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setAllGesturesEnabled(enabled: boolean): void {
|
||||
}
|
||||
setAllGesturesEnabled(enabled: boolean): void { }
|
||||
|
||||
addMarker(options: GoogleMapsMarkerOptions): Promise<GoogleMapsMarker> {
|
||||
return new Promise<GoogleMapsMarker>(
|
||||
@@ -329,55 +306,40 @@ export class GoogleMap {
|
||||
}
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setDiv(domNode: HTMLElement): void {
|
||||
}
|
||||
setDiv(domNode: HTMLElement): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setVisible(visible: boolean): void {
|
||||
}
|
||||
setVisible(visible: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setOptions(options: any): void {
|
||||
}
|
||||
setOptions(options: any): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setBackgroundColor(backgroundColor: string): void {
|
||||
}
|
||||
setBackgroundColor(backgroundColor: string): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setPadding(top?: number, right?: number, bottom?: number, left?: number): void {
|
||||
}
|
||||
setPadding(top?: number, right?: number, bottom?: number, left?: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
clear(): void {
|
||||
}
|
||||
clear(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
refreshLayout(): void {
|
||||
}
|
||||
refreshLayout(): void { }
|
||||
|
||||
@CordovaInstance()
|
||||
fromLatLngToPoint(latLng: GoogleMapsLatLng, point: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
fromLatLngToPoint(latLng: GoogleMapsLatLng, point: any): Promise<any> { return; }
|
||||
|
||||
@CordovaInstance()
|
||||
fromPointToLatLng(point: any, latLng: GoogleMapsLatLng): Promise<GoogleMapsLatLng> {
|
||||
return;
|
||||
}
|
||||
fromPointToLatLng(point: any, latLng: GoogleMapsLatLng): Promise<GoogleMapsLatLng> { return; }
|
||||
|
||||
@CordovaInstance()
|
||||
toDataURL(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
toDataURL(): Promise<any> { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
remove(): void {
|
||||
}
|
||||
remove(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
panBy(): void {
|
||||
}
|
||||
panBy(): void { }
|
||||
|
||||
}
|
||||
|
||||
@@ -396,7 +358,7 @@ export interface AnimateCameraOptions {
|
||||
* @private
|
||||
*/
|
||||
export interface CameraPosition {
|
||||
target?: GoogleMapsLatLng | GoogleMapsLatLngBounds;
|
||||
target?: GoogleMapsLatLng | GoogleMapsLatLngBounds | GoogleMapsLatLng[];
|
||||
zoom?: number;
|
||||
tilt?: number;
|
||||
bearing?: number;
|
||||
@@ -461,8 +423,7 @@ export interface GoogleMapsMarkerIcon {
|
||||
*/
|
||||
export class GoogleMapsMarker {
|
||||
|
||||
constructor(private _objectInstance: any) {
|
||||
}
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
addEventListener(event: any): Observable<any> {
|
||||
return new Observable(
|
||||
@@ -474,117 +435,79 @@ export class GoogleMapsMarker {
|
||||
}
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
isVisible(): boolean {
|
||||
return;
|
||||
}
|
||||
isVisible(): boolean { return; }
|
||||
|
||||
@CordovaInstance()
|
||||
setVisible(visible: boolean): void {
|
||||
}
|
||||
setVisible(visible: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getHashCode(): string {
|
||||
return;
|
||||
}
|
||||
getHashCode(): string { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
remove(): void {
|
||||
}
|
||||
remove(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setOpacity(alpha: number): void {
|
||||
}
|
||||
setOpacity(alpha: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getOpacity(): number {
|
||||
return;
|
||||
}
|
||||
getOpacity(): number { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setZIndex(): void {
|
||||
}
|
||||
setZIndex(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setIconAnchor(x: number, y: number): void {
|
||||
}
|
||||
setIconAnchor(x: number, y: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setInfoWindowAnchor(x: number, y: number): void {
|
||||
}
|
||||
setInfoWindowAnchor(x: number, y: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setDraggable(draggable: boolean): void {
|
||||
}
|
||||
setDraggable(draggable: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
isDraggable(): boolean {
|
||||
return;
|
||||
}
|
||||
isDraggable(): boolean { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setFlat(flat: boolean): void {
|
||||
return;
|
||||
}
|
||||
setFlat(flat: boolean): void { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setIcon(icon: GoogleMapsMarkerIcon): void {
|
||||
}
|
||||
setIcon(icon: GoogleMapsMarkerIcon): void { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setTitle(title: string): void {
|
||||
}
|
||||
setTitle(title: string): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getTitle(): string {
|
||||
return;
|
||||
}
|
||||
getTitle(): string { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setSnippet(snippet: string): void {
|
||||
}
|
||||
setSnippet(snippet: string): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getSnippet(): string {
|
||||
return;
|
||||
}
|
||||
getSnippet(): string { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setRotation(rotation: number): void {
|
||||
}
|
||||
setRotation(rotation: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getRotation(): number {
|
||||
return;
|
||||
}
|
||||
getRotation(): number { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
showInfoWindow(): number {
|
||||
return;
|
||||
}
|
||||
showInfoWindow(): number { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
hideInfoWindow(): number {
|
||||
return;
|
||||
}
|
||||
hideInfoWindow(): number { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setPosition(latLng: GoogleMapsLatLng): void {
|
||||
}
|
||||
setPosition(latLng: GoogleMapsLatLng): void { return; }
|
||||
|
||||
@CordovaInstance()
|
||||
getPosition(): Promise<GoogleMapsLatLng> {
|
||||
return;
|
||||
}
|
||||
getPosition(): Promise<GoogleMapsLatLng> { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getMap(): GoogleMap {
|
||||
return;
|
||||
}
|
||||
getMap(): GoogleMap { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setAnimation(animation: string): void {
|
||||
}
|
||||
|
||||
setAnimation(animation: string): void { }
|
||||
|
||||
}
|
||||
|
||||
@@ -606,8 +529,7 @@ export interface GoogleMapsCircleOptions {
|
||||
*/
|
||||
export class GoogleMapsCircle {
|
||||
|
||||
constructor(private _objectInstance: any) {
|
||||
}
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
addEventListener(event: any): Observable<any> {
|
||||
return new Observable(
|
||||
@@ -619,66 +541,46 @@ export class GoogleMapsCircle {
|
||||
}
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getCenter(): GoogleMapsLatLng {
|
||||
return;
|
||||
}
|
||||
getCenter(): GoogleMapsLatLng { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getRadius(): number {
|
||||
return;
|
||||
}
|
||||
getRadius(): number { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getStrokeColor(): string {
|
||||
return;
|
||||
}
|
||||
getStrokeColor(): string { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getVisible(): boolean {
|
||||
return;
|
||||
}
|
||||
getVisible(): boolean { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getZIndex(): number {
|
||||
return;
|
||||
}
|
||||
getZIndex(): number { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
remove(): void {
|
||||
}
|
||||
remove(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setCenter(latLng: GoogleMapsLatLng): void {
|
||||
}
|
||||
setCenter(latLng: GoogleMapsLatLng): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setFillColor(fillColor: string): void {
|
||||
}
|
||||
setFillColor(fillColor: string): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setStrokeColor(strokeColor: string): void {
|
||||
}
|
||||
setStrokeColor(strokeColor: string): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setStrokeWidth(strokeWidth: number): void {
|
||||
}
|
||||
setStrokeWidth(strokeWidth: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setVisible(visible: boolean): void {
|
||||
}
|
||||
setVisible(visible: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setZIndex(zIndex: number): void {
|
||||
}
|
||||
setZIndex(zIndex: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setRadius(radius: number): void {
|
||||
}
|
||||
setRadius(radius: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getMap(): GoogleMap {
|
||||
return;
|
||||
}
|
||||
getMap(): GoogleMap { return; }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -697,8 +599,7 @@ export interface GoogleMapsPolylineOptions {
|
||||
* @private
|
||||
*/
|
||||
export class GoogleMapsPolyline {
|
||||
constructor(private _objectInstance: any) {
|
||||
}
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
addEventListener(event: any): Observable<any> {
|
||||
return new Observable(
|
||||
@@ -710,62 +611,43 @@ export class GoogleMapsPolyline {
|
||||
}
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getPoints(): Array<GoogleMapsLatLng> {
|
||||
return;
|
||||
}
|
||||
getPoints(): Array<GoogleMapsLatLng> { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getCOlor(): string {
|
||||
return;
|
||||
}
|
||||
getCOlor(): string { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getWidth(): number {
|
||||
return;
|
||||
}
|
||||
getWidth(): number { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getGeodesic(): boolean {
|
||||
return;
|
||||
}
|
||||
getGeodesic(): boolean { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getZIndex(): number {
|
||||
return;
|
||||
}
|
||||
getZIndex(): number { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
remove(): void {
|
||||
}
|
||||
remove(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setPoints(points: Array<GoogleMapsLatLng>): void {
|
||||
}
|
||||
setPoints(points: Array<GoogleMapsLatLng>): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setColor(color: string): void {
|
||||
}
|
||||
setColor(color: string): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setWidth(width: number): void {
|
||||
}
|
||||
setWidth(width: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setVisible(visible: boolean): void {
|
||||
}
|
||||
setVisible(visible: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setZIndex(zIndex: number): void {
|
||||
}
|
||||
setZIndex(zIndex: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setGeoDesic(geoDesic: boolean): void {
|
||||
}
|
||||
setGeoDesic(geoDesic: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getMap(): GoogleMap {
|
||||
return;
|
||||
}
|
||||
getMap(): GoogleMap { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -788,8 +670,7 @@ export interface GoogleMapsPolygonOptions {
|
||||
*/
|
||||
export class GoogleMapsPolygon {
|
||||
|
||||
constructor(private _objectInstance: any) {
|
||||
}
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
addEventListener(event: any): Observable<any> {
|
||||
return new Observable(
|
||||
@@ -801,78 +682,56 @@ export class GoogleMapsPolygon {
|
||||
}
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getPoints(): Array<GoogleMapsLatLng> {
|
||||
return;
|
||||
}
|
||||
getPoints(): Array<GoogleMapsLatLng> { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getStrokeColor(): string {
|
||||
return;
|
||||
}
|
||||
getStrokeColor(): string { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getFillColor(): string {
|
||||
return;
|
||||
}
|
||||
getFillColor(): string { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getStrokeWidth(): number {
|
||||
return;
|
||||
}
|
||||
getStrokeWidth(): number { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getGeodesic(): boolean {
|
||||
return;
|
||||
}
|
||||
getGeodesic(): boolean { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getVisible(): boolean {
|
||||
return;
|
||||
}
|
||||
getVisible(): boolean { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getZIndex(): boolean {
|
||||
return;
|
||||
}
|
||||
getZIndex(): boolean { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
remove(): void {
|
||||
}
|
||||
remove(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setPoints(points: Array<GoogleMapsLatLng>): void {
|
||||
}
|
||||
setPoints(points: Array<GoogleMapsLatLng>): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setStrokeColor(strokeColor: string): void {
|
||||
}
|
||||
setStrokeColor(strokeColor: string): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setFillColor(fillColor: string): void {
|
||||
}
|
||||
setFillColor(fillColor: string): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setStrokeWidth(strokeWidth: number): void {
|
||||
}
|
||||
setStrokeWidth(strokeWidth: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setVisible(visible: boolean): void {
|
||||
}
|
||||
setVisible(visible: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setZIndex(zIndex: number): void {
|
||||
}
|
||||
setZIndex(zIndex: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setGeodesic(geodesic: boolean): void {
|
||||
}
|
||||
setGeodesic(geodesic: boolean): void { }
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface GoogleMapsTileOverlayOptions {
|
||||
titleUrilFormat?: string;
|
||||
tileUrlFormat?: string;
|
||||
visible?: boolean;
|
||||
zIndex?: number;
|
||||
tileSize?: number;
|
||||
@@ -884,52 +743,37 @@ export interface GoogleMapsTileOverlayOptions {
|
||||
*/
|
||||
export class GoogleMapsTileOverlay {
|
||||
|
||||
constructor(private _objectInstance: any) {
|
||||
}
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getVisible(): boolean {
|
||||
return;
|
||||
}
|
||||
getVisible(): boolean { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setVisible(visible: boolean): void {
|
||||
}
|
||||
setVisible(visible: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getFadeIn(): boolean {
|
||||
return;
|
||||
}
|
||||
getFadeIn(): boolean { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setFadeIn(fadeIn: boolean): void {
|
||||
}
|
||||
setFadeIn(fadeIn: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getZIndex(): number {
|
||||
return;
|
||||
}
|
||||
getZIndex(): number { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setZIndex(zIndex: number): void {
|
||||
}
|
||||
setZIndex(zIndex: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getOpacity(): number {
|
||||
return;
|
||||
}
|
||||
getOpacity(): number { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setOpacity(opacity: number): void {
|
||||
}
|
||||
setOpacity(opacity: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
clearTileCache(): void {
|
||||
}
|
||||
clearTileCache(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
remove(): void {
|
||||
}
|
||||
remove(): void { }
|
||||
|
||||
}
|
||||
|
||||
@@ -950,43 +794,31 @@ export interface GoogleMapsGroundOverlayOptions {
|
||||
*/
|
||||
export class GoogleMapsGroundOverlay {
|
||||
|
||||
constructor(private _objectInstance: any) {
|
||||
}
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setBearing(bearing: number): void {
|
||||
}
|
||||
setBearing(bearing: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getBearing(): number {
|
||||
return;
|
||||
}
|
||||
getBearing(): number { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setOpacity(opacity: number): void {
|
||||
}
|
||||
setOpacity(opacity: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getOpacity(): number {
|
||||
return;
|
||||
}
|
||||
getOpacity(): number { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setVisible(visible: boolean): void {
|
||||
}
|
||||
setVisible(visible: boolean): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getVisible(): boolean {
|
||||
return;
|
||||
}
|
||||
getVisible(): boolean { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setImage(image: string): void {
|
||||
};
|
||||
setImage(image: string): void { };
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
remove(): void {
|
||||
}
|
||||
remove(): void { }
|
||||
|
||||
}
|
||||
|
||||
@@ -1004,17 +836,13 @@ export interface GoogleMapsKmlOverlayOptions {
|
||||
*/
|
||||
export class GoogleMapsKmlOverlay {
|
||||
|
||||
constructor(private _objectInstance: any) {
|
||||
}
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
remove(): void {
|
||||
}
|
||||
remove(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getOverlays(): Array<GoogleMapsPolyline | GoogleMapsPolygon | GoogleMapsMarker> {
|
||||
return;
|
||||
}
|
||||
getOverlays(): Array<GoogleMapsPolyline | GoogleMapsPolygon | GoogleMapsMarker> { return; }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1029,28 +857,19 @@ export class GoogleMapsLatLngBounds {
|
||||
}
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
toString(): string {
|
||||
return;
|
||||
}
|
||||
toString(): string { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
toUrlValue(precision?: number): string {
|
||||
return;
|
||||
}
|
||||
toUrlValue(precision?: number): string { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
extend(LatLng: GoogleMapsLatLng): void {
|
||||
}
|
||||
extend(LatLng: GoogleMapsLatLng): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
contains(LatLng: GoogleMapsLatLng): boolean {
|
||||
return;
|
||||
}
|
||||
contains(LatLng: GoogleMapsLatLng): boolean { return; }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getCenter(): GoogleMapsLatLng {
|
||||
return;
|
||||
}
|
||||
getCenter(): GoogleMapsLatLng { return; }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1068,9 +887,7 @@ export class GoogleMapsLatLng {
|
||||
}
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
toString(): string {
|
||||
return;
|
||||
}
|
||||
toString(): string { return; }
|
||||
|
||||
toUrlValue(precision?: number): string {
|
||||
precision = precision || 6;
|
||||
@@ -1083,6 +900,7 @@ export class GoogleMapsLatLng {
|
||||
*/
|
||||
export interface GeocoderRequest {
|
||||
address?: string;
|
||||
bounds?: GoogleMapsLatLng[];
|
||||
position?: { lat: number; lng: number };
|
||||
}
|
||||
/**
|
||||
|
||||
66
src/plugins/location-accuracy.ts
Normal file
66
src/plugins/location-accuracy.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
/**
|
||||
* @name LocationAccuracy
|
||||
* @description
|
||||
* This Cordova/Phonegap plugin for Android and iOS to request enabling/changing of Location Services by triggering a native dialog from within the app, avoiding the need for the user to leave your app to change location settings manually.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { LocationAccuracy } from 'ionic-native';
|
||||
*
|
||||
* LocationAccuracy.canRequest().then((canRequest: boolean) => {
|
||||
*
|
||||
* if(canRequest) {
|
||||
* // the accuracy option will be ignored by iOS
|
||||
* LocationAccuracy.request(LocationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then(
|
||||
* () => console.log('Request successful'),
|
||||
* error => console.log('Error requesting location permissions', error)
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-request-location-accuracy',
|
||||
pluginRef: 'cordova.plugins.locationAccuracy',
|
||||
repo: 'https://github.com/dpa99c/cordova-plugin-request-location-accuracy'
|
||||
})
|
||||
export class LocationAccuracy {
|
||||
/**
|
||||
* Indicates if you can request accurate location
|
||||
* @returns {Promise<boolean>} Returns a promise that resovles with a boolean that indicates if you can request accurate location
|
||||
*/
|
||||
@Cordova()
|
||||
static canRequest(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Indicates if a request is currently in progress
|
||||
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean that indicates if a request is currently in progress
|
||||
*/
|
||||
@Cordova()
|
||||
static isRequesting(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Requests accurate location
|
||||
* @returns {Promise<any>} Returns a promise that resolves on success and rejects if an error occurred
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse' })
|
||||
static request(accuracy: string): Promise<any> { return; }
|
||||
|
||||
static REQUEST_PRIORITY_NO_POWER = 0;
|
||||
static REQUEST_PRIORITY_LOW_POWER = 1;
|
||||
static REQUEST_PRIORITY_BALANCED_POWER_ACCURACY = 2;
|
||||
static REQUEST_PRIORITY_HIGH_ACCURACY = 3;
|
||||
static SUCCESS_SETTINGS_SATISFIED = 0;
|
||||
static SUCCESS_USER_AGREED = 1;
|
||||
static ERROR_ALREADY_REQUESTING = -1;
|
||||
static ERROR_INVALID_ACTION = 0;
|
||||
static ERROR_INVALID_ACCURACY = 1;
|
||||
static ERROR_EXCEPTION = 1;
|
||||
static ERROR_CANNOT_CHANGE_ACCURACY = 3;
|
||||
static ERROR_USER_DISAGREED = 4;
|
||||
static ERROR_GOOGLE_API_CONNECTION_FAILED = 4;
|
||||
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
import { CordovaInstance, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { CordovaInstance, Plugin, getPlugin, pluginWarn } from './plugin';
|
||||
|
||||
declare var Media: any;
|
||||
|
||||
@@ -69,11 +67,12 @@ export interface MediaError {
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
let pluginMeta = {
|
||||
repo: 'https://github.com/apache/cordova-plugin-media',
|
||||
plugin: 'cordova-plugin-media',
|
||||
pluginRef: 'Media'
|
||||
})
|
||||
};
|
||||
@Plugin(pluginMeta)
|
||||
export class MediaPlugin {
|
||||
|
||||
// Constants
|
||||
@@ -118,20 +117,22 @@ export class MediaPlugin {
|
||||
|
||||
// Properties
|
||||
private _objectInstance: any;
|
||||
status: Observable<any>;
|
||||
init: Promise<any>;
|
||||
|
||||
// Methods
|
||||
/**
|
||||
* Open a media file
|
||||
* @param src {string} A URI containing the audio content.
|
||||
* @param onStatusUpdate {Function} A callback function to be invoked when the status of the file changes
|
||||
*/
|
||||
constructor(src: string) {
|
||||
this.init = new Promise<any>((resolve, reject) => {
|
||||
this.status = new Observable((observer) => {
|
||||
this._objectInstance = new Media(src, resolve, reject, observer.next.bind(observer));
|
||||
constructor(src: string, onStatusUpdate?: Function) {
|
||||
if (!!getPlugin('Media')) {
|
||||
this.init = new Promise<any>((resolve, reject) => {
|
||||
this._objectInstance = new Media(src, resolve, reject, onStatusUpdate);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
pluginWarn(pluginMeta);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,13 @@ import { Plugin, Cordova } from './plugin';
|
||||
* .catch(onError);
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* PayPalEnvironment
|
||||
* PayPalPayment
|
||||
* PayPAlItem
|
||||
* PayPalPaymentDetails
|
||||
* PayPalConfigurationOptions
|
||||
* PayPalShippingAddress
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'com.paypal.cordova.mobilesdk',
|
||||
@@ -84,101 +91,304 @@ export interface PayPalEnvironment {
|
||||
PayPalEnvironmentProduction: string;
|
||||
PayPalEnvironmentSandbox: string;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare class PayPalPayment {
|
||||
export declare var PayPalPayment: {
|
||||
/**
|
||||
* Convenience constructor.
|
||||
* Returns a PayPalPayment with the specified amount, currency code, and short description.
|
||||
* @param {String} amount: The amount of the payment.
|
||||
* @param {String} currencyCode: The ISO 4217 currency for the payment.
|
||||
* @param {String} shortDescription: A short descripton of the payment.
|
||||
* @param {String} shortDescription: A short description of the payment.
|
||||
* @param {String} intent: "Sale" for an immediate payment.
|
||||
*/
|
||||
new(amount: string, currencyCode: string, shortDescription: string, intent: string);
|
||||
|
||||
new(amount: string, currencyCode: string, shortDescription: string, intent: string): PayPalPayment;
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface PayPalPayment {
|
||||
/**
|
||||
* Optional invoice number, for your tracking purposes. (up to 256 characters)
|
||||
* @param {String} invoiceNumber: The invoice number for the payment.
|
||||
* The amount of the payment.
|
||||
*/
|
||||
invoiceNumber(invoiceNumber: string): void;
|
||||
|
||||
amount: string;
|
||||
/**
|
||||
* Optional text, for your tracking purposes. (up to 256 characters)
|
||||
* @param {String} custom: The custom text for the payment.
|
||||
* The ISO 4217 currency for the payment.
|
||||
*/
|
||||
custom(custom: string): void;
|
||||
|
||||
currencyCode: string;
|
||||
/**
|
||||
* Optional text which will appear on the customer's credit card statement. (up to 22 characters)
|
||||
* @param {String} softDescriptor: credit card text for payment
|
||||
* A short description of the payment.
|
||||
*/
|
||||
softDescriptor(softDescriptor: string): void;
|
||||
|
||||
shortDescription: string;
|
||||
/**
|
||||
* "Sale" for an immediate payment.
|
||||
*/
|
||||
intent: string;
|
||||
/**
|
||||
* Optional Build Notation code ("BN code"), obtained from partnerprogram@paypal.com,
|
||||
* for your tracking purposes.
|
||||
* @param {String} bnCode: bnCode for payment
|
||||
*/
|
||||
bnCode(bnCode: string): void;
|
||||
bnCode: string;
|
||||
/**
|
||||
* Optional invoice number, for your tracking purposes. (up to 256 characters)
|
||||
*/
|
||||
invoiceNumber: string;
|
||||
|
||||
/**
|
||||
* Optional array of PayPalItem objects. @see PayPalItem
|
||||
* @note If you provide one or more items, be sure that the various prices correctly
|
||||
* sum to the payment `amount` or to `paymentDetails.subtotal`.
|
||||
* @param items {Array<PayPalItem>} Optional
|
||||
* Optional text, for your tracking purposes. (up to 256 characters)
|
||||
*/
|
||||
items(items?: any): void;
|
||||
custom: string;
|
||||
|
||||
/**
|
||||
* Optional text which will appear on the customer's credit card statement. (up to 22 characters)
|
||||
*/
|
||||
softDescriptor: string;
|
||||
|
||||
/**
|
||||
* Optional array of PayPalItem objects.
|
||||
*/
|
||||
items: string;
|
||||
|
||||
/**
|
||||
* Optional customer shipping address, if your app wishes to provide this to the SDK.
|
||||
* @note make sure to set `payPalShippingAddressOption` in PayPalConfiguration to 1 or 3.
|
||||
* @param {PayPalShippingAddress} shippingAddress: PayPalShippingAddress object
|
||||
*/
|
||||
shippingAddress(shippingAddress: PayPalShippingAddress): void;
|
||||
shippingAddress: string;
|
||||
}
|
||||
|
||||
export interface PayPalItem {
|
||||
/**
|
||||
* Name of the item. 127 characters max
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Number of units. 10 characters max.
|
||||
*/
|
||||
quantity: number;
|
||||
/**
|
||||
* Unit price for this item 10 characters max.
|
||||
*/
|
||||
price: string;
|
||||
/**
|
||||
* ISO standard currency code.
|
||||
*/
|
||||
currency: string;
|
||||
/**
|
||||
* The stock keeping unit for this item. 50 characters max (optional)
|
||||
*/
|
||||
sku: string;
|
||||
}
|
||||
|
||||
export declare var PayPalItem: {
|
||||
/**
|
||||
* The PayPalItem class defines an optional itemization for a payment.
|
||||
* @see https://developer.paypal.com/docs/api/#item-object for more details.
|
||||
* @param {String} name: Name of the item. 127 characters max
|
||||
* @param {Number} quantity: Number of units. 10 characters max.
|
||||
* @param {String} price: Unit price for this item 10 characters max.
|
||||
* May be negative for "coupon" etc
|
||||
* @param {String} currency: ISO standard currency code.
|
||||
* @param {String} sku: The stock keeping unit for this item. 50 characters max (optional)
|
||||
*/
|
||||
new(name: string, quantity: number, price: string, currency: string, sku: string): PayPalItem;
|
||||
};
|
||||
|
||||
export interface PayPalPaymentDetails {
|
||||
/**
|
||||
* Sub-total (amount) of items being paid for. 10 characters max with support for 2 decimal places.
|
||||
*/
|
||||
subtotal: string;
|
||||
/**
|
||||
* Amount charged for shipping. 10 characters max with support for 2 decimal places.
|
||||
*/
|
||||
shipping: string;
|
||||
/**
|
||||
* Amount charged for tax. 10 characters max with support for 2 decimal places.
|
||||
*/
|
||||
tax: string;
|
||||
}
|
||||
|
||||
export declare var PayPalPaymentDetails: {
|
||||
/**
|
||||
* The PayPalPaymentDetails class defines optional amount details.
|
||||
* @param {String} subtotal: Sub-total (amount) of items being paid for. 10 characters max with support for 2 decimal places.
|
||||
* @param {String} shipping: Amount charged for shipping. 10 characters max with support for 2 decimal places.
|
||||
* @param {String} tax: Amount charged for tax. 10 characters max with support for 2 decimal places.
|
||||
*/
|
||||
new(subtotal: string, shipping: string, tax: string): PayPalPaymentDetails;
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface PayPalConfigurationOptions {
|
||||
/**
|
||||
* Will be overridden by email used in most recent PayPal login.
|
||||
*/
|
||||
defaultUserEmail?: string;
|
||||
/**
|
||||
* Will be overridden by phone country code used in most recent PayPal login
|
||||
*/
|
||||
defaultUserPhoneCountryCode?: string;
|
||||
/**
|
||||
* Will be overridden by phone number used in most recent PayPal login.
|
||||
*/
|
||||
defaultUserPhoneNumber?: string;
|
||||
/**
|
||||
* Your company name, as it should be displayed to the user when requesting consent via a PayPalFuturePaymentViewController.
|
||||
*/
|
||||
merchantName?: string;
|
||||
/**
|
||||
* URL of your company's privacy policy, which will be offered to the user when requesting consent via a PayPalFuturePaymentViewController.
|
||||
*/
|
||||
merchantPrivacyPolicyUrl?: string;
|
||||
/**
|
||||
* URL of your company's user agreement, which will be offered to the user when requesting consent via a PayPalFuturePaymentViewController.
|
||||
*/
|
||||
merchantUserAgreementUrl?: string;
|
||||
/**
|
||||
* If set to NO, the SDK will only support paying with PayPal, not with credit cards.
|
||||
* This applies only to single payments (via PayPalPaymentViewController).
|
||||
* Future payments (via PayPalFuturePaymentViewController) always use PayPal.
|
||||
* Defaults to true
|
||||
*/
|
||||
acceptCreditCards?: boolean;
|
||||
/**
|
||||
* For single payments, options for the shipping address.
|
||||
* - 0 - PayPalShippingAddressOptionNone: no shipping address applies.
|
||||
* - 1 - PayPalShippingAddressOptionProvided: shipping address will be provided by your app,
|
||||
* in the shippingAddress property of PayPalPayment.
|
||||
* - 2 - PayPalShippingAddressOptionPayPal: user will choose from shipping addresses on file
|
||||
* for their PayPal account.
|
||||
* - 3 - PayPalShippingAddressOptionBoth: user will choose from the shipping address provided by your app,
|
||||
* in the shippingAddress property of PayPalPayment, plus the shipping addresses on file for the user's PayPal account.
|
||||
* Defaults to 0 (PayPalShippingAddressOptionNone).
|
||||
*/
|
||||
payPalShippingAddressOption?: number;
|
||||
/**
|
||||
* If set to YES, then if the user pays via their PayPal account,
|
||||
* the SDK will remember the user's PayPal username or phone number;
|
||||
* if the user pays via their credit card, then the SDK will remember
|
||||
* the PayPal Vault token representing the user's credit card.
|
||||
*
|
||||
* If set to NO, then any previously-remembered username, phone number, or
|
||||
* credit card token will be erased, and subsequent payment information will
|
||||
* not be remembered.
|
||||
*
|
||||
* Defaults to YES.
|
||||
*/
|
||||
rememberUser?: boolean;
|
||||
/**
|
||||
* If not set, or if set to nil, defaults to the device's current language setting.
|
||||
*
|
||||
* Can be specified as a language code ("en", "fr", "zh-Hans", etc.) or as a locale ("en_AU", "fr_FR", "zh-Hant_HK", etc.).
|
||||
* If the library does not contain localized strings for a specified locale, then will fall back to the language. E.g., "es_CO" -> "es".
|
||||
* If the library does not contain localized strings for a specified language, then will fall back to American English.
|
||||
*
|
||||
* If you specify only a language code, and that code matches the device's currently preferred language,
|
||||
* then the library will attempt to use the device's current region as well.
|
||||
* E.g., specifying "en" on a device set to "English" and "United Kingdom" will result in "en_GB".
|
||||
*/
|
||||
languageOrLocale?: string;
|
||||
/**
|
||||
* Normally, the SDK blurs the screen when the app is backgrounded,
|
||||
* to obscure credit card or PayPal account details in the iOS-saved screenshot.
|
||||
* If your app already does its own blurring upon backgrounding, you might choose to disable this.
|
||||
* Defaults to NO.
|
||||
*/
|
||||
disableBlurWhenBackgrounding?: boolean;
|
||||
/**
|
||||
* If you will present the SDK's view controller within a popover, then set this property to YES.
|
||||
* Defaults to NO. (iOS only)
|
||||
*/
|
||||
presentingInPopover?: boolean;
|
||||
/**
|
||||
* Sandbox credentials can be difficult to type on a mobile device. Setting this flag to YES will
|
||||
* cause the sandboxUserPassword and sandboxUserPin to always be pre-populated into login fields.
|
||||
*/
|
||||
forceDefaultsInSandbox?: boolean;
|
||||
sandboxUserPAssword?: string;
|
||||
/**
|
||||
* Password to use for sandbox if 'forceDefaultsInSandbox' is set.
|
||||
*/
|
||||
sandboxUserPassword?: string;
|
||||
/**
|
||||
* PIN to use for sandbox if 'forceDefaultsInSandbox' is set.
|
||||
*/
|
||||
sandboxUserPin?: string;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare class PayPalConfiguration {
|
||||
export declare var PayPalConfiguration: {
|
||||
/**
|
||||
* You use a PayPalConfiguration object to configure many aspects of how the SDK behaves.
|
||||
* see defaults for options available
|
||||
*/
|
||||
new(options: PayPalConfigurationOptions);
|
||||
new(options: PayPalConfigurationOptions): PayPalConfiguration;
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface PayPalConfiguration {
|
||||
defaultUserEmail: string;
|
||||
defaultUserPhoneCountryCode: string;
|
||||
defaultUserPhoneNumber: string;
|
||||
merchantName: string;
|
||||
merchantPrivacyPolicyUrl: string;
|
||||
merchantUserAgreementUrl: string;
|
||||
acceptCreditCards: boolean;
|
||||
payPalShippingAddressOption: number;
|
||||
rememberUser: boolean;
|
||||
languageOrLocale: string;
|
||||
disableBlurWhenBackgrounding: boolean;
|
||||
presentingInPopover: boolean;
|
||||
forceDefaultsInSandbox: boolean;
|
||||
sandboxUserPassword: string;
|
||||
sandboxUserPin: string;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare class PayPalShippingAddress {
|
||||
export declare var PayPalShippingAddress: {
|
||||
/**
|
||||
* See the documentation of the individual properties for more detail.
|
||||
* @param {String} recipientName: Name of the recipient at this address. 50 characters max.
|
||||
* @param {String} line1: Line 1 of the address (e.g., Number, street, etc). 100 characters max.
|
||||
* @param {String} Line 2 of the address (e.g., Suite, apt #, etc). 100 characters max. Optional.
|
||||
* @param {String} line2: Line 2 of the address (e.g., Suite, apt #, etc). 100 characters max. Optional.
|
||||
* @param {String} city: City name. 50 characters max.
|
||||
* @param {String} state: 2-letter code for US states, and the equivalent for other countries. 100 characters max. Required in certain countries.
|
||||
* @param {String} postalCode: ZIP code or equivalent is usually required for countries that have them. 20 characters max. Required in certain countries.
|
||||
* @param {String} countryCode: 2-letter country code. 2 characters max.
|
||||
*/
|
||||
new(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string);
|
||||
new(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string): PayPalShippingAddress;
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface PayPalShippingAddress {
|
||||
/**
|
||||
* Name of the recipient at this address. 50 characters max.
|
||||
*/
|
||||
recipientName: string;
|
||||
/**
|
||||
* Line 1 of the address (e.g., Number, street, etc). 100 characters max.
|
||||
*/
|
||||
line1: string;
|
||||
/**
|
||||
* Line 2 of the address (e.g., Suite, apt #, etc). 100 characters max. Optional.
|
||||
*/
|
||||
line2: string;
|
||||
/**
|
||||
* City name. 50 characters max.
|
||||
*/
|
||||
city: string;
|
||||
/**
|
||||
* 2-letter code for US states, and the equivalent for other countries. 100 characters max. Required in certain countries.
|
||||
*/
|
||||
state: string;
|
||||
/**
|
||||
* ZIP code or equivalent is usually required for countries that have them. 20 characters max. Required in certain countries.
|
||||
*/
|
||||
postalCode: string;
|
||||
/**
|
||||
* 2-letter country code. 2 characters max.
|
||||
*/
|
||||
countryCode: string;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export const getPlugin = function(pluginRef: string): any {
|
||||
* @param pluginObj
|
||||
* @param method
|
||||
*/
|
||||
export const pluginWarn = function(pluginObj: any, method: string) {
|
||||
export const pluginWarn = function(pluginObj: any, method?: string) {
|
||||
let pluginName = pluginObj.name, plugin = pluginObj.plugin;
|
||||
if (method) {
|
||||
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
|
||||
@@ -322,10 +322,24 @@ export function Plugin(config) {
|
||||
cls[k] = config[k];
|
||||
}
|
||||
|
||||
cls['installed'] = function() {
|
||||
cls['installed'] = function(printWarning?: boolean) {
|
||||
return !!getPlugin(config.pluginRef);
|
||||
};
|
||||
|
||||
cls['getPlugin'] = function() {
|
||||
return getPlugin(config.pluginRef);
|
||||
};
|
||||
|
||||
cls['checkInstall'] = function() {
|
||||
let pluginInstance = getPlugin(config.pluginRef);
|
||||
|
||||
if (!pluginInstance) {
|
||||
pluginWarn(cls);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
return cls;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ import { Plugin, Cordova } from './plugin';
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-powermanagement-orig',
|
||||
pluginRef: 'https://github.com/Viras-/cordova-plugin-powermanagement',
|
||||
repo: 'powerManagement'
|
||||
pluginRef: 'powerManagement',
|
||||
repo: 'https://github.com/Viras-/cordova-plugin-powermanagement'
|
||||
})
|
||||
export class PowerManagement {
|
||||
/**
|
||||
|
||||
@@ -134,8 +134,9 @@ export interface PushNotification {
|
||||
* successHandler gets called when background push processing is successfully completed.
|
||||
* @param successHandler
|
||||
* @param errorHandler
|
||||
* @param id
|
||||
*/
|
||||
finish(successHandler: () => any, errorHandler: () => any): void;
|
||||
finish(successHandler: () => any, errorHandler: () => any, id?: string): void;
|
||||
}
|
||||
|
||||
export interface IOSPushOptions {
|
||||
|
||||
@@ -50,7 +50,7 @@ export class SocialSharing {
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
static shareWithOptions(options: { message?: string, subject?: string, file?: string|string[], url?: string, chooserTitle?: string }): Promise<any> { return; }
|
||||
static shareWithOptions(options: { message?: string, subject?: string, files?: string|string[], url?: string, chooserTitle?: string }): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if you can share via a specific app.
|
||||
|
||||
73
src/plugins/stepcounter.ts
Normal file
73
src/plugins/stepcounter.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name Stepcounter
|
||||
* @description
|
||||
* Cordova plugin for using device's stepcounter on Android (API > 19)
|
||||
*
|
||||
* Use to
|
||||
* - start and stop stepcounter service
|
||||
* - read device's stepcounter data
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Stepcounter } from 'ionic-native';
|
||||
*
|
||||
* let startingOffset = 0;
|
||||
* Stepcounter.start(startingOffset).then(onSuccess => console.log('stepcounter-start success', onSuccess), onFailure => console.log('stepcounter-start error', onFailure));
|
||||
*
|
||||
* Stepcounter.getHistory().then(historyObj => console.log('stepcounter-history success', historyObj), onFailure => console.log('stepcounter-history error', onFailure));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'https://github.com/texh/cordova-plugin-stepcounter',
|
||||
pluginRef: 'stepcounter',
|
||||
repo: 'https://github.com/texh/cordova-plugin-stepcounter',
|
||||
platforms: ['Android']
|
||||
})
|
||||
export class Stepcounter {
|
||||
|
||||
/**
|
||||
* Start the step counter
|
||||
*
|
||||
* @param startingOffset {number} will be added to the total steps counted in this session
|
||||
* @return {Promise} Returns a Promise that resolves on success or rejects on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static start(startingOffset: number): Promise<number | any> { return; }
|
||||
|
||||
/**
|
||||
* Stop the step counter
|
||||
* @return {Promise} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static stop(): Promise<number | any> { return; }
|
||||
|
||||
/**
|
||||
* Get the amount of steps for today (or -1 if it no data given)
|
||||
* @return {Promise} Returns a Promise that resolves on success with the amount of steps today, or rejects on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static getTodayStepCount(): Promise<number | any> { return; }
|
||||
|
||||
/**
|
||||
* Get the amount of steps since the start command has been called
|
||||
* @return {Promise} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static getStepCount(): Promise<number | any> { return; }
|
||||
|
||||
/**
|
||||
* Returns true/false if Android device is running >API level 19 && has the step counter API available
|
||||
* @return {Promise} Returns a Promise that resolves on success, or rejects on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static deviceCanCountSteps(): Promise<boolean | any> { return; }
|
||||
|
||||
/**
|
||||
* Get the step history (JavaScript object)
|
||||
* @return {Promise} Returns a Promise that resolves on success, or rejects on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static getHistory(): Promise<any> { return; }
|
||||
}
|
||||
194
src/plugins/themable-browser.ts
Normal file
194
src/plugins/themable-browser.ts
Normal file
@@ -0,0 +1,194 @@
|
||||
import { Plugin, CordovaInstance } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { InAppBrowserEvent } from './inappbrowser';
|
||||
declare var cordova: any;
|
||||
/**
|
||||
* @name ThemableBrowser
|
||||
* @description
|
||||
* In-app browser that allows styling.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { ThemableBrowser } 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
|
||||
* // Note that that `image` and `imagePressed` values refer to resources that are stored in your app
|
||||
* let options = {
|
||||
* statusbar: {
|
||||
* color: '#ffffffff'
|
||||
* },
|
||||
* toolbar: {
|
||||
* height: 44,
|
||||
* color: '#f0f0f0ff'
|
||||
* },
|
||||
* title: {
|
||||
* color: '#003264ff',
|
||||
* showPageTitle: true
|
||||
* },
|
||||
* backButton: {
|
||||
* image: 'back',
|
||||
* imagePressed: 'back_pressed',
|
||||
* align: 'left',
|
||||
* event: 'backPressed'
|
||||
* },
|
||||
* forwardButton: {
|
||||
* image: 'forward',
|
||||
* imagePressed: 'forward_pressed',
|
||||
* align: 'left',
|
||||
* event: 'forwardPressed'
|
||||
* },
|
||||
* closeButton: {
|
||||
* image: 'close',
|
||||
* imagePressed: 'close_pressed',
|
||||
* align: 'left',
|
||||
* event: 'closePressed'
|
||||
* },
|
||||
* customButtons: [
|
||||
* {
|
||||
* image: 'share',
|
||||
* imagePressed: 'share_pressed',
|
||||
* align: 'right',
|
||||
* event: 'sharePressed'
|
||||
* }
|
||||
* ],
|
||||
* menu: {
|
||||
* image: 'menu',
|
||||
* imagePressed: 'menu_pressed',
|
||||
* title: 'Test',
|
||||
* cancel: 'Cancel',
|
||||
* align: 'right',
|
||||
* items: [
|
||||
* {
|
||||
* event: 'helloPressed',
|
||||
* label: 'Hello World!'
|
||||
* },
|
||||
* {
|
||||
* event: 'testPressed',
|
||||
* label: 'Test!'
|
||||
* }
|
||||
* ]
|
||||
* },
|
||||
* backButtonCanClose: true
|
||||
* };
|
||||
*
|
||||
* let browser = new ThemeableBrowser('https://ionic.io', '_blank', options);
|
||||
*
|
||||
* ```
|
||||
* We suggest that you refer to the plugin's repository for additional information on usage that may not be covered here.
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-themeablebrowser',
|
||||
pluginRef: 'cordova.ThemeableBrowser',
|
||||
repo: 'https://github.com/initialxy/cordova-plugin-themeablebrowser'
|
||||
})
|
||||
export class ThemableBrowser {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor(url: string, target: string, styleOptions: ThemeableBrowserOptions) {
|
||||
this._objectInstance = cordova.ThemableBrowser.open(arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an browser window that was opened hidden. Calling this has no effect
|
||||
* if the browser was already visible.
|
||||
*/
|
||||
@CordovaInstance({sync: true})
|
||||
show(): void { }
|
||||
|
||||
/**
|
||||
* Closes the browser window.
|
||||
*/
|
||||
@CordovaInstance({sync: true})
|
||||
close(): void { }
|
||||
|
||||
/**
|
||||
* Reloads the current page
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
reload(): void { }
|
||||
|
||||
/**
|
||||
* Injects JavaScript code into the browser window.
|
||||
* @param script Details of the script to run, specifying either a file or code key.
|
||||
*/
|
||||
@CordovaInstance()
|
||||
executeScript(script: {file?: string, code?: string}): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Injects CSS into the browser window.
|
||||
* @param css Details of the script to run, specifying either a file or code key.
|
||||
*/
|
||||
@CordovaInstance()
|
||||
insertCss(css: {file?: string, code?: string}): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* A method that allows you to listen to events happening in the browser.
|
||||
* Available events are: `ThemableBrowserError`, `ThemableBrowserWarning`, `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.
|
||||
*/
|
||||
on(event: string): Observable<InAppBrowserEvent> {
|
||||
return new Observable<InAppBrowserEvent>((observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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