diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..3287bb67 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Flutter", + "request": "launch", + "type": "dart" + } + ] +} \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 02c26fa6..540276ba 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -51,4 +51,5 @@ + diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt index 7ae40d3f..b8a87c8c 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt @@ -1,6 +1,11 @@ package com.cloud.diplomaticquarterapp +import androidx.annotation.NonNull; + import io.flutter.embedding.android.FlutterFragmentActivity + import io.flutter.embedding.engine.FlutterEngine + import io.flutter.plugins.GeneratedPluginRegistrant -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} +class MainActivity: FlutterFragmentActivity() { + override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { + GeneratedPluginRegistrant.registerWith(flutterEngine); + } +} \ No newline at end of file diff --git a/assets/images/login/101.png b/assets/images/login/101.png new file mode 100644 index 00000000..90c1c575 Binary files /dev/null and b/assets/images/login/101.png differ diff --git a/assets/images/login/102.png b/assets/images/login/102.png new file mode 100644 index 00000000..8502d197 Binary files /dev/null and b/assets/images/login/102.png differ diff --git a/assets/images/login/103.png b/assets/images/login/103.png new file mode 100644 index 00000000..3326814b Binary files /dev/null and b/assets/images/login/103.png differ diff --git a/assets/images/login/104.png b/assets/images/login/104.png new file mode 100644 index 00000000..ad55ff74 Binary files /dev/null and b/assets/images/login/104.png differ diff --git a/assets/images/login/fileNum.png b/assets/images/login/fileNum.png new file mode 100644 index 00000000..386299b7 Binary files /dev/null and b/assets/images/login/fileNum.png differ diff --git a/assets/images/login/forget.png b/assets/images/login/forget.png new file mode 100644 index 00000000..57aa7ccc Binary files /dev/null and b/assets/images/login/forget.png differ diff --git a/assets/images/login/id.png b/assets/images/login/id.png new file mode 100644 index 00000000..9260cf11 Binary files /dev/null and b/assets/images/login/id.png differ diff --git a/assets/images/login/nationalID.png b/assets/images/login/nationalID.png new file mode 100644 index 00000000..5779d562 Binary files /dev/null and b/assets/images/login/nationalID.png differ diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 01603a71..4c9e16e5 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -19,7 +19,10 @@ const Map> localizedValues = { 'clinicName': {'en': 'Clinic Name', 'ar': 'اسم العيادة'}, 'doctorName': {'en': 'Doctor Name', 'ar': 'إسم الطبيب'}, 'nearestAppo': {'en': 'Nearest appointment', 'ar': 'أقرب موعد'}, - 'searchByDocText': {'en': 'Type the name of the doctor to help you find him', 'ar': 'اكتب اسم الطبيب لمساعدتك في العثور عليه'}, + 'searchByDocText': { + 'en': 'Type the name of the doctor to help you find him', + 'ar': 'اكتب اسم الطبيب لمساعدتك في العثور عليه' + }, 'enterDocName': {'en': 'Enter Doctor name', 'ar': 'أدخل إسم الطبيب'}, 'search': {'en': 'Search', 'ar': 'بحث'}, 'bookNow': {'en': 'BOOK NOW', 'ar': 'احجز الآن'}, @@ -29,19 +32,23 @@ const Map> localizedValues = { 'gender': {'en': 'Gender', 'ar': 'الجنس'}, 'nationality': {'en': 'nationality', 'ar': 'الجنسية'}, 'docQualifications': {'en': 'Doctor Qualifications', 'ar': 'مؤهلات الطبيب'}, - 'confirmAppoHeading': {'en': 'Kindly confirm your Appointment', 'ar': 'يرجى تأكيد موعدك'}, + 'confirmAppoHeading': { + 'en': 'Kindly confirm your Appointment', + 'ar': 'يرجى تأكيد موعدك' + }, 'patientInfo': {'en': 'Patient Information', 'ar': 'معلومات المريض'}, 'bookSuccess': {'en': 'Book Success', 'ar': 'تم حجز الموعد بنجاح'}, 'patientShare': {'en': 'Patient Share', 'ar': 'المبلغ المستحق'}, - 'patientShareWithTax': {'en': 'Patient Share with Tax', 'ar': 'المبلغ الإجمالي المستحق'}, + 'patientShareWithTax': { + 'en': 'Patient Share with Tax', + 'ar': 'المبلغ الإجمالي المستحق' + }, 'confirmAppo': {'en': 'Confirm Appointment', 'ar': 'تأكيد الموعد'}, 'confirm': {'en': 'Confirm', 'ar': 'تأكيد'}, 'appointment': {'en': 'Appointment', 'ar': 'الموعد'}, 'confirmLater': {'en': 'Confirm Later', 'ar': 'تأكيد لاحقا'}, 'todoList': {'en': 'Todo List', 'ar': 'مهامي'}, 'appoActions': {'en': 'Appointment Actions', 'ar': 'إجراءات الموعد'}, - - 'login': {'en': 'Login', 'ar': 'تسجيل الدخول'}, 'loginregister': {'en': 'Login / Register', 'ar': 'دخولتسجيل'}, 'welcome': {'en': 'Welcome', 'ar': 'أهلا بك'}, @@ -82,5 +89,12 @@ const Map> localizedValues = { "verify-login-with": { "en": "Please choose one of the following options to verify", "ar": "الرجاء اختيار احدى الخيارات التالية للتحقق من البيانات" - } + }, + "register-user": {"en": "Register", "ar": "تسجيل"}, + "verify-with-fingerprint": {"en": "Fingerprint", "ar": "بصمة"}, + "verify-with-faceid": {"en": "Face ID", "ar": "معرف الوجه"}, + "verify-with-sms": {"en": "SMS", "ar": "الرسائل القصيرة"}, + "verify-with-whatsapp": {"en": "Whatsapp", "ar": " الواتس اب"}, + "last-login": {"en": "LAST LOGIN AT:", "ar": "آخر تسجيل دخول"}, + "last-login-with": {"en": "VERIFICATION TYPE:", "ar": "نوع التحقق:"}, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 1e75a802..6826de00 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -5,3 +5,4 @@ const PUSH_TOKEN = 'push-token'; const REGISTER_DATA_FOR_REGISTER = 'register-data-for-register'; const LOGIN_TOKEN_ID = 'register-data-for-register'; const REGISTER_DATA_FOR_LOGIIN = 'register-data-for-login'; +const LAST_LOGIN = 'last-login'; diff --git a/lib/core/model/auth/check_paitent_authentication_req.dart b/lib/models/Authentication/check_paitent_authentication_req.dart similarity index 100% rename from lib/core/model/auth/check_paitent_authentication_req.dart rename to lib/models/Authentication/check_paitent_authentication_req.dart diff --git a/lib/models/Authentication/get_mobile_info_request.dart b/lib/models/Authentication/get_mobile_info_request.dart new file mode 100644 index 00000000..51a58d88 --- /dev/null +++ b/lib/models/Authentication/get_mobile_info_request.dart @@ -0,0 +1,96 @@ +class GetMobileLoginInfoRequest { + int patientMobileNumber; + String mobileNo; + String deviceToken; + int projectOutSA; + int loginType; + String zipCode; + bool isRegister; + String logInTokenID; + int searchType; + int patientID; + String nationalID; + String patientIdentificationID; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + + GetMobileLoginInfoRequest( + {this.patientMobileNumber, + this.mobileNo, + this.deviceToken, + this.projectOutSA, + this.loginType, + this.zipCode, + this.isRegister, + this.logInTokenID, + this.searchType, + this.patientID, + this.nationalID, + this.patientIdentificationID, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); + + GetMobileLoginInfoRequest.fromJson(Map json) { + patientMobileNumber = json['PatientMobileNumber']; + mobileNo = json['MobileNo']; + deviceToken = json['DeviceToken']; + projectOutSA = json['ProjectOutSA']; + loginType = json['LoginType']; + zipCode = json['ZipCode']; + isRegister = json['isRegister']; + logInTokenID = json['LogInTokenID']; + searchType = json['SearchType']; + patientID = json['PatientID']; + nationalID = json['NationalID']; + patientIdentificationID = json['PatientIdentificationID']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMobileNumber'] = this.patientMobileNumber; + data['MobileNo'] = this.mobileNo; + data['DeviceToken'] = this.deviceToken; + data['ProjectOutSA'] = this.projectOutSA; + data['LoginType'] = this.loginType; + data['ZipCode'] = this.zipCode; + data['isRegister'] = this.isRegister; + data['LogInTokenID'] = this.logInTokenID; + data['SearchType'] = this.searchType; + data['PatientID'] = this.patientID; + data['NationalID'] = this.nationalID; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/models/Authentication/get_mobile_info_response.dart b/lib/models/Authentication/get_mobile_info_response.dart new file mode 100644 index 00000000..562c82dd --- /dev/null +++ b/lib/models/Authentication/get_mobile_info_response.dart @@ -0,0 +1,292 @@ +class GetMobileLoginInfoResponse { + Null date; + int languageID; + int serviceName; + Null time; + Null androidLink; + Null authenticationTokenID; + Null data; + bool dataw; + int dietType; + Null errorCode; + Null errorEndUserMessage; + Null errorEndUserMessageN; + Null errorMessage; + int errorType; + int foodCategory; + Null iOSLink; + bool isAuthenticated; + int mealOrderStatus; + int mealType; + int messageStatus; + int numberOfResultRecords; + Null patientBlodType; + Null successMsg; + Null successMsgN; + Null doctorInformationList; + Null getAllPendingRecordsList; + Null getAllSharedRecordsByStatusList; + Null getResponseFileList; + bool isHMGPatient; + bool isLoginSuccessfully; + bool isNeedUpdateIdintificationNo; + bool kioskSendSMS; + Null list; + Null listAskHabibMobileLoginInfo; + Null listAskHabibPatientFile; + Null listMergeFiles; + List listMobileLoginInfo; + Null listPatientCount; + String logInTokenID; + Null mohemmPrivilegeList; + int pateintID; + Null patientBloodType; + bool patientHasFile; + Null patientMergedIDs; + bool patientOutSA; + int patientShareRequestID; + int patientType; + int projectIDOut; + Null returnMessage; + bool sMSLoginRequired; + Null servicePrivilegeList; + Null sharePatientName; + Null verificationCode; + Null email; + Null errorList; + bool hasFile; + bool isActiveCode; + bool isMerged; + bool isNeedUserAgreement; + bool isSMSSent; + Null memberList; + Null message; + int statusCode; + + GetMobileLoginInfoResponse( + {this.date, + this.languageID, + this.serviceName, + this.time, + this.androidLink, + this.authenticationTokenID, + this.data, + this.dataw, + this.dietType, + this.errorCode, + this.errorEndUserMessage, + this.errorEndUserMessageN, + this.errorMessage, + this.errorType, + this.foodCategory, + this.iOSLink, + this.isAuthenticated, + this.mealOrderStatus, + this.mealType, + this.messageStatus, + this.numberOfResultRecords, + this.patientBlodType, + this.successMsg, + this.successMsgN, + this.doctorInformationList, + this.getAllPendingRecordsList, + this.getAllSharedRecordsByStatusList, + this.getResponseFileList, + this.isHMGPatient, + this.isLoginSuccessfully, + this.isNeedUpdateIdintificationNo, + this.kioskSendSMS, + this.list, + this.listAskHabibMobileLoginInfo, + this.listAskHabibPatientFile, + this.listMergeFiles, + this.listMobileLoginInfo, + this.listPatientCount, + this.logInTokenID, + this.mohemmPrivilegeList, + this.pateintID, + this.patientBloodType, + this.patientHasFile, + this.patientMergedIDs, + this.patientOutSA, + this.patientShareRequestID, + this.patientType, + this.projectIDOut, + this.returnMessage, + this.sMSLoginRequired, + this.servicePrivilegeList, + this.sharePatientName, + this.verificationCode, + this.email, + this.errorList, + this.hasFile, + this.isActiveCode, + this.isMerged, + this.isNeedUserAgreement, + this.isSMSSent, + this.memberList, + this.message, + this.statusCode}); + + GetMobileLoginInfoResponse.fromJson(Map json) { + date = json['Date']; + languageID = json['LanguageID']; + serviceName = json['ServiceName']; + time = json['Time']; + androidLink = json['AndroidLink']; + authenticationTokenID = json['AuthenticationTokenID']; + data = json['Data']; + dataw = json['Dataw']; + dietType = json['DietType']; + errorCode = json['ErrorCode']; + errorEndUserMessage = json['ErrorEndUserMessage']; + errorEndUserMessageN = json['ErrorEndUserMessageN']; + errorMessage = json['ErrorMessage']; + errorType = json['ErrorType']; + foodCategory = json['FoodCategory']; + iOSLink = json['IOSLink']; + isAuthenticated = json['IsAuthenticated']; + mealOrderStatus = json['MealOrderStatus']; + mealType = json['MealType']; + messageStatus = json['MessageStatus']; + numberOfResultRecords = json['NumberOfResultRecords']; + patientBlodType = json['PatientBlodType']; + successMsg = json['SuccessMsg']; + successMsgN = json['SuccessMsgN']; + doctorInformationList = json['DoctorInformation_List']; + getAllPendingRecordsList = json['GetAllPendingRecordsList']; + getAllSharedRecordsByStatusList = json['GetAllSharedRecordsByStatusList']; + getResponseFileList = json['GetResponseFileList']; + isHMGPatient = json['IsHMGPatient']; + isLoginSuccessfully = json['IsLoginSuccessfully']; + isNeedUpdateIdintificationNo = json['IsNeedUpdateIdintificationNo']; + kioskSendSMS = json['KioskSendSMS']; + list = json['List']; + listAskHabibMobileLoginInfo = json['List_AskHabibMobileLoginInfo']; + listAskHabibPatientFile = json['List_AskHabibPatientFile']; + listMergeFiles = json['List_MergeFiles']; + if (json['List_MobileLoginInfo'] != null) { + listMobileLoginInfo = new List(); + json['List_MobileLoginInfo'].forEach((v) { + listMobileLoginInfo.add(new ListMobileLoginInfo.fromJson(v)); + }); + } + listPatientCount = json['List_PatientCount']; + logInTokenID = json['LogInTokenID']; + mohemmPrivilegeList = json['MohemmPrivilege_List']; + pateintID = json['PateintID']; + patientBloodType = json['PatientBloodType']; + patientHasFile = json['PatientHasFile']; + patientMergedIDs = json['PatientMergedIDs']; + patientOutSA = json['PatientOutSA']; + patientShareRequestID = json['PatientShareRequestID']; + patientType = json['PatientType']; + projectIDOut = json['ProjectIDOut']; + returnMessage = json['ReturnMessage']; + sMSLoginRequired = json['SMSLoginRequired']; + servicePrivilegeList = json['ServicePrivilege_List']; + sharePatientName = json['SharePatientName']; + verificationCode = json['VerificationCode']; + email = json['email']; + errorList = json['errorList']; + hasFile = json['hasFile']; + isActiveCode = json['isActiveCode']; + isMerged = json['isMerged']; + isNeedUserAgreement = json['isNeedUserAgreement']; + isSMSSent = json['isSMSSent']; + memberList = json['memberList']; + message = json['message']; + statusCode = json['statusCode']; + } + + Map toJson() { + final Map data = new Map(); + data['Date'] = this.date; + data['LanguageID'] = this.languageID; + data['ServiceName'] = this.serviceName; + data['Time'] = this.time; + data['AndroidLink'] = this.androidLink; + data['AuthenticationTokenID'] = this.authenticationTokenID; + data['Data'] = this.data; + data['Dataw'] = this.dataw; + data['DietType'] = this.dietType; + data['ErrorCode'] = this.errorCode; + data['ErrorEndUserMessage'] = this.errorEndUserMessage; + data['ErrorEndUserMessageN'] = this.errorEndUserMessageN; + data['ErrorMessage'] = this.errorMessage; + data['ErrorType'] = this.errorType; + data['FoodCategory'] = this.foodCategory; + data['IOSLink'] = this.iOSLink; + data['IsAuthenticated'] = this.isAuthenticated; + data['MealOrderStatus'] = this.mealOrderStatus; + data['MealType'] = this.mealType; + data['MessageStatus'] = this.messageStatus; + data['NumberOfResultRecords'] = this.numberOfResultRecords; + data['PatientBlodType'] = this.patientBlodType; + data['SuccessMsg'] = this.successMsg; + data['SuccessMsgN'] = this.successMsgN; + data['DoctorInformation_List'] = this.doctorInformationList; + data['GetAllPendingRecordsList'] = this.getAllPendingRecordsList; + data['GetAllSharedRecordsByStatusList'] = + this.getAllSharedRecordsByStatusList; + data['GetResponseFileList'] = this.getResponseFileList; + data['IsHMGPatient'] = this.isHMGPatient; + data['IsLoginSuccessfully'] = this.isLoginSuccessfully; + data['IsNeedUpdateIdintificationNo'] = this.isNeedUpdateIdintificationNo; + data['KioskSendSMS'] = this.kioskSendSMS; + data['List'] = this.list; + data['List_AskHabibMobileLoginInfo'] = this.listAskHabibMobileLoginInfo; + data['List_AskHabibPatientFile'] = this.listAskHabibPatientFile; + data['List_MergeFiles'] = this.listMergeFiles; + if (this.listMobileLoginInfo != null) { + data['List_MobileLoginInfo'] = + this.listMobileLoginInfo.map((v) => v.toJson()).toList(); + } + data['List_PatientCount'] = this.listPatientCount; + data['LogInTokenID'] = this.logInTokenID; + data['MohemmPrivilege_List'] = this.mohemmPrivilegeList; + data['PateintID'] = this.pateintID; + data['PatientBloodType'] = this.patientBloodType; + data['PatientHasFile'] = this.patientHasFile; + data['PatientMergedIDs'] = this.patientMergedIDs; + data['PatientOutSA'] = this.patientOutSA; + data['PatientShareRequestID'] = this.patientShareRequestID; + data['PatientType'] = this.patientType; + data['ProjectIDOut'] = this.projectIDOut; + data['ReturnMessage'] = this.returnMessage; + data['SMSLoginRequired'] = this.sMSLoginRequired; + data['ServicePrivilege_List'] = this.servicePrivilegeList; + data['SharePatientName'] = this.sharePatientName; + data['VerificationCode'] = this.verificationCode; + data['email'] = this.email; + data['errorList'] = this.errorList; + data['hasFile'] = this.hasFile; + data['isActiveCode'] = this.isActiveCode; + data['isMerged'] = this.isMerged; + data['isNeedUserAgreement'] = this.isNeedUserAgreement; + data['isSMSSent'] = this.isSMSSent; + data['memberList'] = this.memberList; + data['message'] = this.message; + data['statusCode'] = this.statusCode; + return data; + } +} + +class ListMobileLoginInfo { + int iD; + int loginType; + + ListMobileLoginInfo({this.iD, this.loginType}); + + ListMobileLoginInfo.fromJson(Map json) { + iD = json['ID']; + loginType = json['LoginType']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['LoginType'] = this.loginType; + return data; + } +} diff --git a/lib/core/model/auth/select_device_imei_res.dart b/lib/models/Authentication/select_device_imei_res.dart similarity index 100% rename from lib/core/model/auth/select_device_imei_res.dart rename to lib/models/Authentication/select_device_imei_res.dart diff --git a/lib/models/Authentication/send_activation_request.dart b/lib/models/Authentication/send_activation_request.dart new file mode 100644 index 00000000..804f6ef0 --- /dev/null +++ b/lib/models/Authentication/send_activation_request.dart @@ -0,0 +1,100 @@ +class SendActivationRequest { + int patientMobileNumber; + String mobileNo; + String deviceToken; + int projectOutSA; + int loginType; + String zipCode; + bool isRegister; + String logInTokenID; + int searchType; + int patientID; + String nationalID; + String patientIdentificationID; + int oTPSendType; + int languageID; + double versionID; + int channel; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + + SendActivationRequest( + {this.patientMobileNumber, + this.mobileNo, + this.deviceToken, + this.projectOutSA, + this.loginType, + this.zipCode, + this.isRegister, + this.logInTokenID, + this.searchType, + this.patientID, + this.nationalID, + this.patientIdentificationID, + this.oTPSendType, + this.languageID, + this.versionID, + this.channel, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); + + SendActivationRequest.fromJson(Map json) { + patientMobileNumber = json['PatientMobileNumber']; + mobileNo = json['MobileNo']; + deviceToken = json['DeviceToken']; + projectOutSA = json['ProjectOutSA']; + loginType = json['LoginType']; + zipCode = json['ZipCode']; + isRegister = json['isRegister']; + logInTokenID = json['LogInTokenID']; + searchType = json['SearchType']; + patientID = json['PatientID']; + nationalID = json['NationalID']; + patientIdentificationID = json['PatientIdentificationID']; + oTPSendType = json['OTP_SendType']; + languageID = json['LanguageID']; + versionID = json['VersionID']; + channel = json['Channel']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMobileNumber'] = this.patientMobileNumber; + data['MobileNo'] = this.mobileNo; + data['DeviceToken'] = this.deviceToken; + data['ProjectOutSA'] = this.projectOutSA; + data['LoginType'] = this.loginType; + data['ZipCode'] = this.zipCode; + data['isRegister'] = this.isRegister; + data['LogInTokenID'] = this.logInTokenID; + data['SearchType'] = this.searchType; + data['PatientID'] = this.patientID; + data['NationalID'] = this.nationalID; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['OTP_SendType'] = this.oTPSendType; + data['LanguageID'] = this.languageID; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 3b02024d..ab2ada4c 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -1,8 +1,9 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/core/model/auth/select_device_imei_res.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/landing/replay_page.dart'; -import 'package:diplomaticquarterapp/providers/auth_provider.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index d6552883..afbc5915 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -1,4 +1,11 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; +import 'package:diplomaticquarterapp/models/Authentication/get_mobile_info_request.dart'; +import 'package:diplomaticquarterapp/models/Authentication/get_mobile_info_response.dart'; +import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -6,9 +13,48 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:flutter/services.dart'; +import 'package:local_auth/local_auth.dart'; -class ConfirmLogin extends StatelessWidget { - static int loginType = 0; +class ConfirmLogin extends StatefulWidget { + @override + _ConfirmLogin createState() => _ConfirmLogin(); +} + +class _ConfirmLogin extends State { + final LocalAuthentication auth = LocalAuthentication(); + List _availableBiometrics; + var sharedPref = new AppSharedPreferences(); + bool authenticated; + final authService = new AuthProvider(); + int mobileNumber; + + var user; + + CheckPatientAuthenticationReq registerd_data; + + var zipCode; + + var patientOutSA; + + var loginTokenID; + + var loginType; + + var deviceToken; + + var lastLogin; + + int selectedOption; + + bool onlySMSBox; + + @override + void initState() { + _getAvailableBiometrics(); + setDefault(); + super.initState(); + } @override Widget build(BuildContext context) { @@ -19,29 +65,43 @@ class ConfirmLogin extends StatelessWidget { padding: EdgeInsets.all(20), child: Column( children: [ + Expanded( + flex: 3, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + 'assets/images/habib-logo.png', + height: 80, + width: 80, + ), + AppText( + TranslationBase.of(context).verifyLoginWith, + fontSize: SizeConfig.textMultiplier * 3.5, + textAlign: TextAlign.left, + ), + ])), Expanded( flex: 4, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset( - 'assets/images/habib-logo.png', - height: 80, - width: 80, - ), - AppText( - TranslationBase.of(context).verifyLoginWith, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.left, - ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: InkWell( - onTap: () => {}, + onTap: () => { + authenticateUser( + 3, BiometricType.face.index) + }, child: RoundedContainer( + backgroundColor: + BiometricType.face.index == 1 + ? Colors.white + : Colors.white.withOpacity(.7), borderColor: Colors.grey, showBorder: true, child: Padding( @@ -52,20 +112,20 @@ class ConfirmLogin extends StatelessWidget { MainAxisAlignment.center, children: [ Image.asset( - 'assets/images/id_card_icon.png', + 'assets/images/login/101.png', height: SizeConfig .imageSizeMultiplier * - 12, + 13, width: SizeConfig .imageSizeMultiplier * - 15, + 16, ), SizedBox( height: 20, ), AppText( TranslationBase.of(context) - .nationalID, + .verifyFaceID, fontSize: SizeConfig.textMultiplier * 2, @@ -75,8 +135,15 @@ class ConfirmLogin extends StatelessWidget { )))), Expanded( child: InkWell( - onTap: () => {}, + onTap: () => { + authenticateUser(2, + BiometricType.fingerprint.index) + }, child: RoundedContainer( + backgroundColor: + BiometricType.fingerprint.index == 1 + ? Colors.white + : Colors.white.withOpacity(.7), borderColor: Colors.grey, showBorder: true, child: Padding( @@ -85,20 +152,20 @@ class ConfirmLogin extends StatelessWidget { child: Column( children: [ Image.asset( - 'assets/images/my_file_white_icon.png', + 'assets/images/login/102.png', height: SizeConfig .imageSizeMultiplier * - 12, + 13, width: SizeConfig .imageSizeMultiplier * - 15, + 16, ), SizedBox( height: 20, ), AppText( TranslationBase.of(context) - .fileNo, + .verifyFingerprint, fontSize: SizeConfig.textMultiplier * 2, @@ -108,18 +175,79 @@ class ConfirmLogin extends StatelessWidget { )))) ], ), - Divider( - color: Colors.grey, - height: 2, + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: InkWell( + onTap: () => {authenticateUser(1, true)}, + child: RoundedContainer( + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB( + 20, 10, 20, 10), + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/login/103.png', + height: SizeConfig + .imageSizeMultiplier * + 13, + width: SizeConfig + .imageSizeMultiplier * + 16, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context) + .verifySMS, + fontSize: + SizeConfig.textMultiplier * + 2, + ) + ], + ), + )))), + Expanded( + child: InkWell( + onTap: () => {authenticateUser(4, true)}, + child: RoundedContainer( + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB( + 25, 10, 25, 10), + child: Column( + children: [ + Image.asset( + 'assets/images/login/104.png', + height: SizeConfig + .imageSizeMultiplier * + 13, + width: SizeConfig + .imageSizeMultiplier * + 16, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context) + .verifyWhatsApp, + fontSize: + SizeConfig.textMultiplier * + 2, + ) + ], + ), + )))) + ], ), - Center( - child: InkWell( - onTap: () => {}, - child: AppText( - TranslationBase.of(context).forgotPassword, - fontSize: SizeConfig.textMultiplier * 3, - margin: 10, - underline: true))) ]), ), Expanded( @@ -127,25 +255,171 @@ class ConfirmLogin extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ - Row( - children: [ - Expanded( - child: RaisedButton( - color: Colors.grey, - textColor: Colors.white, - child: - Text(TranslationBase.of(context).registerNow), - onPressed: () => { - Navigator.of(context).pushNamed( - REGISTER, - ) - }, - )) - ], - ), + // Row( + // children: [ + // Expanded( + // child: RaisedButton( + // color: Colors.grey, + // textColor: Colors.white, + // child: + // Text(TranslationBase.of(context).registerNow), + // onPressed: () => { + // Navigator.of(context).pushNamed( + // REGISTER, + // ) + // }, + // )) + // ], + // ), ], )) ], ))); } + + Future _getAvailableBiometrics() async { + List availableBiometrics; + try { + availableBiometrics = await auth.getAvailableBiometrics(); + } on PlatformException catch (e) { + print(e); + } + if (!mounted) return; + + setState(() { + _availableBiometrics = availableBiometrics; + print(_availableBiometrics); + }); + } + + authenticateUser(type, isActive) { + this.selectedOption = + type; //this.selectedOption && !this.onlySMSBox ? this.selectedOption : this.fingrePrintBefore ? this.fingrePrintBefore : el.value; + + switch (type) { + case 1: + this.loginWithSMS(type, isActive); + break; + case 2: + this.loginWithFingurePrintFace(type, isActive); + break; + case 3: + this.loginWithFingurePrintFace(type, isActive); + break; + case 4: + this.loginWithWhatsapp(type, isActive); + break; + default: + break; + } + sharedPref.setInt(LAST_LOGIN, + type); //this.cs.sharedService.setStorage(this.selectedOption, AuthenticationService.LAST_LOGIN); + } + + loginWithSMS(type, isActive) {} + loginWithFingurePrintFace(type, isActive) async { + if (isActive == 1) { + // this.startBiometricLoginIfAvailable(); + authenticated = await auth.authenticateWithBiometrics( + localizedReason: 'Scan your fingerprint to authenticate', + useErrorDialogs: true, + stickyAuth: true); + print(authenticated); + if (authenticated == true) { + var request = this.getCommonRequest(); + this.getMobileInfo(request); + } + } + } + + loginWithWhatsapp(type, isActive) {} + getMobileInfo(request) { + this + .authService + .getLoginInfo(request) + .then((GetMobileLoginInfoResponse result) => { + if (!result.sMSLoginRequired) + { + this.loginTokenID = result.logInTokenID, + this.patientOutSA = result.patientOutSA, + // sms for register the biometric + if (result.isSMSSent) + { + this.onlySMSBox = false, + //this.button(); + } + else + { + //this.checkActivationCode(); + } + } + else + { + if (result.isAuthenticated) + { + // this.onlySMSBox = false; + // this.cs.sharedService.setSharedData(true, AuthenticationService.ONLY_SMS); + // this.cs.sharedService.setSharedData(this.selectedOption, AuthenticationService.FINGUREPRINT_BEFORE); + // this.cs.confirmLogin(); + // this.button(); + } + else + { + // this.cs.presentAlert(result.ErrorEndUserMessage); + } + } + }); + } + + setDefault() async { + // this.user = this.cs.sharedService.getSharedData( + // AuthenticationService.IMEI_USER_DATA, + // false + // ); + this.registerd_data = await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN); + this.mobileNumber = this.registerd_data != null + ? this.registerd_data.patientMobileNumber + : int.parse(this.user.Mobile); + this.zipCode = this.registerd_data != null + ? this.registerd_data.zipCode + : this.user.OutSA ? "971" : "966"; + this.patientOutSA = this.registerd_data != null + ? this.registerd_data.zipCode == "966" ? 0 : 1 + : this.user.OutSA; + if (this.registerd_data != null) { + this.loginTokenID = sharedPref.getString(LOGIN_TOKEN_ID); + this.loginType = this.registerd_data.searchType; + } + this.deviceToken = sharedPref.getString(PUSH_TOKEN); + this.lastLogin = sharedPref.getInt( + LAST_LOGIN); //this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN); + } + + getCommonRequest() { + var request = SendActivationRequest(); + request.patientMobileNumber = this.mobileNumber; + request.mobileNo = '0' + this.mobileNumber.toString(); + request.deviceToken = this.deviceToken; + request.projectOutSA = this.patientOutSA; + request.loginType = this.selectedOption; + request.zipCode = this.zipCode; + request.isRegister = false; + request.logInTokenID = this.loginTokenID ?? ""; + if (this.registerd_data != null) { + request.searchType = this.registerd_data.searchType == 1 + ? this.registerd_data.searchType + : 1; + request.patientID = this.registerd_data.patientID != 0 + ? this.registerd_data.patientID + : 0; + request.patientIdentificationID = + request.nationalID = this.registerd_data.patientIdentificationID; + } else { + request.searchType = request.searchType == 1 ? request.searchType : 2; + request.patientID = int.parse(this.user.PatientID); + request.patientID = request.nationalID = + request.nationalID != null ? request.nationalID : 0; + } + return request; + } } diff --git a/lib/pages/login/login-type.dart b/lib/pages/login/login-type.dart index c0697099..7a8a940d 100644 --- a/lib/pages/login/login-type.dart +++ b/lib/pages/login/login-type.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; @@ -128,7 +129,7 @@ class LoginType extends StatelessWidget { }, child: AppText( TranslationBase.of(context).forgotPassword, - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier * 2.5, margin: 10, underline: true))) ]), @@ -141,12 +142,9 @@ class LoginType extends StatelessWidget { Row( children: [ Expanded( - child: RaisedButton( - color: Colors.grey, - textColor: Colors.white, - child: - Text(TranslationBase.of(context).registerNow), - onPressed: () => { + child: DefaultButton( + TranslationBase.of(context).registerNow, + () => { Navigator.of(context).pushNamed( REGISTER, ) diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index ad88371b..982d75e3 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -1,18 +1,20 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/model/auth/check_paitent_authentication_req.dart'; +import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; -import 'package:diplomaticquarterapp/providers/auth_provider.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -31,73 +33,77 @@ class _Login extends State { bool isButtonDisabled = true; final authService = new AuthProvider(); var sharedPref = new AppSharedPreferences(); + bool isLoading = false; @override Widget build(BuildContext context) { return AppScaffold( appBarTitle: TranslationBase.of(context).login, isShowAppBar: true, - body: SingleChildScrollView( - child: Container( - padding: EdgeInsets.only(top: 10, left: 20, right: 20), - height: SizeConfig.realScreenHeight * .8, - width: SizeConfig.realScreenWidth, - child: Column(children: [ - Expanded( - flex: 1, - child: AppText( - TranslationBase.of(context).enterNationalId, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.left, - )), - Expanded( - flex: 2, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - MobileNo( - onNumberChange: (value) => - {mobileNo = value, validateForm()}, - onCountryChange: (value) => countryCode = value), - Container( - child: TextFields( - controller: nationalIDorFile, - onChanged: (value) => {validateForm()}, - prefixIcon: Icon( - loginType == 1 - ? Icons.chrome_reader_mode - : Icons.receipt, - color: Colors.red), - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - hintText: loginType == 1 - ? TranslationBase.of(context).nationalID - : TranslationBase.of(context).fileNo, - )) - ], - ), - ), - Expanded( - flex: 2, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Row( + body: isLoading == true + ? AppCircularProgressIndicator() + : SingleChildScrollView( + child: Container( + padding: + EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 20), + height: SizeConfig.realScreenHeight * .9, + width: SizeConfig.realScreenWidth, + child: Column(children: [ + Expanded( + flex: 1, + child: AppText( + TranslationBase.of(context).enterNationalId, + fontSize: SizeConfig.textMultiplier * 3.5, + textAlign: TextAlign.left, + )), + Expanded( + flex: 2, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Expanded( - child: RaisedButton( - color: isButtonDisabled == true - ? Colors.grey - : Colors.grey[600], - textColor: Colors.white, - child: Text(TranslationBase.of(context).login), - onPressed: () => {this.startLogin()}, + MobileNo( + onNumberChange: (value) => + {mobileNo = value, validateForm()}, + onCountryChange: (value) => countryCode = value), + Container( + child: TextFields( + controller: nationalIDorFile, + onChanged: (value) => {validateForm()}, + prefixIcon: Icon( + loginType == 1 + ? Icons.chrome_reader_mode + : Icons.receipt, + color: Colors.red), + padding: EdgeInsets.only( + top: 20, bottom: 20, left: 10, right: 10), + hintText: loginType == 1 + ? TranslationBase.of(context).nationalID + : TranslationBase.of(context).fileNo, )) ], ), - ], - )) - ]), - ))); + ), + Expanded( + flex: 3, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).login, + () => {this.startLogin()}, + color: isButtonDisabled == true + ? Colors.grey + : Colors.grey[600], + textColor: Colors.white, + )) + ], + ), + ], + )) + ]), + ))); } startLogin() { @@ -133,6 +139,7 @@ class _Login extends State { } checkUserAuthentication() { + showLoader(true); var request = CheckPatientAuthenticationReq(); request.isRegister = false; request.patientMobileNumber = int.parse(mobileNo); @@ -148,6 +155,7 @@ class _Login extends State { } sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request); authService.checkPatientAuthentication(request).then((value) => { + showLoader(false), if (value['isSMSSent']) { sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']), @@ -162,4 +170,9 @@ class _Login extends State { } checkActivationCode() {} + showLoader(bool isTrue) { + setState(() { + isLoading = isTrue; + }); + } } diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 6c58ba72..31a4c4a1 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; @@ -25,19 +26,19 @@ class _Register extends State { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).login, + appBarTitle: TranslationBase.of(context).register, isShowAppBar: true, body: SingleChildScrollView( child: Container( - padding: EdgeInsets.only(top: 10, left: 20, right: 20), - height: SizeConfig.realScreenHeight * .8, + padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 20), + height: SizeConfig.realScreenHeight * .9, width: SizeConfig.realScreenWidth, child: Column(children: [ Expanded( flex: 1, child: AppText( TranslationBase.of(context).enterNationalId, - fontSize: SizeConfig.textMultiplier * 3.5, + fontSize: SizeConfig.textMultiplier * 3, textAlign: TextAlign.left, )), Expanded( @@ -111,11 +112,9 @@ class _Register extends State { Row( children: [ Expanded( - child: RaisedButton( - color: Colors.grey, - textColor: Colors.white, - child: Text(TranslationBase.of(context).login), - onPressed: () => {}, + child: DefaultButton( + TranslationBase.of(context).login, + () => {}, )) ], ), diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index 978ff449..250f6d34 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -17,7 +18,7 @@ class WelcomeLogin extends StatelessWidget { child: Column( children: [ Expanded( - flex: 3, + flex: 4, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, @@ -41,35 +42,39 @@ class WelcomeLogin extends StatelessWidget { TranslationBase.of(context).welcomeText2, style: TextStyle(fontSize: 24), textAlign: TextAlign.left, + ), + SizedBox( + height: SizeConfig.realScreenHeight * .2, ) ]), ), Expanded( - flex: 2, + flex: 1, child: Column( - mainAxisAlignment: MainAxisAlignment.end, + // mainAxisAlignment: MainAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ Expanded( - child: RaisedButton( - color: Colors.red[900], - textColor: Colors.white, - child: Text(TranslationBase.of(context).yes), - onPressed: () => { + child: DefaultButton( + TranslationBase.of(context).yes, + () => { Navigator.of(context).pushNamed( LOGIN_TYPE, - ) + ), }, + color: Colors.red[900], + textColor: Colors.white, )) ], ), Row( children: [ Expanded( - child: RaisedButton( - child: Text(TranslationBase.of(context).no), - onPressed: () => { + child: DefaultButton( + TranslationBase.of(context).no, + () => { Navigator.of(context).pushNamed( REGISTER, ) diff --git a/lib/providers/auth_provider.dart b/lib/services/authentication/auth_provider.dart similarity index 75% rename from lib/providers/auth_provider.dart rename to lib/services/authentication/auth_provider.dart index 3590355b..96548939 100644 --- a/lib/providers/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/core/model/auth/check_paitent_authentication_req.dart'; -import 'package:diplomaticquarterapp/core/model/auth/select_device_imei_res.dart'; +import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; +import 'package:diplomaticquarterapp/models/Authentication/get_mobile_info_request.dart'; +import 'package:diplomaticquarterapp/models/Authentication/get_mobile_info_response.dart'; +import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -16,6 +18,7 @@ const String SELECT_DEVICE_IMEI = '/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI'; const String CHECK_PATIENT_AUTH = '/Authentication.svc/REST/CheckPatientAuthentication'; +const GET_MOBILE_INFO = '/Authentication.svc/REST/GetMobileLoginInfo'; class AuthProvider with ChangeNotifier { bool isLogin = false; @@ -121,4 +124,27 @@ class AuthProvider with ChangeNotifier { throw error; } } + + Future getLoginInfo( + GetMobileLoginInfoRequest request) async { + request.versionID = VERSION_ID; + request.channel = CHANNEL; + request.iPAdress = IP_ADDRESS; + request.generalid = GENERAL_ID; + request.languageID = 2; + request.patientOutSA = request.zipCode == '966' ? 0 : 1; + try { + dynamic localRes; + await new BaseAppClient().post(GET_MOBILE_INFO, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request.toJson()); + return Future.value(localRes); + } catch (error) { + print(error); + throw error; + } + } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index fd452325..237e6988 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -54,9 +54,11 @@ class TranslationBase { String get nearestAppo => localizedValues['nearestAppo'][locale.languageCode]; - String get searchByDocText => localizedValues['searchByDocText'][locale.languageCode]; + String get searchByDocText => + localizedValues['searchByDocText'][locale.languageCode]; - String get enterDocName => localizedValues['enterDocName'][locale.languageCode]; + String get enterDocName => + localizedValues['enterDocName'][locale.languageCode]; String get search => localizedValues['search'][locale.languageCode]; @@ -66,29 +68,35 @@ class TranslationBase { String get appoInfo => localizedValues['appoInfo'][locale.languageCode]; - String get availableAppo => localizedValues['availableAppo'][locale.languageCode]; + String get availableAppo => + localizedValues['availableAppo'][locale.languageCode]; String get gender => localizedValues['gender'][locale.languageCode]; String get nationality => localizedValues['nationality'][locale.languageCode]; - String get docQualifications => localizedValues['docQualifications'][locale.languageCode]; + String get docQualifications => + localizedValues['docQualifications'][locale.languageCode]; - String get confirmAppoHeading => localizedValues['confirmAppoHeading'][locale.languageCode]; + String get confirmAppoHeading => + localizedValues['confirmAppoHeading'][locale.languageCode]; String get patientInfo => localizedValues['patientInfo'][locale.languageCode]; String get bookSuccess => localizedValues['bookSuccess'][locale.languageCode]; - String get patientShare => localizedValues['patientShare'][locale.languageCode]; + String get patientShare => + localizedValues['patientShare'][locale.languageCode]; - String get patientShareWithTax => localizedValues['patientShareWithTax'][locale.languageCode]; + String get patientShareWithTax => + localizedValues['patientShareWithTax'][locale.languageCode]; String get confirmAppo => localizedValues['confirmAppo'][locale.languageCode]; String get confirm => localizedValues['confirm'][locale.languageCode]; - String get confirmLater => localizedValues['confirmLater'][locale.languageCode]; + String get confirmLater => + localizedValues['confirmLater'][locale.languageCode]; String get todoList => localizedValues['todoList'][locale.languageCode]; @@ -124,6 +132,18 @@ class TranslationBase { localizedValues['gregorian-date'][locale.languageCode]; String get verifyLoginWith => localizedValues['verify-login-with'][locale.languageCode]; + String get register => localizedValues['register-user'][locale.languageCode]; + String get verifyFingerprint => + localizedValues['verify-with-fingerprint'][locale.languageCode]; + String get verifyFaceID => + localizedValues['verify-with-faceid'][locale.languageCode]; + String get verifySMS => + localizedValues['verify-with-sms'][locale.languageCode]; + String get verifyWhatsApp => + localizedValues['verify-with-whatsapp'][locale.languageCode]; + String get lastLoginAt => localizedValues['last-login'][locale.languageCode]; + String get lastLoginWith => + localizedValues['last-login-with'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/buttons/defaultButton.dart b/lib/widgets/buttons/defaultButton.dart new file mode 100644 index 00000000..bc56f474 --- /dev/null +++ b/lib/widgets/buttons/defaultButton.dart @@ -0,0 +1,26 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/material.dart'; + +class DefaultButton extends StatelessWidget { + final String text; + final Function onPress; + final Color textColor; + final Color color; + DefaultButton(this.text, this.onPress, {this.color, this.textColor}); + @override + Widget build(BuildContext context) { + return Container( + height: 60, + child: RaisedButton( + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), + color: color != null ? color : Colors.grey[700], + textColor: color != null ? textColor : Colors.white, + child: Text( + this.text, + style: TextStyle(fontSize: SizeConfig.textMultiplier * 2), + ), + onPressed: () => this.onPress())); + } +} diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 4a5071d1..24d3bc4f 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -15,7 +15,8 @@ class AppDrawer extends StatefulWidget { class _AppDrawerState extends State { @override Widget build(BuildContext context) { - return FlexibleContainer( + return SizedBox( + width: MediaQuery.of(context).size.width * 0.75, child: Container( color: Colors.white, child: Drawer( diff --git a/pubspec.yaml b/pubspec.yaml index 9a13dcdd..3af9946a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -95,6 +95,7 @@ flutter: assets: - assets/images/ - assets/images/new-design/ + - assets/images/login/ - assets/json/ fonts: