diff --git a/README.md b/README.md index 7f34a53..a698fb8 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ on their device. The app supports Apple Maps, Google Maps, Citymapper, Uber, and - 2GIS - `dgis` - Liftago - `liftago` - Petal Maps - `petalmaps` (Android only) +- Sygic - `sygic` @@ -84,6 +85,7 @@ Just add this in your `Info.plist` depending on which apps you'd like to support nmap dgis lftgpas + sygic ``` @@ -200,6 +202,10 @@ You can do so by coping the `` statement below, and pasting it in the t + + + + ``` @@ -262,8 +268,9 @@ showLocation({ Notes: - The `sourceLatitude` / `sourceLongitude` options only work if you specify both. Currently supports all apps except Waze. -- `directionsMode` works on google-maps and apple-maps (on the latter, `bike` mode will not work). Without setting it, the app will decide based on his own settings. +- `directionsMode` works on google-maps, apple-maps and sygic (on apple-maps, `bike` mode will not work, while on sygic, only `walk` and `car` will work). Without setting it, the app will decide based on his own settings. - If you set `directionsMode` but do not set `sourceLatitude` and `sourceLongitude`, google-maps and apple-maps will still enter directions mode, and use the current location as starting point. +- ### Or diff --git a/src/constants.ts b/src/constants.ts index 40fc617..bf67255 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -32,6 +32,7 @@ export const generatePrefixes = ({ dgis: 'dgis://2gis.ru/', liftago: 'lftgpas://', petalmaps: 'petalmaps://', + sygic: 'com.sygic.aura://', }; }; @@ -67,6 +68,7 @@ export const generateTitles = ( dgis: '2GIS', liftago: 'Liftago', petalmaps: 'Petal Maps', + sygic: 'Sygic', ...(titles || {}), }; }; @@ -94,6 +96,7 @@ export const icons: Record = { dgis: require('./images/dgis.png'), liftago: require('./images/liftago.png'), petalmaps: require('./images/petalmaps.png'), + sygic: require('./images/sygic.png'), }; export const appKeys: string[] = Object.keys(icons); diff --git a/src/images/sygic.png b/src/images/sygic.png new file mode 100644 index 0000000..775cabb Binary files /dev/null and b/src/images/sygic.png differ diff --git a/src/utils.ts b/src/utils.ts index 35e83e8..d9e2060 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -149,6 +149,19 @@ export const getDirectionsModeGoogleMaps = ( return modeMap[directionsMode || ''] || undefined; }; +export const getDirectionsModeSygic = ( + directionsMode: 'car' | 'walk' | 'public-transport' | 'bike' | undefined, +): string | undefined => { + const modeMap: Record = { + car: 'drive', + walk: 'walk', + 'public-transport': 'show', + bike: 'show', + }; + + return modeMap[directionsMode || ''] || undefined; +}; + export const checkOptions = ({ latitude, longitude, @@ -425,6 +438,11 @@ export const generateMapUrl = ({ url += `&saddr=${sourceLat},${sourceLng}`; } break; + case 'sygic': + const sygicDirectionsMode = getDirectionsModeSygic(directionsMode); + url = `${prefixes.sygic}coordinate|${lng}|${lat}|`; + url += sygicDirectionsMode ? `${sygicDirectionsMode}` : ''; + break; } return url;