latest push after master merged

pull/3/head
faizatflutter 2 months ago
parent 1af571705a
commit c6a95fe7d7

@ -40,96 +40,96 @@ class AuthenticationViewModel extends ChangeNotifier {
); );
} }
Future<void> checkUserAuthentication({Function(dynamic)? onSuccess, Function(String)? onError}) async { // Future<void> checkUserAuthentication({Function(dynamic)? onSuccess, Function(String)? onError}) async {
CheckPatientAuthenticationReq checkPatientAuthenticationReq = RequestUtils.getCommonRequestWelcome( // CheckPatientAuthenticationReq checkPatientAuthenticationReq = RequestUtils.getCommonRequestWelcome(
phoneNumber: '0567184134', // phoneNumber: '0567184134',
otpTypeEnum: OTPTypeEnum.sms, // otpTypeEnum: OTPTypeEnum.sms,
deviceToken: 'dummyDeviceToken123', // deviceToken: 'dummyDeviceToken123',
patientOutSA: true, // patientOutSA: true,
loginTokenID: 'dummyLoginToken456', // loginTokenID: 'dummyLoginToken456',
registeredData: null, // registeredData: null,
patientId: 12345, // patientId: 12345,
nationIdText: '1234567890', // nationIdText: '1234567890',
countryCode: 'SA', // countryCode: 'SA',
); // );
//
final result = await authenticationRepo.checkPatientAuthentication(checkPatientAuthenticationReq: checkPatientAuthenticationReq); // final result = await authenticationRepo.checkPatientAuthentication(checkPatientAuthenticationReq: checkPatientAuthenticationReq);
result.fold( // result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure), // (failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) { // (apiResponse) {
if (apiResponse.data['isSMSSent']) { // if (apiResponse.data['isSMSSent']) {
// TODO: set this in AppState // // TODO: set this in AppState
// sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']); // // sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']);
// loginTokenID = value['LogInTokenID'], // // loginTokenID = value['LogInTokenID'],
// sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request), // // sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request),
sendActivationCode(type); // sendActivationCode(type);
} else { // } else {
if (apiResponse.data['IsAuthenticated']) { // if (apiResponse.data['IsAuthenticated']) {
checkActivationCode(onWrongActivationCode: (String? message) {}); // checkActivationCode(onWrongActivationCode: (String? message) {});
} // }
} // }
}, // },
); // );
} // }
Future<void> sendActivationCode({required OTPTypeEnum otpTypeEnum}) async {
var request = RequestUtils.getCommonRequestAuthProvider(
otpTypeEnum: otpTypeEnum,
registeredData: null,
deviceToken: "dummyLoginToken456",
mobileNumber: "0567184134",
zipCode: "SA",
patientOutSA: true,
loginTokenID: "dummyLoginToken456",
selectedOption: selectedOption,
patientId: 12345,
);
request.sMSSignature = await SMSOTP.getSignature(); // Future<void> sendActivationCode({required OTPTypeEnum otpTypeEnum}) async {
selectedOption = type; // var request = RequestUtils.getCommonRequestAuthProvider(
// GifLoaderDialogUtils.showMyDialog(context); // otpTypeEnum: otpTypeEnum,
if (healthId != null || isDubai) { // registeredData: null,
if (!isDubai) { // deviceToken: "dummyLoginToken456",
request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob)); // mobileNumber: "0567184134",
} // zipCode: "SA",
request.healthId = healthId; // patientOutSA: true,
request.isHijri = isHijri; // loginTokenID: "dummyLoginToken456",
await this.apiClient.sendActivationCodeRegister(request).then((result) { // selectedOption: selectedOption,
// patientId: 12345,
// );
//
// request.sMSSignature = await SMSOTP.getSignature();
// selectedOption = type;
// // GifLoaderDialogUtils.showMyDialog(context);
// if (healthId != null || isDubai) {
// if (!isDubai) {
// request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob));
// }
// request.healthId = healthId;
// request.isHijri = isHijri;
// await this.apiClient.sendActivationCodeRegister(request).then((result) {
// // GifLoaderDialogUtils.hideDialog(context);
// if (result != null && result['isSMSSent'] == true) {
// this.startSMSService(type);
// }
// }).catchError((r) {
// GifLoaderDialogUtils.hideDialog(context); // GifLoaderDialogUtils.hideDialog(context);
if (result != null && result['isSMSSent'] == true) { // context.showBottomSheet(
this.startSMSService(type); // child: ExceptionBottomSheet(
} // message: r.toString(),
}).catchError((r) { // onOkPressed: () {
GifLoaderDialogUtils.hideDialog(context); // Navigator.of(context).pop();
context.showBottomSheet( // },
child: ExceptionBottomSheet( // ));
message: r.toString(), // // AppToast.showErrorToast(message: r);
onOkPressed: () { // });
Navigator.of(context).pop(); // } else {
}, // request.dob = "";
)); // request.healthId = "";
// AppToast.showErrorToast(message: r); // request.isHijri = 0;
}); // await this.authService.sendActivationCode(request).then((result) {
} else { // GifLoaderDialogUtils.hideDialog(context);
request.dob = ""; // if (result != null && result['isSMSSent'] == true) {
request.healthId = ""; // this.startSMSService(type);
request.isHijri = 0; // }
await this.authService.sendActivationCode(request).then((result) { // }).catchError((r) {
GifLoaderDialogUtils.hideDialog(context); // GifLoaderDialogUtils.hideDialog(context);
if (result != null && result['isSMSSent'] == true) { // context.showBottomSheet(
this.startSMSService(type); // child: ExceptionBottomSheet(
} // message: r.toString(),
}).catchError((r) { // onOkPressed: () {
GifLoaderDialogUtils.hideDialog(context); // Navigator.of(context).pop();
context.showBottomSheet( // },
child: ExceptionBottomSheet( // ));
message: r.toString(), // // AppToast.showErrorToast(message: r.toString());
onOkPressed: () { // });
Navigator.of(context).pop(); // }
}, // }
));
// AppToast.showErrorToast(message: r.toString());
});
}
}
} }

@ -11,23 +11,17 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/authantication/login.dart';
import 'package:hmg_patient_app_new/presentation/home/data/landing_page_data.dart'; import 'package:hmg_patient_app_new/presentation/home/data/landing_page_data.dart';
import 'package:hmg_patient_app_new/presentation/home/widgets/habib_wallet_card.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/habib_wallet_card.dart';
import 'package:hmg_patient_app_new/presentation/home/widgets/large_service_card.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/large_service_card.dart';
import 'package:hmg_patient_app_new/presentation/home/widgets/small_service_card.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/small_service_card.dart';
import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart';
import 'package:hmg_patient_app_new/providers/authentication_view_model.dart';
import 'package:hmg_patient_app_new/providers/bottom_navigation_provider.dart'; import 'package:hmg_patient_app_new/providers/bottom_navigation_provider.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../core/app_assets.dart';
import '../../core/utils/utils.dart';
import '../../widgets/buttons/custom_button.dart';
import '../../widgets/transitions/fade_page.dart';
class LandingPage extends StatefulWidget { class LandingPage extends StatefulWidget {
const LandingPage({super.key}); const LandingPage({super.key});

Loading…
Cancel
Save