2016-03-06 15:08:19 -05:00
|
|
|
import {Plugin, Cordova} from './plugin';
|
|
|
|
|
|
|
|
export interface launchNavigatorOptions {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* iOS, Android, Windows
|
|
|
|
* If true, the plugin will NOT attempt to use the geolocation plugin to determine the current device position when the start location parameter is omitted. Defaults to false.
|
|
|
|
*/
|
2016-03-08 14:25:22 -05:00
|
|
|
disableAutoGeolocation : boolean,
|
2016-03-06 15:08:19 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* iOS, Android, Windows
|
|
|
|
* Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified.
|
|
|
|
*/
|
2016-03-08 14:25:22 -05:00
|
|
|
transportMode : string,
|
2016-03-06 15:08:19 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* iOS
|
|
|
|
* If true, plugin will attempt to launch Google Maps instead of Apple Maps. If Google Maps is not available, it will fall back to Apple Maps.
|
|
|
|
*/
|
2016-03-08 14:25:22 -05:00
|
|
|
preferGoogleMaps : boolean,
|
2016-03-06 15:08:19 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* iOS
|
|
|
|
* If using Google Maps and the app has a URL scheme, passing this to Google Maps will display a button which returns to the app.
|
|
|
|
*/
|
2016-03-08 14:25:22 -05:00
|
|
|
urlScheme : string,
|
2016-03-06 15:08:19 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* iOS
|
|
|
|
* If using Google Maps with a URL scheme, this specifies the text of the button in Google Maps which returns to the app. Defaults to "Back" if not specified.
|
|
|
|
*/
|
2016-03-08 14:25:22 -05:00
|
|
|
backButtonText : string,
|
2016-03-06 15:08:19 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* iOS
|
|
|
|
* If true, debug log output will be generated by the plugin. Defaults to false.
|
|
|
|
*/
|
2016-03-08 14:25:22 -05:00
|
|
|
enableDebug : boolean,
|
2016-03-06 15:08:19 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Android
|
|
|
|
* Navigation mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified.
|
|
|
|
*/
|
2016-03-08 14:25:22 -05:00
|
|
|
navigationMode : string,
|
2016-03-06 15:08:19 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-03-12 18:30:16 -05:00
|
|
|
* @name LaunchNavigator
|
|
|
|
* @description
|
2016-03-06 15:08:19 -05:00
|
|
|
* Requires Cordova plugin: uk.co.workingedge.phonegap.plugin.launchnavigator. For more info, please see the [LaunchNavigator plugin docs](https://github.com/dpa99c/phonegap-launch-navigator).
|
|
|
|
*
|
|
|
|
* @usage
|
|
|
|
* ```js
|
2016-03-06 15:11:19 -05:00
|
|
|
* LaunchNavigator.navigate("Toronto, ON", "London, ON")
|
|
|
|
* .then(
|
|
|
|
* success => console.log("Launched navigator"),
|
|
|
|
* error => console.log("Error launching navigator", error)
|
|
|
|
* );
|
2016-03-06 15:08:19 -05:00
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
@Plugin({
|
2016-03-12 18:30:16 -05:00
|
|
|
plugin: 'uk.co.workingedge.phonegap.plugin.launchnavigator',
|
|
|
|
pluginRef: 'launchnavigator',
|
|
|
|
repo: 'https://github.com/dpa99c/phonegap-launch-navigator.git'
|
2016-03-06 15:08:19 -05:00
|
|
|
})
|
|
|
|
export class LaunchNavigator {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Launches navigator app
|
|
|
|
* @param destination Location name or coordinates
|
|
|
|
* @param start Location name or coordinates
|
|
|
|
* @param options
|
|
|
|
* @returns {Promise<any>}
|
|
|
|
*/
|
|
|
|
@Cordova({
|
|
|
|
successIndex: 2,
|
|
|
|
errorIndex: 3
|
|
|
|
})
|
2016-03-10 15:48:20 -06:00
|
|
|
static navigate(
|
|
|
|
destination: any,
|
|
|
|
start: any,
|
|
|
|
options?: launchNavigatorOptions
|
|
|
|
): Promise<any> { return }
|
2016-03-06 15:08:19 -05:00
|
|
|
|
|
|
|
}
|