6/22/1
This commit is contained in:
@@ -4,9 +4,7 @@ import 'dart:io';
|
||||
void showInBrowser(String url) async {
|
||||
if (await canLaunchUrl(Uri.parse(url))) {
|
||||
launchUrl(Uri.parse(url));
|
||||
} else {
|
||||
print('Could not launch $url');
|
||||
}
|
||||
} else {}
|
||||
}
|
||||
|
||||
void launchCommunication(
|
||||
@@ -30,7 +28,6 @@ void launchCommunication(
|
||||
'mailto:$contactInfo?subject=Subject&body=${Uri.encodeComponent(message)}';
|
||||
break;
|
||||
default:
|
||||
print('Method not supported on iOS');
|
||||
return;
|
||||
}
|
||||
} else if (Platform.isAndroid) {
|
||||
@@ -49,7 +46,6 @@ void launchCommunication(
|
||||
url =
|
||||
'whatsapp://send?phone=$contactInfo&text=${Uri.encodeComponent(message)}';
|
||||
} else {
|
||||
print('WhatsApp is not installed on this device.');
|
||||
// Provide an alternative action, such as opening the WhatsApp Web API
|
||||
url =
|
||||
'https://api.whatsapp.com/send?phone=$contactInfo&text=${Uri.encodeComponent(message)}';
|
||||
@@ -60,19 +56,13 @@ void launchCommunication(
|
||||
'mailto:$contactInfo?subject=Subject&body=${Uri.encodeComponent(message)}';
|
||||
break;
|
||||
default:
|
||||
print('Method not supported on Android');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
print('Platform not supported');
|
||||
return;
|
||||
}
|
||||
|
||||
print('Launching URL: $url');
|
||||
|
||||
if (await canLaunchUrl(Uri.parse(url))) {
|
||||
await launchUrl(Uri.parse(url));
|
||||
} else {
|
||||
print('Could not launch $url');
|
||||
}
|
||||
} else {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user