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/Neshan Map #179

Open
wants to merge 4 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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Currently supported maps:
</br><img src="https://github.com/mattermoran/map_launcher/raw/master/assets/icons/kakao.svg" width="25"> KakaoMap
</br><img src="https://github.com/mattermoran/map_launcher/raw/master/assets/icons/tmap.svg" width="25"> TMAP
</br><img src="https://github.com/mattermoran/map_launcher/raw/master/assets/icons/mapyCz.svg" width="25"> Mapy.cz
</br><img src="https://github.com/mattermoran/map_launcher/raw/master/assets/icons/neshan.svg" width="25"> Neshan Map

## Get started

Expand Down Expand Up @@ -188,6 +189,7 @@ if (await MapLauncher.isMapAvailable(MapType.google)) {
| `.flitsmeister` | ✓ | ✗ | always uses current location | ✗ | ✗ | ✗ | ✗ |
| `.truckmeister` | ✓ | ✗ | always uses current location | ✗ | ✗ | ✗ | ✗ |
| `.sygicTruck` | ✓ | ✗ | always uses current location | ✗ | ✗ | ✗ | ✗ |
| `.neshan` | ✓ | ✗ | ✓ | ✗ | ✓ | ✗ | ✗ |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you also add an entry into the Show Marker section


### Extra Params
It's possible to pass some map specific query params like api keys etc using `extraParams` option
Expand Down
1 change: 1 addition & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<package android:name="net.daum.android.map" />
<package android:name="com.skt.tmap.ku" />
<package android:name="cz.seznam.mapy" />
<package android:name="org.rajman.neshan.traffic.tehran.navigator" />
</queries>

</manifest>
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 }
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,neshan }

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.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.mapyCz, "Mapy CZ", "cz.seznam.mapy", "https://")
MapModel(MapType.mapyCz, "Mapy CZ", "cz.seznam.mapy", "https://"),
MapModel(MapType.neshan, "Neshan Map", "org.rajman.neshan.traffic.tehran.navigator", "nshn.ir/")
)

private fun getInstalledMaps(): List<MapModel> {
Expand Down
17 changes: 17 additions & 0 deletions assets/icons/neshan.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 41 additions & 17 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,30 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
lints:
dependency: transitive
description:
Expand All @@ -89,39 +113,39 @@ packages:
path: ".."
relative: true
source: path
version: "3.2.1"
version: "3.3.1"
matcher:
dependency: transitive
description:
name: matcher
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.16"
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
version: "1.12.0"
path:
dependency: transitive
description:
name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.8.3"
version: "1.9.0"
path_drawing:
dependency: transitive
description:
Expand Down Expand Up @@ -195,10 +219,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
version: "0.7.0"
vector_math:
dependency: transitive
description:
Expand All @@ -207,14 +231,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
web:
vm_service:
dependency: transitive
description:
name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "0.3.0"
version: "14.2.1"
xml:
dependency: transitive
description:
Expand All @@ -224,5 +248,5 @@ packages:
source: hosted
version: "5.4.1"
sdks:
dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.13.0"
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
4 changes: 3 additions & 1 deletion ios/Classes/SwiftMapLauncherPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ private enum MapType: String {
case kakao
case tmap
case mapyCz
case neshan

func type() -> String {
return self.rawValue
Expand Down Expand Up @@ -72,7 +73,8 @@ private let maps: [Map] = [
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: "Mapy CZ", mapType: MapType.mapyCz, urlPrefix: "szn-mapy://")
Map(mapName: "Mapy CZ", mapType: MapType.mapyCz, urlPrefix: "szn-mapy://"),
Map(mapName: "Neshan Map", mapType: MapType.neshan, urlPrefix: "neshan://")
]

private func getMapByRawMapType(type: String) -> Map? {
Expand Down
23 changes: 23 additions & 0 deletions lib/src/directions_url.dart
Original file line number Diff line number Diff line change
Expand Up @@ -359,5 +359,28 @@ String getMapDirectionsUrl({
'source': 'coor',
},
);
case MapType.neshan:
if (Platform.isIOS) {
return Utils.buildUrl(
url: 'neshan://',
queryParams: {
'origin': Utils.nullOrValue(
origin,
'${origin?.latitude},${origin?.longitude}',
),
'destination': '${destination.latitude},${destination.longitude}',
'vehicle': directionsMode == DirectionsMode.driving ? 'd' : 'm',
...(extraParams ?? {}),
},
);
}
return Utils.buildUrl(
url: 'https://nshn.ir/',
queryParams: {
'origin': '${origin?.latitude},${origin?.longitude}',
'destination': '${destination.latitude},${destination.longitude}',
'vehicle': directionsMode == DirectionsMode.driving ? 'd' : 'm',
},
);
}
}
16 changes: 16 additions & 0 deletions lib/src/marker_url.dart
Original file line number Diff line number Diff line change
Expand Up @@ -336,5 +336,21 @@ String getMapMarkerUrl({
'source': 'coor',
},
);
case MapType.neshan:
if (Platform.isIOS) {
return Utils.buildUrl(
url: 'neshan://',
queryParams: {
'destination': '${coords.latitude},${coords.longitude}',
},
);
}
return Utils.buildUrl(
url: 'https://nshn.ir',
queryParams: {
'lat': '${coords.latitude}',
'lng': '${coords.longitude}',
},
);
}
}
2 changes: 2 additions & 0 deletions lib/src/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ enum MapType {

/// MapyCZ
mapyCz,

neshan
}

/// Defines the supported modes of transportation for [showDirections]
Expand Down
56 changes: 40 additions & 16 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
lints:
dependency: transitive
description:
Expand All @@ -79,34 +103,34 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.16"
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
version: "1.12.0"
path:
dependency: transitive
description:
name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.8.3"
version: "1.9.0"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -156,10 +180,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
version: "0.7.0"
vector_math:
dependency: transitive
description:
Expand All @@ -168,14 +192,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
web:
vm_service:
dependency: transitive
description:
name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "0.3.0"
version: "14.2.1"
sdks:
dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.13.0"
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"