Skip to content

Commit

Permalink
remove launchMap method, rename sygic to sygicTruck
Browse files Browse the repository at this point in the history
  • Loading branch information
mattermoran committed Oct 17, 2023
1 parent 83e452b commit aee671e
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 29 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Currently supported maps:
</br><img src="https://github.com/mattermoran/map_launcher/raw/master/assets/icons/copilot.svg" width="25"> CoPilot
</br><img src="https://github.com/mattermoran/map_launcher/raw/master/assets/icons/flitsmeister.svg" width="25"> Flitsmeister (Android only)
</br><img src="https://github.com/mattermoran/map_launcher/raw/master/assets/icons/truckmeister.svg" width="25"> Truckmeister (Android only)
</br><img src="https://github.com/mattermoran/map_launcher/raw/master/assets/icons/sygic.svg" width="25"> Sygic Truck
</br><img src="https://github.com/mattermoran/map_launcher/raw/master/assets/icons/sygicTruck.svg" width="25"> Sygic Truck

## Get started

Expand Down Expand Up @@ -140,7 +140,7 @@ if (await MapLauncher.isMapAvailable(MapType.google)) {
| `.copilot` ||||||
| `.flitsmeister` | ✓ <br /> does not support marker <br /> shows directions instead |||||
| `.truckmeister` | ✓ <br /> does not support marker <br /> shows directions instead |||||
| `.sygic` | ✓ <br /> does not support marker <br /> shows directions instead |||||
| `.sygicTruck` | ✓ <br /> does not support marker <br /> shows directions instead |||||

### Show Directions

Expand Down Expand Up @@ -179,7 +179,7 @@ if (await MapLauncher.isMapAvailable(MapType.google)) {
| `.copilot` ||| always uses current location |||||
| `.flitsmeister` ||| always uses current location |||||
| `.truckmeister` ||| always uses current location |||||
| `.sygic` ||| always uses current location |||||
| `.sygicTruck` ||| always uses current location |||||

### Extra Params
It's possible to pass some map specific query params like api keys etc using `extraParams` option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
import io.flutter.plugin.common.MethodChannel.Result

private enum class MapType { google, googleGo, amap, baidu, waze, yandexNavi, yandexMaps, citymapper, mapswithme, osmand, osmandplus, doubleGis, tencent, here, petal, tomtomgo, copilot, sygic, tomtomgofleet, flitsmeister, truckmeister }
private enum class MapType { google, googleGo, amap, baidu, waze, yandexNavi, yandexMaps, citymapper, mapswithme, osmand, osmandplus, doubleGis, tencent, here, petal, tomtomgo, copilot, sygicTruck, tomtomgofleet, flitsmeister, truckmeister }

private class MapModel(val mapType: MapType, val mapName: String, val packageName: String, val urlPrefix: String) {
fun toMap(): Map<String, String> {
Expand Down Expand Up @@ -56,7 +56,7 @@ class MapLauncherPlugin : FlutterPlugin, MethodCallHandler {
MapModel(MapType.petal, "Petal Maps", "com.huawei.maps.app", "petalmaps://"),
MapModel(MapType.tomtomgo, "TomTom Go", "com.tomtom.gplay.navapp", "tomtomgo://"),
MapModel(MapType.tomtomgofleet, "TomTom Go Fleet", "com.tomtom.gplay.navapp.gofleet", "tomtomgofleet://"),
MapModel(MapType.sygic, "Sygic Truck", "com.sygic.truck", "com.sygic.aura://"),
MapModel(MapType.sygicTruck, "Sygic Truck", "com.sygic.truck", "com.sygic.aura://"),
MapModel(MapType.copilot, "CoPilot", "com.alk.copilot.mapviewer", "copilot://"),
MapModel(MapType.flitsmeister, "Flitsmeister", "nl.flitsmeister", "flitsmeister://"),
MapModel(MapType.truckmeister, "Truckmeister", "nl.flitsmeister.flux", "truckmeister://")
Expand Down
File renamed without changes
4 changes: 2 additions & 2 deletions ios/Classes/SwiftMapLauncherPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private enum MapType: String {
case tomtomgo
case tomtomgofleet
case copilot
case sygic
case sygicTruck

func type() -> String {
return self.rawValue
Expand Down Expand Up @@ -63,7 +63,7 @@ private let maps: [Map] = [
Map(mapName: "HERE WeGo", mapType: MapType.here, urlPrefix: "here-location://"),
Map(mapName: "TomTom Go", mapType: MapType.tomtomgo, urlPrefix: "tomtomgo://"),
Map(mapName: "TomTom Go Fleet", mapType: MapType.tomtomgofleet, urlPrefix: "tomtomgofleet://"),
Map(mapName: "Sygic Truck", mapType: MapType.sygic, urlPrefix: "com.sygic.aura://"),
Map(mapName: "Sygic Truck", mapType: MapType.sygicTruck, urlPrefix: "com.sygic.aura://"),
Map(mapName: "CoPilot", mapType: MapType.copilot, urlPrefix: "copilot://")
]

Expand Down
2 changes: 1 addition & 1 deletion lib/src/directions_url.dart
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ String getMapDirectionsUrl({
},
);

case MapType.sygic:
case MapType.sygicTruck:
// Documentation:
// https://www.sygic.com/developers/professional-navigation-sdk/introduction
return Utils.buildUrl(
Expand Down
15 changes: 0 additions & 15 deletions lib/src/map_launcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@ class MapLauncher {
);
}

@Deprecated('use showMarker instead')
static Future<dynamic> launchMap({
required MapType mapType,
required Coords coords,
required String title,
String? description,
}) {
return showMarker(
mapType: mapType,
coords: coords,
title: title,
description: description,
);
}

/// Opens map app specified in [mapType]
/// and shows marker at [coords]
static Future<dynamic> showMarker({
Expand Down
2 changes: 1 addition & 1 deletion lib/src/marker_url.dart
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ String getMapMarkerUrl({
},
);

case MapType.sygic:
case MapType.sygicTruck:
// Documentation:
// https://www.sygic.com/developers/professional-navigation-sdk/introduction
return Utils.buildUrl(
Expand Down
61 changes: 56 additions & 5 deletions lib/src/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,77 @@ import 'package:map_launcher/src/utils.dart';

/// Defines the map types supported by this plugin
enum MapType {
/// Apple Maps
/// Only available on iOS
apple,

/// Google Maps
google,

/// Google Maps Go
/// Only available on Android
googleGo,

/// Amap (Gaode Maps)
amap,

/// Baidu Maps
baidu,

/// Waze
waze,

/// Yandex Maps
yandexMaps,

/// Yandex Navi
yandexNavi,

/// Citymapper
citymapper,

/// Maps.me
mapswithme,

/// OsmAnd
osmand,

/// OsmAnd+
/// Only available on Android
osmandplus,

/// DoubleGis
doubleGis,

/// Tencent (QQ Maps)
tencent,

/// HERE WeGo
here,

/// Petal Maps
/// Only available on Android
petal,

/// TomTom Go
tomtomgo,
copilot,

/// TomTom Go Fleet
tomtomgofleet,
sygic,

/// CoPilot
copilot,

/// Sygic Truck
sygicTruck,

/// Flitsmeister
/// Only available on Android
flitsmeister,
truckmeister

/// Truckmeister
/// Only available on Android
truckmeister,
}

/// Defines the supported modes of transportation for [showDirections]
Expand All @@ -48,7 +97,8 @@ class Waypoint {
final Coords coords;
final String? title;

Waypoint(double latitude, double longitude, [this.title]) : coords = Coords(latitude, longitude);
Waypoint(double latitude, double longitude, [this.title])
: coords = Coords(latitude, longitude);

double get latitude => coords.latitude;
double get longitude => coords.longitude;
Expand All @@ -68,7 +118,8 @@ class AvailableMap {

/// Parses json object to [AvailableMap]
static AvailableMap? fromJson(json) {
final MapType? mapType = Utils.enumFromString(MapType.values, json['mapType']);
final MapType? mapType =
Utils.enumFromString(MapType.values, json['mapType']);
if (mapType != null) {
return AvailableMap(
mapName: json['mapName'],
Expand Down

0 comments on commit aee671e

Please sign in to comment.