You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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<void> 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.
🐛 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.
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.
WhatsApp.Video.2025-04-06.at.23.46.57.mp4