AOSSIE-Org / AOSSIE-Org/Monumento
Fix inverted logic in makeExpertCall function causing phone dialer launch failure
- Lingua principale
- Dart
- Stelle
- 54
- Fork
- 81
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### 🐛 Describe the bug
The phone call functionality is not working properly in the LocalExpert feature. When users attempt to call an expert by tapping the phone icon, an alert dialog appears instead of launching the phone dialer. Upon investigation, this is caused by inverted conditional logic in the makeExpertCall function.
```
Future makeExpertCall(
LocalExpertEntity expertDetails, BuildContext context) async {
final Uri phoneUri = Uri(scheme: 'tel', path: expertDetails.phoneNumber);
if (!await canLaunchUrl(phoneUri)) {
await launchUrl(phoneUri, mode: LaunchMode.externalApplication);
} else {
showAlertDialog(
context,
"Contact ${expertDetails.name}",
"You can contact ${expertDetails.name} at ${expertDetails.phoneNumber}",
);
}
https://github.com/user-attachments/assets/636e603a-542e-4334-a3c6-b6f98f752070
}
```
The function does not produce an error traceback but exhibits incorrect behavior. The condition is checking
**_!await canLaunchUrl(phoneUri)_** which inverts the logic. The function attempts to launch the URL when canLaunchUrl returns false, and shows the dialog when it returns true, which is the opposite of the intended behavior.
https://github.com/user-attachments/assets/fe13e164-d303-4b74-b44f-83eacf2110e2
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.