|
|
|
@ -41,12 +41,12 @@ class VerificationMethodsScreen extends StatefulWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
ProjectViewModel projectsProvider;
|
|
|
|
late ProjectViewModel projectsProvider;
|
|
|
|
bool isMoreOption = false;
|
|
|
|
bool isMoreOption = false;
|
|
|
|
bool onlySMSBox = false;
|
|
|
|
bool onlySMSBox = false;
|
|
|
|
AuthMethodTypes fingerPrintBefore;
|
|
|
|
AuthMethodTypes? fingerPrintBefore;
|
|
|
|
AuthMethodTypes selectedOption;
|
|
|
|
late AuthMethodTypes selectedOption;
|
|
|
|
AuthenticationViewModel authenticationViewModel;
|
|
|
|
late AuthenticationViewModel authenticationViewModel;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
@ -103,7 +103,7 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
AppText(
|
|
|
|
Helpers.convertToTitleCase(
|
|
|
|
Helpers.convertToTitleCase(
|
|
|
|
authenticationViewModel.user.doctorName),
|
|
|
|
authenticationViewModel.user!.doctorName??''),
|
|
|
|
fontSize: SizeConfig
|
|
|
|
fontSize: SizeConfig
|
|
|
|
.getTextMultiplierBasedOnWidth() *
|
|
|
|
.getTextMultiplierBasedOnWidth() *
|
|
|
|
6,
|
|
|
|
6,
|
|
|
|
@ -187,7 +187,7 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
text: authenticationViewModel
|
|
|
|
text: authenticationViewModel
|
|
|
|
.getType(
|
|
|
|
.getType(
|
|
|
|
authenticationViewModel
|
|
|
|
authenticationViewModel
|
|
|
|
.user
|
|
|
|
.user!
|
|
|
|
.logInTypeID,
|
|
|
|
.logInTypeID,
|
|
|
|
context),
|
|
|
|
context),
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
@ -217,25 +217,25 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
AppText(
|
|
|
|
authenticationViewModel
|
|
|
|
authenticationViewModel
|
|
|
|
.user.editedOn !=
|
|
|
|
.user!.editedOn !=
|
|
|
|
null
|
|
|
|
null
|
|
|
|
? AppDateUtils
|
|
|
|
? AppDateUtils
|
|
|
|
.getDayMonthYearDateFormatted(
|
|
|
|
.getDayMonthYearDateFormatted(
|
|
|
|
AppDateUtils
|
|
|
|
AppDateUtils
|
|
|
|
.convertStringToDate(
|
|
|
|
.convertStringToDate(
|
|
|
|
authenticationViewModel
|
|
|
|
authenticationViewModel
|
|
|
|
.user
|
|
|
|
.user!
|
|
|
|
.editedOn),
|
|
|
|
.editedOn!),
|
|
|
|
isMonthShort: true)
|
|
|
|
isMonthShort: true)
|
|
|
|
: authenticationViewModel
|
|
|
|
: authenticationViewModel
|
|
|
|
.user.createdOn !=
|
|
|
|
.user!.createdOn! !=
|
|
|
|
null
|
|
|
|
null
|
|
|
|
? AppDateUtils.getDayMonthYearDateFormatted(
|
|
|
|
? AppDateUtils.getDayMonthYearDateFormatted(
|
|
|
|
AppDateUtils
|
|
|
|
AppDateUtils
|
|
|
|
.convertStringToDate(
|
|
|
|
.convertStringToDate(
|
|
|
|
authenticationViewModel
|
|
|
|
authenticationViewModel
|
|
|
|
.user
|
|
|
|
.user!
|
|
|
|
.createdOn),
|
|
|
|
.createdOn!),
|
|
|
|
isMonthShort: true)
|
|
|
|
isMonthShort: true)
|
|
|
|
: '--',
|
|
|
|
: '--',
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
@ -248,21 +248,21 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
AppText(
|
|
|
|
authenticationViewModel
|
|
|
|
authenticationViewModel
|
|
|
|
.user.editedOn !=
|
|
|
|
.user!.editedOn! !=
|
|
|
|
null
|
|
|
|
null
|
|
|
|
? AppDateUtils.getHour(AppDateUtils
|
|
|
|
? AppDateUtils.getHour(AppDateUtils
|
|
|
|
.convertStringToDate(
|
|
|
|
.convertStringToDate(
|
|
|
|
authenticationViewModel
|
|
|
|
authenticationViewModel
|
|
|
|
.user.editedOn))
|
|
|
|
.user!.editedOn!))
|
|
|
|
: authenticationViewModel
|
|
|
|
: authenticationViewModel
|
|
|
|
.user.createdOn !=
|
|
|
|
.user!.createdOn! !=
|
|
|
|
null
|
|
|
|
null
|
|
|
|
? AppDateUtils.getHour(
|
|
|
|
? AppDateUtils.getHour(
|
|
|
|
AppDateUtils
|
|
|
|
AppDateUtils
|
|
|
|
.convertStringToDate(
|
|
|
|
.convertStringToDate(
|
|
|
|
authenticationViewModel
|
|
|
|
authenticationViewModel
|
|
|
|
.user
|
|
|
|
.user!
|
|
|
|
.createdOn))
|
|
|
|
.createdOn!))
|
|
|
|
: '--',
|
|
|
|
: '--',
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
fontSize: SizeConfig
|
|
|
|
fontSize: SizeConfig
|
|
|
|
@ -355,8 +355,8 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
SelectedAuthMethodTypesService
|
|
|
|
SelectedAuthMethodTypesService
|
|
|
|
.getMethodsTypeService(
|
|
|
|
.getMethodsTypeService(
|
|
|
|
authenticationViewModel
|
|
|
|
authenticationViewModel
|
|
|
|
.user
|
|
|
|
.user!
|
|
|
|
.logInTypeID),
|
|
|
|
.logInTypeID!),
|
|
|
|
authenticateUser:
|
|
|
|
authenticateUser:
|
|
|
|
(AuthMethodTypes
|
|
|
|
(AuthMethodTypes
|
|
|
|
authMethodType,
|
|
|
|
authMethodType,
|
|
|
|
@ -490,15 +490,12 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sendActivationCodeByOtpNotificationType(
|
|
|
|
sendActivationCodeByOtpNotificationType(AuthMethodTypes authMethodType) async {
|
|
|
|
AuthMethodTypes authMethodType) async {
|
|
|
|
if (authMethodType == AuthMethodTypes.SMS || authMethodType == AuthMethodTypes.WhatsApp) {
|
|
|
|
if (authMethodType == AuthMethodTypes.SMS ||
|
|
|
|
|
|
|
|
authMethodType == AuthMethodTypes.WhatsApp) {
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
|
|
|
|
|
|
|
await authenticationViewModel.sendActivationCodeForDoctorApp(
|
|
|
|
await authenticationViewModel.sendActivationCodeForDoctorApp(
|
|
|
|
authMethodType: authMethodType,
|
|
|
|
authMethodType: authMethodType, password: authenticationViewModel.userInfo.password!);
|
|
|
|
password: authenticationViewModel.userInfo.password);
|
|
|
|
|
|
|
|
if (authenticationViewModel.state == ViewState.ErrorLocal) {
|
|
|
|
if (authenticationViewModel.state == ViewState.ErrorLocal) {
|
|
|
|
Helpers.showErrorToast(authenticationViewModel.error);
|
|
|
|
Helpers.showErrorToast(authenticationViewModel.error);
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
@ -523,12 +520,9 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
Helpers.showErrorToast(authenticationViewModel.error);
|
|
|
|
Helpers.showErrorToast(authenticationViewModel.error);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
await sharedPref.setString(
|
|
|
|
await sharedPref.setString(TOKEN,
|
|
|
|
TOKEN,
|
|
|
|
authenticationViewModel.activationCodeVerificationScreenRes.logInTokenID!);
|
|
|
|
authenticationViewModel
|
|
|
|
if (authMethodType == AuthMethodTypes.SMS || authMethodType == AuthMethodTypes.WhatsApp) {
|
|
|
|
.activationCodeVerificationScreenRes.logInTokenID);
|
|
|
|
|
|
|
|
if (authMethodType == AuthMethodTypes.SMS ||
|
|
|
|
|
|
|
|
authMethodType == AuthMethodTypes.WhatsApp) {
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
this.startSMSService(authMethodType, isSilentLogin: true);
|
|
|
|
this.startSMSService(authMethodType, isSilentLogin: true);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -542,8 +536,7 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
authMethodType == AuthMethodTypes.FaceID) {
|
|
|
|
authMethodType == AuthMethodTypes.FaceID) {
|
|
|
|
fingerPrintBefore = authMethodType;
|
|
|
|
fingerPrintBefore = authMethodType;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.selectedOption =
|
|
|
|
this.selectedOption = (fingerPrintBefore != null ? fingerPrintBefore : authMethodType)!;
|
|
|
|
fingerPrintBefore != null ? fingerPrintBefore : authMethodType;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (authMethodType) {
|
|
|
|
switch (authMethodType) {
|
|
|
|
case AuthMethodTypes.SMS:
|
|
|
|
case AuthMethodTypes.SMS:
|
|
|
|
@ -578,8 +571,8 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
type,
|
|
|
|
type,
|
|
|
|
authenticationViewModel.loggedUser != null
|
|
|
|
authenticationViewModel.loggedUser != null
|
|
|
|
? authenticationViewModel.loggedUser.mobileNumber
|
|
|
|
? authenticationViewModel.loggedUser!.mobileNumber
|
|
|
|
: authenticationViewModel.user.mobile,
|
|
|
|
: authenticationViewModel.user!.mobile,
|
|
|
|
(value) {
|
|
|
|
(value) {
|
|
|
|
showDialog(
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
@ -601,11 +594,9 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
await authenticationViewModel.showIOSAuthMessages();
|
|
|
|
await authenticationViewModel.showIOSAuthMessages();
|
|
|
|
if (!mounted) return;
|
|
|
|
if (!mounted) return;
|
|
|
|
if (authenticationViewModel.user != null &&
|
|
|
|
if (authenticationViewModel.user != null &&
|
|
|
|
(SelectedAuthMethodTypesService.getMethodsTypeService(
|
|
|
|
(SelectedAuthMethodTypesService.getMethodsTypeService(authenticationViewModel.user!.logInTypeID!) ==
|
|
|
|
authenticationViewModel.user.logInTypeID) ==
|
|
|
|
|
|
|
|
AuthMethodTypes.Fingerprint ||
|
|
|
|
AuthMethodTypes.Fingerprint ||
|
|
|
|
SelectedAuthMethodTypesService.getMethodsTypeService(
|
|
|
|
SelectedAuthMethodTypesService.getMethodsTypeService(authenticationViewModel.user!.logInTypeID!) ==
|
|
|
|
authenticationViewModel.user.logInTypeID) ==
|
|
|
|
|
|
|
|
AuthMethodTypes.FaceID)) {
|
|
|
|
AuthMethodTypes.FaceID)) {
|
|
|
|
this.sendActivationCode(authMethodTypes);
|
|
|
|
this.sendActivationCode(authMethodTypes);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -616,19 +607,22 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
checkActivationCode({String value, bool isSilentLogin = false}) async {
|
|
|
|
checkActivationCode({String? value,bool isSilentLogin = false}) async {
|
|
|
|
await authenticationViewModel.checkActivationCodeForDoctorApp(
|
|
|
|
await authenticationViewModel.checkActivationCodeForDoctorApp(activationCode: value!,isSilentLogin: isSilentLogin);
|
|
|
|
activationCode: value, isSilentLogin: isSilentLogin);
|
|
|
|
|
|
|
|
if (authenticationViewModel.state == ViewState.ErrorLocal) {
|
|
|
|
if (authenticationViewModel.state == ViewState.ErrorLocal) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
Navigator.pop(context);
|
|
|
|
Helpers.showErrorToast(authenticationViewModel.error);
|
|
|
|
Helpers.showErrorToast(authenticationViewModel.error);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
await authenticationViewModel.onCheckActivationCodeSuccess();
|
|
|
|
await authenticationViewModel.onCheckActivationCodeSuccess();
|
|
|
|
if(value !=null){
|
|
|
|
if(value !=null){
|
|
|
|
if (Navigator.canPop(context)) Navigator.pop(context);
|
|
|
|
if(Navigator.canPop(context))
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (Navigator.canPop(context)) Navigator.pop(context);
|
|
|
|
if(Navigator.canPop(context))
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
navigateToLandingPage();
|
|
|
|
navigateToLandingPage();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|