Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support added for Moovit #189

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, osmand, osmandplus, doubleGis, tencent, here, petal, tomtomgo, copilot, sygicTruck, tomtomgofleet, flitsmeister, truckmeister, naver, kakao, tmap, mapyCz, mappls }
private enum class MapType { google, googleGo, amap, baidu, waze, yandexNavi, yandexMaps, citymapper, osmand, osmandplus, doubleGis, tencent, here, petal, tomtomgo, copilot, sygicTruck, tomtomgofleet, flitsmeister, truckmeister, naver, kakao, tmap, mapyCz, mappls, moovit }

private class MapModel(val mapType: MapType, val mapName: String, val packageName: String, val urlPrefix: String) {
fun toMap(): Map<String, String> {
Expand Down Expand Up @@ -53,7 +53,8 @@ class MapLauncherPlugin : FlutterPlugin, MethodCallHandler {
MapModel(MapType.kakao, "Kakao Maps", "net.daum.android.map", "kakaomap://"),
MapModel(MapType.tmap, "TMap", "com.skt.tmap.ku", "tmap://"),
MapModel(MapType.mapyCz, "Mapy CZ", "cz.seznam.mapy", "https://"),
MapModel(MapType.mappls, "Mappls MapmyIndia","com.mmi.maps","mappls://")
MapModel(MapType.mappls, "Mappls MapmyIndia","com.mmi.maps","mappls://"),
MapModel(MapType.moovit, "Moovit","com.tranzmate","moovit://")
)

private fun getInstalledMaps(): List<MapModel> {
Expand Down
9 changes: 9 additions & 0 deletions assets/icons/moovit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion ios/Classes/SwiftMapLauncherPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ private enum MapType: String {
case tmap
case mapyCz
case mappls
case moovit

func type() -> String {
return self.rawValue
Expand Down Expand Up @@ -74,7 +75,8 @@ private let maps: [Map] = [
Map(mapName: "Kakao Maps", mapType: MapType.kakao, urlPrefix: "kakaomap://"),
Map(mapName: "TMap", mapType: MapType.tmap, urlPrefix: "tmap://"),
Map(mapName: "Mapy CZ", mapType: MapType.mapyCz, urlPrefix: "szn-mapy://"),
Map(mapName: "Mappls MapmyIndia", mapType: MapType.mappls, urlPrefix: "mappls://")
Map(mapName: "Mappls MapmyIndia", mapType: MapType.mappls, urlPrefix: "mappls://"),
Map(mapName: "Moovit", mapType: MapType.moovit, urlPrefix: "moovit://")
]

private func getMapByRawMapType(type: String) -> Map? {
Expand Down
9 changes: 9 additions & 0 deletions lib/src/directions_url.dart
Original file line number Diff line number Diff line change
Expand Up @@ -413,5 +413,14 @@ String getMapDirectionsUrl({
'mode': mode,
},
);
case MapType.moovit:
return Utils.buildUrl(
url: "moovit://directions",
queryParams: {
'dest_lat': origin?.latitude.toString(),
'dest_lon': origin?.longitude.toString(),
'dest_name': originTitle
},
);
}
}
10 changes: 10 additions & 0 deletions lib/src/marker_url.dart
Original file line number Diff line number Diff line change
Expand Up @@ -343,5 +343,15 @@ String getMapMarkerUrl({
'https://www.mappls.com/location/${coords.latitude},${coords.longitude}',
queryParams: {},
);

case MapType.moovit:
return Utils.buildUrl(
url: 'moovit://directions',
queryParams: {
'dest_lat': '${coords.latitude}',
'dest_lon': '${coords.longitude}',
'dest_name': title,
},
);
}
}
3 changes: 3 additions & 0 deletions lib/src/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ enum MapType {

// MAPPLS MapmyIndia
mappls,

// Moovit
moovit,
}

/// Defines the supported modes of transportation for [showDirections]
Expand Down