|
|
|
|
@ -1,6 +1,9 @@
|
|
|
|
|
import 'dart:io' show Platform;
|
|
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
@ -11,7 +14,6 @@ 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();
|
|
|
|
|
@ -24,8 +26,11 @@ Helpers helpers = Helpers();
|
|
|
|
|
*@desc: Verification Methods widget
|
|
|
|
|
*/
|
|
|
|
|
class VerificationMethods extends StatefulWidget {
|
|
|
|
|
VerificationMethods({this.changeLoadingStata});
|
|
|
|
|
VerificationMethods({this.changeLoadingStata, this.password});
|
|
|
|
|
|
|
|
|
|
final password;
|
|
|
|
|
final Function changeLoadingStata;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_VerificationMethodsState createState() => _VerificationMethodsState();
|
|
|
|
|
}
|
|
|
|
|
@ -267,40 +272,79 @@ class _VerificationMethodsState extends State<VerificationMethods> {
|
|
|
|
|
if (oTPSendType == 1 || oTPSendType == 2) {
|
|
|
|
|
widget.changeLoadingStata(true);
|
|
|
|
|
|
|
|
|
|
ActivationCodeModel activationCodeModel = ActivationCodeModel(
|
|
|
|
|
facilityId: 15,
|
|
|
|
|
generalid: "Cs2020@2016\$2958",
|
|
|
|
|
memberID: _loggedUser['List_MemberInformation'][0]['MemberID'],
|
|
|
|
|
zipCode: _loggedUser['ZipCode'],
|
|
|
|
|
mobileNumber: _loggedUser['MobileNumber'],
|
|
|
|
|
password: widget.password);
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> model = {
|
|
|
|
|
"LogInTokenID": _loggedUser['LogInTokenID'],
|
|
|
|
|
"Channel": 9,
|
|
|
|
|
"MobileNumber": _loggedUser['MobileNumber'],
|
|
|
|
|
"IPAdress": "11.11.11.11",
|
|
|
|
|
"LanguageID": 2,
|
|
|
|
|
"ProjectID": 15, //TODO : this should become daynamci
|
|
|
|
|
"ZipCode": _loggedUser['ZipCode'],
|
|
|
|
|
"UserName": _loggedUser['List_MemberInformation'][0]['MemberID'],
|
|
|
|
|
|
|
|
|
|
"OTP_SendType": oTPSendType
|
|
|
|
|
};
|
|
|
|
|
authProv.sendActivationCodeByOtpNotificationType(model).then((res) {
|
|
|
|
|
widget.changeLoadingStata(false);
|
|
|
|
|
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT,
|
|
|
|
|
arguments: {'model': model});
|
|
|
|
|
} else {
|
|
|
|
|
print(res['ErrorEndUserMessage']);
|
|
|
|
|
helpers.showErrorToast(res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print('$err');
|
|
|
|
|
widget.changeLoadingStata(false);
|
|
|
|
|
try {
|
|
|
|
|
authProv
|
|
|
|
|
.sendActivationCodeForDoctorApp(activationCodeModel)
|
|
|
|
|
.then((res) {
|
|
|
|
|
widget.changeLoadingStata(false);
|
|
|
|
|
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT,
|
|
|
|
|
arguments: {'model': model});
|
|
|
|
|
} else {
|
|
|
|
|
print(res['ErrorEndUserMessage']);
|
|
|
|
|
helpers.showErrorToast(res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catchError((err) {
|
|
|
|
|
print('$err');
|
|
|
|
|
widget.changeLoadingStata(false);
|
|
|
|
|
|
|
|
|
|
helpers.showErrorToast();
|
|
|
|
|
});
|
|
|
|
|
helpers.showErrorToast();
|
|
|
|
|
});
|
|
|
|
|
} catch (e) {}
|
|
|
|
|
|
|
|
|
|
// Map<String, dynamic> model = {
|
|
|
|
|
// "LogInTokenID": _loggedUser['LogInTokenID'],
|
|
|
|
|
// "Channel": 9,
|
|
|
|
|
// "MobileNumber": _loggedUser['MobileNumber'],
|
|
|
|
|
// "IPAdress": "11.11.11.11",
|
|
|
|
|
// "LanguageID": 2,
|
|
|
|
|
// "ProjectID": 15, //TODO : this should become daynamci
|
|
|
|
|
// "ZipCode": _loggedUser['ZipCode'],
|
|
|
|
|
// "UserName": _loggedUser['List_MemberInformation'][0]['MemberID'],
|
|
|
|
|
// "OTP_SendType": oTPSendType
|
|
|
|
|
// };
|
|
|
|
|
// authProv.sendActivationCodeByOtpNotificationType(model).then((res) {
|
|
|
|
|
// widget.changeLoadingStata(false);
|
|
|
|
|
//
|
|
|
|
|
// if (res['MessageStatus'] == 1) {
|
|
|
|
|
// Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT,
|
|
|
|
|
// arguments: {'model': model});
|
|
|
|
|
// } else {
|
|
|
|
|
// print(res['ErrorEndUserMessage']);
|
|
|
|
|
// helpers.showErrorToast(res['ErrorEndUserMessage']);
|
|
|
|
|
// }
|
|
|
|
|
// }).catchError((err) {
|
|
|
|
|
// print('$err');
|
|
|
|
|
// widget.changeLoadingStata(false);
|
|
|
|
|
//
|
|
|
|
|
// helpers.showErrorToast();
|
|
|
|
|
// });
|
|
|
|
|
} else {
|
|
|
|
|
// TODO route to this page with parameters to inicate we should present 2 option
|
|
|
|
|
if (Platform.isAndroid && oTPSendType == 3) {
|
|
|
|
|
helpers.showErrorToast('Your device not support this feature');
|
|
|
|
|
} else {
|
|
|
|
|
Navigator.of(context).pushNamed(VERIFICATION_METHODS,
|
|
|
|
|
arguments: {'verificationMethod': oTPSendType});
|
|
|
|
|
Navigator.of(context).push(MaterialPageRoute(
|
|
|
|
|
builder: (BuildContext context) =>
|
|
|
|
|
VerificationMethodsScreen(password: widget.password,)));
|
|
|
|
|
|
|
|
|
|
// Navigator.of(context).pushNamed(VERIFICATION_METHODS,
|
|
|
|
|
// arguments: {'verificationMethod': oTPSendType});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|