verifyOTP method
void
verifyOTP(
- String otp,
- Widget homeScreen,
- Iwatting iwatting,
- HandleException handleException,
Implementation
void verifyOTP(
String otp,
Widget homeScreen,
Iwatting iwatting,
HandleException handleException,
) async {
updateStatusButton();
iwatting.showWatting();
if (otp == '123456' && Common.phoneNumberInput == Common.fakeLoginPhone) {
if (kDebugMode) {
print('================');
print('|| fake login ||');
print('================');
}
await initAccountModel();
iwatting.hideWatting();
clearData();
isInProcess = false;
await Get.offAll(() => homeScreen);
return;
}
var credential = PhoneAuthProvider.credential(
verificationId: strVerificationId,
smsCode: otp,
);
await auth
.signInWithCredential(credential)
.then((UserCredential result) async {
await initAccountModel();
iwatting.hideWatting();
clearData();
isInProcess = false;
await Get.offAll(() => homeScreen);
}).catchError((e) {
iwatting.hideWatting();
if (handleException.handleExceptionAuth(e)) {
handleExceptionAuth(e, iwatting);
}
isInProcess = false;
update();
});
}