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

Feature/mapy cz #171

Merged
merged 5 commits into from
Mar 7, 2024
Merged
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, mapswithme, osmand, osmandplus, doubleGis, tencent, here, petal, tomtomgo, copilot, sygicTruck, tomtomgofleet, flitsmeister, truckmeister, naver, kakao, tmap }
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, naver, kakao, tmap, mapyCz }

private class MapModel(val mapType: MapType, val mapName: String, val packageName: String, val urlPrefix: String) {
fun toMap(): Map<String, String> {
Expand Down Expand Up @@ -62,7 +62,8 @@ class MapLauncherPlugin : FlutterPlugin, MethodCallHandler {
MapModel(MapType.truckmeister, "Truckmeister", "nl.flitsmeister.flux", "truckmeister://"),
MapModel(MapType.naver, "Naver Map", "com.nhn.android.nmap", "nmap://"),
MapModel(MapType.kakao, "Kakao Maps", "net.daum.android.map", "kakaomap://"),
MapModel(MapType.tmap, "TMap", "com.skt.tmap.ku", "tmap://")
MapModel(MapType.tmap, "TMap", "com.skt.tmap.ku", "tmap://"),
MapModel(MapType.mapyCz, "Mapy CZ", "cz.seznam.mapy", "https://")
)

private fun getInstalledMaps(): List<MapModel> {
Expand Down
1 change: 1 addition & 0 deletions assets/icons/mapyCz.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 @@ -24,6 +24,7 @@ private enum MapType: String {
case naver
case kakao
case tmap
case mapyCz

func type() -> String {
return self.rawValue
Expand Down Expand Up @@ -70,7 +71,8 @@ private let maps: [Map] = [
Map(mapName: "CoPilot", mapType: MapType.copilot, urlPrefix: "copilot://"),
Map(mapName: "Naver Map", mapType: MapType.naver, urlPrefix: "nmap://"),
Map(mapName: "Kakao Maps", mapType: MapType.kakao, urlPrefix: "kakaomap://"),
Map(mapName: "TMap", mapType: MapType.tmap, urlPrefix: "tmap://")
Map(mapName: "TMap", mapType: MapType.tmap, urlPrefix: "tmap://"),
Map(mapName: "Mapy CZ", mapType: MapType.mapyCz, urlPrefix: "szn-mapy://")
]

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 @@ -350,5 +350,14 @@ String getMapDirectionsUrl({
...(extraParams ?? {}),
},
);

case MapType.mapyCz:
return Utils.buildUrl(
url: 'https://mapy.cz/zakladni',
queryParams: {
'id': '${destination.longitude},${destination.latitude}',
'source': 'coor',
},
);
}
}
10 changes: 10 additions & 0 deletions lib/src/marker_url.dart
Original file line number Diff line number Diff line change
Expand Up @@ -326,5 +326,15 @@ String getMapMarkerUrl({
...(extraParams ?? {}),
},
);

case MapType.mapyCz:
return Utils.buildUrl(
url: 'https://mapy.cz/zakladni',
queryParams: {
'id': '${coords.longitude},${coords.latitude}',
'z': '$zoomLevel',
'source': 'coor',
},
);
}
}
3 changes: 3 additions & 0 deletions lib/src/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ enum MapType {

// TMAP
tmap,

/// MapyCZ
mapyCz,
}

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