Skip to content

Commit

Permalink
Merge pull request #281 from ansmlc/master
Browse files Browse the repository at this point in the history
  • Loading branch information
tschoffelen authored Apr 2, 2024
2 parents 9fe43fc + 714457a commit 67c22c0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

</details>

Expand Down Expand Up @@ -84,6 +85,7 @@ Just add this in your `Info.plist` depending on which apps you'd like to support
<string>nmap</string>
<string>dgis</string>
<string>lftgpas</string>
<string>sygic</string>
</array>
```

Expand Down Expand Up @@ -200,6 +202,10 @@ You can do so by coping the `<queries>` statement below, and pasting it in the t
<action android:name="android.intent.action.VIEW" />
<data android:scheme="petalmaps" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="com.sygic.aura" />
</intent>
</queries>
```

Expand Down Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const generatePrefixes = ({
dgis: 'dgis://2gis.ru/',
liftago: 'lftgpas://',
petalmaps: 'petalmaps://',
sygic: 'com.sygic.aura://',
};
};

Expand Down Expand Up @@ -67,6 +68,7 @@ export const generateTitles = (
dgis: '2GIS',
liftago: 'Liftago',
petalmaps: 'Petal Maps',
sygic: 'Sygic',
...(titles || {}),
};
};
Expand Down Expand Up @@ -94,6 +96,7 @@ export const icons: Record<string, number> = {
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);
Expand Down
Binary file added src/images/sygic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> = {
car: 'drive',
walk: 'walk',
'public-transport': 'show',
bike: 'show',
};

return modeMap[directionsMode || ''] || undefined;
};

export const checkOptions = ({
latitude,
longitude,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 67c22c0

Please sign in to comment.