AOSSIE-Org / AOSSIE-Org/Monumento

Fix inverted logic in makeExpertCall function causing phone dialer launch failure

Ouverte
#338 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Dart
Étoiles
54
Forks
81
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

### 🐛 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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.