Skip to content

Commit e5769d3

Browse files
authored
Merge pull request #321 from martinhage/master
2 parents 65d062b + 2f9ed33 commit e5769d3

6 files changed

Lines changed: 39 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ on their device. The app supports Apple Maps, Google Maps, Citymapper, Uber, and
3535
- Liftago - `liftago`
3636
- Petal Maps - `petalmaps` (Android only)
3737
- Sygic - `sygic`
38+
- TomTom GO - `tomtomgo` (IOS only)
3839

3940
</details>
4041

src/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const generatePrefixes = ({
3535
petalmaps: 'petalmaps://',
3636
sygic: 'com.sygic.aura://',
3737
here: 'here-route://',
38+
tomtomgo: 'tomtomgo://',
3839
};
3940
};
4041

@@ -72,6 +73,7 @@ export const generateTitles = (
7273
petalmaps: 'Petal Maps',
7374
sygic: 'Sygic',
7475
here: 'Here We Go',
76+
tomtomgo: 'TomTom GO',
7577
...(titles || {}),
7678
};
7779
};
@@ -101,6 +103,7 @@ export const icons: Record<string, ImageRequireSource> = {
101103
petalmaps: require('./images/petalmaps.png'),
102104
sygic: require('./images/sygic.png'),
103105
here: require('./images/here.png'),
106+
tomtomgo: require('./images/tomtomgo.png'),
104107
};
105108

106109
export const appKeys: string[] = Object.keys(icons);

src/images/tomtomgo.png

1.98 KB
Loading

src/type.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export type MapId =
2525
| 'liftago'
2626
| 'petalmaps'
2727
| 'sygic'
28-
| 'here';
28+
| 'here'
29+
| 'tomtomgo';
2930

3031
export type DirectionMode = 'car' | 'walk' | 'public-transport' | 'bike';
3132

src/utils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,15 @@ export const generateMapUrl = ({
567567
url = `https://share.here.com/r/${sourceLat && sourceLng ? `${sourceLat},${sourceLng}/` : ''}${lat},${lng}?m=d`;
568568
}
569569
break;
570+
case 'tomtomgo':
571+
if (address) {
572+
throw new MapsException(
573+
'tomtomgo does not support passing the address or has not been implemented yet.',
574+
);
575+
} else {
576+
url = `${prefixes.tomtomgo}x-callback-url/navigate?destination=${latlng}`;
577+
}
578+
break;
570579
}
571580

572581
return url;

tests/index.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,4 +634,28 @@ describe('showLocation', () => {
634634
);
635635
});
636636
});
637+
describe('tomtomgo', () => {
638+
it('opens with correct url if source is not provided', () => {
639+
verifyThatSettingsLeadToUrl(
640+
{
641+
latitude,
642+
longitude,
643+
app: 'tomtomgo',
644+
},
645+
'tomtomgo://x-callback-url/navigate?destination=123,234',
646+
);
647+
});
648+
it('opens with correct url if source is provided', () => {
649+
verifyThatSettingsLeadToUrl(
650+
{
651+
latitude,
652+
longitude,
653+
sourceLatitude,
654+
sourceLongitude,
655+
app: 'tomtomgo',
656+
},
657+
'tomtomgo://x-callback-url/navigate?destination=123,234',
658+
);
659+
});
660+
});
637661
});

0 commit comments

Comments
 (0)