|
|
|
|
@ -10,6 +10,7 @@ import '../../routes.dart';
|
|
|
|
|
import '../../util/dr_app_shared_pref.dart';
|
|
|
|
|
import '../../util/helpers.dart';
|
|
|
|
|
import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
|
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
|
Helpers helpers = Helpers();
|
|
|
|
|
@ -50,7 +51,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
|
|
|
|
|
super.didChangeDependencies();
|
|
|
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
|
|
|
verificationMethod =
|
|
|
|
|
routeArgs != null ? routeArgs['verificationMethod'] : null;
|
|
|
|
|
routeArgs != null ? routeArgs['verificationMethod'] : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -74,8 +75,8 @@ class _VerificationMethodsState extends State<VerificationMethods> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
hideSilentMethods()
|
|
|
|
|
? 'As a first step, you need to verify by one of those methods'
|
|
|
|
|
: 'Please choose one of the Following option to verify',
|
|
|
|
|
? TranslationBase.of(context).firstStep
|
|
|
|
|
: TranslationBase.of(context).pleaseChoose,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 3.5 * SizeConfig.textMultiplier,
|
|
|
|
|
),
|
|
|
|
|
@ -101,17 +102,17 @@ class _VerificationMethodsState extends State<VerificationMethods> {
|
|
|
|
|
child: buildFingerprintMethod(
|
|
|
|
|
context, authProv),
|
|
|
|
|
replacement:
|
|
|
|
|
buildWhatsAppMethod(context, authProv),
|
|
|
|
|
buildWhatsAppMethod(context, authProv),
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: hideSilentMethods() ? false : true,
|
|
|
|
|
child: buildFaceIDMethod(context, authProv),
|
|
|
|
|
replacement:
|
|
|
|
|
buildSMSMethod(context, authProv),
|
|
|
|
|
buildSMSMethod(context, authProv),
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible:
|
|
|
|
|
hideSilentMethods() ? false : true,
|
|
|
|
|
hideSilentMethods() ? false : true,
|
|
|
|
|
child: buildWhatsAppMethod(
|
|
|
|
|
context, authProv)),
|
|
|
|
|
Visibility(
|
|
|
|
|
@ -126,8 +127,8 @@ class _VerificationMethodsState extends State<VerificationMethods> {
|
|
|
|
|
// height: 500,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
// height: 20,
|
|
|
|
|
)
|
|
|
|
|
// height: 20,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
@ -137,7 +138,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*@author: Elham Rababah
|
|
|
|
|
*@author: Elham Rababah
|
|
|
|
|
*@Date:28/5/2020
|
|
|
|
|
*@param: BuildContext context, AuthProvider authProv
|
|
|
|
|
*@return: Center widget
|
|
|
|
|
@ -145,12 +146,15 @@ class _VerificationMethodsState extends State<VerificationMethods> {
|
|
|
|
|
*/
|
|
|
|
|
Center buildSMSMethod(BuildContext context, AuthProvider authProv) {
|
|
|
|
|
return buildVerificationMethod(
|
|
|
|
|
context, 'assets/images/verification_sms_icon.png', 'SMS', () {
|
|
|
|
|
context,
|
|
|
|
|
'assets/images/verification_sms_icon.png',
|
|
|
|
|
TranslationBase.of(context).sms, () {
|
|
|
|
|
sendActivationCodeByOtpNotificationType(1, authProv);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*@author: Elham Rababah
|
|
|
|
|
*@author: Elham Rababah
|
|
|
|
|
*@Date:28/5/2020
|
|
|
|
|
*@param: BuildContext context, AuthProvider authProv
|
|
|
|
|
*@return: Center widget
|
|
|
|
|
@ -158,13 +162,15 @@ class _VerificationMethodsState extends State<VerificationMethods> {
|
|
|
|
|
*/
|
|
|
|
|
Center buildWhatsAppMethod(BuildContext context, AuthProvider authProv) {
|
|
|
|
|
return buildVerificationMethod(
|
|
|
|
|
context, 'assets/images/verification_whatsapp_icon.png', 'WhatsApp',
|
|
|
|
|
() {
|
|
|
|
|
sendActivationCodeByOtpNotificationType(2, authProv);
|
|
|
|
|
});
|
|
|
|
|
context,
|
|
|
|
|
'assets/images/verification_whatsapp_icon.png',
|
|
|
|
|
TranslationBase.of(context).whatsApp, () {
|
|
|
|
|
sendActivationCodeByOtpNotificationType(2, authProv);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
*@author: Elham Rababah
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*@author: Elham Rababah
|
|
|
|
|
*@Date:28/5/2020
|
|
|
|
|
*@param: BuildContext context, AuthProvider authProv
|
|
|
|
|
*@return: Center widget
|
|
|
|
|
@ -172,26 +178,31 @@ class _VerificationMethodsState extends State<VerificationMethods> {
|
|
|
|
|
*/
|
|
|
|
|
Center buildFaceIDMethod(BuildContext context, AuthProvider authProv) {
|
|
|
|
|
return buildVerificationMethod(
|
|
|
|
|
context, 'assets/images/verification_faceid_icon.png', 'Face ID', () {
|
|
|
|
|
context,
|
|
|
|
|
'assets/images/verification_faceid_icon.png',
|
|
|
|
|
TranslationBase.of(context).faceId, () {
|
|
|
|
|
sendActivationCodeByOtpNotificationType(3, authProv);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
*@author: Elham Rababah
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*@author: Elham Rababah
|
|
|
|
|
*@Date:28/5/2020
|
|
|
|
|
*@param: BuildContext context, AuthProvider authProv
|
|
|
|
|
*@return: Center widget
|
|
|
|
|
*@desc: build Fingerprint Methods widget
|
|
|
|
|
*/
|
|
|
|
|
Center buildFingerprintMethod(BuildContext context, AuthProvider authProv) {
|
|
|
|
|
return buildVerificationMethod(context,
|
|
|
|
|
'assets/images/verification_fingerprint_icon.png', 'Fingerprint', () {
|
|
|
|
|
sendActivationCodeByOtpNotificationType(4, authProv);
|
|
|
|
|
});
|
|
|
|
|
return buildVerificationMethod(
|
|
|
|
|
context,
|
|
|
|
|
'assets/images/verification_fingerprint_icon.png',
|
|
|
|
|
TranslationBase.of(context).fingerprint, () {
|
|
|
|
|
sendActivationCodeByOtpNotificationType(4, authProv);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*@author: Elham Rababah
|
|
|
|
|
/*
|
|
|
|
|
*@author: Elham Rababah
|
|
|
|
|
*@Date:28/5/2020
|
|
|
|
|
*@param: BuildContext context, AuthProvider authProv
|
|
|
|
|
*@return: Center widget
|
|
|
|
|
@ -212,7 +223,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
|
|
|
|
|
width: 1,
|
|
|
|
|
color: Hexcolor(
|
|
|
|
|
'#CCCCCC') // <--- border width here
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10))),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
@ -243,20 +254,19 @@ class _VerificationMethodsState extends State<VerificationMethods> {
|
|
|
|
|
return verificationMethod == 4 || verificationMethod == 3 ? true : false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*@author: Elham Rababah
|
|
|
|
|
*@Date:15/4/2020
|
|
|
|
|
/*
|
|
|
|
|
*@author: Elham Rababah
|
|
|
|
|
*@Date:15/4/2020
|
|
|
|
|
*@param: oTPSendType
|
|
|
|
|
*@return:
|
|
|
|
|
*@desc: send Activation Code By Otp Notification Type
|
|
|
|
|
*/
|
|
|
|
|
sendActivationCodeByOtpNotificationType(oTPSendType, AuthProvider authProv) {
|
|
|
|
|
|
|
|
|
|
// TODO : build enum for verfication method
|
|
|
|
|
if (oTPSendType == 1 || oTPSendType == 2) {
|
|
|
|
|
widget.changeLoadingStata(true);
|
|
|
|
|
|
|
|
|
|
Map<String,dynamic> model = {
|
|
|
|
|
Map<String, dynamic> model = {
|
|
|
|
|
"LogInTokenID": _loggedUser['LogInTokenID'],
|
|
|
|
|
"Channel": 9,
|
|
|
|
|
"MobileNumber": _loggedUser['MobileNumber'],
|
|
|
|
|
@ -271,7 +281,8 @@ class _VerificationMethodsState extends State<VerificationMethods> {
|
|
|
|
|
widget.changeLoadingStata(false);
|
|
|
|
|
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, arguments: {'model':model});
|
|
|
|
|
Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT,
|
|
|
|
|
arguments: {'model': model});
|
|
|
|
|
} else {
|
|
|
|
|
print(res['ErrorEndUserMessage']);
|
|
|
|
|
helpers.showErrorToast(res['ErrorEndUserMessage']);
|
|
|
|
|
|