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

✨ Add support for TMAP #267

Merged
merged 1 commit into from
Jan 9, 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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ on their device. The app supports Apple Maps, Google Maps, Citymapper, Uber, and
- Yandex Taxi – `yandex-taxi`
- Yandex Maps – `yandex-maps`
- Kakao Map – `kakaomap`
- TMAP - `tmap`
- Mapy.cz – `mapycz`
- Maps.me – `maps-me`
- OsmAnd - `osmand`
Expand Down Expand Up @@ -70,6 +71,7 @@ Just add this in your `Info.plist` depending on which apps you'd like to support
<string>yandextaxi</string>
<string>yandexmaps</string>
<string>kakaomap</string>
<string>tmap</string>
<string>szn-mapy</string>
<string>mapsme</string>
<string>osmandmaps</string>
Expand Down Expand Up @@ -156,6 +158,10 @@ You can do so by coping the `<queries>` statement below, and pasting it in the t
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="kakaomap" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="tmap" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
Expand Down
1 change: 1 addition & 0 deletions docs/expo.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Add the following to your Expo app's config file. This file is typically named `
"yandextaxi",
"yandexmaps",
"kakaomap",
"tmap",
"szn-mapy",
"mapsme",
"osmandmaps",
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type MapId =
| 'yandex-maps'
| 'yandex-taxi'
| 'kakaomap'
| 'tmap'
| 'mapycz'
| 'maps-me'
| 'osmand'
Expand Down
3 changes: 3 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function generatePrefixes(options) {
'yandex-maps': 'yandexmaps://maps.yandex.ru/',
'yandex-taxi': 'yandextaxi://',
kakaomap: 'kakaomap://',
tmap: 'tmap://',
mapycz: isIOS ? 'szn-mapy://' : 'mapycz://',
'maps-me': 'mapsme://',
osmand: isIOS ? 'osmandmaps://' : 'osmand.geo://',
Expand Down Expand Up @@ -53,6 +54,7 @@ export function generateTitles(titles) {
'yandex-taxi': 'Yandex Taxi',
'yandex-maps': 'Yandex Maps',
kakaomap: 'Kakao Maps',
tmap: 'TMAP',
mapycz: 'Mapy.cz',
'maps-me': 'Maps Me',
osmand: 'OsmAnd',
Expand All @@ -79,6 +81,7 @@ export const icons = {
'yandex-taxi': require('./images/yandex-taxi.png'),
'yandex-maps': require('./images/yandex-maps.png'),
kakaomap: require('./images/kakao-map.png'),
tmap: require('./images/tmap.png'),
mapycz: require('./images/mapycz.png'),
'maps-me': require('./images/maps-me.png'),
osmand: require('./images/osmand.png'),
Expand Down
Binary file added src/images/tmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,13 @@ export async function showLocation(options) {
url = `${prefixes.kakaomap}route?sp=${sourceLat},${sourceLng}&ep=${latlng}&by=CAR`;
}
break;
case 'tmap':
url = `${prefixes.tmap}viewmap?x=${lng}&y=${lat}`;

if (useSourceDestiny) {
url = `${prefixes.tmap}route?startx=${sourceLng}&starty=${sourceLat}&goalx=${lng}&goaly=${lat}`;
}
break;
case 'mapycz':
url = `${prefixes.mapycz}www.mapy.cz/zakladni?x=${lng}&y=${lat}&source=coor&id=${lng},${lat}`;

Expand Down
26 changes: 26 additions & 0 deletions tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,32 @@ describe('showLocation', () => {
});
});

describe('tmap', () => {
it('opens with correct url if source is not provided', () => {
verifyThatSettingsLeadToUrl(
{
latitude,
longitude,
app: 'tmap',
},
'tmap://viewmap?x=234&y=123',
);
});

it('opens with correct url if source is provided', () => {
verifyThatSettingsLeadToUrl(
{
latitude,
longitude,
sourceLatitude,
sourceLongitude,
app: 'tmap',
},
'tmap://route?startx=890&starty=567&goalx=234&goaly=123',
);
});
});

describe('mapycz', () => {
it('opens with correct url if source is not provided', () => {
verifyThatSettingsLeadToUrl(
Expand Down
Loading