completeWhatsappConnection method
Handles completing whatsapp connection after scanning from another mobile device.
Implementation
Future<void> completeWhatsappConnection() async {
try {
final phone = countryCodeController.text +
phoneNumberController.text.replaceAll('-', '');
getConnectionUrlLoadingStatus.value = true;
// _loadingService.show(status: 'Processing...');
final response =
await _linkingRepository.completeWhatsappConnection(phone);
if (response.status == 'success') {
// _loadingService.dismiss();
getConnectionUrlLoadingStatus.value = false;
//log(response.message.toString());
linkingSuccess.value = response.message ?? '';
getSocialMediaAccounts();
phoneNumberController.clear();
countryCodeController.clear();
update();
// initUniLinks();
// await _loadFromUrl(response.data ?? '');
}
} catch (e) {
if (e is DioError) {
getConnectionUrlLoadingStatus.value = false;
linkingError.value =
e.response?.data['message'] ?? 'Error connecting account';
// _loadingService.showError(
// e.response?.data['message'] ?? 'Error connecting account');
} else {
getConnectionUrlLoadingStatus.value = false;
linkingError.value = 'Error connecting account';
// _loadingService.showError('Error connecting account');
}
getConnectionUrlLoadingStatus.value = false;
// _loadingService.dismiss();
}
}