-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
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. | ||
*/ | ||
disableAutoGeolocation? : boolean, | ||
|
||
/** | ||
* iOS, Android, Windows | ||
* Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified. | ||
*/ | ||
transportMode? : string, | ||
|
||
/** | ||
* 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. | ||
*/ | ||
preferGoogleMaps? : boolean, | ||
|
||
/** | ||
* 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. | ||
*/ | ||
urlScheme? : string, | ||
|
||
/** | ||
* 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. | ||
*/ | ||
backButtonText? : string, | ||
|
||
/** | ||
* iOS | ||
* If true, debug log output will be generated by the plugin. Defaults to false. | ||
*/ | ||
enableDebug? : boolean, | ||
|
||
/** | ||
* Android | ||
* Navigation mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified. | ||
*/ | ||
navigationMode? : string, | ||
|
||
} | ||
|
||
/** | ||
* | ||
* 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). | ||
* | ||
* ``` | ||
* cordova plugin add https://github.com/dpa99c/phonegap-launch-navigator.git | ||
* ``` | ||
* | ||
* @usage | ||
* ```js | ||
* Badge.set(10); | ||
* Badge.increase(); | ||
* Badge.clear(); | ||
* ``` | ||
*/ | ||
@Plugin({ | ||
plugin: 'https://github.com/dpa99c/phonegap-launch-navigator', | ||
pluginRef: 'launchnavigator' | ||
}) | ||
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 | ||
}) | ||
static navigate(destination : any, start : any, options? : launchNavigatorOptions) : Promise<any> { | ||
// This Promise is replaced by one from the @Cordova decorator that wraps | ||
// the plugin's callbacks. We provide a dummy one here so TypeScript | ||
// knows that the correct return type is Promise, because there's no way | ||
// for it to know the return type from a decorator. | ||
// See https://github.com/Microsoft/TypeScript/issues/4881 | ||
return new Promise<any>((res, rej) => {}); | ||
} | ||
|
||
} |