chore: fix ui bug
This commit is contained in:
@@ -38,6 +38,7 @@ import {
|
||||
getLivreurTelegramStatus,
|
||||
generateLivreurLinkToken,
|
||||
unlinkLivreurTelegram,
|
||||
getDeliveryNavLink,
|
||||
} from "../../api/api_delivery";
|
||||
import { geocodeAddress, calculateRoute } from "../../api/tomtom";
|
||||
import type { RouteInfo } from "../../api/tomtom";
|
||||
@@ -520,13 +521,12 @@ export default function DashboardScreen() {
|
||||
}
|
||||
};
|
||||
|
||||
const openNavigation = (address: string) => {
|
||||
const encoded = encodeURIComponent(address);
|
||||
const wazeApp = `waze://?q=${encoded}&navigate=yes`;
|
||||
const wazeWeb = `https://waze.com/ul?q=${encoded}&navigate=yes`;
|
||||
Linking.openURL(wazeApp).catch(() => {
|
||||
Linking.openURL(wazeWeb);
|
||||
});
|
||||
const openNavigation = async (deliveryId: number, address: string) => {
|
||||
const res = await getDeliveryNavLink(deliveryId);
|
||||
const link = res.success && res.waze_app
|
||||
? res.waze_app
|
||||
: `waze://?q=${encodeURIComponent(address)}&navigate=yes`;
|
||||
Linking.openURL(link);
|
||||
};
|
||||
|
||||
// --------------------------------------------------
|
||||
@@ -577,7 +577,7 @@ export default function DashboardScreen() {
|
||||
|
||||
<TouchableOpacity
|
||||
style={styles.addressRow}
|
||||
onPress={() => openNavigation(item.adresse)}
|
||||
onPress={() => openNavigation(item.id, item.adresse)}
|
||||
activeOpacity={0.7}
|
||||
>
|
||||
<Ionicons
|
||||
|
||||
Reference in New Issue
Block a user