Patient app update

merge-update-with-lab-changes
haroon amjad 1 year ago
parent 3d44aa2e64
commit 18b4fc5317

@ -210,6 +210,7 @@ dependencies {
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22'
androidTestImplementation "androidx.test:core:1.4.0"
}

Binary file not shown.

Binary file not shown.

@ -34,8 +34,8 @@
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />
<uses-feature android:name="android.hardware.sensor.stepcounter" android:required="false" />
<uses-feature android:name="android.hardware.sensor.stepdetector" android:required="false" />
<uses-feature android:name="android.hardware.sensor.stepcounter" android:required="false" tools:node="replace"/>
<uses-feature android:name="android.hardware.sensor.stepdetector" android:required="false" tools:node="replace"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.INTERNET" />

@ -207,12 +207,12 @@ internal class PenguinView(
.build()
// Set location delegate to handle location updates
PlugAndPlaySDK.setPiLocationDelegate {
// PlugAndPlaySDK.setPiLocationDelegate {
// Example code to handle location updates
// Uncomment and modify as needed
// if (location.size() > 0)
// Toast.makeText(_context, "Location Info Latitude: ${location[0]}, Longitude: ${location[1]}", Toast.LENGTH_SHORT).show()
}
// }
// Set events delegate for reporting issues
PlugAndPlaySDK.setPiEventsDelegate { }
@ -231,14 +231,8 @@ internal class PenguinView(
try {
if (refID.isBlank()) {
Log.e("navigateTo", "Invalid refID: The reference ID is blank.")
}
// referenceId = refID
navigator.navigateTo(mContext, refID,object : RefIdDelegate {
override fun onRefByIDSuccess(PoiId: String?) {
Log.e("navigateTo", "PoiId is penguin view+++++++ $PoiId")

@ -12,6 +12,7 @@ buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://developer.huawei.com/repo/' }
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

@ -1,9 +1,9 @@
# Uncomment this line to define a global platform for your project
platform :ios, '13.0'
platform :ios, '14.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
# use_frameworks! :linkage => :static
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
@ -34,6 +34,7 @@ target 'Runner' do
pod 'OpenTok', '~> 2.22.0'
pod 'VTO2Lib'
pod 'MapboxMaps', '10.18.2'
pod 'FLAnimatedImage'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

@ -31,7 +31,6 @@
76D71B6E2C6B81CC00DAFB84 /* PenguinPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76D71B6D2C6B81CC00DAFB84 /* PenguinPlugin.swift */; };
76D71B702C6B81EA00DAFB84 /* PenguinViewFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76D71B6F2C6B81EA00DAFB84 /* PenguinViewFactory.swift */; };
76F2556127F1FFED0062C1CD /* PassKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76F2556027F1FFED0062C1CD /* PassKit.framework */; };
76F9B0E22C6DED310064C51B /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13E5B711BC29EB6ECCE1964C /* Pods_Runner.framework */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
@ -52,6 +51,7 @@
E9C8C136256BACDA00EFFB62 /* HMG_Guest.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9C8C135256BACDA00EFFB62 /* HMG_Guest.swift */; };
E9E27168256E3A4000F49B69 /* LocalizedFromFlutter.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9E27167256E3A4000F49B69 /* LocalizedFromFlutter.swift */; };
E9F7623B25922BCE00FB5CCF /* FlutterConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9F7623A25922BCE00FB5CCF /* FlutterConstants.swift */; };
FD7241B0D73FB24C87572FAC /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E413842321D0D624872E9BE /* Pods_Runner.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -71,7 +71,6 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
13E5B711BC29EB6ECCE1964C /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
29631B9D2C96C7F600DF5916 /* PenguinNavigator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PenguinNavigator.swift; sourceTree = "<group>"; };
@ -101,6 +100,7 @@
76F2556027F1FFED0062C1CD /* PassKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PassKit.framework; path = System/Library/Frameworks/PassKit.framework; sourceTree = SDKROOT; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
838788A2BEDC4910F4B029A6 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
8E413842321D0D624872E9BE /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -134,13 +134,13 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
76F9B0E22C6DED310064C51B /* Pods_Runner.framework in Frameworks */,
76F2556127F1FFED0062C1CD /* PassKit.framework in Frameworks */,
76815B27275F381C00E66E94 /* HealthKit.framework in Frameworks */,
E9620805255C2ED100D3A35D /* NetworkExtension.framework in Frameworks */,
47C935042C91766A00981BA7 /* PenNavUI.xcframework in Frameworks */,
47C935002C91766800981BA7 /* Penguin.xcframework in Frameworks */,
47C935022C91766900981BA7 /* PenguinINRenderer.xcframework in Frameworks */,
FD7241B0D73FB24C87572FAC /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -166,7 +166,7 @@
76F2556027F1FFED0062C1CD /* PassKit.framework */,
76815B26275F381C00E66E94 /* HealthKit.framework */,
E9620804255C2ED100D3A35D /* NetworkExtension.framework */,
13E5B711BC29EB6ECCE1964C /* Pods_Runner.framework */,
8E413842321D0D624872E9BE /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@ -600,7 +600,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 4.5.95;
MARKETING_VERSION = 4.5.991;
PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -751,7 +751,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 4.5.95;
MARKETING_VERSION = 4.5.991;
PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -794,7 +794,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 4.5.95;
MARKETING_VERSION = 4.5.991;
PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

@ -1,11 +1,6 @@
//
// HMGPenguinInPlatformBridge.swift
// Runner
//
// Created by Haroon Amjad on 13/08/2024.
//
import Foundation
import FLAnimatedImage
var flutterMethodChannelPenguinIn:FlutterMethodChannel? = nil
fileprivate var mainViewController:MainFlutterVC!
@ -34,6 +29,7 @@ class HMGPenguinInPlatformBridge{
if let arguments = methodCall.arguments as Any? {
if methodCall.method == "launchPenguin"{
print("====== launchPenguinView Launched =========")
self.launchPenguinView(arguments: arguments, result: result)
}
} else {
@ -41,8 +37,9 @@ class HMGPenguinInPlatformBridge{
}
}
}
private func launchPenguinView(arguments: Any, result: @escaping FlutterResult) {
let penguinView = PenguinView(
frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height),
viewIdentifier: 0,
@ -53,9 +50,45 @@ class HMGPenguinInPlatformBridge{
let penguinUIView = penguinView.view()
penguinUIView.frame = mainViewController.view.bounds
penguinUIView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
mainViewController.view.addSubview(penguinUIView)
result(nil) // Call result to indicate the method was successfully handled
}
guard let args = arguments as? [String: Any],
let loaderImageData = args["loaderImage"] as? FlutterStandardTypedData else {
print("loaderImage data not found in arguments")
result(FlutterError(code: "ARGUMENT_ERROR", message: "Missing loaderImage data", details: nil))
return
}
let loadingOverlay = UIView(frame: UIScreen.main.bounds)
loadingOverlay.backgroundColor = UIColor.black.withAlphaComponent(0.5) // Semi-transparent overlay
loadingOverlay.autoresizingMask = [.flexibleWidth, .flexibleHeight]
// Display the GIF using FLAnimatedImage
let animatedImage = FLAnimatedImage(animatedGIFData: loaderImageData.data)
let gifImageView = FLAnimatedImageView()
gifImageView.animatedImage = animatedImage
gifImageView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
gifImageView.center = loadingOverlay.center
gifImageView.contentMode = .scaleAspectFit
loadingOverlay.addSubview(gifImageView)
if let window = UIApplication.shared.windows.first {
window.addSubview(loadingOverlay)
} else {
print("Error: Main window not found")
}
penguinView.onSuccess = {
// Hide and remove the loader
DispatchQueue.main.async {
loadingOverlay.removeFromSuperview()
}
}
result(nil)
}
}

@ -1,10 +1,17 @@
//
// BlueGpsView.swift
// Runner
//
// Created by Penguin.
//
import Foundation
import UIKit
import Flutter
@ -14,211 +21,425 @@ import Foundation
import Flutter
import UIKit
/**
* A custom Flutter platform view for displaying Penguin UI components.
* This class integrates with the Penguin navigation SDK and handles UI events.
*/
class PenguinView: NSObject, FlutterPlatformView
, PIEventsDelegate, PenNavInitializationDelegate
class PenguinView: NSObject, FlutterPlatformView, PIEventsDelegate, PenNavInitializationDelegate
{
// The main view displayed within the platform view
private var _view: UIView
private var model: PenguinModel?
private var methodChannel: FlutterMethodChannel
var onSuccess: (() -> Void)?
/**
* Initializes the PenguinView with the provided parameters.
*
* @param frame The frame of the view, specifying its size and position.
* @param viewId A unique identifier for this view instance.
* @param args Optional arguments provided for creating the view.
* @param messenger The [FlutterBinaryMessenger] used for communication with Dart.
*/
init(
frame: CGRect,
viewIdentifier viewId: Int64,
arguments args: Any?,
binaryMessenger messenger: FlutterBinaryMessenger?
) {
_view = UIView()
methodChannel = FlutterMethodChannel(name: "launch_penguin_ui", binaryMessenger: messenger!)
super.init()
// Get the screen's width and height to set the view's frame
let screenWidth = UIScreen.main.bounds.width
let screenHeight = UIScreen.main.bounds.height
// Uncomment to set the background color of the view
// _view.backgroundColor = UIColor.red
// Set the frame of the view to cover the entire screen
_view.frame = CGRect(x: 0, y: 0, width: screenWidth, height: screenHeight)
print("========Inside Penguin View ========")
print(args)
guard let arguments = args as? [String: Any] else {
print("Error: Arguments are not in the expected format.")
return
}
print("===== i got tha Args=======")
// Initialize the model from the arguments
if let penguinModel = PenguinModel(from: arguments) {
self.model = penguinModel
initPenguin(args: penguinModel)
} else {
print("Error: Failed to initialize PenguinModel from arguments ")
}
// Initialize the Penguin SDK with required configurations
// initPenguin( arguments: args)
}
/**
* Initializes the Penguin SDK with custom configuration settings.
*/
func initPenguin(args: PenguinModel) {
// Set the initialization delegate to handle SDK initialization events
PenNavUIManager.shared.initializationDelegate = self
// Configure the Penguin SDK with necessary parameters
PenNavUIManager.shared
.setClientKey(args.clientKey)
.setClientID(args.clientID)
.setUsername(args.username)
.setSimulationModeEnabled(isEnable: args.isSimulationModeEnabled)
.setBaseURL(dataURL: args.dataURL, positionURL: args.positionURL)
.setServiceName(dataServiceName: args.dataServiceName, positionServiceName: args.positionServiceName)
.setIsShowUserName(args.isShowUserName)
.setIsUpdateUserLocationSmoothly(args.isUpdateUserLocationSmoothly)
.setEnableReportIssue(enable: args.isEnableReportIssue)
.setLanguage(args.languageCode)
.setBackButtonVisibility(true)
.build()
}
/**
* Returns the main view associated with this platform view.
*
* @return The UIView instance that represents this platform view.
*/
func view() -> UIView {
return _view
}
// MARK: - PIEventsDelegate Methods
/**
* Called when the Penguin UI is dismissed.
*/
func onPenNavUIDismiss() {
// Handle UI dismissal if needed
print("====== onPenNavUIDismiss =========")
self.view().removeFromSuperview()
}
/**
* Called when a report issue is generated.
*
* @param issue The type of issue reported.
*/
func onReportIssue(_ issue: PenNavUI.IssueType) {
// Handle report issue events if needed
print("====== onReportIssueError =========")
methodChannel.invokeMethod("onReportIssue", arguments: ["issueType": issue])
}
/**
* Called when the Penguin UI setup is successful.
*/
func onPenNavSuccess() {
print("====== onPenNavSuccess =========")
onSuccess?()
methodChannel.invokeMethod("onPenNavSuccess", arguments: nil)
// Obtain the FlutterViewController instance
let controller: FlutterViewController = UIApplication.shared.windows.first?.rootViewController as! FlutterViewController
print("====== after contoller onPenNavSuccess =========")
print("====== after controller onPenNavSuccess =========")
// Set the events delegate to handle SDK events
PenNavUIManager.shared.eventsDelegate = self
print("====== after eventsDelegate onPenNavSuccess =========")
// Present the Penguin UI on top of the Flutter view controller
PenNavUIManager.shared.present(root: controller, view: _view)
print("====== after present onPenNavSuccess =========")
print(model?.clinicID)
print("====== after present onPenNavSuccess =========")
guard let config = self.model else {
print("Error: Config Model is nil")
return
}
guard let clinicID = self.model?.clinicID,
let clientID = self.model?.clientID, !clientID.isEmpty else {
print("Error: Config Client ID is nil or empty")
return
}
let navigator = PenguinNavigator(config: config)
PenNavUIManager.shared.getToken(clientID: config.clientID, clientKey: config.clientKey) { [weak self] token, error in
if let error = error {
let errorMessage = "Token error while getting the for Navigate to method"
print("Failed to get token: \(errorMessage)")
return
}
guard let token = token else {
print("Token is nil")
return
}
print("Token Generated")
print(token);
self?.handleNavigation(clinicID: clinicID, token: token) { success, errorMessage in
if success {
print("Navigation successful")
} else {
print("Navigation failed: \(errorMessage ?? "Unknown error")")
}
}
print("====== after Token onPenNavSuccess =========")
}
}
private func handleNavigation(clinicID: String, token: String, completion: @escaping (Bool, String?) -> Void) {
DispatchQueue.main.async {
PenNavUIManager.shared.setToken(token: token)
PenNavUIManager.shared.navigate(to: clinicID)
completion(true,nil)
}
}
/**
* Called when there is an initialization error with the Penguin UI.
*
* @param errorType The type of initialization error.
* @param errorDescription A description of the error.
*/
func onPenNavInitializationError(errorType: PenNavUI.PenNavUIError, errorDescription: String) {
// Handle initialization errors if needed
print("onPenNavInitializationErrorType: \(errorType.rawValue)")
print("onPenNavInitializationError: \(errorDescription)")
}
}

@ -31,7 +31,7 @@ var BASE_URL = 'https://uat.hmgwebservices.com/';
// var BASE_URL = 'https://webservices.hmg.com/';
// var BASE_URL = 'http://10.200.204.42/';
// var BASE_URL = 'http://10.200.204.42/';
// Pharmacy UAT URLs
// var BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
@ -677,6 +677,11 @@ var GET_DENTAL_INSTRUCTIONS = 'Services/OUTPs.svc/Rest/getProcedureNotification'
var INSERT_WALKIN_APPOINTMENT = "Services/Doctors.svc/REST/InsertWalkinAppointment";
//Usage Agreement APIs
var CHECK_USAGE_AGREEMENT = "Services/Patients.svc/REST/CheckForUsageAgreement";
var GET_USAGE_AGREEMENT = "Services/Patients.svc/REST/GetUsageAgreementText";
var ADD_USAGE_AGREEMENT = "Services/Patients.svc/REST/AddUsageAgreement";
//PAYFORT
var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails";
var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse";

@ -2013,4 +2013,6 @@ const Map localizedValues = {
"searchByBranch": {"en": "Search By Branch Name", "ar": "البحث عن طريق اسم الفرع"},
"hospitalNavigationTitle": {"en": "Hospital", "ar": "الملاحة"},
"hospitalNavigationSubtitle": {"en": "Navigation", "ar": "المستشفى"},
"continueAgreeTerms": {"en": "By continuing, You agree to the above Terms and Conditions.", "ar": "من خلال المتابعة، فإنك توافق على الشروط والأحكام المذكورة أعلاه."},
"agreeText": {"en": "Agree", "ar": "أوافق"},
};

@ -48,7 +48,7 @@ class ProjectViewModel extends BaseViewModel {
GetAdmissionInfoResponseModel getAdmissionInfoResponseModel = GetAdmissionInfoResponseModel();
GetAdmissionRequestInfoResponseModel getAdmissionRequestInfoResponseModel = GetAdmissionRequestInfoResponseModel();
bool isIndoorNavigationEnabled = false;
bool isIndoorNavigationEnabled = true;
int waitingAppointmentProjectID = 0;
DoctorList? waitingAppointmentDoctor;

@ -204,7 +204,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
Permission.bluetoothScan,
Permission.activityRecognition,
].request().whenComplete(() {
PenguinMethodChannel.launch("penguin", widget.projectViewModel!.isArabic ? "ar" : "en", widget.projectViewModel!.authenticatedUserObject.user.patientID.toString(), details: data);
PenguinMethodChannel().launch("penguin", widget.projectViewModel!.isArabic ? "ar" : "en", widget.projectViewModel!.authenticatedUserObject.user.patientID.toString(), details: data);
});
}
}

@ -576,7 +576,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
Permission.bluetoothScan,
Permission.activityRecognition,
].request().whenComplete(() {
PenguinMethodChannel.launch("penguin", projectViewModel.isArabic ? "ar" : "en", projectViewModel.authenticatedUserObject.user.patientID.toString(), details: data);
PenguinMethodChannel().launch("penguin", projectViewModel.isArabic ? "ar" : "en", projectViewModel.authenticatedUserObject.user.patientID.toString(), details: data);
});
}
}

@ -33,6 +33,11 @@ class _HomePageState2 extends State<HomePage2> {
PharmacyModuleViewModel pharmacyModuleViewModel = locator<PharmacyModuleViewModel>();
late ProjectViewModel projectViewModel;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);

@ -216,7 +216,7 @@ class ServicesView extends StatelessWidget {
Permission.bluetoothScan,
Permission.activityRecognition,
].request().whenComplete(() {
PenguinMethodChannel.launch("penguin", projectViewModel.isArabic ? "ar" : "en", projectViewModel.authenticatedUserObject.user.patientID.toString());
PenguinMethodChannel().launch("penguin", projectViewModel.isArabic ? "ar" : "en", projectViewModel.authenticatedUserObject.user.patientID.toString());
});
} //
}

@ -19,6 +19,7 @@ import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_requ
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/login/login.dart';
import 'package:diplomaticquarterapp/pages/login/register_new.dart';
import 'package:diplomaticquarterapp/pages/login/user-login-agreement-page.dart';
import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
@ -48,11 +49,7 @@ class ConfirmLogin extends StatefulWidget {
final fromRegistration;
final bool isDubai;
const ConfirmLogin({Key? key,
this.changePageViewIndex,
this.fromRegistration = false,
this.isDubai = false})
: super(key: key);
const ConfirmLogin({Key? key, this.changePageViewIndex, this.fromRegistration = false, this.isDubai = false}) : super(key: key);
@override
_ConfirmLogin createState() => _ConfirmLogin();
@ -64,8 +61,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
var sharedPref = AppSharedPreferences();
bool authenticated = false;
final authService = AuthProvider();
PharmacyModuleViewModel pharmacyModuleViewModel =
locator<PharmacyModuleViewModel>();
PharmacyModuleViewModel pharmacyModuleViewModel = locator<PharmacyModuleViewModel>();
late int mobileNumber;
String errorMsg = '';
SelectDeviceIMEIRES? user;
@ -95,10 +91,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
int fingrePrintBefore = 0;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AppointmentRateViewModel appointmentRateViewModel =
locator<AppointmentRateViewModel>();
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AppointmentRateViewModel appointmentRateViewModel = locator<AppointmentRateViewModel>();
late ProjectViewModel projectViewModel;
late ToDoCountProviderModel toDoProvider;
@ -145,35 +139,17 @@ class _ConfirmLogin extends State<ConfirmLogin> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase
.of(context)
.welcomeBack,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.64),
TranslationBase.of(context).welcomeBack,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64),
),
Text(
user!.name!.toLowerCase().capitalizeFirstofEach,
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w700,
color: Color(0xff2B353E),
height: 1,
letterSpacing: -1.44),
style: TextStyle(fontSize: 24, fontWeight: FontWeight.w700, color: Color(0xff2B353E), height: 1, letterSpacing: -1.44),
),
SizedBox(height: 10),
Text(
TranslationBase
.of(context)
.accountInfo,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.64,
height: 25 / 16),
TranslationBase.of(context).accountInfo,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 25 / 16),
),
Container(
height: 72,
@ -192,48 +168,28 @@ class _ConfirmLogin extends State<ConfirmLogin> {
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
TranslationBase
.of(context)
.lastLoginAt
.toCamelCase,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.64),
TranslationBase.of(context).lastLoginAt.toCamelCase,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64),
),
Text(
// user!.editedOn != null
// ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user!.editedOn!))
// :
user!.createdOn != null
? DateUtil.getDayMonthYearDateFormatted(
DateUtil.convertStringToDate(
user!.createdOn!))
: '--',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.48),
user!.createdOn != null ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user!.createdOn!)) : '--',
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48),
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
TranslationBase
.of(context)
.lastLoginWith
.toCamelCase,
TranslationBase.of(context).lastLoginWith.toCamelCase,
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.w600,
@ -256,17 +212,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
// user!.editedOn!),
// false)
// :
user!.createdOn != null
? DateUtil.formatDateToTimeLang(
DateUtil.convertStringToDate(
user!.createdOn!),
false)
: '--',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xff575757),
letterSpacing: -0.48),
user!.createdOn != null ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user!.createdOn!), false) : '--',
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48),
),
],
)
@ -274,21 +221,11 @@ class _ConfirmLogin extends State<ConfirmLogin> {
),
),
Text(
TranslationBase
.of(context)
.pleaseVerify,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
letterSpacing: -0.64),
TranslationBase.of(context).pleaseVerify,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64),
),
GridView(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 13,
mainAxisSpacing: 9),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9),
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(top: 9),
shrinkWrap: true,
@ -302,67 +239,40 @@ class _ConfirmLogin extends State<ConfirmLogin> {
],
)
else
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Image.asset(
'assets/images/habib-logo.png',
height: 90,
width: 90,
),
SizedBox(height: 23),
this.onlySMSBox == false
? Text(
TranslationBase
.of(context)
.verifyLoginWith,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.64,
height: 25 / 16),
)
: Text(
TranslationBase
.of(context)
.verifyFingerprint2,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.64,
height: 25 / 16),
),
SizedBox(height: 23),
Text(
TranslationBase
.of(context)
.pleaseVerify,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
letterSpacing: -0.64),
),
GridView(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 13,
mainAxisSpacing: 9),
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(top: 9),
shrinkWrap: true,
children: [
if (onlySMSBox == false) getButton(3),
if (onlySMSBox == false) getButton(2),
getButton(1),
getButton(4),
],
),
]),
Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
Image.asset(
'assets/images/habib-logo.png',
height: 90,
width: 90,
),
SizedBox(height: 23),
this.onlySMSBox == false
? Text(
TranslationBase.of(context).verifyLoginWith,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 25 / 16),
)
: Text(
TranslationBase.of(context).verifyFingerprint2,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 25 / 16),
),
SizedBox(height: 23),
Text(
TranslationBase.of(context).pleaseVerify,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64),
),
GridView(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9),
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(top: 9),
shrinkWrap: true,
children: [
if (onlySMSBox == false) getButton(3),
if (onlySMSBox == false) getButton(2),
getButton(1),
getButton(4),
],
),
]),
],
),
),
@ -370,13 +280,10 @@ class _ConfirmLogin extends State<ConfirmLogin> {
height: 12,
),
DefaultButton(
TranslationBase
.of(context)
.useAnotherAccount,
() {
TranslationBase.of(context).useAnotherAccount,
() {
Navigator.of(context).pushNamed(LOGIN_TYPE);
projectViewModel.analytics.loginRegistration
.login_with_other_account();
projectViewModel.analytics.loginRegistration.login_with_other_account();
},
),
],
@ -387,8 +294,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
Future<void> _getAvailableBiometrics() async {
final bool canAuthenticateWithBiometrics = await auth.canCheckBiometrics;
final bool canAuthenticate =
canAuthenticateWithBiometrics || await auth.isDeviceSupported();
final bool canAuthenticate = canAuthenticateWithBiometrics || await auth.isDeviceSupported();
var availableBiometrics;
try {
@ -417,8 +323,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
login_method = type;
LoginRegistration.verificationMethod = type;
// if(!widget.fromRegistration)
projectViewModel.analytics.loginRegistration
.login_verfication(forRegistration: widget.fromRegistration);
projectViewModel.analytics.loginRegistration.login_verfication(forRegistration: widget.fromRegistration);
switch (type) {
case 1:
@ -436,8 +341,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
default:
break;
}
sharedPref.setInt(LAST_LOGIN,
this.selectedOption); //this.cs.sharedService.setStorage(this.selectedOption, AuthenticationService.LAST_LOGIN);
sharedPref.setInt(LAST_LOGIN, this.selectedOption); //this.cs.sharedService.setStorage(this.selectedOption, AuthenticationService.LAST_LOGIN);
}
loginWithSMS(type) {
@ -465,23 +369,22 @@ class _ConfirmLogin extends State<ConfirmLogin> {
sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request);
authService
.checkPatientAuthentication(request)
.then((value) =>
{
GifLoaderDialogUtils.hideDialog(context),
if (value['isSMSSent'])
{
sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']),
this.loginTokenID = value['LogInTokenID'],
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request),
// Future.delayed(Duration(seconds: 1), () {
this.sendActivationCode(type)
// })
}
else
{
if (value['IsAuthenticated']) {this.checkActivationCode()}
}
})
.then((value) => {
GifLoaderDialogUtils.hideDialog(context),
if (value['isSMSSent'])
{
sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']),
this.loginTokenID = value['LogInTokenID'],
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request),
// Future.delayed(Duration(seconds: 1), () {
this.sendActivationCode(type)
// })
}
else
{
if (value['IsAuthenticated']) {this.checkActivationCode()}
}
})
.catchError((err) {
print(err);
GifLoaderDialogUtils.hideDialog(context);
@ -494,8 +397,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
GifLoaderDialogUtils.showMyDialog(context);
if (healthId != null || widget.isDubai) {
if (!widget.isDubai) {
request.dob =
dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob));
request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob));
}
request.healthId = healthId;
request.isHijri = isHijri;
@ -532,11 +434,10 @@ class _ConfirmLogin extends State<ConfirmLogin> {
context,
type,
this.mobileNumber,
(value) {
(value) {
this.checkActivationCode(value: value);
},
() =>
{
() => {
Navigator.pop(context),
},
).displayDialog(context);
@ -612,28 +513,23 @@ class _ConfirmLogin extends State<ConfirmLogin> {
setDefault() async {
showLoader(true);
if (await sharedPref.getObject(IMEI_USER_DATA) != null)
user = SelectDeviceIMEIRES.fromJson(
await sharedPref.getObject(IMEI_USER_DATA));
if (await sharedPref.getObject(IMEI_USER_DATA) != null) user = SelectDeviceIMEIRES.fromJson(await sharedPref.getObject(IMEI_USER_DATA));
if (await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN) != null) {
isMoreOption = true;
this.registerd_data = await CheckPatientAuthenticationReq.fromJson(
await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN));
this.registerd_data = await CheckPatientAuthenticationReq.fromJson(await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN));
}
this.mobileNumber = this.registerd_data != null
? this.registerd_data.patientMobileNumber
: int.parse(this.user!.mobile!);
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 == true
? "971"
: "966";
? "971"
: "966";
this.patientOutSA = this.registerd_data != null
? this.registerd_data.zipCode == "966"
? 0
: 1
? 0
: 1
: this.user!.outSA;
if (this.registerd_data != null) {
this.loginTokenID = await sharedPref.getString(LOGIN_TOKEN_ID);
@ -643,9 +539,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
if (nhic != null) {
final DateFormat dateFormat = DateFormat('MM/dd/yyyy');
final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy');
dob = nhic['IsHijri']
? nhic['DateOfBirth']
: dateFormat2.format(dateFormat.parse(nhic['DateOfBirth']));
dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format(dateFormat.parse(nhic['DateOfBirth']));
isHijri = nhic['IsHijri'] ? 1 : 0;
healthId = nhic['HealthId'];
@ -654,8 +548,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
this.lastLogin = await sharedPref.getInt(LAST_LOGIN) != null
? await sharedPref.getInt(LAST_LOGIN)
: user != null
? user!.logInType
: null;
? user!.logInType
: null;
showLoader(false);
//this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN);
@ -668,34 +562,22 @@ class _ConfirmLogin extends State<ConfirmLogin> {
request.deviceToken = this.deviceToken;
request.projectOutSA = this.patientOutSA == true ? true : false;
request.loginType = this.selectedOption;
request.oTPSendType =
type == 1 ? type : 2; //this.selectedOption == 1 ? 1 : 2;
request.oTPSendType = type == 1 ? type : 2; //this.selectedOption == 1 ? 1 : 2;
request.zipCode = this.zipCode;
request.logInTokenID = this.loginTokenID ?? "";
if (this.registerd_data != null) {
request.searchType = this.registerd_data.searchType != null
? this.registerd_data.searchType
: 1;
request.patientID = this.registerd_data.patientID != null
? this.registerd_data.patientID
: 0;
request.patientIdentificationID = request.nationalID =
this.registerd_data.patientIdentificationID != null
? this.registerd_data.patientIdentificationID
: '0';
request.searchType = this.registerd_data.searchType != null ? this.registerd_data.searchType : 1;
request.patientID = this.registerd_data.patientID != null ? this.registerd_data.patientID : 0;
request.patientIdentificationID = request.nationalID = this.registerd_data.patientIdentificationID != null ? this.registerd_data.patientIdentificationID : '0';
request.dob = this.registerd_data.dob;
request.isRegister = this.registerd_data.isRegister;
} else {
request.searchType = request.searchType != null ? request.searchType : 2;
request.patientID =
this.user!.patientID != null ? this.user!.patientID : 0;
request.nationalID =
request.nationalID != null ? request.nationalID : '0';
request.patientIdentificationID = request.patientIdentificationID != null
? request.patientIdentificationID
: '0';
request.patientID = this.user!.patientID != null ? this.user!.patientID : 0;
request.nationalID = request.nationalID != null ? request.nationalID : '0';
request.patientIdentificationID = request.patientIdentificationID != null ? request.patientIdentificationID : '0';
request.isRegister = false;
}
request.deviceTypeID = request.searchType;
@ -716,40 +598,31 @@ class _ConfirmLogin extends State<ConfirmLogin> {
authService
.checkActivationCodeRegister(request, value)
.then((result) =>
{
res = result,
if (result is Map)
{
result = CheckActivationCode.fromJson(
result as Map<String, dynamic>),
if (this.registerd_data != null &&
this.registerd_data.isRegister == true)
{
// if(widget.isDubai ==false){
widget.changePageViewIndex!(1),
// if(widget.isDubai ==false){
Navigator.popUntil(
context,
(route) =>
Utils.route(route, equalsTo: RegisterNew)),
}
}
else
{
// Navigator.of(context).pop(),
GifLoaderDialogUtils.hideDialog(context),
Future.delayed(Duration(seconds: 1), () {
AppToast.showErrorToast(message: result);
}),
projectViewModel.analytics.loginRegistration
.login_fail(error: result),
projectViewModel.analytics.errorTracking.log(
'otp_verification_at_confirm_login',
error: result),
}
})
.then((result) => {
res = result,
if (result is Map)
{
result = CheckActivationCode.fromJson(result as Map<String, dynamic>),
if (this.registerd_data != null && this.registerd_data.isRegister == true)
{
// if(widget.isDubai ==false){
widget.changePageViewIndex!(1),
// if(widget.isDubai ==false){
Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)),
}
}
else
{
// Navigator.of(context).pop(),
GifLoaderDialogUtils.hideDialog(context),
Future.delayed(Duration(seconds: 1), () {
AppToast.showErrorToast(message: result);
}),
projectViewModel.analytics.loginRegistration.login_fail(error: result),
projectViewModel.analytics.errorTracking.log('otp_verification_at_confirm_login', error: result),
}
})
.catchError((err) {
print(err);
GifLoaderDialogUtils.hideDialog(context);
@ -762,62 +635,56 @@ class _ConfirmLogin extends State<ConfirmLogin> {
authService
.checkActivationCode(request, value)
.then((result) => {
res = result,
if (result is Map)
{
result = CheckActivationCode.fromJson(result as Map<String, dynamic>),
if(result.errorCode =='699'){
//699 block run here
GifLoaderDialogUtils.hideDialog(context),
Future.delayed(Duration(seconds: 2), () {
AppToast.showErrorToast(message: result.errorEndUserMessage);
Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: Login));
res = result,
if (result is Map)
{
result = CheckActivationCode.fromJson(result as Map<String, dynamic>),
if (result.errorCode == '699')
{
//699 block run here
GifLoaderDialogUtils.hideDialog(context),
Future.delayed(Duration(seconds: 2), () {
AppToast.showErrorToast(message: result.errorEndUserMessage);
Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: Login));
})
}
else if (this.registerd_data != null && this.registerd_data.isRegister == true)
{
widget.changePageViewIndex!(1),
Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)),
}
else
{
sharedPref.remove(FAMILY_FILE),
result.list.isFamily = false,
userData = result.list,
sharedPref.setString(BLOOD_TYPE, result.patientBloodType ?? ""),
//Remove o+ from here Added by Aamir
authenticatedUserObject.user = result.list,
projectViewModel.setPrivilege(privilegeList: res),
sharedPref.setObject(MAIN_USER, result.list),
sharedPref.setObject(USER_PROFILE, result.list),
loginTokenID = result.logInTokenID,
sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
sharedPref.setString(TOKEN, result.authenticationTokenID),
checkIfUserAgreedBefore(result),
projectViewModel.analytics.loginRegistration.login_successful(),
}
}
else
{
// Navigator.of(context).pop(),
GifLoaderDialogUtils.hideDialog(context),
Future.delayed(Duration(seconds: 1), () {
Navigator.of(context).pop();
AppToast.showErrorToast(message: result, localContext: context);
startSMSService(tempType);
}),
projectViewModel.analytics.loginRegistration.login_fail(error: result),
projectViewModel.analytics.errorTracking.log('otp_verification_at_confirm_login', error: result)
}
})
}
else if (this.registerd_data != null &&
this.registerd_data.isRegister == true)
{
widget.changePageViewIndex!(1),
Navigator.popUntil(
context,
(route) =>
Utils.route(route, equalsTo: RegisterNew)),
}
else
{
sharedPref.remove(FAMILY_FILE),
result.list.isFamily = false,
userData = result.list,
sharedPref.setString(BLOOD_TYPE, result.patientBloodType ?? ""),
//Remove o+ from here Added by Aamir
authenticatedUserObject.user = result.list,
projectViewModel.setPrivilege(privilegeList: res),
sharedPref.setObject(MAIN_USER, result.list),
sharedPref.setObject(USER_PROFILE, result.list),
loginTokenID = result.logInTokenID,
sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
sharedPref.setString(TOKEN, result.authenticationTokenID),
checkIfUserAgreedBefore(result),
projectViewModel.analytics.loginRegistration.login_successful(),
}
}
else
{
// Navigator.of(context).pop(),
GifLoaderDialogUtils.hideDialog(context),
Future.delayed(Duration(seconds: 1), () {
Navigator.of(context).pop();
AppToast.showErrorToast(message: result, localContext: context);
startSMSService(tempType);
}),
projectViewModel.analytics.loginRegistration
.login_fail(error: result),
projectViewModel.analytics.errorTracking
.log('otp_verification_at_confirm_login', error: result)
}
})
.catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
Future.delayed(Duration(seconds: 1), () {
@ -830,10 +697,37 @@ class _ConfirmLogin extends State<ConfirmLogin> {
}
checkIfUserAgreedBefore(CheckActivationCode result) {
this.authService.checkIfUserAgreed().then((result) {
if (result['IsPatientAlreadyAgreed']) {
goToHome();
} else {
this.authService.getUserAgreementContent().then((result) {
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: UserLoginAgreementPage(
userAgreementText: result['UserAgreementContent'],
authenticatedUserObject: authenticatedUserObject,
appointmentRateViewModel: appointmentRateViewModel,
selectedOption: selectedOption,
),
),
(r) => false);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
// if (result.isNeedUserAgreement == true) {
//move to agreement page.
// } else {
goToHome();
// goToHome();
// }
}
@ -851,25 +745,17 @@ class _ConfirmLogin extends State<ConfirmLogin> {
print("Has Admission Request: $hasAdmissionRequest");
if (isAdmitted) {
if (res['PatientAdmittedInformation'].length != 0) {
getAdmissionInfoResponseModel =
GetAdmissionInfoResponseModel.fromJson(
res['PatientAdmittedInformation'][0]);
projectViewModel.setInPatientProjectID(
res['PatientAdmittedInformation'][0]['ProjectID']);
projectViewModel
.setInPatientAdmissionInfo(getAdmissionInfoResponseModel);
getAdmissionInfoResponseModel = GetAdmissionInfoResponseModel.fromJson(res['PatientAdmittedInformation'][0]);
projectViewModel.setInPatientProjectID(res['PatientAdmittedInformation'][0]['ProjectID']);
projectViewModel.setInPatientAdmissionInfo(getAdmissionInfoResponseModel);
projectViewModel.setIsPatientAdmitted(true);
}
}
if (hasAdmissionRequest) {
if (res['MedicalInstruction'].length != 0) {
getAdmissionRequestInfoResponseModel =
GetAdmissionRequestInfoResponseModel.fromJson(
res['MedicalInstruction'][0]);
projectViewModel.setInPatientProjectID(
res['MedicalInstruction'][0]['ProjectID']);
projectViewModel.setInPatientAdmissionRequest(
getAdmissionRequestInfoResponseModel);
getAdmissionRequestInfoResponseModel = GetAdmissionRequestInfoResponseModel.fromJson(res['MedicalInstruction'][0]);
projectViewModel.setInPatientProjectID(res['MedicalInstruction'][0]['ProjectID']);
projectViewModel.setInPatientAdmissionRequest(getAdmissionRequestInfoResponseModel);
projectViewModel.setPatientHasAdmissionRequest(true);
}
}
@ -878,10 +764,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
}
insertIMEI() {
authService
.insertDeviceImei(selectedOption)
.then((value) => {})
.catchError((err) {
authService.insertDeviceImei(selectedOption).then((value) => {}).catchError((err) {
print(err);
});
}
@ -891,8 +774,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
ClinicListService service = new ClinicListService();
service.getActiveAppointmentNo(context).then((res) {
if (res['MessageStatus'] == 1) {
toDoProvider.setState(res['AppointmentActiveNumber'],
res['AncillaryOrderListCount'], true, "0");
toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, "0");
// toDoProvider.setState(res['AppointmentActiveNumber'], true, "0");
} else {}
}).catchError((err) {
@ -911,42 +793,31 @@ class _ConfirmLogin extends State<ConfirmLogin> {
getToDoCount();
appointmentRateViewModel
.getIsLastAppointmentRatedList(projectViewModel.isArabic ? 1 : 2)
.then((value) =>
{
GifLoaderDialogUtils.hideDialog(AppGlobal.context),
if (appointmentRateViewModel.isHaveAppointmentNotRate)
{
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: RateAppointmentDoctor(),
),
(r) => false)
}
else
{
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: LandingPage(),
),
(r) => false)
},
insertIMEI()
})
.then((value) => {
GifLoaderDialogUtils.hideDialog(AppGlobal.context),
if (appointmentRateViewModel.isHaveAppointmentNotRate)
{
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: RateAppointmentDoctor(),
),
(r) => false)
}
else
{
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: LandingPage(),
),
(r) => false)
},
insertIMEI()
})
.catchError((err) {
print(err);
});
// getToDoCount();
// Navigator.pushAndRemoveUntil(
// context,
// FadePage(
// page: LandingPage(),
// ),
// (r) => false);
// insertIMEI();
}
loading(flag) {
@ -956,26 +827,21 @@ class _ConfirmLogin extends State<ConfirmLogin> {
}
Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) {
bool isDisable =
(_flag == 3 && !checkIfBiometricAvailable(BiometricType.face) ||
_flag == 2 &&
!checkIfBiometricAvailable(BiometricType.fingerprint) &&
_flag == 2 &&
!checkIfBiometricAvailable(BiometricType.strong));
bool isDisable = (_flag == 3 && !checkIfBiometricAvailable(BiometricType.face) ||
_flag == 2 && !checkIfBiometricAvailable(BiometricType.fingerprint) && _flag == 2 && !checkIfBiometricAvailable(BiometricType.strong));
return InkWell(
onTap: isDisable
? null
: () {
if (_flag == 0) {
setState(() {
isMoreOption = true;
});
} else {
authenticateUser(_flag, isActive: _loginIndex);
projectViewModel.analytics.loginRegistration.verify_otp_method(
forRegistration: widget.fromRegistration);
}
},
if (_flag == 0) {
setState(() {
isMoreOption = true;
});
} else {
authenticateUser(_flag, isActive: _loginIndex);
projectViewModel.analytics.loginRegistration.verify_otp_method(forRegistration: widget.fromRegistration);
}
},
child: Container(
padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28),
decoration: BoxDecoration(
@ -997,17 +863,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
color: isDisable ? Color(0xff2B353E).withOpacity(0.7) : null,
),
Text(
TranslationBase
.of(context)
.verifyThrough + " " + _title,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: isDisable
? Color(0xff2B353E).withOpacity(0.7)
: Color(0xff2B353E),
letterSpacing: -0.48,
height: 20 / 16),
TranslationBase.of(context).verifyThrough + " " + _title,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: isDisable ? Color(0xff2B353E).withOpacity(0.7) : Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16),
),
],
),
@ -1019,49 +876,28 @@ class _ConfirmLogin extends State<ConfirmLogin> {
Widget getButton(int flag) {
switch (flag) {
case 4:
return _loginOptionButton(TranslationBase
.of(context)
.verifyWhatsApp,
'assets/images/new/verify_whatsapp.svg', flag, null);
return _loginOptionButton(TranslationBase.of(context).verifyWhatsApp, 'assets/images/new/verify_whatsapp.svg', flag, null);
break;
case 1:
return _loginOptionButton(TranslationBase
.of(context)
.verifySMS,
'assets/images/new/verify_sms.svg', flag, null);
return _loginOptionButton(TranslationBase.of(context).verifySMS, 'assets/images/new/verify_sms.svg', flag, null);
break;
case 2:
return _loginOptionButton(
TranslationBase
.of(context)
.verifyFingerprint,
'assets/images/new/verify_thumb.svg',
flag,
BiometricType.fingerprint.index);
return _loginOptionButton(TranslationBase.of(context).verifyFingerprint, 'assets/images/new/verify_thumb.svg', flag, BiometricType.fingerprint.index);
break;
case 3:
return _loginOptionButton(
TranslationBase
.of(context)
.verifyFaceID,
'assets/images/new/verify_face.svg',
flag,
BiometricType.face.index);
return _loginOptionButton(TranslationBase.of(context).verifyFaceID, 'assets/images/new/verify_face.svg', flag, BiometricType.face.index);
break;
default:
return InkWell(
onTap: () =>
{
onTap: () => {
setState(() {
isMoreOption = true;
})
},
child: RoundedContainer(
height: 150,
backgroundColor: BiometricType.fingerprint.index == 1
? Colors.white
: Colors.white.withOpacity(.7),
backgroundColor: BiometricType.fingerprint.index == 1 ? Colors.white : Colors.white.withOpacity(.7),
borderColor: Colors.grey,
showBorder: true,
child: Padding(
@ -1075,17 +911,12 @@ class _ConfirmLogin extends State<ConfirmLogin> {
),
projectViewModel.isArabic
? SizedBox(
height: 15,
)
height: 15,
)
: SizedBox(
height: 20,
),
Texts(TranslationBase
.of(context)
.moreVerification,
fontSize: SizeConfig.textMultiplier! * 1.8,
textAlign: TextAlign.center,
color: Colors.black)
height: 20,
),
Texts(TranslationBase.of(context).moreVerification, fontSize: SizeConfig.textMultiplier! * 1.8, textAlign: TextAlign.center, color: Colors.black)
],
),
),
@ -1097,29 +928,19 @@ class _ConfirmLogin extends State<ConfirmLogin> {
getType(type, context) {
switch (type) {
case 1:
return TranslationBase
.of(context)
.verifySMS;
return TranslationBase.of(context).verifySMS;
break;
case 2:
return TranslationBase
.of(context)
.verifyFingerprint;
return TranslationBase.of(context).verifyFingerprint;
break;
case 3:
return TranslationBase
.of(context)
.verifyFaceID;
return TranslationBase.of(context).verifyFaceID;
break;
case 4:
return TranslationBase
.of(context)
.verifyWhatsApp;
return TranslationBase.of(context).verifyWhatsApp;
break;
default:
return TranslationBase
.of(context)
.verifySMS;
return TranslationBase.of(context).verifySMS;
break;
}
}

@ -0,0 +1,215 @@
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/TermsConditionsViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/custom_text_button.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:provider/provider.dart';
class UserLoginAgreementPage extends StatefulWidget {
final String userAgreementText;
final AuthenticatedUserObject authenticatedUserObject;
final AppointmentRateViewModel appointmentRateViewModel;
final int selectedOption;
UserLoginAgreementPage({required this.userAgreementText, required this.authenticatedUserObject, required this.appointmentRateViewModel, required this.selectedOption});
@override
State<UserLoginAgreementPage> createState() => _UserLoginAgreementPageState();
}
class _UserLoginAgreementPageState extends State<UserLoginAgreementPage> {
late ProjectViewModel projectViewModel;
late ToDoCountProviderModel toDoProvider;
final authService = AuthProvider();
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
toDoProvider = Provider.of<ToDoCountProviderModel>(context);
return BaseView<TermsConditionsViewModel>(
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
showNewAppBarTitle: true,
showNewAppBar: true,
isShowDecPage: false,
appBarTitle: TranslationBase.of(context).userAgreement,
body: Padding(
padding: const EdgeInsets.all(8.0),
child: SingleChildScrollView(
child: Html(
data: widget.userAgreementText,
),
),
),
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10), bottomLeft: Radius.circular(10), bottomRight: Radius.circular(10)),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset: Offset(0, 3), // changes position of shadow
),
],
),
padding: EdgeInsets.only(left: 21, right: 21, top: 15, bottom: 15),
width: double.infinity,
// color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 12),
Text(
TranslationBase.of(context).continueAgreeTerms,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.64,
),
),
SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Expanded(
flex: 1,
child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
height: 45.0,
child: CustomTextButton(
backgroundColor: CustomColors.green,
elevation: 0,
onPressed: () {
addUsageAgreement();
},
child: Text(TranslationBase.of(context).acceptLbl.toUpperCase(),
style: TextStyle(
fontSize: 18.0,
color: Colors.white,
)),
),
),
),
mWidth(7),
Expanded(
flex: 1,
child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
height: 45.0,
child: CustomTextButton(
backgroundColor: Color(0xffc5272d),
elevation: 0,
onPressed: () {
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: LandingPage(),
),
(r) => false);
},
child: Text(TranslationBase.of(context).declineLbl.toUpperCase(), style: TextStyle(fontSize: 18.0, color: Colors.white)),
),
),
),
],
),
],
),
),
),
);
}
addUsageAgreement() {
GifLoaderDialogUtils.showMyDialog(context);
this.authService.addUserAgreementContent().then((result) {
goToHome();
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}
goToHome() async {
widget.authenticatedUserObject.isLogin = true;
widget.appointmentRateViewModel.isLogin = true;
projectViewModel.isLogin = true;
projectViewModel.user = widget.authenticatedUserObject.user;
await widget.authenticatedUserObject.getUser(getUser: true);
// GifLoaderDialogUtils.hideDialog(context);
getToDoCount();
widget.appointmentRateViewModel
.getIsLastAppointmentRatedList(projectViewModel.isArabic ? 1 : 2)
.then((value) => {
GifLoaderDialogUtils.hideDialog(context),
if (widget.appointmentRateViewModel.isHaveAppointmentNotRate)
{
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: RateAppointmentDoctor(),
),
(r) => false)
}
else
{
GifLoaderDialogUtils.hideDialog(context),
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: LandingPage(),
),
(r) => false)
},
insertIMEI()
})
.catchError((err) {
print(err);
});
}
insertIMEI() {
authService.insertDeviceImei(widget.selectedOption).then((value) => {}).catchError((err) {
print(err);
});
}
getToDoCount() {
toDoProvider.setState(0, 0, true, "0");
ClinicListService service = new ClinicListService();
service.getActiveAppointmentNo(context).then((res) {
if (res['MessageStatus'] == 1) {
toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, "0");
// toDoProvider.setState(res['AppointmentActiveNumber'], true, "0");
} else {}
}).catchError((err) {
print(err);
});
}
}

@ -1775,6 +1775,60 @@ class AuthProvider with ChangeNotifier {
}
}
Future<dynamic> checkIfUserAgreed() async {
Map<String, dynamic> request;
request = {"Region": 1};
dynamic localRes;
try {
await new BaseAppClient().post(CHECK_USAGE_AGREEMENT, onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
localRes = error;
return Future.value(error);
// throw error;
}, body: request);
return Future.value(localRes);
} catch (error) {
throw error;
}
}
Future<dynamic> getUserAgreementContent() async {
Map<String, dynamic> request;
request = {"Region": 1};
dynamic localRes;
try {
await new BaseAppClient().post(GET_USAGE_AGREEMENT, onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
localRes = error;
return Future.value(error);
// throw error;
}, body: request);
return Future.value(localRes);
} catch (error) {
throw error;
}
}
Future<dynamic> addUserAgreementContent() async {
Map<String, dynamic> request;
request = {"Region": 1};
dynamic localRes;
try {
await new BaseAppClient().post(ADD_USAGE_AGREEMENT, onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
localRes = error;
return Future.value(error);
// throw error;
}, body: request);
return Future.value(localRes);
} catch (error) {
throw error;
}
}
Future<dynamic> getDashboard() async {
Map<String, dynamic> request = {};

@ -3,7 +3,12 @@ import 'package:flutter/services.dart';
class PenguinMethodChannel {
static const MethodChannel _channel = MethodChannel('launch_penguin_ui');
static Future<void> launch(String storyboardName, String languageCode, String username, {NavigationClinicDetails? details}) async {
Future<Uint8List> loadGif() async {
return await rootBundle.load("assets/images/progress-loading-red-crop-1.gif").then((data) => data.buffer.asUint8List());
}
Future<void> launch(String storyboardName, String languageCode, String username, {NavigationClinicDetails? details}) async {
Uint8List image = await loadGif();
try {
await _channel.invokeMethod('launchPenguin', {
"storyboardName": storyboardName,
@ -26,10 +31,11 @@ class PenguinMethodChannel {
"languageCode": languageCode,
"clientKey": "UGVuZ3VpbklOX1Blbk5hdl9QSUY=",
"mapBoxKey": "sk.eyJ1IjoicndhaWQiLCJhIjoiY2x6NWo0bTMzMWZodzJrcGZpemYzc3Z4dSJ9.uSSZuwNSGCcCdPAiORECmg",
// "clinicID": details?.clinicId ?? "",
"clinicID": details?.clinicId ?? "", // 46 ,49, 133
"clinicID": details?.clinicId ?? "",
// "clinicID": "108", // 46 ,49, 133
"patientID": details?.patientId ?? "",
"projectID": details?.projectId ?? "",
"loaderImage": image,
});
} on PlatformException catch (e) {
print("Failed to launch PenguinIn: '${e.message}'.");

@ -426,7 +426,7 @@ class PushNotificationHandler {
Permission.bluetoothScan,
Permission.activityRecognition,
].request().whenComplete(() {
PenguinMethodChannel.launch("penguin", "en", "1231755", details: data);
PenguinMethodChannel().launch("penguin", "en", "1231755", details: data);
});
}
}

@ -2984,10 +2984,11 @@ class TranslationBase {
String get proceedPackage => localizedValues["proceedPackage"][locale.languageCode];
String get hospitalNavigationTitle => localizedValues["hospitalNavigationTitle"][locale.languageCode];
String get hospitalNavigationSubtitle => localizedValues["hospitalNavigationSubtitle"][locale.languageCode];
String get workplaceNameAr => localizedValues["workplaceNameAr"][locale.languageCode];
String get occupationNameEn => localizedValues["occupationNameEn"][locale.languageCode];
String get occupationNameAr => localizedValues["occupationNameAr"][locale.languageCode];
String get continueAgreeTerms => localizedValues["continueAgreeTerms"][locale.languageCode];
String get agreeText => localizedValues["agreeText"][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -1,7 +1,7 @@
name: diplomaticquarterapp
description: A new Flutter application.
version: 4.5.068+4050068
version: 4.5.069+4050069
environment:
sdk: ">=3.0.0 <3.13.0"
@ -36,7 +36,7 @@ dependencies:
#Google Fit & Apple HealthKit
# health: ^3.0.3
health: ^11.1.0
pedometer: ^4.0.2
# pedometer: ^4.0.2
#chart
fl_chart: ^0.64.0

Loading…
Cancel
Save