mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-05-08 03:19:22 +08:00
feat(launch-navigator): add new methods and constants to match latest plugin API
This commit is contained in:
parent
6f625f9222
commit
29de6b394e
@ -3,52 +3,54 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
export interface LaunchNavigatorOptions {
|
export interface LaunchNavigatorOptions {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* iOS, Android, Windows
|
* name of the navigation app to use for directions. Specify using launchnavigator.APP constants. If not specified, defaults to User Selection.
|
||||||
* 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;
|
app?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* iOS, Android, Windows
|
* nickname to display in app for destination. e.g. "Bob's House".
|
||||||
* Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified.
|
|
||||||
*/
|
*/
|
||||||
transportMode?: string;
|
destinationName?: 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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start point of the navigation
|
* Start point of the navigation
|
||||||
*/
|
*/
|
||||||
start?: string|number[];
|
start?: string|number[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nickname to display in app for start . e.g. "My House".
|
||||||
|
*/
|
||||||
|
startName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified.
|
||||||
|
*/
|
||||||
|
transportMode?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, debug log output will be generated by the plugin. Defaults to false.
|
||||||
|
*/
|
||||||
|
enableDebug?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a key/value map of extra app-specific parameters. For example, to tell Google Maps on Android to display Satellite view in "maps" launch mode: `{"t": "k"}`
|
||||||
|
*/
|
||||||
|
extras?: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Android only) mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified. Specify using launchnavigator.LAUNCH_MODE constants.
|
||||||
|
*/
|
||||||
|
launchMode?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* text to display in the native picker which enables user to select which navigation app to launch. Defaults to "Select app for navigation" if not specified.
|
||||||
|
*/
|
||||||
|
appSelectionDialogHeader?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* text to display for the cancel button in the native picker which enables user to select which navigation app to launch. Defaults to "Cancel" if not specified.
|
||||||
|
*/
|
||||||
|
appSelectionCancelButton?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,12 +59,17 @@ export interface LaunchNavigatorOptions {
|
|||||||
* 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).
|
* 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
|
* @usage
|
||||||
|
* Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper.
|
||||||
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* import {LaunchNavigator} from 'ionic-native';
|
* import {LaunchNavigator, LaunchNavigatorOptions} from 'ionic-native';
|
||||||
*
|
*
|
||||||
|
* let options: LaunchNavigatorOptions = {
|
||||||
|
* start: 'London, ON',
|
||||||
|
* app: LaunchNavigator.APPS.UBER
|
||||||
|
* };
|
||||||
*
|
*
|
||||||
*
|
* LaunchNavigator.navigate("Toronto, ON", options)
|
||||||
* LaunchNavigator.navigate("Toronto, ON", "London, ON")
|
|
||||||
* .then(
|
* .then(
|
||||||
* success => console.log("Launched navigator"),
|
* success => console.log("Launched navigator"),
|
||||||
* error => console.log("Error launching navigator", error)
|
* error => console.log("Error launching navigator", error)
|
||||||
@ -78,7 +85,7 @@ export class LaunchNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Launches navigator app
|
* Launches navigator app
|
||||||
* @param destination {string|number[]} Location name or coordinates
|
* @param destination {string|number[]} Location name or coordinates (as string or array)
|
||||||
* @param options {LaunchNavigatorOptions}
|
* @param options {LaunchNavigatorOptions}
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
@ -91,4 +98,96 @@ export class LaunchNavigator {
|
|||||||
options?: LaunchNavigatorOptions
|
options?: LaunchNavigatorOptions
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if the given app is installed and available on the current device.
|
||||||
|
* @param app {string}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static isAppAvailable(app: string): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list indicating which apps are installed and available on the current device.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static availableApps(): Promise<string[]> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the display name of the specified app.
|
||||||
|
* @param app {string}
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static getAppDisplayName(app: string): string {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns list of supported apps on a given platform.
|
||||||
|
* @param platform {string}
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static getAppsForPlatform(platform: string): string[] {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if an app on a given platform supports specification of transport mode.
|
||||||
|
* @param app {string} specified as a string, you can use one of the constants, e.g `LaunchNavigator.APP.GOOGLE_MAPS`
|
||||||
|
* @param platform {string}
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static supportsTransportMode(app: string, platform: string): boolean {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of transport modes supported by an app on a given platform.
|
||||||
|
* @param app {string}
|
||||||
|
* @param platform {string}
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static getTransportModes(app: string, platform: string): string[] {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if an app on a given platform supports specification of launch mode.
|
||||||
|
* Note that currently only Google Maps on Android does.
|
||||||
|
* @param app {string}
|
||||||
|
* @param platform {string}
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static supportsLaunchMode(app: string, platform: string): boolean {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if an app on a given platform supports specification of start location.
|
||||||
|
* @param app {string}
|
||||||
|
* @param platform {string}
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static supportsStart(app: string, platform: string): boolean {return; }
|
||||||
|
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static supportsStartName(app: string, platform: string): boolean {return; }
|
||||||
|
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static supportsDestName(app: string, platform: string): boolean {return; }
|
||||||
|
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static userSelect(destination: string|number[], options: LaunchNavigatorOptions): void { }
|
||||||
|
|
||||||
|
static APP: any = {
|
||||||
|
USER_SELECT: 'user_select',
|
||||||
|
APPLE_MAPS: 'apple_maps',
|
||||||
|
GOOGLE_MAPS: 'google_maps',
|
||||||
|
WAZE: 'waze',
|
||||||
|
CITYMAPPER: 'citymapper',
|
||||||
|
NAVIGON: 'navigon',
|
||||||
|
TRANSIT_APP: 'transit_app',
|
||||||
|
YANDEX: 'yandex',
|
||||||
|
UBER: 'uber',
|
||||||
|
TOMTOM: 'tomtom',
|
||||||
|
BING_MAPS: 'bing_maps',
|
||||||
|
SYGIC: 'sygic',
|
||||||
|
HERE_MAPS: 'here_maps',
|
||||||
|
MOOVIT: 'moovit'
|
||||||
|
};
|
||||||
|
|
||||||
|
static TRANSPORT_MODE: any = {
|
||||||
|
DRIVING: 'driving',
|
||||||
|
WALKING: 'walking',
|
||||||
|
BICYCLING: 'bicycling',
|
||||||
|
TRANSIT: 'transit'
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user