updating structure

pull/3/head
Sultan khan 2 months ago
parent cbfb381615
commit d3aff9f93d

@ -1,45 +1,188 @@
import java.util.Properties
import java.io.FileInputStream
plugins {
id("com.android.application")
id("kotlin-android")
id("com.google.gms.google-services") version "4.4.1" // Add the version here
id("dev.flutter.flutter-gradle-plugin")
id("com.google.gms.google-services")
// id("com.huawei.agconnect")
id("com.huawei.agconnect")
// id("com.mapbox.gradle.application")
// id("com.mapbox.gradle.plugins.ndk")
}
val keystoreProperties = Properties()
val keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}
android {
namespace = "com.ejada.hmg.hmg_patient_app_new"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
namespace = "com.ejada.hmg"
compileSdk = 36
ndkVersion = "28.2.13676358"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
defaultConfig {
applicationId = "com.ejada.hmg"
// minSdk = 24
minSdk = 26
targetSdk = 35
compileSdk = 35
// targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
multiDexEnabled = true
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
buildFeatures {
viewBinding = true
dataBinding = true
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.ejada.hmg.hmg_patient_app_new"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
sourceSets {
// getByName("main") {
// java.srcDirs += "src/main/kotlin"
// jniLibs.srcDir("src/main/libs")
// jni.srcDirs = listOf() // disables automatic ndk-build
// }
getByName("main") {
java.srcDir("src/main/kotlin")
jniLibs.srcDir("src/main/libs")
// To disable automatic ndk-build, do not set jni.srcDirs
// If you need to clear jni.srcDirs:
// set("jni.srcDirs", emptyList<String>())
}
}
signingConfigs {
create("release") {
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword = keystoreProperties.getProperty("keyPassword")
storeFile = keystoreProperties.getProperty("storeFile")?.let { file(it) }
storePassword = keystoreProperties.getProperty("storePassword")
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
getByName("debug") {
isDebuggable = true
signingConfig = signingConfigs.getByName("debug")
isMinifyEnabled = false
isShrinkResources = false
}
getByName("release") {
isDebuggable = false
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
create("staging") {
matchingFallbacks += listOf("debug", "qa", "release")
}
}
packagingOptions {
jniLibs {
pickFirsts += listOf(
"lib/x86/libc++_shared.so",
"lib/x86_64/libc++_shared.so",
"lib/armeabi-v7a/libc++_shared.so",
"lib/arm64-v8a/libc++_shared.so",
"**/*.so"
)
useLegacyPackaging = true
}
resources {
excludes += listOf("META-INF/proguard/androidx-annotations.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
isCoreLibraryDesugaringEnabled = true
}
// kotlinOptions {
// jvmTarget = "17"
// }
lint {
disable += "MissingTranslation"
checkReleaseBuilds = false
}
}
flutter {
source = "../.."
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.20")
implementation("com.google.firebase:firebase-messaging:24.1.2")
implementation("pub.devrel:easypermissions:3.0.0")
implementation("com.google.guava:guava:33.4.0-android")
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"), "exclude" to listOf("bcprov-jdk16-1.46.jar"))))
implementation("com.google.code.gson:gson:2.12.0")
// Zoom SDKs
implementation("us.zoom.videosdk:zoomvideosdk-core:1.12.10")
implementation("us.zoom.videosdk:zoomvideosdk-annotation:1.12.10")
implementation("us.zoom.videosdk:zoomvideosdk-videoeffects:1.12.10")
// Networking
implementation("com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.11")
implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.11")
implementation("com.squareup.retrofit2:retrofit:2.11.0")
implementation("com.squareup.retrofit2:converter-gson:2.11.0")
implementation("com.squareup.retrofit2:adapter-java8:2.11.0")
// Google Services
implementation("com.google.android.gms:play-services-location:21.3.0")
implementation("com.google.android.gms:play-services-basement:18.7.0")
implementation("com.android.volley:volley:1.2.1")
implementation("androidx.constraintlayout:constraintlayout:2.2.1")
implementation("androidx.navigation:navigation-fragment-ktx:2.9.0")
implementation("androidx.navigation:navigation-ui-ktx:2.9.0")
implementation("androidx.activity:activity-ktx:1.10.1")
// val room_version = "2.6.1"
// implementation("androidx.room:room-runtime:$room_version")
// annotationProcessor("androidx.room:room-compiler:$room_version")
implementation("net.zetetic:android-database-sqlcipher:4.5.4")
implementation("com.intuit.ssp:ssp-android:1.1.0")
implementation("com.intuit.sdp:sdp-android:1.1.0")
// implementation("com.github.bumptech.glide:glide:4.16.0")
// annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")
implementation("com.mapbox.maps:android:11.5.0")
// implementation("com.mapbox.maps:android:11.4.0")
// AARs
// implementation(files("libs/PenNavUI.aar"))
// implementation(files("libs/Penguin.aar"))
// implementation(files("libs/PenguinRenderer.aar"))
implementation("com.github.kittinunf.fuel:fuel:2.3.1")
implementation("com.github.kittinunf.fuel:fuel-android:2.3.1")
// implementation("com.opentok.android:opentok-android-sdk:2.25.2")
// implementation("com.facebook.stetho:stetho:1.6.0")
// implementation("com.facebook.stetho:stetho-urlconnection:1.6.0")
implementation("androidx.core:core-ktx:1.16.0")
implementation("androidx.appcompat:appcompat:1.7.1")
implementation("com.google.android.material:material:1.12.0")
implementation("pl.droidsonroids.gif:android-gif-drawable:1.2.25")
androidTestImplementation("androidx.test:core:1.6.1")
implementation("com.whatsapp.otp:whatsapp-otp-android-sdk:0.1.0")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
// implementation(project(":vitalSignEngine"))
}

@ -193,31 +193,31 @@
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
<receiver
android:name=".geofence.intent_receivers.GeofenceBroadcastReceiver"
android:enabled="true"
android:exported="false" />
<receiver
android:name=".geofence.intent_receivers.GeofencingRebootBroadcastReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<receiver
android:name=".geofence.intent_receivers.LocationProviderChangeReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.location.PROVIDERS_CHANGED" />
</intent-filter>
</receiver>
<!-- <receiver-->
<!-- android:name=".geofence.intent_receivers.GeofenceBroadcastReceiver"-->
<!-- android:enabled="true"-->
<!-- android:exported="false" />-->
<!-- <receiver-->
<!-- android:name=".geofence.intent_receivers.GeofencingRebootBroadcastReceiver"-->
<!-- android:enabled="true"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.BOOT_COMPLETED" />-->
<!-- <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <receiver-->
<!-- android:name=".geofence.intent_receivers.LocationProviderChangeReceiver"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.location.PROVIDERS_CHANGED" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<service
android:name=".geofence.intent_receivers.ReregisterGeofenceJobService"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" /> <!-- Geofencing -->
<!-- <service-->
<!-- android:name=".geofence.intent_receivers.ReregisterGeofenceJobService"-->
<!-- android:exported="true"-->
<!-- android:permission="android.permission.BIND_JOB_SERVICE" /> &lt;!&ndash; Geofencing &ndash;&gt;-->
<!--
Huawei Push Notifications
Set push kit auto enable to true (for obtaining the token on initialize)
@ -226,25 +226,25 @@
<!-- android:name="push_kit_auto_init_enabled" -->
<!-- android:value="true" /> -->
<!-- These receivers are for sending scheduled local notifications -->
<receiver
android:name="com.huawei.hms.flutter.push.receiver.local.HmsLocalNotificationBootEventReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver
android:name="com.huawei.hms.flutter.push.receiver.local.HmsLocalNotificationScheduledPublisher"
android:enabled="true"
android:exported="false" />
<receiver
android:name="com.huawei.hms.flutter.push.receiver.BackgroundMessageBroadcastReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.huawei.hms.flutter.push.receiver.BACKGROUND_REMOTE_MESSAGE" />
</intent-filter>
</receiver> <!-- Huawei Push Notifications -->
<!-- <receiver-->
<!-- android:name="com.huawei.hms.flutter.push.receiver.local.HmsLocalNotificationBootEventReceiver"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.BOOT_COMPLETED" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <receiver-->
<!-- android:name="com.huawei.hms.flutter.push.receiver.local.HmsLocalNotificationScheduledPublisher"-->
<!-- android:enabled="true"-->
<!-- android:exported="false" />-->
<!-- <receiver-->
<!-- android:name="com.huawei.hms.flutter.push.receiver.BackgroundMessageBroadcastReceiver"-->
<!-- android:enabled="true"-->
<!-- android:exported="true">-->
<!-- <intent-filter>-->
<!-- <action android:name="com.huawei.hms.flutter.push.receiver.BACKGROUND_REMOTE_MESSAGE" />-->
<!-- </intent-filter>-->
<!-- </receiver> &lt;!&ndash; Huawei Push Notifications &ndash;&gt;-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8" />

@ -1,5 +0,0 @@
package com.ejada.hmg.hmg_patient_app_new
import io.flutter.embedding.android.FlutterActivity
class MainActivity : FlutterActivity()

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Theme applied to the Android Window while the process is starting -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@android:color/white</item>
</style>
</resources>

@ -1,13 +1,25 @@
buildscript {
repositories {
google()
mavenCentral()
// maven { url = uri("https://developer.huawei.com/repo/") }
google()
maven { url = uri("https://developer.huawei.com/repo/") }
maven {
url = uri("https://api.mapbox.com/downloads/v2/releases/maven")
credentials {
username = "mapbox"
password = "sk.eyJ1IjoicndhaWQiLCJhIjoiY2x6NWo0bTMzMWZodzJrcGZpemYzc3Z4dSJ9.uSSZuwNSGCcCdPAiORECmg"
if (password.isNullOrEmpty()) {
throw GradleException("MAPBOX_DOWNLOADS_TOKEN isn't set. Set it to the project properties or to the environment variables.")
}
}
authentication {
create<BasicAuthentication>("basic")
}
}
}
dependencies {
classpath("com.android.tools.build:gradle:7.4.2")
classpath("com.google.gms:google-services:4.4.1")
// classpath("com.huawei.agconnect:agcp:1.9.3.302")
classpath("com.android.tools.build:gradle:8.1.0")
classpath("com.huawei.agconnect:agcp:1.9.1.304")
}
}
@ -15,16 +27,73 @@ allprojects {
repositories {
google()
mavenCentral()
// maven { url = uri("https://developer.huawei.com/repo/") }
maven { url = uri("https://developer.huawei.com/repo/") }
maven { url = uri("https://artifactory.ess-dev.com/artifactory/gradle-dev-local") }
maven {
url = uri("https://api.mapbox.com/downloads/v2/releases/maven")
credentials {
username = "mapbox"
password = "sk.eyJ1IjoicndhaWQiLCJhIjoiY2x6NWo0bTMzMWZodzJrcGZpemYzc3Z4dSJ9.uSSZuwNSGCcCdPAiORECmg"
if (password.isNullOrEmpty()) {
throw GradleException("MAPBOX_DOWNLOADS_TOKEN isn't set. Set it to the project properties or to the environment variables.")
}
}
authentication {
create<BasicAuthentication>("basic")
}
}
}
configurations.all {
exclude(group = "org.bouncycastle", module = "bcprov-jdk16")
}
tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = JavaVersion.VERSION_21.toString()
targetCompatibility = JavaVersion.VERSION_21.toString()
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "21"
}
}
}
val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
rootProject.layout.buildDirectory.value(newBuildDir)
subprojects {
afterEvaluate {
if (project.hasProperty("android")) {
project.extensions.findByName("android")?.let { androidExt ->
val android = androidExt as com.android.build.gradle.BaseExtension
if (android.namespace == null) {
android.namespace = project.group.toString()
}
android.buildFeatures.apply {
if (buildConfig == null) {
buildConfig = true
}
}
android.compileOptions.apply {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
}
}
project.tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = JavaVersion.VERSION_21.toString()
targetCompatibility = JavaVersion.VERSION_21.toString()
}
project.tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "21"
}
}
}
}
}
rootProject.buildDir = File("../build")
subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir)
project.buildDir = File("${rootProject.buildDir}/${project.name}")
}
subprojects {
project.evaluationDependsOn(":app")
@ -32,4 +101,4 @@ subprojects {
tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
}

@ -336,40 +336,40 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/url_launcher_ios/ios"
SPEC CHECKSUMS:
audio_session: 9bb7f6c970f21241b19f5a3658097ae459681ba0
connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd
audio_session: 19e9480dbdd4e5f6c4543826b2e8b0e4ab6145fe
connectivity_plus: 2a701ffec2c0ae28a48cf7540e279787e77c447d
CryptoSwift: e64e11850ede528a02a0f3e768cec8e9d92ecb90
device_calendar: b55b2c5406cfba45c95a59f9059156daee1f74ed
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
device_calendar: 9cb33f88a02e19652ec7b8b122ca778f751b1f7b
device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be
file_picker: b159e0c068aef54932bb15dc9fd1571818edaf49
Firebase: d99ac19b909cd2c548339c2241ecd0d1599ab02e
firebase_core: 995454a784ff288be5689b796deb9e9fa3601818
firebase_messaging: f4a41dd102ac18b840eba3f39d67e77922d3f707
firebase_core: 99a37263b3c27536063a7b601d9e2a49400a433c
firebase_messaging: bf6697c61f31c7cc0f654131212ff04c0115c2c7
FirebaseCore: efb3893e5b94f32b86e331e3bd6dadf18b66568e
FirebaseCoreInternal: 9afa45b1159304c963da48addb78275ef701c6b4
FirebaseInstallations: 317270fec08a5d418fdbc8429282238cab3ac843
FirebaseMessaging: 3b26e2cee503815e01c3701236b020aa9b576f09
FLAnimatedImage: bbf914596368867157cc71b38a8ec834b3eeb32b
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_callkit_incoming: cb8138af67cda6dd981f7101a5d709003af21502
flutter_inappwebview_ios: b89ba3482b96fb25e00c967aae065701b66e9b99
flutter_ios_voip_kit_karmm: 371663476722afb631d5a13a39dee74c56c1abd0
flutter_local_notifications: a5a732f069baa862e728d839dd2ebb904737effb
flutter_zoom_videosdk: df7353598a3f0ad081055166e12c992ac9218a8c
fluttertoast: 2c67e14dce98bbdb200df9e1acf610d7a6264ea1
geolocator_apple: ab36aa0e8b7d7a2d7639b3b4e48308394e8cef5e
flutter_callkit_incoming: 417dd1b46541cdd5d855ad795ccbe97d1c18155e
flutter_inappwebview_ios: 6f63631e2c62a7c350263b13fa5427aedefe81d4
flutter_ios_voip_kit_karmm: 7ea37381a8841c92d186edf1f4604df5cc437579
flutter_local_notifications: ff50f8405aaa0ccdc7dcfb9022ca192e8ad9688f
flutter_zoom_videosdk: 7ddc97d617b85aeace252165d2b5fc5638678c38
fluttertoast: 21eecd6935e7064cc1fcb733a4c5a428f3f24f0f
geolocator_apple: 66b711889fd333205763b83c9dcf0a57a28c7afd
Google-Maps-iOS-Utils: 66d6de12be1ce6d3742a54661e7a79cb317a9321
google_maps_flutter_ios: 0291eb2aa252298a769b04d075e4a9d747ff7264
google_maps_flutter_ios: e31555a04d1986ab130f2b9f24b6cdc861acc6d3
GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7
GoogleMaps: 8939898920281c649150e0af74aa291c60f2e77d
GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1
health: f496ad838f4bd227191f5bc05060b6f6138b44fd
image_picker_ios: 7fe1ff8e34c1790d6fff70a32484959f563a928a
just_audio: 4e391f57b79cad2b0674030a00453ca5ce817eed
local_auth_darwin: d2e8c53ef0c4f43c646462e3415432c4dab3ae19
manage_calendar_events: fe1541069431af035ced925ebd9def8b4b271254
health: f1207cccb625fc2e8af263b09c29661bde7b0b7e
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
just_audio: a42c63806f16995daf5b219ae1d679deb76e6a79
local_auth_darwin: fa4b06454df7df8e97c18d7ee55151c57e7af0de
manage_calendar_events: 9b2889799340398027b3e3f5c4891d41599ec257
MapboxCommon: 119f3759f7dc9457f0695848108ab323eb643cb4
MapboxCoreMaps: ca17f67baced23f8c952166ac6314c35bad3f66c
MapboxCoreNavigation: 3be9990fae3ed732a101001746d0e3b4234ec023
@ -381,21 +381,21 @@ SPEC CHECKSUMS:
MapboxSpeech: cd25ef99c3a3d2e0da72620ff558276ea5991a77
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
Polyline: 2a1f29f87f8d9b7de868940f4f76deb8c678a5b1
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
SDWebImage: 9f177d83116802728e122410fb25ad88f5c7608a
share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
share_plus: 8b6f8b3447e494cca5317c8c3073de39b3600d1f
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
Solar-dev: 4612dc9878b9fed2667d23b327f1d4e54e16e8d0
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
Turf: aa2ede4298009639d10db36aba1a7ebaad072a5e
url_launcher_ios: 694010445543906933d732453a59da0a173ae33d
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
ZoomVideoSDK: 94e939820e57a075c5e712559f927017da0de06a
PODFILE CHECKSUM: ac23c99fc61c3e92ed1c20a19299a1205568c016
PODFILE CHECKSUM: 5df9d8aa8f2c105eacd5ad7a310503d93c68c86b
COCOAPODS: 1.16.2
COCOAPODS: 1.15.2

@ -279,14 +279,10 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
@ -300,14 +296,10 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";

@ -1,293 +1,600 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'dart:io' show Platform;
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/consts.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_exception.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
import 'package:http/http.dart';
import 'package:http/io_client.dart';
// ignore_for_file: avoid_annotating_with_dynamic
typedef FactoryConstructor<U> = U Function(dynamic);
class APIError {
int? errorCode;
String? errorMessage;
APIError(this.errorCode, this.errorMessage);
Map<String, dynamic> toJson() => {'errorCode': errorCode, 'errorMessage': errorMessage};
@override
String toString() {
return jsonEncode(this);
}
}
APIException _throwAPIException(Response response, Function retryCallBack) {
LoggerService loggerService = getIt.get<LoggerService>();
switch (response.statusCode) {
case 200:
APIError? apiError;
if (response.body != null && response.body.isNotEmpty) {
var jsonError = jsonDecode(response.body);
loggerService.logInfo(jsonError.toString());
apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage']);
}
return APIException(APIException.BAD_REQUEST, error: apiError);
case 400:
APIError? apiError;
if (response.body != null && response.body.isNotEmpty) {
var jsonError = jsonDecode(response.body);
apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage']);
}
return APIException(APIException.BAD_REQUEST, error: apiError);
case 401:
return APIException(APIException.UNAUTHORIZED);
case 403:
return APIException(APIException.FORBIDDEN);
case 404:
return APIException(APIException.NOT_FOUND);
case 500:
return APIException(APIException.INTERNAL_SERVER_ERROR);
case 444:
var downloadUrl = response.headers["location"];
return APIException(APIException.UPGRADE_REQUIRED, arguments: downloadUrl);
default:
return APIException(APIException.OTHER);
}
}
abstract class IApiClient {
Future<U> postJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, T jsonObject,
{String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0});
Future<Response> postJsonForResponse<T>(String url, T jsonObject, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0});
Future<Response> getJsonForResponse<T>(String url, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0});
void setHomeUrl(String url);
import 'package:http/http.dart' as http;
abstract class ApiClient {
Future<void> post(
String endPoint, {
required Map<String, dynamic> body,
required Function(dynamic response, int statusCode) onSuccess,
required Function(String error, int statusCode) onFailure,
bool isAllowAny,
bool isExternal,
bool isRCService,
bool bypassConnectionCheck,
});
Future<void> get(
String endPoint, {
required Function(dynamic response, int statusCode) onSuccess,
required Function(String error, int statusCode) onFailure,
Map<String, dynamic>? queryParams,
bool isExternal,
bool isRCService,
});
Future<void> simplePost(
String fullUrl, {
required Map<dynamic, dynamic> body,
required Map<String, String> headers,
required Function(dynamic response, int statusCode) onSuccess,
required Function(String error, int statusCode) onFailure,
});
Future<void> simpleGet(
String fullUrl, {
Function(dynamic response, int statusCode)? onSuccess,
Function(String error, int statusCode)? onFailure,
Map<String, dynamic>? queryParams,
Map<String, String>? headers,
});
Future<void> simplePut(
String fullUrl, {
Map<String, dynamic>? body,
Map<String, String>? headers,
Function(dynamic response, int statusCode)? onSuccess,
Function(String error, int statusCode)? onFailure,
});
Future<void> simpleDelete(
String fullUrl, {
Function(dynamic response, int statusCode)? onSuccess,
Function(String error, int statusCode)? onFailure,
Map<String, String>? queryParams,
Map<String, String>? headers,
});
Future<bool> handleUnauthorized(int statusCode, {required String forUrl});
String getSessionId(String id);
Future<String> generatePackagesToken();
}
class ApiClient implements IApiClient {
LoggerService loggerService;
ApiClient({required this.loggerService});
@override
Future<U> postJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, T jsonObject,
{String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0, bool isFormData = false}) async {
var _headers = {'Accept': 'application/json'};
if (headers != null && headers.isNotEmpty) {
_headers.addAll(headers);
}
if (!kReleaseMode) {
loggerService.logInfo("Url:$url");
var bodyJson = json.encode(jsonObject);
loggerService.logInfo("body:$bodyJson");
}
var response = await postJsonForResponse(url, jsonObject, token: token, queryParameters: queryParameters, headers: _headers, retryTimes: retryTimes);
// try {
if (!kReleaseMode) {
loggerService.logInfo("res: ${response.body}");
}
var jsonData = jsonDecode(response.body);
if (jsonData["IsAuthenticated"] != null) {
getIt.get<AppState>().setIsAuthenticated = jsonData["IsAuthenticated"];
}
if (jsonData["ErrorMessage"] == null) {
return factoryConstructor(jsonData);
class ApiClientImp implements ApiClient {
final _analytics = getIt<GAnalytics>();
final LoggerService loggerService;
ApiClientImp({required this.loggerService});
post(String endPoint,
{required Map<String, dynamic> body,
required Function(dynamic response, int statusCode) onSuccess,
required Function(String error, int statusCode) onFailure,
bool isAllowAny = false,
bool isExternal = false,
bool isRCService = false,
bool bypassConnectionCheck = false}) async {
AppState appState = getIt.get<AppState>();
String url;
if (isExternal) {
url = endPoint;
} else {
APIError? apiError;
apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage']);
throw APIException(APIException.BAD_REQUEST, error: apiError);
}
// } catch (ex) {
// if (ex is APIException) {
// rethrow;
// } else {
// throw APIException(APIException.BAD_RESPONSE_FORMAT, arguments: ex);
// }
// }
}
@override
Future<Response> postJsonForResponse<T>(String url, T jsonObject, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
String? requestBody;
late Map<String, String> stringObj;
if (jsonObject != null) {
requestBody = jsonEncode(jsonObject);
if (headers == null) {
headers = {'Content-Type': 'application/json'};
if (isRCService) {
url = RC_BASE_URL + endPoint;
} else {
headers['Content-Type'] = 'application/json';
url = BASE_URL + endPoint;
}
}
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes);
}
Future<Response> _postForResponse(String url, requestBody, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
try {
var _headers = <String, String>{};
// if (token != null) {
// _headers['Authorization'] = 'Bearer $token';
// }
if (headers != null && headers.isNotEmpty) {
_headers.addAll(headers);
}
if (queryParameters != null) {
// var queryString = new Uri(queryParameters: queryParameters).query;
var queryString = Uri(queryParameters: queryParameters.map((key, value) => MapEntry(key, value?.toString()))).query;
url = '$url?$queryString';
var user = appState.getAuthenticatedUser;
Map<String, String> headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
};
if (!isExternal) {
String? token = appState.appAuthToken;
String? languageID =
(appState.postParamsObject?.languageID == 1 ? 'ar' : 'en') ?? 'ar';
if (endPoint == ApiConsts.sendActivationCode) {
languageID = 'en';
}
if (body.containsKey('SetupID')) {
body['SetupID'] = body.containsKey('SetupID')
? body['SetupID'] ?? body['']
: SETUP_ID;
} else {}
if (body.containsKey('LanguageID')) {
if (body['LanguageID'] != null) {
//change this line because language issue happened on dental
body['LanguageID'] = body['LanguageID'] == 'ar'
? 1
: body['LanguageID'] == 'en'
? 2
: body['LanguageID'];
}
}
if (body.containsKey('isDentalAllowedBackend')) {
body['isDentalAllowedBackend'] =
body.containsKey('isDentalAllowedBackend')
? body['isDentalAllowedBackend'] ?? IS_DENTAL_ALLOWED_BACKEND
: IS_DENTAL_ALLOWED_BACKEND;
}
body['DeviceTypeID'] = Platform.isIOS
? 1
: await Utils.isGoogleServicesAvailable()
? 2
: 3;
if (!body.containsKey('IsPublicRequest')) {
// if (!body.containsKey('PatientType')) {
if (user != null && user.patientType != null) {
body['PatientType'] = user.patientType;
} else {
body['PatientType'] = PATIENT_TYPE;
}
// }
// body['PatientType'] = body.containsKey('PatientType')
// ? body['PatientType'] != null
// ? body['PatientType']
// : user['PatientType'] != null
// ? user['PatientType']
// : PATIENT_TYPE
// : PATIENT_TYPE;
// if (!body.containsKey('PatientTypeID')) {
if (user != null && user.patientType != null) {
body['PatientTypeID'] = user.patientType;
} else {
body['PatientType'] = PATIENT_TYPE_ID;
}
// }
// body['PatientTypeID'] = body.containsKey('PatientTypeID')
// ? body['PatientTypeID'] != null
// ? body['PatientTypeID']
// : user['PatientType'] != null
// ? user['PatientType']
// : PATIENT_TYPE_ID
// : PATIENT_TYPE_ID;
if (user != null) {
body['TokenID'] = body['TokenID'] ?? token;
body['PatientID'] = body['PatientID'] ?? user.patientID;
body['PatientOutSA'] = body.containsKey('PatientOutSA')
? body['PatientOutSA'] ?? user.outSA
: user.outSA;
body['SessionID'] = getSessionId(body['TokenID'] ?? ""); //getSe
}
}
}
// if (!kReleaseMode && url.contains("saned")) {
if (!kReleaseMode) {
loggerService.logInfo("Url: $url");
loggerService.logInfo("Headers: $_headers");
// var bodyJson = json.encode(requestBody);
loggerService.logInfo("body: $requestBody");
}
body.removeWhere((key, value) => value == null);
var response = await _post(Uri.parse(url), body: requestBody, headers: _headers).timeout(Duration(seconds: 120));
if (response.statusCode >= 200 && response.statusCode < 300) {
return response;
debugPrint("URL : $url");
final jsonBody = json.encode(body);
debugPrint(jsonBody);
// }
// return;
if (await Utils.checkConnection(
bypassConnectionCheck: bypassConnectionCheck)) {
final response = await http.post(Uri.parse(url.trim()),
body: json.encode(body), headers: headers);
final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 400) {
onFailure('Error While Fetching data', statusCode);
logApiEndpointError(
endPoint, 'Error While Fetching data', statusCode);
} else {
// var decoded = utf8.decode(response.bodyBytes);
var parsed;
// if (url.contains('Services/NHIC.svc/REST/GetPatientInfo')) {
// parsed = json.decode(sampleNHICResponse);
// } else {
parsed = json.decode(utf8.decode(response.bodyBytes));
// }
// print("Response: $parsed");
if (isAllowAny) {
onSuccess(parsed, statusCode);
} else {
if (parsed['Response_Message'] != null) {
onSuccess(parsed, statusCode);
} else {
if (parsed['ErrorType'] == 4) {
//TODO : handle app update
logApiEndpointError(
endPoint,
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
}
if (parsed['ErrorType'] == 2) {
// todo: handle Logout
logApiEndpointError(endPoint, "session logged out", statusCode);
}
if (isAllowAny) {
onSuccess(parsed, statusCode);
} else if (parsed['IsAuthenticated'] == null) {
if (parsed['isSMSSent'] == true) {
onSuccess(parsed, statusCode);
} else if (parsed['MessageStatus'] == 1) {
onSuccess(parsed, statusCode);
} else if (parsed['Result'] == 'OK') {
onSuccess(parsed, statusCode);
} else {
// if (parsed != null) {
// onSuccess(parsed, statusCode);
// } else {
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
logApiEndpointError(
endPoint,
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
// logout();
// }
}
} else if (parsed['MessageStatus'] == 1 ||
parsed['SMSLoginRequired'] == true) {
onSuccess(parsed, statusCode);
} else if (parsed['MessageStatus'] == 2 &&
parsed['IsAuthenticated']) {
if (parsed['SameClinicApptList'] != null) {
onSuccess(parsed, statusCode);
} else {
if (parsed['message'] == null &&
parsed['ErrorEndUserMessage'] == null) {
if (parsed['ErrorSearchMsg'] == null) {
onFailure("Server Error found with no available message",
statusCode);
logApiEndpointError(
endPoint,
"Server Error found with no available message",
statusCode);
} else {
onFailure(parsed['ErrorSearchMsg'], statusCode);
logApiEndpointError(
endPoint, parsed['ErrorSearchMsg'], statusCode);
}
} else {
onFailure(
parsed['message'] ??
parsed['ErrorEndUserMessage'] ??
parsed['ErrorMessage'],
statusCode);
logApiEndpointError(endPoint,
parsed['message'] ?? parsed['message'], statusCode);
}
}
}
// else if (!parsed['IsAuthenticated']) {
// await logout();
// }
else {
if (parsed['SameClinicApptList'] != null) {
onSuccess(parsed, statusCode);
} else {
if (parsed['message'] != null) {
onFailure(
parsed['message'] ?? parsed['message'], statusCode);
logApiEndpointError(endPoint,
parsed['message'] ?? parsed['message'], statusCode);
} else {
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
logApiEndpointError(
endPoint,
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
}
}
}
}
}
}
} else {
throw _throwAPIException(response, () {
// _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes, isAuthAPI: isAuthAPI);
postJsonForResponse(url, requestBody);
});
onFailure('Please Check The Internet Connection 1', -1);
_analytics.errorTracking
.log("internet_connectivity", error: "no internet available");
}
} on SocketException catch (e) {
if (retryTimes > 0) {
loggerService.logInfo('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
} catch (e) {
print(e);
if (e.toString().contains("ClientException")) {
onFailure('Something went wrong, plase try again', -1);
_analytics.errorTracking
.log("internet_connectivity", error: "no internet available");
} else {
throw APIException(APIException.OTHER, arguments: e);
onFailure(e.toString(), -1);
}
} on HttpException catch (e) {
if (retryTimes > 0) {
loggerService.logInfo('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
_analytics.errorTracking
.log(endPoint, error: "api exception: $e - API Path: $url");
}
}
get(String endPoint,
{required Function(dynamic response, int statusCode) onSuccess,
required Function(String error, int statusCode) onFailure,
Map<String, dynamic>? queryParams,
bool isExternal = false,
bool isRCService = false}) async {
String url;
if (isExternal) {
url = endPoint;
} else {
if (isRCService) {
url = RC_BASE_URL + endPoint;
} else {
throw APIException(APIException.OTHER, arguments: e);
url = BASE_URL + endPoint;
}
} on TimeoutException catch (e) {
throw APIException(APIException.TIMEOUT, arguments: e);
} on ClientException catch (e) {
if (retryTimes > 0) {
loggerService.logInfo('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
}
if (queryParams != null) {
String queryString = Uri(queryParameters: queryParams).query;
url += '?$queryString';
}
debugPrint("URL : $url");
// print("Body : ${json.encode(body)}");
if (await Utils.checkConnection()) {
final response = await http.get(
Uri.parse(url.trim()),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
);
final int statusCode = response.statusCode;
// print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400) {
onFailure!('Error While Fetching data', statusCode);
logApiEndpointError(endPoint, 'Error While Fetching data', statusCode);
} else {
throw APIException(APIException.OTHER, arguments: e);
var parsed = json.decode(utf8.decode(response.bodyBytes));
onSuccess!(parsed, statusCode);
}
} else {
onFailure!('Please Check The Internet Connection', -1);
_analytics.errorTracking
.log("internet_connectivity", error: "no internet available");
}
}
@override
Future<Response> getJsonForResponse<T>(String url, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0, bool isAuthAPI = false}) async {
loggerService.logInfo("Url:$url");
if (headers == null) {
headers = {'Content-Type': 'application/json'};
simplePost(
String fullUrl, {
required Map<dynamic, dynamic> body,
required Map<String, String> headers,
required Function(dynamic response, int statusCode) onSuccess,
required Function(String error, int statusCode) onFailure,
}) async {
String url = fullUrl;
// print("URL Query String: $url");
// print("body: $body");
if (await Utils.checkConnection()) {
headers!.addAll(
{'Content-Type': 'application/json', 'Accept': 'application/json'});
final response = await http.post(
Uri.parse(url.trim()),
body: json.encode(body),
headers: headers,
);
final int statusCode = response.statusCode;
// print("statusCode :$statusCode");
if (await handleUnauthorized(statusCode, forUrl: fullUrl))
simplePost(fullUrl,
onFailure: onFailure,
onSuccess: onSuccess,
body: body,
headers: headers);
// print(response.body.toString());
if (statusCode < 200 || statusCode >= 400) {
onFailure!('Error While Fetching data', statusCode);
logApiFullUrlError(fullUrl, 'Error While Fetching data', statusCode);
} else {
onSuccess!(response.body.toString(), statusCode);
}
} else {
headers['Content-Type'] = 'application/json';
onFailure!('Please Check The Internet Connection', -1);
_analytics.errorTracking
.log("internet_connectivity", error: "no internet available");
}
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes, isAuthAPI: isAuthAPI);
}
Future<Response> _getForResponse(String url, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0, bool isAuthAPI = false}) async {
try {
var _headers = <String, String>{};
if (token != null) {
_headers['Authorization'] = 'Bearer $token';
}
simpleGet(String fullUrl,
{Function(dynamic response, int statusCode)? onSuccess,
Function(String error, int statusCode)? onFailure,
Map<String, dynamic>? queryParams,
Map<String, String>? headers}) async {
headers = headers ?? {};
String url = fullUrl;
var haveParams = (queryParams != null);
if (haveParams) {
String queryString = Uri(queryParameters: queryParams).query;
url += '?$queryString';
// print("URL Query String: $url");
}
if (headers != null && headers.isNotEmpty) {
_headers.addAll(headers);
if (await Utils.checkConnection()) {
headers.addAll(
{'Content-Type': 'application/json', 'Accept': 'application/json'});
final response = await http.get(
Uri.parse(url.trim()),
headers: headers,
);
final int statusCode = response.statusCode;
// print("statusCode :$statusCode");
if (await handleUnauthorized(statusCode, forUrl: fullUrl))
simpleGet(fullUrl,
onFailure: onFailure,
onSuccess: onSuccess,
headers: headers,
queryParams: queryParams);
if (statusCode < 200 || statusCode >= 400) {
onFailure!('Error While Fetching data', statusCode);
logApiFullUrlError(fullUrl, 'Error While Fetching data', statusCode);
} else {
onSuccess!(response.body.toString(), statusCode);
}
} else {
onFailure!('Please Check The Internet Connection', -1);
_analytics.errorTracking
.log("internet_connectivity", error: "no internet available");
}
}
if (isAuthAPI) {
String token = await Utils.getStringFromPrefs(SharedPrefsConsts.appAuthToken);
_headers['Authorization'] = "Bearer $token";
simplePut(String fullUrl,
{Map<String, dynamic>? body,
Map<String, String>? headers,
Function(dynamic response, int statusCode)? onSuccess,
Function(String error, int statusCode)? onFailure}) async {
String url = fullUrl;
// print("URL Query String: $url");
if (await Utils.checkConnection()) {
headers!.addAll(
{'Content-Type': 'application/json', 'Accept': 'application/json'});
final response = await http.put(
Uri.parse(url.trim()),
body: json.encode(body),
headers: headers,
);
final int statusCode = response.statusCode;
// print("statusCode :$statusCode");
if (await handleUnauthorized(statusCode, forUrl: fullUrl))
simplePut(fullUrl,
onFailure: onFailure,
onSuccess: onSuccess,
headers: headers,
body: body);
if (statusCode < 200 || statusCode >= 400) {
onFailure!('Error While Fetching data', statusCode);
logApiFullUrlError(fullUrl, 'Error While Fetching data', statusCode);
} else {
onSuccess!(response.body.toString(), statusCode);
}
} else {
onFailure!('Please Check The Internet Connection', -1);
_analytics.errorTracking
.log("internet_connectivity", error: "no internet available");
}
}
if (queryParameters != null) {
var queryString = Uri(queryParameters: queryParameters).query;
url = '$url?$queryString';
}
var response = await _get(Uri.parse(url), headers: _headers).timeout(Duration(seconds: 60));
simpleDelete(String fullUrl,
{Function(dynamic response, int statusCode)? onSuccess,
Function(String error, int statusCode)? onFailure,
Map<String, String>? queryParams,
Map<String, String>? headers}) async {
String url = fullUrl;
// print("URL Query String: $url");
var haveParams = (queryParams != null);
if (haveParams) {
String queryString = Uri(queryParameters: queryParams).query;
url += '?$queryString';
// print("URL Query String: $url");
}
if (response.statusCode >= 200 && response.statusCode < 300) {
return response;
} else {
throw _throwAPIException(response, () {
_getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes);
});
}
} on SocketException catch (e) {
if (retryTimes > 0) {
loggerService.logInfo('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
if (await Utils.checkConnection()) {
headers!.addAll(
{'Content-Type': 'application/json', 'Accept': 'application/json'});
final response = await http.delete(
Uri.parse(url.trim()),
headers: headers,
);
final int statusCode = response.statusCode;
// print("statusCode :$statusCode");
if (await handleUnauthorized(statusCode, forUrl: fullUrl))
simpleDelete(fullUrl,
onFailure: onFailure,
onSuccess: onSuccess,
queryParams: queryParams,
headers: headers);
if (statusCode < 200 || statusCode >= 400) {
onFailure!('Error While Fetching data', statusCode);
logApiFullUrlError(fullUrl, 'Error While Fetching data', statusCode);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
} on HttpException catch (e) {
if (retryTimes > 0) {
loggerService.logInfo('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
} on TimeoutException catch (e) {
throw APIException(APIException.TIMEOUT, arguments: e);
} on ClientException catch (e) {
if (retryTimes > 0) {
loggerService.logInfo('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
} else {
throw APIException(APIException.OTHER, arguments: e);
onSuccess!(response.body.toString(), statusCode);
}
} else {
onFailure!('Please Check The Internet Connection', -1);
_analytics.errorTracking
.log("internet_connectivity", error: "no internet available");
}
}
Future<Response> _get(url, {Map<String, String>? headers}) => _withClient((client) => client.get(url, headers: headers));
bool _certificateCheck(X509Certificate cert, String host, int port) => true;
Future<T> _withClient<T>(Future<T> Function(Client) fn) async {
var httpClient = HttpClient()..badCertificateCallback = _certificateCheck;
var client = IOClient(httpClient);
try {
return await fn(client);
} finally {
client.close();
Future<bool> handleUnauthorized(int statusCode,
{required String forUrl}) async {
if (forUrl.startsWith(EXA_CART_API_BASE_URL) && statusCode == 401) {
final token = await generatePackagesToken();
ApiConsts.packagesAuthHeader['Authorization'] = 'Bearer $token';
return (token is String);
}
return false;
}
Future<Response> _post(url, {Map<String, String>? headers, body, Encoding? encoding}) => _withClient((client) => client.post(url, headers: headers, body: body, encoding: encoding));
String getSessionId(String id) {
return id.replaceAll(RegExp('/[^a-zA-Z]'), '');
}
Future<String> generatePackagesToken() async {
var url = EXA_CART_API_BASE_URL + PACKAGES_TOKEN;
var body = {
"api_client": {
"client_id": "a4ab6be4-424f-4836-b032-46caed88e184",
"client_secret": "3c1a3e07-4a40-4510-9fb0-ee5f0a72752c"
}
};
String? token;
final completer = Completer();
simplePost(url, body: body, headers: {},
onSuccess: (dynamic stringResponse, int statusCode) {
if (statusCode == 200) {
var jsonResponse = json.decode(stringResponse);
token = jsonResponse['auth_token'];
completer.complete();
}
}, onFailure: (String error, int statusCode) {
completer.complete();
logApiFullUrlError(url, error, statusCode);
});
await completer.future;
return token!;
}
logApiFullUrlError(String fullUrl, error, code) {
final endpoint = Uri.parse(fullUrl).pathSegments.last;
logApiEndpointError(endpoint, error, code);
}
@override
void setHomeUrl(String url) {
// TODO: implement setHomeUrl
logApiEndpointError(String endPoint, error, code) {
_analytics.errorTracking.log(endPoint, error: error);
}
}

@ -0,0 +1,765 @@
import 'dart:io';
var MAX_SMALL_SCREEN = 660;
final OPENTOK_API_KEY = '46209962';
// final OPENTOK_API_KEY = '47464241';
// PACKAGES and OFFERS
var EXA_CART_API_BASE_URL = 'https://mdlaboratories.com/offersdiscounts';
// var EXA_CART_API_BASE_URL = 'http://10.200.101.75:9000';
var PACKAGES_CATEGORIES = '/api/categories';
var PACKAGES_STORES = '/api/stores';
var PACKAGES_TOKEN = '/api/token';
var PACKAGES_PRODUCTS = '/api/products';
var PACKAGES_CUSTOMER = '/api/customers';
var PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
var PACKAGES_ORDERS = '/api/orders';
var PACKAGES_ORDER_HISTORY = '/api/orders/items';
var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara';
// var BASE_URL = 'http://10.50.100.198:2018/';
var BASE_URL = 'https://uat.hmgwebservices.com/';
// var BASE_URL = 'https://hmgwebservices.com/';
// var BASE_URL = 'http://10.201.204.103/';
// var BASE_URL = 'https://orash.cloudsolutions.com.sa/';
// var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/';
// var BASE_URL = 'https://vidamergeuat.cloudsolutions.com.sa/';
// var BASE_URL = 'https://webservices.hmg.com/';
// var BASE_URL = 'http://10.50.100.198:4422/';
// Pharmacy UAT URLs
// var BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
// var PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
// // Pharmacy Production URLs
var BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/';
var PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/';
var PHARMACY_REDIRECT_URL = 'https://bit.ly/AlhabibPharmacy';
// Pharmacy VidaPlus URLs
// var BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapitest/api/';
// var PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapitest/api/';
// // Pharmacy Pre-Production URLs
// var BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapitest/api/';
// var PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapitest/api/';
// RC API URL
var RC_BASE_URL = 'https://rc.hmg.com/';
// var RC_BASE_URL = 'https://rc.hmg.com/test/';
// var RC_BASE_URL = 'https://ms.hmg.com/rc/';
var PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity';
var GET_PROJECT = 'Services/Lists.svc/REST/GetProject';
///Geofencing
var GET_GEO_ZONES = 'Services/Patients.svc/REST/GeoF_GetAllPoints';
var LOG_GEO_ZONES = 'Services/Patients.svc/REST/GeoF_InsertPatientFileInfo';
// Delivery Driver
var DRIVER_LOCATION = 'Services/Patients.svc/REST/PatientER_GetDriverLocation';
//weather
var WEATHER_INDICATOR = 'Services/Weather.svc/REST/GetCityInfo';
var GET_PRIVILEGE = 'Services/Patients.svc/REST/Service_Privilege';
// Wifi Credentials
var WIFI_CREDENTIALS = "Services/Patients.svc/Hmg_SMS_Get_By_ProjectID_And_PatientID";
///Doctor
var GET_MY_DOCTOR = 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult';
var GET_DOCTOR_PROFILE = 'Services/Doctors.svc/REST/GetDocProfiles';
var GET_DOCTOR_PRE_POST_IMAGES = 'Services/Doctors.svc/REST/GetDoctorPrePostImages';
var GET_DOCTOR_RATING_NOTES = 'Services/Doctors.svc/REST/dr_GetNotesDoctorRating';
var GET_DOCTOR_RATING_DETAILS = 'Services/Doctors.svc/REST/dr_GetDoctorRatingDetails';
var GET_DOCTOR_RATING = 'Services/Doctors.svc/REST/dr_GetAvgDoctorRating';
///Prescriptions
// var PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList';
var PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList_Async';
var GET_PRESCRIPTIONS_ALL_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
var GET_PRESCRIPTION_REPORT = 'Services/Patients.svc/REST/INP_GetPrescriptionReport';
var SEND_PRESCRIPTION_EMAIL = 'Services/Notifications.svc/REST/SendPrescriptionEmail';
var GET_PRESCRIPTION_REPORT_ENH = 'Services/Patients.svc/REST/GetPrescriptionReport_enh';
///Lab Order
var GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders';
var GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLabSpecialResults';
var SEND_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/SendLabReportEmail';
var GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults';
var GET_Patient_LAB_ORDERS_RESULT = 'Services/Patients.svc/REST/GetPatientLabOrdersResults';
var SEND_COVID_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/GenerateCOVIDReport';
var COVID_PASSPORT_UPDATE = 'Services/Patients.svc/REST/Covid19_Certificate_PassportUpdate';
var GET_PATIENT_PASSPORT_NUMBER = 'Services/Patients.svc/REST/Covid19_Certificate_GetPassport';
var SEND_LAB_RESULT_EMAIL_NEW = 'ReportsAPI/api/reports/labReport';
var UPDATE_WORKPLACE_NAME = 'Services/Patients.svc/REST/ActivateSickLeave_FromVida';
var GET_SICKLEAVE_STATUS_ADMISSION_NO = 'Services/ChatBot_Service.svc/REST/GetSickLeaveStatusByAdmissionNo';
///
var GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders';
var GET_PATIENT_LAB_ORDERS_BY_APPOINTMENT = 'Services/Patients.svc/REST/GetPatientLabResultsByAppointmentNo';
var GET_PATIENT_ORDERS_DETAILS = 'Services/Patients.svc/REST/Rad_UpdatePatientRadOrdersToRead';
var GET_RAD_IMAGE_URL = 'Services/Patients.svc/Rest/GetRadImageURL';
var SEND_RAD_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendRadReportEmail';
///Feedback
var SEND_FEEDBACK = 'Services/COCWS.svc/REST/InsertCOCItemInSPList';
var GET_STATUS_FOR_COCO = 'Services/COCWS.svc/REST/GetStatusforCOC';
// var GET_PATIENT_AppointmentHistory = 'Services'
// '/Doctors.svc/REST/PateintHasAppoimentHistory';
var GET_PATIENT_AppointmentHistory = 'Services'
'/Doctors.svc/REST/PateintHasAppoimentHistory_Async';
///VITAL SIGN
var GET_PATIENT_VITAL_SIGN = 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign';
///Er Nearest
var GET_NEAREST_HOSPITAL = 'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime';
///ED Online
var ER_GET_VISUAL_TRIAGE_QUESTIONS = "services/Doctors.svc/REST/ER_GetVisualTriageQuestions";
var ER_SAVE_TRIAGE_INFORMATION = "services/Doctors.svc/REST/ER_SaveTriageInformation";
var ER_GetPatientPaymentInformationForERClinic = "services/Doctors.svc/REST/ER_GetPatientPaymentInformationForERClinic";
///Er Nearest
var GET_AMBULANCE_REQUEST = 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod';
var GET_PATIENT_ALL_PRES_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
var GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID = 'Services/Patients.svc/REST/PatientER_RRT_GetPickUpRequestByPresOrderID';
var UPDATE_PRESS_ORDER = 'Services/Patients.svc/REST/PatientER_UpdatePresOrder';
var INSERT_ER_INERT_PRES_ORDER = 'Services/Patients.svc/REST/PatientER_InsertPresOrder';
/// ER RRT
var GET_ALL_RC_TRANSPORTATION = 'api/Transportation/getalltransportation';
var GET_ALL_TRANSPORTATIONS_RC = 'api/Transportation/getalltransportation';
var GET_ALL_RRT_QUESTIONS = 'Services/Patients.svc/REST/PatientER_RRT_GetAllQuestions';
var GET_RRT_SERVICE_PRICE = 'Services/Patients.svc/REST/PatientE_RealRRT_GetServicePrice';
var GET_ALL_TRANSPORTATIONS_ORDERS = 'api/Transportation/get';
var CANCEL_AMBULANCE_REQUEST = "api/Transportation/update";
var INSERT_TRANSPORTATION_ORDER_RC = "api/Transportation/add";
///FindUs
var GET_FINDUS_REQUEST = 'Services/Lists.svc/REST/Get_HMG_Locations';
///LiveChat
var GET_LIVECHAT_REQUEST = 'Services/Patients.svc/REST/GetPatientICProjects';
///babyInformation
var GET_BABYINFORMATION_REQUEST = 'Services/Community.svc/REST/GetBabyByUserID';
///Get Baby By User ID
var GET_BABY_BY_USER_ID = 'Services/Community.svc/REST/GetBabyByUserID';
///userInformation
var GET_USERINFORMATION_REQUEST = 'Services/Community.svc/REST/GetUserInformation_New';
///Update email
var UPDATE_PATENT_EMAIL = 'Services/Patients.svc/REST/UpdatePateintEmail';
var UPDATE_PATENT_INFO = 'Services/Community.svc/REST/UpdateUserInfo_New';
///addNewChild
var GET_NEWCHILD_REQUEST = 'Services/Community.svc/REST/CreateNewBaby';
///newUserId
var GET_NEW_USER_REQUEST = 'Services/Community.svc/REST/CreateNewUser_New';
///delete Child
var DELETE_CHILD_REQUEST = 'Services/Community.svc/REST/DeleteBaby';
///addNewTABLE
var GET_TABLE_REQUEST = 'Services/Community.svc/REST/CreateVaccinationTable';
///BloodDenote
var GET_CITIES_REQUEST = 'Services/Lists.svc/REST/GetAllCities';
///BloodDetails
var GET_BLOOD_REQUEST = 'services/PatientVarification.svc/REST/BloodDonation_GetBloodGroupDetails';
var SAVE_BLOOD_REQUEST = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType';
var GET_BLOOD_AGREEMENT = 'Services/PatientVarification.svc/REST/CheckUserAgreementForBloodDonation';
var SAVE_BLOOD_AGREEMENT = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation';
///Reports
var REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo';
var INSERT_REQUEST_FOR_MEDICAL_REPORT = 'Services/Doctors.svc/REST/InsertRequestForMedicalReport';
var SEND_MEDICAL_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendMedicalReportEmail';
var GET_INPATIENT_ADMISSIONS = 'Services/inps.svc/REST/getAdmissionForMedicalReport';
var GET_MEDICAL_REPORT_PDF = 'Services/inps.svc/REST/getMedicalReportPDF';
///Rate
// var IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated';
var IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated_Async';
var GET_APPOINTMENT_DETAILS_BY_NO = 'Services/MobileNotifications.svc/REST/GetAppointmentDetailsByApptNo';
var NEW_RATE_APPOINTMENT_URL = "Services/Doctors.svc/REST/AppointmentsRating_InsertAppointmentRate";
var NEW_RATE_DOCTOR_URL = "Services/Doctors.svc/REST/DoctorsRating_InsertDoctorRate";
var GET_QR_PARKING = 'Services/SWP.svc/REST/GetQRParkingByID';
//URL to get clinic list
var GET_CLINICS_LIST_URL = "Services/lists.svc/REST/GetClinicCentralized";
var GET_CLINICS_LIST_WRT_HOSPITAL_URL = "Services/Lists.svc/REST/GetClinicFromDoctorSchedule";
//URL to get active appointment list
var GET_ACTIVE_APPOINTMENTS_LIST_URL = "Services/Doctors.svc/Rest/Dr_GetAppointmentActiveNumber";
//URL to get projects list
var GET_PROJECTS_LIST = 'Services/Lists.svc/REST/GetProject';
//URL to get doctors list
var GET_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/SearchDoctorsByTime";
//URL to dental doctors list
var GET_DENTAL_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/Dental_DoctorChiefComplaintMapping";
//URL to get doctor free slots
var GET_DOCTOR_FREE_SLOTS = "Services/Doctors.svc/REST/GetDoctorFreeSlots";
//URL to insert appointment
var INSERT_SPECIFIC_APPOINTMENT = "Services/Doctors.svc/REST/InsertSpecificAppointment";
//URL to get patient share
var GET_PATIENT_SHARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNO";
//URL to get patient appointment history
var GET_PATIENT_APPOINTMENT_HISTORY = "Services/Doctors.svc/REST/PateintHasAppoimentHistory";
var GET_OBGYNE_ORDERS_LIST = "services/Patients.svc/REST/HIS_OBGYNEProcedureGet";
var GET_OBGYNE_DOCTORS_LIST = "services/Doctors.svc/REST/HIS_ObgyneUltrasoundDoctors";
var OBGYNE_PROCEDURE_UPDATE = "services/Patients.svc/REST/HIS_OBGYNEProcedure_Update";
var GET_RRT_PROCEDURE_LIST = "Services/Patients.svc/REST/GetRRTProcedureDetailsListFromVida";
var DOCTOR_SCHEDULE_URL = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable';
var SEND_REPORT_EYE_EMAIL = "Services/Notifications.svc/REST/SendGlassesPrescriptionEmail";
var SEND_CONTACT_LENS_PRESCRIPTION_EMAIL = "Services/Notifications.svc/REST/SendContactLensPrescriptionEmail";
//URL to get patient appointment curfew history
// var GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = "Services/Doctors.svc/REST/AppoimentHistoryForCurfew";
var GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = "Services/Doctors.svc/REST/AppoimentHistoryForCurfew_Async";
//URL to confirm appointment
var CONFIRM_APPOINTMENT = "Services/MobileNotifications.svc/REST/ConfirmAppointment";
var INSERT_VIDA_REQUEST = "Services/ER_VirtualCall.svc/REST/PatientER_VidaRequestInseart";
//URL to cancel appointment
var CANCEL_APPOINTMENT = "Services/Doctors.svc/REST/CancelAppointment";
//URL get appointment QR
var GENERATE_QR_APPOINTMENT = "Services/Doctors.svc/REST/GenerateQRAppointmentNo";
//URL send email appointment QR
var EMAIL_QR_APPOINTMENT = "Services/Notifications.svc/REST/sendEmailForOnLineCheckin";
//URL check payment status
var CHECK_PAYMENT_STATUS = "Services/PayFort_Serv.svc/REST/GetRequestStatusByRequestID";
//URL create advance payment
var CREATE_ADVANCE_PAYMENT = "Services/Doctors.svc/REST/CreateAdvancePayment";
var HIS_CREATE_ADVANCE_PAYMENT = "Services/Patients.svc/REST/HIS_CreateAdvancePayment";
var ER_CREATE_ADVANCE_PAYMENT = "services/Doctors.svc/REST/ER_CreateAdvancePaymentForClinic";
var ER_INSERT_ADVANCE_PAYMENT = "services/Doctors.svc/REST/ER_InsertEROnlinePaymentDetails";
var ADD_ADVANCE_NUMBER_REQUEST = 'Services/PayFort_Serv.svc/REST/AddAdvancedNumberRequest';
var GENERATE_ANCILLARY_ORDERS_INVOICE = 'Services/Doctors.svc/REST/AutoGenerateAncillaryOrderInvoice';
var IS_ALLOW_ASK_DOCTOR = 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult';
var GET_CALL_REQUEST_TYPE = 'Services/Doctors.svc/REST/GetCallRequestType_LOV';
var ADD_VIDA_REQUEST = 'Services/ER_VirtualCall.svc/REST/PatientER_VidaRequestInseart';
var SEND_CALL_REQUEST = 'Services/Doctors.svc/REST/InsertCallInfo';
var GET_LIVECARE_CLINICS = 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinics';
var GET_LIVECARE_SCHEDULE_CLINICS = 'Services/Doctors.svc/REST/PatientER_GetClinicsHaveSchedule';
var GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST = 'Services/Doctors.svc/REST/PatientER_GetDoctorByClinicID';
var GET_LIVECARE_SCHEDULE_DOCTOR_TIME_SLOTS = 'Services/Doctors.svc/REST/PatientER_GetDoctorFreeSlots';
var INSERT_LIVECARE_SCHEDULE_APPOINTMENT = 'Services/Doctors.svc/REST/InsertSpecificAppoitmentForSchedule';
var GET_PATIENT_SHARE_LIVECARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForLiveCare";
var SET_ONLINE_CHECKIN_FOR_APPOINTMENT = "Services/Patients.svc/REST/SetOnlineCheckInForAppointment";
var GET_LIVECARE_CLINIC_TIMING = 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinicsServiceTimingsSchedule';
var GET_ER_APPOINTMENT_FEES = 'Services/DoctorApplication.svc/REST/GetERAppointmentFees';
var GET_ER_APPOINTMENT_TIME = 'Services/ER_VirtualCall.svc/REST/GetRestTime';
var CHECK_PATIENT_DERMA_PACKAGE = 'Services/OUTPs.svc/REST/getPatientPackageComponentsForOnlineCheckIn';
var ADD_NEW_CALL_FOR_PATIENT_ER = 'Services/DoctorApplication.svc/REST/NewCallForPatientER';
var GET_LIVECARE_HISTORY = 'Services/ER_VirtualCall.svc/REST/GetPatientErVirtualHistory';
var CANCEL_LIVECARE_REQUEST = 'Services/ER_VirtualCall.svc/REST/DeleteErRequest';
var SEND_LIVECARE_INVOICE_EMAIL = 'Services/Notifications.svc/REST/SendInvoiceForLiveCare';
var CHANGE_PATIENT_ER_SESSION = 'Services/DoctorApplication.svc/REST/ChangePatientERSession';
var APPLE_PAY_INSERT_REQUEST = 'Services/PayFort_Serv.svc/REST/PayFort_ApplePayRequestData_Insert';
var GET_USER_TERMS = 'Services/Patients.svc/REST/GetUserTermsAndConditions';
var TAMARA_REQUEST_INSERT = 'Services/PayFort_Serv.svc/REST/AddTamaraRequest';
var UPDATE_HEALTH_TERMS = 'services/Patients.svc/REST/UpdatePateintHealthSummaryReport';
var GET_PATIENT_HEALTH_STATS = 'Services/Patients.svc/REST/Med_GetTransactionsSts';
var SEND_CHECK_IN_NFC_REQUEST = 'Services/Patients.svc/REST/Patient_CheckAppointmentValidation_ForNFC';
var CHECK_SCANNED_NFC_QR_CODE = 'Services/Patients.svc/REST/Patient_ValidationMachine_ForNFC';
var HAS_DENTAL_PLAN = 'Services/Doctors.svc/REST/Dental_IsPatientHasOnGoingEstimation';
var LASER_BODY_PARTS = 'Services/Patients.svc/REST/Laser_GetBodyPartsByCategory';
var INSERT_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnarie_Insert';
var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnarie_Update';
var GET_PATIENT_SHARE_FOR_WALKIN_APPOINTMENT = 'Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForWalkIn';
var CAN_PAY_FOR_FOR_WALKIN_APPOINTMENT = 'Services/Doctors.svc/REST/CanPayForWalkinAppointment';
//URL to get medicine and pharmacies list
var CHANNEL = 3;
var GENERAL_ID = 'Cs2020@2016\$2958';
var IP_ADDRESS = '10.20.10.20';
var VERSION_ID = 18.7;
var SETUP_ID = '91877';
var LANGUAGE = 2;
// var PATIENT_OUT_SA = 0;
var SESSION_ID = 'TMRhVmkGhOsvamErw';
var IS_DENTAL_ALLOWED_BACKEND = false;
var PATIENT_TYPE = 1;
var PATIENT_TYPE_ID = 1;
var DEVICE_TOKEN = "";
var IS_VOICE_COMMAND_CLOSED = true;
var IS_TEXT_COMPLETED = false;
// var DeviceTypeID = Platform.isIOS ? 1 : 2;
// var LANGUAGE_ID = 2;
var GET_PHARMCY_ITEMS = "Services/Lists.svc/REST/GetPharmcyItems_Region";
var GET_PHARMACY_LIST = "Services/Patients.svc/REST/GetPharmcyList";
var GET_PAtIENTS_INSURANCE = "Services/Patients.svc/REST/Get_PatientInsuranceDetails";
var GET_PAtIENTS_INSURANCE_UPDATED = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceCardUpdateHistory";
var INSURANCE_DETAILS = "Services/Patients.svc/REST/Get_InsuranceCheckList";
var INSURANCE_SCHEMES = "Services/Patients.svc/REST/PatientER_SchemesOfAactiveCompaniesGet";
var UPDATE_MANUAL_INSURANCE = "Services/Patients.svc/REST/PatientER_PatientInfoForInsuranceCardUpdate";
var INSURANCE_COMPANIES = "Services/Patients.svc/REST/PatientER_InsuranceCompanyGet";
var GET_PATIENT_INSURANCE_DETAILS = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceDetails";
var UPLOAD_INSURANCE_CARD = 'Services/Patients.svc/REST/PatientER_PatientInfoForInsuranceCardUpdate';
var GET_VACCINES = "Services/Patients.svc/REST/GetDoneVaccinesByPatientID";
var GET_VACCINES_EMAIL = "Services/Notifications.svc/REST/SendVaccinesEmail";
var GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus_Async";
// var GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus";
var SEARCH_BOT = 'HabibiChatBotApi/BotInterface/GetVoiceCommandResponse';
var GET_VACCINATIONS_ITEMS = "/Services/ERP.svc/REST/GET_VACCINATIONS_ITEMS";
var GET_VACCINATION_ONHAND = "/Services/ERP.svc/REST/GET_VACCINATION_ONHAND";
var GET_PATIENT_SICK_LEAVE = 'Services/Patients.svc/REST/GetPatientSickLeave';
var GET_PATIENT_SICK_LEAVE_STATUS = 'Services/Patients.svc/REST/GetPatientSickLeave_Status';
var SendSickLeaveEmail = 'Services/Notifications.svc/REST/SendSickLeaveEmail';
var GET_PATIENT_AdVANCE_BALANCE_AMOUNT = 'Services/Patients.svc/REST/GetPatientAdvanceBalanceAmount';
var GET_PATIENT_INFO_BY_ID = 'Services/Doctors.svc/REST/GetPatientInfoByPatientID';
var GET_PATIENT_INFO_BY_ID_AND_MOBILE_NUMBER = 'Services/Patients.svc/REST/AP_GetPatientInfoByPatientIDandMobileNumber';
var SEND_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/SendActivationCodeForAdvancePayment';
var CHECK_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/CheckActivationCodeForAdvancePayment';
var GET_COVID_DRIVETHRU_PROJECT_LIST = 'Services/Doctors.svc/REST/COVID19_ProjectDriveThroughTestingCenter';
var GET_COVID_DRIVETHRU_PAYMENT_INFO = 'Services/Doctors.svc/REST/COVID19_GetPatientPaymentInormation';
var GET_COVID_DRIVETHRU_FREE_SLOTS = 'Services/Doctors.svc/REST/COVID19_GetFreeSlots';
var GET_COVID_DRIVETHRU_PROCEDURES_LIST = 'Services/Doctors.svc/REST/COVID19_GetTestProcedures';
///Smartwatch Integration Services
var GET_PATIENT_LAST_RECORD = 'Services/Patients.svc/REST/Med_GetPatientLastRecord';
var INSERT_PATIENT_HEALTH_DATA = 'Services/Patients.svc/REST/Med_InsertTransactions';
///My Trackers
var GET_DIABETIC_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetDiabeticResultAverage';
var GET_DIABTEC_RESULT = 'Services/Patients.svc/REST/Patient_GetDiabtecResults';
var ADD_DIABTEC_RESULT = 'Services/Patients.svc/REST/Patient_AddDiabtecResult';
var GET_BLOOD_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetBloodPressureResultAverage';
var GET_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetBloodPressureResult';
var ADD_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddBloodPressureResult';
var GET_WEIGHT_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage';
var GET_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult';
var ADD_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddWeightMeasurementResult';
var ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID = 'Services/Patients.svc/Rest/GetActivePrescriptionReportByPatientID';
var GET_CALL_INFO_HOURS_RESULT = 'Services/Doctors.svc/REST/GetCallInfoHoursResult';
var GET_CALL_REQUEST_TYPE_LOV = 'Services/Doctors.svc/REST/GetCallRequestType_LOV';
var GET_QUESTION_TYPES = 'Services/OUTPs.svc/REST/getQuestionsTypes';
var UPDATE_DIABETIC_RESULT = 'Services/Patients.svc/REST/Patient_UpdateDiabeticResult';
var SEND_AVERAGE_BLOOD_SUGAR_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodSugarReport';
var DEACTIVATE_DIABETIC_STATUS = 'services/Patients.svc/REST/Patient_DeactivateDiabeticStatus';
var DEACTIVATE_BLOOD_PRESSURES_STATUS = 'services/Patients.svc/REST/Patient_DeactivateBloodPressureStatus';
var UPDATE_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateBloodPressureResult';
var SEND_AVERAGE_BLOOD_WEIGHT_REPORT = 'Services/Notifications.svc/REST/SendAverageBodyWeightReport';
var SEND_AVERAGE_BLOOD_PRESSURE_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodPressureReport';
var UPDATE_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateWeightMeasurementResult';
var DEACTIVATE_WEIGHT_PRESSURE_RESULT = 'services/Patients.svc/REST/Patient_DeactivateWeightMeasurementStatus';
var GET_DOCTOR_RESPONSE = 'Services/Patients.svc/REST/GetDoctorResponse';
var UPDATE_READ_STATUS = 'Services/Patients.svc/REST/UpdateReadStatus';
var INSERT_CALL_INFO = 'Services/Doctors.svc/REST/InsertCallInfo';
var INSERT_APPOINTMENT_QUESTION = 'Services/OUTPs.svc/REST/insertAppointmentQuestion';
var RATE_DOCTOR_RESPONSE = 'Services/OUTPs.svc/REST/insertAppointmentQuestionRating';
var GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies';
// H2O
var H2O_GET_USER_PROGRESS = "Services/H2ORemainder.svc/REST/H2O_GetUserProgress";
var H2O_INSERT_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2O_InsertUserActivity";
var H2O_GET_USER_DETAIL = "Services/H2ORemainder.svc/REST/H2O_GetUserDetails_New";
var H2O_UPDATE_USER_DETAIL = "Services/H2ORemainder.svc/REST/H2O_UpdateUserDetails_New";
var H2O_UNDO_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2o_UndoUserActivity";
//E_Referral Services
var GET_ALL_RELATIONSHIP_TYPES = "Services/Patients.svc/REST/GetAllRelationshipTypes";
var SEND_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/SendActivationCodeForEReferral';
var CHECK_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/CheckActivationCodeForEReferral';
var GET_ALL_CITIES = 'services/Lists.svc/rest/GetAllCities';
var CREATE_E_REFERRAL = "Services/Patients.svc/REST/CreateEReferral";
var GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals";
// Encillary Orders
var GET_ANCILLARY_ORDERS = 'Services/Doctors.svc/REST/GetOnlineAncillaryOrderList';
var GET_ANCILLARY_ORDERS_DETAILS = 'Services/Doctors.svc/REST/GetOnlineAncillaryOrderProcList';
//Pharmacy wishlist
// var GET_WISHLIST = "http://swd-pharapp-01:7200/api/shopping_cart_items/";
var GET_DOCTOR_LIST_BY_TIME = "Services/Doctors.svc/REST/SearchDoctorsByTime";
// pharmacy
var PHARMACY_AUTORZIE_CUSTOMER = "AutorizeCustomer";
var PHARMACY_VERIFY_CUSTOMER = "VerifyCustomer";
var PHARMACY_GET_COUNTRY = "countries";
// var PHARMACY_CREATE_CUSTOMER = "epharmacy/api/CreateCustomer";
var PHARMACY_CREATE_CUSTOMER = "getorcreateCustomer";
var GET_PHARMACY_BANNER = "promotionbanners";
var GET_PHARMACY_TOP_MANUFACTURER = "topmanufacturer";
var GET_PHARMACY_BEST_SELLER_PRODUCT = "bestsellerproducts";
var GET_PHARMACY_PRODUCTs_BY_IDS = "productsbyids/";
var GET_PHARMACY_PRODUCTs_BY_SKU = "productbysku/";
var GET_CUSTOMERS_ADDRESSES = "Customers/";
var SUBSCRIBE_PRODUCT = "subscribe?";
var GET_ORDER = "orders?";
var GET_ORDER_DETAILS = "orders/";
var ADD_CUSTOMER_ADDRESS = "addcustomeraddress";
var EDIT_CUSTOMER_ADDRESS = "editcustomeraddress";
var DELETE_CUSTOMER_ADDRESS = "deletecustomeraddress";
var GET_ADDRESS = "Customers/";
var GET_Cancel_ORDER = "cancelorder/";
var WRITE_REVIEW = "Content-Type" + "text/plain; charset=utf-8";
var GET_SHOPPING_CART = "shopping_cart_items/";
var GET_SHIPPING_OPTIONS = "get_shipping_option/";
var DELETE_SHOPPING_CART = "delete_shopping_cart_items/";
var DELETE_SHOPPING_CART_ALL = "delete_shopping_cart_item_by_customer/";
var ORDER_SHOPPING_CART = "orders";
var GET_LACUM_ACCOUNT_INFORMATION = "Services/Patients.svc/REST/GetLakumAccountInformation";
var GET_LACUM_GROUP_INFORMATION = "Services/Patients.svc/REST/GetlakumInQueryInfoGrouping";
var LACUM_ACCOUNT_ACTIVATE = "Services/Patients.svc/REST/LakumAccountActivation";
var LACUM_ACCOUNT_DEACTIVATE = "Services/Patients.svc/REST/LakumAccountDeactivation";
var CREATE_LAKUM_ACCOUNT = "Services/Patients.svc/REST/PHR_CreateLakumAccount";
var TRANSFER_YAHALA_LOYALITY_POINTS = "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints";
var LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy";
// var PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList';
var PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList_Async';
var GET_RECOMMENDED_PRODUCT = 'alsoProduct/';
var GET_MOST_VIEWED_PRODUCTS = "mostview";
var GET_NEW_PRODUCTS = "newproducts";
// Home Health Care
var HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices";
var HHC_GET_ALL_CMC_SERVICES = "Services/Patients.svc/REST/PatientER_CMC_GetAllServices";
var PATIENT_ER_UPDATE_PRES_ORDER = "Services/Patients.svc/REST/PatientER_UpdatePresOrder";
var GET_ORDER_DETAIL_BY_ID = "Services/Patients.svc/REST/PatientER_HHC_GetTransactionsForOrder";
var GET_CMC_ORDER_DETAIL_BY_ID = "Services/Patients.svc/REST/PatientER_CMC_GetTransactionsForOrder";
var GET_CHECK_UP_ITEMS = "Services/Patients.svc/REST/GetCheckUpItems";
var PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS = 'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications';
var PUSH_NOTIFICATION_SET_MESSAGES_FROM_POOL_AS_READ = 'Services/MobileNotifications.svc/REST/PushNotification_SetMessagesFromPoolAsRead';
var GET_PATIENT_ALL_PRES_ORD = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
var PATIENT_ER_INSERT_PRES_ORDER = 'Services/Patients.svc/REST/PatientER_InsertPresOrder';
var BLOOD_DONATION_REGISTER_BLOOD_TYPE = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType';
var ADD_USER_AGREEMENT_FOR_BLOOD_DONATION = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation';
// HHC RC SERVICES
var HHC_GET_ALL_SERVICES_RC = "api/HHC/getallhhc";
var ADD_HHC_ORDER_RC = "api/HHC/add";
var GET_ALL_HHC_ORDERS_RC = 'api/hhc/list';
var UPDATE_HHC_ORDER_RC = 'api/hhc/update';
// CMC RC SERVICES
var GET_ALL_CMC_SERVICES_RC = 'api/cmc/getallcmc';
var ADD_CMC_ORDER_RC = 'api/cmc/add';
var GET_ALL_CMC_ORDERS_RC = 'api/cmc/list';
var UPDATE_CMC_ORDER_RC = 'api/cmc/update';
// RRT RC SERVICES
var ADD_RRT_ORDER_RC = "api/rrt/add";
var GET_ALL_RRT_ORDERS_RC = "api/rrt/list";
var UPDATE_RRT_ORDER_RC = 'api/rrt/update';
// PRESCRIPTION RC SERVICES
var ADD_PRESCRIPTION_ORDER_RC = "api/prescription/add";
var GET_ALL_PRESCRIPTION_ORDERS_RC = "api/prescription/list";
var GET_ALL_PRESCRIPTION_INFO_RC = "api/Prescription/info";
var UPDATE_PRESCRIPTION_ORDER_RC = 'api/prescription/update';
//Pharmacy wishlist
var GET_WISHLIST = "shopping_cart_items/";
var DELETE_WISHLIST = "delete_shopping_cart_item_by_product?customer_id=";
var GET_REVIEW = "customerreviews/";
var GET_BRANDS = "manufacturer";
var GET_TOP_BRANDS = "topmanufacturer?page=1&limit=8";
var GET_PRODUCT_DETAIL = "products/";
var GET_LOCATION = "Services/Patients.svc/REST/GetPharmcyListBySKU";
var GET_SPECIFICATION = "productspecification/";
var GET_BRAND_ITEMS = "products";
var PHARMACY_MAKE_REVIEW = 'insertreviews';
// External API
var ADD_ADDRESS_INFO = "addcustomeraddress";
var GET_CUSTOMER_ADDRESSES = "Customers/";
var GET_CUSTOMER_INFO = "VerifyCustomer";
//Pharmacy
var GET_PHARMACY_CATEGORISE = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0';
var GET_OFFERS_CATEGORISE = 'discountcategories';
var GET_OFFERS_PRODUCTS = 'offerproducts/';
var GET_CATEGORISE_PARENT = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
var GET_PARENT_PRODUCTS = 'products?categoryid=';
var GET_SUB_CATEGORISE = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
var GET_SUB_PRODUCTS = 'products?categoryid=';
var GET_FINAL_PRODUCTS =
'products?fields=id,reviews,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&CategoryId=';
var GET_CLINIC_CATEGORY = 'Services/Doctors.svc/REST/DP_GetClinicCategory';
var GET_DISEASE_BY_CLINIC_ID = 'Services/Doctors.svc/REST/DP_GetDiseasesByClinicID';
var SEARCH_DOCTOR_BY_TIME = 'Services/Doctors.svc/REST/SearchDoctorsByTime';
var TIMER_MIN = 10;
var GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw";
var GET_BRANDS_LIST = 'categoryManufacturer?categoryids=';
var GET_SEARCH_PRODUCTS =
'searchproducts?fields=id,discount_ids,reviews,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&search_key=';
var SCAN_QR_CODE = 'productbysku/';
var FILTERED_PRODUCTS = 'products?categoryids=';
var GET_DOCTOR_LIST_CALCULATION = "Services/Doctors.svc/REST/GetCallculationDoctors";
var GET_ALL_APPOINTMENTS_FOR_DENTAL_CLINIC = "Services/Patients.svc/REST/GetDentalAppointments";
var GET_DENTAL_APPOINTMENT_INVOICE = "Services/Patients.svc/REST/HIS_eInvoiceForDentalByAppointmentNo";
var SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL = "Services/Notifications.svc/REST/SendInvoiceForDental";
var GET_TAMARA_PLAN = 'https://mdlaboratories.com/tamaralive/Home/GetInstallments';
var GET_TAMARA_PAYMENT_STATUS = 'https://mdlaboratories.com/tamaralive/api/OnlineTamara/order_status?orderid=';
var UPDATE_TAMARA_STATUS = 'Services/PayFort_Serv.svc/REST/Tamara_UpdateRequestStatus';
var MARK_APPOINTMENT_TAMARA_STATUS = 'Services/Patients.svc/REST/MarkAppointmentForTamaraPayment_FromVida';
var AUTO_GENERATE_INVOICE_TAMARA = 'Services/PayFort_Serv.svc/REST/Tamara_GetinfoByAppointmentNo_AutoGenerateInvoice';
var GET_ONESIGNAL_VOIP_TOKEN = 'https://onesignal.com/api/v1/players';
var CANCEL_PHARMA_LIVECARE_REQUEST = 'https://vcallapi.hmg.com/api/PharmaLiveCare/SendPaymentStatus';
var INSERT_FREE_SLOTS_LOGS = 'Services/Doctors.svc/Rest/InsertDoctorFreeSlotsLogs';
var GET_NATIONALITY = 'Services/Lists.svc/REST/GetNationality';
var PAYFORT_TEST_URL = 'https://sbpaymentservices.payfort.com/FortAPI/paymentApi';
var PAYFORT_PROD_URL = 'https://paymentservices.payfort.com/FortAPI/paymentApi';
// Check If InPatient API
var CHECK_IF_INPATIENT = 'Services/Patients.svc/REST/GetInPatientAdmissionInfo';
var CHECK_IF_PATIENT_ADMITTED = 'Services/Inps.svc/REST/checkIsPatientAdmittedOrAdmissionRequest';
// Get General Instructions API
var GET_GENERAL_INSTRUCTIONS = 'Services/INPs.svc/REST/getGeneralInstructions';
// Get Medical Instructions API
var GET_MEDICAL_INSTRUCTIONS = 'Services/INPs.svc/REST/getPatientAdmissionRequest';
var GET_INPATIENT_ADVANCE_PAYMENT_REQUESTS = 'Services/INPs.svc/REST/getInpatientAdvancePendingPayment';
var GET_INPATIENT_PAID_ADVANCE_PAYMENT = 'Services/INPs.svc/REST/getInpatientAdvanceHistory';
var GET_INPATIENT_ADVANCE_PAYMENT_LINK = 'Services/PayFort_Serv.svc/REST/InsertInPatientAdvanceDetails';
var INSERT_INPATIENT_ORDER = 'Services/INPs.svc/REST/Inpcp_insertOrder';
var INPATIENT_DISCHARGE_MEDICATIONS = 'Services/INPs.svc/REST/chekPatientHasDischargeMedicine';
var GET_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/getBirthNotification_bymothermrn';
var SAVE_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/SaveBirthNotification';
var INSERT_GENERAL_ADMISSION_CONSENT = 'Services/INPs.svc/REST/Inp_insertAAForGeneralAdmissionConsent';
//Meal Plan APIs
var GET_ADMITTED_PATIENTS = 'Services/MOP.svc/REST/GetAdmittedPatients';
var GET_CURRENT_WEEKID_WEEKDAY = 'Services/MOP.svc/REST/GetCurrentWeekAndDayHMGMP';
var GET_MEALS_OF_SCHEDULE_ID = 'Services/MOP.svc/REST/GetMealsOfScheduleID_Mobile';
var GET_MEAL_ITEMS_OF_SCHEDULE_ID = 'Services/MOP.svc/REST/GetDefaultItemsOfScheduleID';
var PLACE_MEAL_PLAN_ORDER = 'Services/MOP.svc/REST/UpdateOrMakeNewOrder';
var CHECK_PATIENT_NPHIES_ELIGIBILITY = 'Services/Doctors.svc/REST/checkPatientInsuranceCompanyValidity';
var CONVERT_PATIENT_TO_CASH = 'Services/Doctors.svc/REST/deActivateInsuranceCompany';
var GET_BLOOD_DONATION_PROJECTS_LIST = 'Services/OUTPs.svc/REST/BD_getProjectsHaveBDClinics';
var GET_BLOOD_DONATION_FREE_SLOTS = 'Services/OUTPs.svc/REST/BD_GetFreeSlots';
var GET_WE_CARE_TOUR_URL = 'Services/Consent.svc/Rest/Consent_VirtualJurny_Url_GetByProjectID';
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";
var GET_ER_ONLINE_PAYMENT_DETAILS = 'Services/OUTPs.svc/Rest/Outp_GetPatientPaymentInformationForERClinic';
var AUTO_GENERATE_INVOICE_ER = 'Services/OUTPs.svc/Rest/Outp_AutoGenerateInvoiceForER';
var CHECK_IF_PATIENT_ARRIVED_ER_ONLINE_CHECKIN = 'Services/OUTPs.svc/Rest/IsPatientArrived';
var CHECK_PATIENT_ER_ADVANCE_BALANCE = 'Services/OUTPs.svc/Rest/getPatientAdvanceBalanceAmountByClinic';
var GET_PROJECT_FROM_NFC = 'Services/OUTPs.svc/Rest/GetProjectByNFC';
var GET_PATIENT_OCCUPATION_LIST = 'Services/Authentication.svc/REST/GetPatientOccupation';
var IS_DOCTOR_AVAILABLE_BY_CALENDAR_SCHEDULE = 'Services/OUTPs.svc/REST/HIS_IsDoctorAvailableByCalendarSchedule';
//PAYFORT
var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails";
var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse";
// var payFortEnvironment = FortEnvironment.production;
var applePayMerchantId = "merchant.com.hmgwebservices";
// var payFortEnvironment = FortEnvironment.test;
// var applePayMerchantId = "merchant.com.hmgwebservices.uat";
// Auth Provider Consts
const String INSERT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_INSERTDeviceIMEI';
const String SELECT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI';
const String CHECK_PATIENT_AUTH = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
const GET_MOBILE_INFO = 'Services/Authentication.svc/REST/GetMobileLoginInfo';
const SEND_ACTIVATION_CODE = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType';
const SEND_ACTIVATION_CODE_REGISTER = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationTypeForRegistration';
const CHECK_ACTIVATION_CODE = 'Services/Authentication.svc/REST/CheckActivationCode';
const CHECK_ACTIVATION_CODE_REGISTER = 'Services/Authentication.svc/REST/CheckActivationCodeForRegistration';
const FORGOT_PASSWORD = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo';
const CHECK_PATIENT_FOR_REGISTRATION = "Services/Authentication.svc/REST/CheckPatientForRegisteration";
const CHECK_USER_STATUS = "Services/NHIC.svc/REST/GetPatientInfo";
const REGISTER_USER = 'Services/Authentication.svc/REST/PatientRegistration';
const LOGGED_IN_USER_URL = 'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo';
const FORGOT_PATIENT_ID = 'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber';
const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard';
const PROFILE_SETTING = 'Services/Patients.svc/REST/GetPateintInfoForUpdate';
const SAVE_SETTING = 'Services/Patients.svc/REST/UpdatePateintInfo';
const DEACTIVATE_ACCOUNT = 'Services/Patients.svc/REST/PatientAppleActivation_InsertUpdate';
class ApiConsts {
static const maxSmallScreen = 660;
static bool isDevelopment = true;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT
static String baseUrl = 'https://hmgwebservices.com/'; // HIS API URL PROD
static String SELECT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI';
static num VERSION_ID = 18.9;
static final String selectDeviceImei = 'https://hmgwebservices.com/Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI';
static final String sendActivationCode = 'https://hmgwebservices.com/Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType';
static setBackendURLs() {
if (isDevelopment) {
baseUrl = "https://uat.hmgwebservices.com/";
} else {
baseUrl = "https://hmgwebservices.com/";
}
}
static final Map<String, String> packagesAuthHeader = {};
}

@ -1,7 +1,9 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:hmg_patient_app_new/core/post_params_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/authenticated_user_model.dart';
import 'package:hmg_patient_app_new/main.dart';
import 'api_consts.dart' as ApiConsts;
import 'consts.dart';
class AppState {
@ -21,8 +23,13 @@ class AppState {
set setUserLong(v) => userLong = v;
final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 3, versionID: ApiConsts.VERSION_ID);
final PostParamsModel _postParamsInitConfig = PostParamsModel(
channel: 3,
versionID: ApiConsts.VERSION_ID,
ipAddress: '10.20.10.20',
generalId: 'Cs2020@2016\$2958',
deviceTypeID: "2",
sessionID: 'TMRhVmkGhOsvamErw');
void setPostParamsInitConfig() {
isAuthenticated = false;
@ -30,8 +37,12 @@ class AppState {
}
PostParamsModel? _postParams;
PostParamsModel? get postParamsObject => _postParams;
Map<String, dynamic> get postParamsJson => isAuthenticated ? (_postParams?.toJsonAfterLogin() ?? {}) : (_postParams?.toJson() ?? {});
Map<String, dynamic> get postParamsJson => isAuthenticated
? (_postParams?.toJsonAfterLogin() ?? {})
: (_postParams?.toJson() ?? {});
void setPostParamsModel(PostParamsModel _postParams) {
this._postParams = _postParams;
@ -40,7 +51,18 @@ class AppState {
double userLat = 0.0;
double userLong = 0.0;
bool isArabic() => EasyLocalization.of(navigatorKey.currentContext!)?.locale.languageCode == "ar";
bool isArabic() =>
EasyLocalization.of(navigatorKey.currentContext!)?.locale.languageCode ==
"ar";
int getLanguageID(context) =>
EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2;
AuthenticatedUser? _authenticatedUser;
void setAuthenticatedUser(AuthenticatedUser authenticatedUser) {
_authenticatedUser = authenticatedUser;
}
int getLanguageID(context) => EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2;
AuthenticatedUser? get getAuthenticatedUser => _authenticatedUser;
}

@ -1,23 +1,4 @@
class ApiConsts {
static const maxSmallScreen = 660;
static bool isDevelopment = true;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT
static String baseUrl = 'https://hmgwebservices.com/'; // HIS API URL PROD
static String SELECT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI';
static num VERSION_ID = 18.9;
static setBackendURLs() {
if (isDevelopment) {
baseUrl = "https://uat.hmgwebservices.com/";
} else {
baseUrl = "https://hmgwebservices.com/";
}
}
}
class SharedPrefsConsts {
static String isRememberMe = "remember_me";

@ -19,7 +19,7 @@ class AppDependencies {
final sharedPreferences = await SharedPreferences.getInstance();
getIt.registerLazySingleton<CacheService>(() => CacheServiceImp(sharedPreferences: sharedPreferences));
getIt.registerSingleton(AppState());
getIt.registerLazySingleton<ApiClient>(() => ApiClient(loggerService: getIt()));
getIt.registerLazySingleton<ApiClient>(() => ApiClientImp(loggerService: getIt()));
// Repositories
getIt.registerLazySingleton<CommonRepo>(() => CommonRepoImp(loggerService: getIt()));

@ -16,12 +16,11 @@ class APIException implements Exception {
static const String UNKNOWN = 'unexpected_error';
final String message;
final APIError? error;
final arguments;
const APIException(this.message, {this.arguments, this.error});
const APIException(this.message, {this.arguments});
Map<String, dynamic> toJson() => {'message': message, 'error': error, 'arguments': '$arguments'};
Map<String, dynamic> toJson() => {'message': message, 'arguments': '$arguments'};
@override
String toString() {

@ -14,7 +14,7 @@ class PostParamsModel {
String? sessionID;
String? setupID;
PostParamsModel({this.versionID, this.channel, this.languageID, this.logInTokenID, this.tokenID, this.language, this.ipAddress, this.generalId, this.latitude, this.longitude, this.deviceTypeID});
PostParamsModel({this.versionID, this.channel, this.languageID, this.logInTokenID, this.tokenID, this.language, this.ipAddress, this.generalId, this.latitude, this.longitude, this.deviceTypeID, this.sessionID});
PostParamsModel.fromJson(Map<String, dynamic> json) {
versionID = json['VersionID'];
@ -22,25 +22,28 @@ class PostParamsModel {
languageID = json['LanguageID'];
logInTokenID = json['LogInTokenID'];
tokenID = json['TokenID'];
sessionID = json['SessionID'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = <String, dynamic>{};
data['versionID'] = versionID;
data['channel'] = channel;
data['languageID'] = languageID;
data['logInTokenID'] = logInTokenID ?? "";
data['tokenID'] = tokenID ?? "";
data['VersionID'] = versionID;
data['Channel'] = channel;
data['LanguageID'] = languageID;
data['LogInTokenID'] = logInTokenID ?? "";
data['TokenID'] = tokenID ?? "";
data['SessionID'] = sessionID ?? "";
return data;
}
Map<String, dynamic> toJsonAfterLogin() {
Map<String, dynamic> data = <String, dynamic>{};
data['versionID'] = versionID;
data['channel'] = channel;
data['languageID'] = languageID;
data['logInTokenID'] = logInTokenID;
data['tokenID'] = tokenID;
data['VersionID'] = versionID;
data['Channel'] = channel;
data['LanguageID'] = languageID;
data['LogInTokenID'] = logInTokenID;
data['TokenID'] = tokenID;
data['SessionID'] = sessionID;
return data;
}

@ -0,0 +1,487 @@
import 'package:device_calendar/device_calendar.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class DateUtil {
/// convert String To Date function
/// [date] String we want to convert
static DateTime convertStringToDate(String? date) {
if (date != null) {
const start = "/Date(";
const end = "+0300)";
final startIndex = date.indexOf(start);
final endIndex = date.indexOf(end, startIndex + start.length);
return DateTime.fromMillisecondsSinceEpoch(int.parse(
date.substring(startIndex + start.length, endIndex),
));
} else {
return DateTime.now();
}
}
static DateTime convertStringToDateSaudiTimezone(String date, int projectId) {
if (date != null) {
const start = "/Date(";
const end = "+0300)";
final startIndex = date.indexOf(start);
final endIndex = date.indexOf(end, startIndex + start.length);
// if (projectId == 2 || projectId == 3) {
// return DateTime.fromMillisecondsSinceEpoch(
// int.parse(
// date.substring(startIndex + start.length, endIndex),
// ),
// isUtc: true)
// .add(Duration(hours: 4));
// } else {
return DateTime.fromMillisecondsSinceEpoch(
int.parse(
date.substring(startIndex + start.length, endIndex),
),
isUtc: true)
.add(Duration(hours: 3));
// }
} else {
return DateTime.now();
}
}
static DateTime convertStringToDateNoTimeZone(String date) {
// /Date(1585774800000+0300)/
if (date != null) {
const start = "/Date(";
const end = ")";
final startIndex = date.indexOf(start);
final endIndex = date.indexOf(end, startIndex + start.length);
return DateTime.fromMillisecondsSinceEpoch(
int.parse(
date.substring(startIndex + start.length, endIndex),
),
);
} else {
return DateTime.now();
}
}
static DateTime convertStringToDateTime(String? date) {
if (date != null) {
try {
var dateT = date.split('/');
var year = dateT[2].substring(0, 4);
var dateP = DateTime(int.parse(year), int.parse(dateT[1]), int.parse(dateT[0]));
return dateP;
} catch (e) {
print(e);
}
return DateTime.now();
} else {
return DateTime.now();
}
}
static String convertDateToString(DateTime date) {
const start = "/Date(";
const end = "+0300)/";
int milliseconds = date.millisecondsSinceEpoch;
return start + "$milliseconds" + end;
}
static String convertDateToStringLocation(DateTime date) {
const start = "/Date(";
const end = ")/";
int milliseconds = date.millisecondsSinceEpoch;
return start + "$milliseconds" + end;
}
static String convertTime(String timeStr) {
TimeOfDay time = TimeOfDay(hour: int.parse(timeStr.split(":")[0]), minute: int.parse(timeStr.split(":")[1])); // 24-hour format time
int hour = time.hourOfPeriod; // get hour in 12-hour format
String meridiem = time.period == DayPeriod.am ? "AM" : "PM"; // get AM/PM
String convertedTime = '$hour:${time.minute == 0 ? "00" : time.minute} $meridiem'; // create the new time string
return convertedTime;
}
static String formatDateToDate(DateTime date, bool isArabic) {
return DateFormat('dd MMM yyy', isArabic ? "ar_SA" : "en_US").format(date);
}
static String formatDateToTime(DateTime date) {
return DateFormat('hh:mm a').format(date);
}
static String yearMonthDay(DateTime dateTime) {
String dateFormat = '${dateTime.year}-${dateTime.month}-${dateTime.day}';
return dateFormat;
}
static String time(DateTime dateTime) {
String dateFormat = '${dateTime.hour}:${dateTime.minute}:00';
return dateFormat;
}
static String convertDateMSToJsonDate(utc) {
var dt = new DateTime.fromMicrosecondsSinceEpoch(utc);
return "/Date(" + (dt.millisecondsSinceEpoch * 1000).toString() + '+0300' + ")/";
}
/// check Date
/// [dateString] String we want to convert
static String checkDate(DateTime checkedTime) {
DateTime currentTime = DateTime.now();
if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month) && (currentTime.day == checkedTime.day)) {
return "Today";
} else if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month)) {
if ((currentTime.day - checkedTime.day) == 1) {
return "YESTERDAY";
} else if ((currentTime.day - checkedTime.day) == -1) {
return "Tomorrow";
}
if ((currentTime.day - checkedTime.day) <= -2) {
return "Next Week";
} else {
return "Old Date";
}
}
return "Old Date";
}
static String getDateFormatted(String date) {
DateTime dateObj = DateUtil.convertStringToDate(date);
return DateUtil.getWeekDay(dateObj.weekday) + ", " + dateObj.day.toString() + " " + DateUtil.getMonth(dateObj.month) + " " + dateObj.year.toString();
}
static String getISODateFormat(DateTime dateTime) {
// 2020-04-30T00:00:00.000
return dateTime.toIso8601String();
}
/// get month by
/// [month] convert month number in to month name
static getMonth(int month) {
switch (month) {
case 1:
return "January";
case 2:
return "February";
case 3:
return "March";
case 4:
return "April";
case 5:
return "May";
case 6:
return "June";
case 7:
return "July";
case 8:
return "August";
case 9:
return "September";
case 10:
return "October";
case 11:
return "November";
case 12:
return "December";
}
}
/// get month by
/// [month] convert month number in to month name in Arabic
static getMonthArabic(int month) {
switch (month) {
case 1:
return "يناير";
case 2:
return " فبراير";
case 3:
return "مارس";
case 4:
return "أبريل";
case 5:
return "مايو";
case 6:
return "يونيو";
case 7:
return "يوليو";
case 8:
return "أغسطس";
case 9:
return "سبتمبر";
case 10:
return " اكتوبر";
case 11:
return " نوفمبر";
case 12:
return "ديسمبر";
}
}
static getMonthByName(String month) {
switch (month.toLowerCase()) {
case 'january':
return 1;
case 'february':
return 2;
case 'march':
return 3;
case 'april':
return 4;
case 'may':
return 5;
case 'june':
return 6;
case 'july':
return 7;
case 'august':
return 8;
case 'september':
return 9;
case 'october':
return 10;
case 'november':
return 11;
case 'december':
return 12;
}
}
static getMonthDateTime(String month, yearName) {
DateTime? date;
try {
date = DateTime(int.parse(yearName), getMonthByName(month));
} catch (e) {
print(e);
}
return date ?? DateTime.now();
}
/// get month by
/// [weekDay] convert week day in int to week day name
static getWeekDay(int weekDay) {
switch (weekDay) {
case 1:
return "Monday";
case 2:
return "Tuesday";
case 3:
return "Wednesday";
case 4:
return "Thursday";
case 5:
return "Friday";
case 6:
return "Saturday ";
case 7:
return "Sunday";
}
}
/// get month by
/// [weekDay] convert week day in int to week day name arabic
static getWeekDayArabic(int weekDay) {
switch (weekDay) {
case 1:
return "الاثنين";
case 2:
return "الثلاثاء";
case 3:
return "الاربعاء";
case 4:
return "الخميس";
case 5:
return "الجمعه";
case 6:
return "السبت ";
case 7:
return "الاحد";
}
}
static getWeekDayEnglish(int weekDay) {
switch (weekDay) {
case 1:
return "Monday";
case 2:
return "Tuesday";
case 3:
return "Wednesday";
case 4:
return "Thursday";
case 5:
return "Friday";
case 6:
return "Saturday ";
case 7:
return "Sunday";
}
}
/// get data formatted like Apr 26,2020
/// [dateTime] convert DateTime to data formatted
static String getMonthDayYearDateFormatted(DateTime dateTime) {
if (dateTime != null) {
return getMonth(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString();
} else {
return "";
}
}
/// get data formatted like Apr 26,2020
/// [dateTime] convert DateTime to data formatted Arabic
static String getMonthDayYearDateFormattedAr(DateTime dateTime) {
if (dateTime != null) {
return getMonthArabic(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString();
} else {
return "";
}
}
/// get data formatted like Thursday, Apr 26,2020
/// [dateTime] convert DateTime to date formatted
static String getWeekDayMonthDayYearDateFormatted(DateTime dateTime, String lang) {
if (dateTime != null) {
return lang == 'en'
? getWeekDayEnglish(dateTime.weekday) + ", " + getMonth(dateTime.month) + " " + dateTime.day.toString() + " " + dateTime.year.toString()
: getWeekDayArabic(dateTime.weekday) + ", " + dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
} else {
return "";
}
}
static String getMonthDayYearLangDateFormatted(DateTime dateTime, String lang) {
if (dateTime != null) {
return lang == 'en'
? getMonth(dateTime.month) + " " + dateTime.day.toString() + " " + dateTime.year.toString()
: dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
} else {
return "";
}
}
/// get data formatted like 26/4/2020
static String getDayMonthYearLangDateFormatted(DateTime dateTime, String lang) {
if (dateTime != null) {
return lang == 'en'
? dateTime.day.toString() + " " + getMonth(dateTime.month) + " " + dateTime.year.toString()
: dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
} else {
return "";
}
}
static String getMonthYearLangDateFormatted(DateTime dateTime, String lang) {
if (dateTime != null) {
return lang == 'en' ? getMonth(dateTime.month) + " " + dateTime.year.toString() : getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
} else {
return "";
}
}
/// get data formatted like 26/4/2020
/// [dateTime] convert DateTime to data formatted
static String getDayMonthYearDateFormatted(DateTime dateTime) {
if (dateTime != null) {
return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString();
} else {
return "";
}
}
/// get data formatted like 26/4/2020
/// [dateTime] convert DateTime to data formatted
static String getDayMonthDateFormatted(DateTime dateTime) {
if (dateTime != null) {
return DateFormat('dd/MM').format(dateTime);
} else {
return "";
}
}
/// get data formatted like 26/4/2020
/// [dateTime] convert DateTime to data formatted according to language
static String getDayMonthYearDateFormattedLang(DateTime dateTime, bool isArabic) {
if (dateTime != null) {
return DateFormat('dd/MM/yyyy', isArabic ? "ar_SA" : "en_US").format(dateTime);
} else {
return "";
}
}
/// get data formatted like 10:30 according to lang
static String formatDateToTimeLang(DateTime date, bool isArabic) {
return DateFormat('HH:mm', isArabic ? "ar_SA" : "en_US").format(date);
}
/// get data formatted like 26/4/2020 10:30
/// [dateTime] convert DateTime to data formatted
static String getDayMonthYearHourMinuteDateFormatted(DateTime dateTime) {
if (dateTime != null) {
return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString() + " " + DateFormat('HH:mm').format(dateTime);
} else {
return "";
}
}
/// get data formatted like 2020-8-13 09:43:00
/// [dateTime] convert DateTime to data formatted
static String getYearMonthDayHourMinSecDateFormatted(DateTime dateTime) {
if (dateTime != null) {
return dateTime.year.toString() +
"-" +
dateTime.month.toString() +
"-" +
dateTime.day.toString() +
" " +
dateTime.hour.toString() +
":" +
dateTime.minute.toString() +
":" +
dateTime.second.toString();
} else {
return "";
}
}
static String getFormattedDate(DateTime dateTime, String formattedString) {
return DateFormat(formattedString).format(dateTime);
}
static convertISODateToJsonDate(String isoDate) {
return "/Date(" + DateFormat('mm-dd-yyy').parse(isoDate).millisecondsSinceEpoch.toString() + ")/";
}
static String getDay(DayOfWeek dayOfWeek) {
switch (dayOfWeek) {
case DayOfWeek.Monday:
return "Monday";
break;
case DayOfWeek.Tuesday:
return "Tuesday";
break;
case DayOfWeek.Wednesday:
return "Wednesday";
break;
case DayOfWeek.Thursday:
return "Thursday";
break;
case DayOfWeek.Friday:
return "Friday";
break;
case DayOfWeek.Saturday:
return "Saturday";
break;
case DayOfWeek.Sunday:
return "Sunday";
break;
}
return "";
}
}

@ -1,4 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/consts.dart';
class SizeConfig {

@ -1,3 +1,8 @@
import 'dart:convert';
import 'package:crypto/crypto.dart' as crypto;
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:google_api_availability/google_api_availability.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
@ -454,4 +459,39 @@ class Utils {
}
static Future<bool> isGoogleServicesAvailable() async {
GooglePlayServicesAvailability availability = await GoogleApiAvailability
.instance
.checkGooglePlayServicesAvailability();
String status = availability.toString().split('.').last;
if (status == "success") {
return true;
}
return false;
}
static Future<bool> checkConnection(
{bool bypassConnectionCheck = false}) async {
if (bypassConnectionCheck) return true;
List<ConnectivityResult> connectivityResult =
await (Connectivity().checkConnectivity());
if (connectivityResult.contains(ConnectivityResult.mobile) ||
connectivityResult.contains(ConnectivityResult.wifi)) {
return true;
} else {
return false;
}
}
static String generateMd5Hash(String input) {
return crypto.md5.convert(utf8.encode(input)).toString();
}
}

@ -1,5 +1,8 @@
import 'dart:convert';
import 'package:dartz/dartz.dart';
import 'package:hmg_patient_app_new/core/api/api_client.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_exception.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/features/authentication/models/select_device_by_imei.dart';
@ -7,7 +10,7 @@ import 'package:hmg_patient_app_new/services/logger_service.dart';
import 'package:http/http.dart';
abstract class AuthenticationRepo {
Future<Either<Failure, SelectDeviceByImeiRespModelElement?>> selectDeviceByImei({required String deviceIMEI});
Future<Either<Failure, SelectDeviceByImeiRespModelElement?>> selectDeviceByImei({required String firebaseToken});
}
class AuthenticationRepoImp implements AuthenticationRepo {
@ -17,23 +20,22 @@ class AuthenticationRepoImp implements AuthenticationRepo {
AuthenticationRepoImp({required this.loggerService, required this.apiClient});
@override
Future<Either<Failure, SelectDeviceByImeiRespModelElement?>> selectDeviceByImei({required String deviceIMEI}) async {
final mapDevice = {"": deviceIMEI};
Future<Either<Failure, SelectDeviceByImeiRespModelElement?>> selectDeviceByImei({required String firebaseToken}) async {
final mapDevice = {"IMEI": firebaseToken};
final String apiUrl = "https://hmgwebservices.com/Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI" ;
try {
final Response result = await apiClient.postJsonForResponse(apiUrl, mapDevice);
final Response result = await apiClient.postJsonForResponse(ApiConsts.selectDeviceImei, mapDevice);
final SelectDeviceByImeiRespModelElement selectDeviceByImeiRespModelElement = SelectDeviceByImeiRespModelElement.fromJson(jsonDecode(result.body)['Patient_SELECTDeviceIMEIbyIMEIList'][0]);
loggerService.logInfo(result.body);
if (result !=null) {
return Right(null);
return Right(selectDeviceByImeiRespModelElement);
} else {
loggerService.errorLogs(result.toString());
return Left(ServerFailure(result.toString()));
}
} on APIException catch (e) {
APIError? apiError;
if (e.error is APIError) {
apiError = e.error as APIError;
}
loggerService.errorLogs(e.toString());
return Left(ServerFailure(apiError?.errorMessage ?? e.message));
} catch (e) {

@ -1,44 +1,44 @@
import 'dart:developer';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_repo.dart';
import 'package:hmg_patient_app_new/features/authentication/models/check_activation_code_request_register.dart';
class AuthenticationViewModel extends ChangeNotifier {
AuthenticationRepo authenticationRepo;
AppState appState;
AuthenticationViewModel({required this.authenticationRepo});
AuthenticationViewModel({
required this.appState,
required this.authenticationRepo,
});
final TextEditingController nationalIdController = TextEditingController();
final TextEditingController phoneNumberController = TextEditingController();
Future<void> signUp({
required String phone,
required String password,
Future<void> selectDeviceImei({
Function(dynamic)? onSuccess,
Function(String)? onError,
Function(String)? onError
}) async {
Utils.showLoading();
final String deviceIMEI =
final String firebaseToken =
"cIkkB7h7Q7uoFkC4Qv82xG:APA91bEb53Z9XzqymCIctaLxCoMX6bm9fuKlWILQ59uUqfwhCoD42AOP1-jWGB1WYd9BVN5PT2pUUFxrT07vcNg1KH9OH39mrPgCl0m21XVIgWrzNnCkufg";
final resultEither = await authenticationRepo.selectDeviceByImei(deviceIMEI: deviceIMEI);
if (resultEither.isLeft()) {
}
if (resultEither.isRight()) {
}
final resultEither =
await authenticationRepo.selectDeviceByImei(firebaseToken: firebaseToken);
resultEither.fold(
(failure) {
Utils.hideLoading();
notifyListeners();
if (onError != null) onError(failure.message);
},
(data) {
log("resultEither: ${data.toString()} ");
notifyListeners();
if (onSuccess != null) onSuccess(data);
},

@ -0,0 +1,292 @@
import 'package:hmg_patient_app/uitl/date_uitl.dart';
class AuthenticatedUser {
String? setupID;
int? patientType;
int? patientID;
String? firstName;
String? middleName;
String? lastName;
String? firstNameN;
String? middleNameN;
String? lastNameN;
int? relationshipID;
int? gender;
String? dateofBirth;
DateTime? dateofBirthDataTime;
dynamic dateofBirthN;
String? nationalityID;
dynamic phoneResi;
dynamic phoneOffice;
String? mobileNumber;
dynamic faxNumber;
String? emailAddress;
dynamic bloodGroup;
dynamic rHFactor;
bool? isEmailAlertRequired;
bool? isSMSAlertRequired;
String? preferredLanguage;
bool? isPrivilegedMember;
dynamic memberID;
dynamic expiryDate;
dynamic isHmgEmployee;
dynamic employeeID;
dynamic emergencyContactName;
dynamic emergencyContactNo;
int? patientPayType;
dynamic dHCCPatientRefID;
bool? isPatientDummy;
int? status;
dynamic isStatusCleared;
int? patientIdentificationType;
String? patientIdentificationNo;
int? projectID;
int? infoSourceID;
dynamic address;
int? age;
String? ageDesc;
int? areaID;
int? createdBy;
String? genderDescription;
dynamic iR;
dynamic iSOCityID;
dynamic iSOCountryID;
List<ListPrivilege>? listPrivilege;
dynamic marital;
int? outSA;
dynamic pOBox;
bool? receiveHealthSummaryReport;
int? sourceType;
dynamic strDateofBirth;
dynamic tempAddress;
dynamic zipCode;
dynamic isFamily;
dynamic cRSVerificationStatus;
// dynamic patientPayType;
// dynamic patientType;
// dynamic status;
AuthenticatedUser(
{this.setupID,
this.patientType,
this.patientID,
this.firstName,
this.middleName,
this.lastName,
this.firstNameN,
this.middleNameN,
this.lastNameN,
this.relationshipID,
this.gender,
this.dateofBirth,
this.dateofBirthN,
this.nationalityID,
this.phoneResi,
this.phoneOffice,
this.mobileNumber,
this.faxNumber,
this.emailAddress,
this.bloodGroup,
this.rHFactor,
this.isEmailAlertRequired,
this.isSMSAlertRequired,
this.preferredLanguage,
this.isPrivilegedMember,
this.memberID,
this.expiryDate,
this.isHmgEmployee,
this.employeeID,
this.emergencyContactName,
this.emergencyContactNo,
this.patientPayType,
this.dHCCPatientRefID,
this.isPatientDummy,
this.status,
this.isStatusCleared,
this.patientIdentificationType,
this.patientIdentificationNo,
this.projectID,
this.infoSourceID,
this.address,
this.age,
this.ageDesc,
this.areaID,
this.createdBy,
this.genderDescription,
this.iR,
this.iSOCityID,
this.iSOCountryID,
this.listPrivilege,
this.marital,
this.outSA,
this.pOBox,
this.receiveHealthSummaryReport,
this.sourceType,
this.strDateofBirth,
this.tempAddress,
this.zipCode,
this.isFamily,
this.cRSVerificationStatus});
AuthenticatedUser.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];
patientType = json['PatientType'];
patientID = json['PatientID'];
firstName = json['FirstName'];
middleName = json['MiddleName'];
lastName = json['LastName'];
firstNameN = json['FirstNameN'];
middleNameN = json['MiddleNameN'];
lastNameN = json['LastNameN'];
relationshipID = json['RelationshipID'];
gender = json['Gender'];
dateofBirth = json['DateofBirth'];
dateofBirthDataTime = DateUtil.convertStringToDate(json['DateofBirth']);
dateofBirthN = json['DateofBirthN'];
nationalityID = json['NationalityID'];
phoneResi = json['PhoneResi'];
phoneOffice = json['PhoneOffice'];
mobileNumber = json['MobileNumber'];
faxNumber = json['FaxNumber'];
emailAddress = json['EmailAddress'];
bloodGroup = json['BloodGroup'];
rHFactor = json['RHFactor'];
isEmailAlertRequired = json['IsEmailAlertRequired'];
isSMSAlertRequired = json['IsSMSAlertRequired'];
preferredLanguage = json['PreferredLanguage'];
isPrivilegedMember = json['IsPrivilegedMember'];
memberID = json['MemberID'];
expiryDate = json['ExpiryDate'];
isHmgEmployee = json['IsHmgEmployee'];
employeeID = json['EmployeeID'];
emergencyContactName = json['EmergencyContactName'];
emergencyContactNo = json['EmergencyContactNo'];
patientPayType = json['PatientPayType'];
dHCCPatientRefID = json['DHCCPatientRefID'];
isPatientDummy = json['IsPatientDummy'];
status = json['Status'];
isStatusCleared = json['IsStatusCleared'];
patientIdentificationType = json['PatientIdentificationType'];
patientIdentificationNo = json['PatientIdentificationNo'];
projectID = json['ProjectID'];
infoSourceID = json['InfoSourceID'];
address = json['Address'];
age = json['Age'];
ageDesc = json['AgeDesc'];
areaID = json['AreaID'];
createdBy = json['CreatedBy'];
genderDescription = json['GenderDescription'];
iR = json['IR'];
iSOCityID = json['ISOCityID'];
iSOCountryID = json['ISOCountryID'];
if (json['ListPrivilege'] != null) {
listPrivilege = [];
json['ListPrivilege'].forEach((v) {
listPrivilege!.add(new ListPrivilege.fromJson(v));
});
}
marital = json['Marital'];
outSA = json['OutSA'];
pOBox = json['POBox'];
receiveHealthSummaryReport = json['ReceiveHealthSummaryReport'];
sourceType = json['SourceType'];
strDateofBirth = json['StrDateofBirth'];
tempAddress = json['TempAddress'];
zipCode = json['ZipCode'];
isFamily = json['IsFamily'];
cRSVerificationStatus = json['CRSVerificationStatus'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['SetupID'] = this.setupID;
data['PatientType'] = this.patientType;
data['PatientID'] = this.patientID;
data['FirstName'] = this.firstName;
data['MiddleName'] = this.middleName;
data['LastName'] = this.lastName;
data['FirstNameN'] = this.firstNameN;
data['MiddleNameN'] = this.middleNameN;
data['LastNameN'] = this.lastNameN;
data['RelationshipID'] = this.relationshipID;
data['Gender'] = this.gender;
data['DateofBirth'] = this.dateofBirth;
data['DateofBirthN'] = this.dateofBirthN;
data['NationalityID'] = this.nationalityID;
data['PhoneResi'] = this.phoneResi;
data['PhoneOffice'] = this.phoneOffice;
data['MobileNumber'] = this.mobileNumber;
data['FaxNumber'] = this.faxNumber;
data['EmailAddress'] = this.emailAddress;
data['BloodGroup'] = this.bloodGroup;
data['RHFactor'] = this.rHFactor;
data['IsEmailAlertRequired'] = this.isEmailAlertRequired;
data['IsSMSAlertRequired'] = this.isSMSAlertRequired;
data['PreferredLanguage'] = this.preferredLanguage;
data['IsPrivilegedMember'] = this.isPrivilegedMember;
data['MemberID'] = this.memberID;
data['ExpiryDate'] = this.expiryDate;
data['IsHmgEmployee'] = this.isHmgEmployee;
data['EmployeeID'] = this.employeeID;
data['EmergencyContactName'] = this.emergencyContactName;
data['EmergencyContactNo'] = this.emergencyContactNo;
data['PatientPayType'] = this.patientPayType;
data['DHCCPatientRefID'] = this.dHCCPatientRefID;
data['IsPatientDummy'] = this.isPatientDummy;
data['Status'] = this.status;
data['IsStatusCleared'] = this.isStatusCleared;
data['PatientIdentificationType'] = this.patientIdentificationType;
data['PatientIdentificationNo'] = this.patientIdentificationNo;
data['ProjectID'] = this.projectID;
data['InfoSourceID'] = this.infoSourceID;
data['Address'] = this.address;
data['Age'] = this.age;
data['AgeDesc'] = this.ageDesc;
data['AreaID'] = this.areaID;
data['CreatedBy'] = this.createdBy;
data['GenderDescription'] = this.genderDescription;
data['IR'] = this.iR;
data['ISOCityID'] = this.iSOCityID;
data['ISOCountryID'] = this.iSOCountryID;
if (this.listPrivilege != null) {
data['ListPrivilege'] =
this.listPrivilege!.map((v) => v.toJson()).toList();
}
data['Marital'] = this.marital;
data['OutSA'] = this.outSA;
data['POBox'] = this.pOBox;
data['ReceiveHealthSummaryReport'] = this.receiveHealthSummaryReport;
data['SourceType'] = this.sourceType;
data['StrDateofBirth'] = this.strDateofBirth;
data['TempAddress'] = this.tempAddress;
data['ZipCode'] = this.zipCode;
data['IsFamily'] = this.isFamily;
data['CRSVerificationStatus'] = this.cRSVerificationStatus;
return data;
}
}
class ListPrivilege {
int? iD;
String? serviceName;
bool? previlege;
dynamic region;
ListPrivilege({this.iD, this.serviceName, this.previlege, this.region});
ListPrivilege.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
serviceName = json['ServiceName'];
previlege = json['Previlege'];
region = json['Region'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ID'] = this.iD;
data['ServiceName'] = this.serviceName;
data['Previlege'] = this.previlege;
data['Region'] = this.region;
return data;
}
}

@ -0,0 +1,121 @@
class CheckActivationCodeRegisterReq {
int? patientMobileNumber;
String? mobileNo;
String? deviceToken;
bool? projectOutSA;
int? loginType;
String? zipCode;
bool? isRegister;
String? logInTokenID;
int? searchType;
int? patientID;
String? nationalID;
String? patientIdentificationID;
String? activationCode;
bool? isSilentLogin;
double? versionID;
int? channel;
int? languageID;
String? iPAdress;
String? generalid;
int? patientOutSA;
dynamic sessionID;
bool? isDentalAllowedBackend;
int? deviceTypeID;
bool? forRegisteration;
String? dob;
int? isHijri;
String? healthId;
CheckActivationCodeRegisterReq({
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.activationCode,
this.isSilentLogin,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.forRegisteration,
this.dob,
this.isHijri,
this.healthId,
});
CheckActivationCodeRegisterReq.fromJson(Map<String, dynamic> 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'];
activationCode = json['activationCode'];
isSilentLogin = json['IsSilentLogin'];
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'];
forRegisteration = json['ForRegisteration'];
dob = json['DOB'];
isHijri = json['IsHijri'];
healthId = json['HealthId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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['activationCode'] = this.activationCode;
data['IsSilentLogin'] = this.isSilentLogin;
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;
data['ForRegisteration'] = this.forRegisteration;
data['DOB'] = dob;
data['IsHijri'] = isHijri;
data['HealthId'] = healthId;
return data;
}
}

@ -1,6 +1,5 @@
import 'package:dartz/dartz.dart';
import 'package:hmg_patient_app_new/core/api/api_client.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_exception.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
@ -41,13 +40,6 @@ class BookAppointmentsRepoImp implements BookAppointmentsRepo {
loggerService.errorLogs(result.toString());
return Left(ServerFailure(result.toString()));
}
} on APIException catch (e) {
APIError? apiError;
if (e.error is APIError) {
apiError = e.error as APIError;
}
loggerService.errorLogs(e.toString());
return Left(ServerFailure(apiError?.errorMessage ?? e.message));
} catch (e) {
loggerService.errorLogs(e.toString());
return Left(ServerFailure(e.toString()));

@ -63,13 +63,6 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
loggerService.errorLogs(result.toString());
return Left(ServerFailure(result.toString()));
}
} on APIException catch (e) {
APIError? apiError;
if (e.error is APIError) {
apiError = e.error as APIError;
}
loggerService.errorLogs(e.toString());
return Left(ServerFailure(apiError?.errorMessage ?? e.message));
} catch (e) {
loggerService.errorLogs(e.toString());
return Left(ServerFailure(e.toString()));

@ -45,7 +45,7 @@ Future<void> callInitializations() async {
}
void main() async {
callInitializations();
await callInitializations();
runApp(
EasyLocalization(
supportedLocales: const <Locale>[
@ -56,7 +56,7 @@ void main() async {
fallbackLocale: Locale('en', 'US'),
child: MultiProvider(providers: <SingleChildWidget>[
ChangeNotifierProvider<AuthenticationViewModel>(
create: (_) => AuthenticationViewModel(authenticationRepo: getIt()),
create: (_) => AuthenticationViewModel(authenticationRepo: getIt(), appState: getIt()),
),
], child: MyApp()),
),

@ -6,29 +6,16 @@ import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/input_widget.dart';
import 'package:hmg_patient_app_new/widgets/language_switcher.dart';
import 'package:sizer/sizer.dart'; // Import sizer
import 'package:sizer/sizer.dart';
class LoginScreen extends StatefulWidget {
@override
_LoginScreen createState() => _LoginScreen();
}
class _LoginScreen extends State<LoginScreen> {
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
class LoginScreen extends StatelessWidget {
const LoginScreen({super.key});
@override
Widget build(BuildContext context) {
@ -37,7 +24,6 @@ class _LoginScreen extends State<LoginScreen> {
return Scaffold(
appBar: CustomAppBar(
onBackPressed: () {
// Navigator.of(context).pop();
},
onLanguageChanged: (String value) {
print(value);

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
import 'package:provider/provider.dart';
class LandingPage extends StatefulWidget {
const LandingPage({super.key});
@ -10,16 +11,22 @@ class LandingPage extends StatefulWidget {
}
class _LandingPageState extends State<LandingPage> {
late AuthenticationViewModel authenticationViewModel;
@override
Widget build(BuildContext context) {
AuthenticationViewModel authenticationViewModel = context.read<AuthenticationViewModel>();;
return Scaffold(
body: Column(
children: [
Padding(
padding: const EdgeInsets.all(64.0),
child: "Login".toText18(color: Colors.black),
InkWell(
onTap: () {
authenticationViewModel.selectDeviceImei();
},
child: Padding(
padding: const EdgeInsets.all(64.0),
child: "Login".toText18(color: Colors.black),
),
),
],
),

@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/presentation/authantication/login.dart';
import 'package:hmg_patient_app_new/presentation/authentication/login.dart';
import 'package:hmg_patient_app_new/splashPage.dart';
class AppRoutes {
@ -10,5 +10,4 @@ class AppRoutes {
initialRoute: (context) => SplashPage(),
login: (context) => LoginScreen(),
};
static Map<String, WidgetBuilder> get routes => {initialRoute: (context) => SplashPage()};
}

@ -0,0 +1,143 @@
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:geolocator/geolocator.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/authentication/models/authenticated_user_model.dart';
import 'package:hmg_patient_app_new/services/analytics/flows/advance_payments.dart';
import 'package:hmg_patient_app_new/services/analytics/flows/app_nav.dart';
import 'package:hmg_patient_app_new/services/analytics/flows/appointments.dart';
import 'package:hmg_patient_app_new/services/analytics/flows/error_tracking.dart';
import 'package:hmg_patient_app_new/services/analytics/flows/hamburger_menu.dart';
import 'package:hmg_patient_app_new/services/analytics/flows/hmg_services.dart';
import 'package:hmg_patient_app_new/services/analytics/flows/live_care.dart';
import 'package:hmg_patient_app_new/services/analytics/flows/login_registration.dart';
import 'package:hmg_patient_app_new/services/analytics/flows/offers_promotions.dart';
import 'package:hmg_patient_app_new/services/analytics/flows/todo_list.dart';
import 'package:http/http.dart' as AnalyticEvents;
typedef GALogger = Function(String name, {Map<String, dynamic> parameters});
var _analytics = FirebaseAnalytics.instance;
_logger(String name, {Map<String, dynamic>? parameters}) async {
// return;
if (name.isNotEmpty) {
if (name.contains(' ')) name = name.replaceAll(' ', '_');
// To LowerCase
if (parameters != null && parameters.isNotEmpty) {
parameters = parameters.map((key, value) {
final key_ = key.toLowerCase();
var value_ = value;
if (value is String) value_ = value.toLowerCase();
return MapEntry(key_, value_);
});
}
try {
final safeParameters = parameters?.map((key, value) => MapEntry(key, value as Object));
await _analytics.logEvent(
name: name.trim().toLowerCase(),
parameters: safeParameters,
);
} catch (e) {
print('Error sending analytics event: $e');
}
}
}
class GAnalytics {
static String? TREATMENT_TYPE;
static String? APPOINTMENT_DETAIL_FLOW_TYPE;
static String? PAYMENT_TYPE;
setUser(AuthenticatedUser user) async {
try {
_analytics.setUserProperty(name: 'user_language', value: user.preferredLanguage == '1' ? 'arabic' : 'english');
_analytics.setUserProperty(name: 'userid', value: Utils.generateMd5Hash(user.emailAddress!));
_analytics.setUserProperty(name: 'login_status', value: user == null ? 'guest' : 'loggedin');
// if (await PermissionService.isLocationEnabled()) {
// final location = await Geolocator.getCurrentPosition();
// if (location != null && !location.isMocked) {
// final places = await placemarkFromCoordinates(location.latitude, location.longitude,);
// final countryCode = places.first.isoCountryCode;
// _analytics.setUserProperty(name: 'user_country', value: countryCode);
// }
// } else {
// _analytics.setUserProperty(name: 'user_country', value: "N/A");
// }
} catch (e) {}
}
// NavObserver navObserver() => NavObserver();
final hamburgerMenu = HamburgerMenu(_logger);
final bottomTabNavigation = AppNav(_logger);
final hmgServices = HMGServices(_logger);
final loginRegistration = LoginRegistration(_logger);
final appointment = Appointment(_logger);
final liveCare = LiveCare(_logger);
final todoList = TodoList(_logger);
final advancePayments = AdvancePayments(_logger);
final offerPackages = OfferAndPromotion(_logger);
final errorTracking = ErrorTracking(_logger);
}
// // adb shell setprop debug.firebase.analytics.app com.ejada.hmg -> Android
// class NavObserver extends RouteObserver<PageRoute<dynamic>> {
// _sendScreenView(PageRoute route) async {
// log(String className) {
// var event = AnalyticEvents.get(className);
// if (event.active != null) {
// _analytics.setCurrentScreen(screenName: event.flutterName(), screenClassOverride: className).catchError(
// (Object error) {
// print('$FirebaseAnalyticsObserver: $error');
// },
// test: (Object error) {
// return error is PlatformException;
// },
// );
// }
// }
//
// if (route.settings.name != null && route.settings.name!.isNotEmpty && route.settings.name != "null") {
// var class_ = routes[route.settings.name]!(0);
// if (class_ != null) log(class_.toStringShort());
// } else if (route is FadePage) {
// var class_ = route.page;
// if (class_ != null) log(class_.toStringShort());
// } else if (route is MaterialPageRoute) {
// var class_ = route.builder(route.subtreeContext!);
// log(class_.toStringShort());
// } else {
// print("");
// }
// }
//
// @override
// void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) {
// super.didPush(route, previousRoute);
// if (route is PageRoute) {
// _sendScreenView(route);
// }
// }
//
// @override
// void didReplace({Route<dynamic>? newRoute, Route<dynamic>? oldRoute}) {
// super.didReplace(newRoute: newRoute, oldRoute: oldRoute);
// if (newRoute is PageRoute) {
// _sendScreenView(newRoute);
// }
// }
//
// @override
// void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) {
// super.didPop(route, previousRoute);
// // if (previousRoute is PageRoute && route is PageRoute) {
// // _sendScreenView(previousRoute);
// // }
// }
// }

@ -0,0 +1,91 @@
import 'package:flutter/cupertino.dart';
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
class AdvancePayments{
final GALogger logger;
AdvancePayments(this.logger);
// R038
payment_services({required String service_type}){
logger('payment_services', parameters: {
'service_type' : service_type
});
}
// R039
wallet_recharge({required String service_type}){
logger('wallet_recharge', parameters: {
'service_type' : service_type
});
}
// R040
wallet_payment_details(){
logger('wallet_payment_details');
}
// R041
payment_method({required String method,type}){
logger('payment_method', parameters: {
'payment_method' : method,
'payment_type' : type
});
}
// R042
payment_confirm({required String method,type}){
logger('payment_confirm', parameters: {
'payment_method' : method,
'payment_type' : type
});
}
// R043
payment_otp_confirmation({required String method,type}){
logger('payment_otp_confirmation', parameters: {
'payment_method' : method,
'payment_type' : type
});
}
// R044
payment_confirm_card_details({required String method,type}){
logger('payment_confirm_card_details', parameters: {
'payment_method' : method,
'payment_type' : type
});
}
// R045
payment_pay({required String method,type}){
logger('payment_pay', parameters: {
'payment_method' : method,
'payment_type' : type
});
}
// R046
payment_success({required String hospital, payment_method, payment_type, txn_number, txn_amount, txn_currency}){
logger('payment_success', parameters: {
'payment_method' : payment_method,
'payment_type' : payment_type,
'hospital_name' : hospital,
'transaction_number' : txn_number,
'transaction_amount' : txn_amount,
'transaction_currency' : txn_currency
});
}
payment_fail({required String hospital, payment_method, payment_type, txn_amount, txn_currency, error_type}){
logger('payment_fail', parameters: {
'payment_method' : payment_method,
'payment_type' : payment_type,
'hospital_name' : hospital,
'transaction_amount' : txn_amount,
'transaction_currency' : txn_currency,
'error_type' : error_type
});
}
}

@ -0,0 +1,30 @@
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
class AppNav{
final name = 'app_nav';
final GALogger logger;
AppNav(this.logger);
logNavName(String value){
logger(name, parameters: {
'nav_name' : value
});
}
log({int? tabIndex, bool? isLoggedIn}){
var nav_name = "";
if(tabIndex == 1)
nav_name = "medical file";
if(tabIndex == 3)
nav_name = "my family";
if(tabIndex == 4)
nav_name = "todo list";
if(tabIndex == 5)
nav_name = "help";
if(nav_name.isNotEmpty)
logger(name, parameters: {
'nav_name' : nav_name
});
}
}

@ -0,0 +1,268 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
import 'package:intl/intl.dart';
class Appointment {
final GALogger logger;
Appointment(this.logger);
// R015
book_appointment() {
logger('book_appointment');
}
// R016.1, R017.2
book_appointment_by_clinic() {
logger('book_appointment_by_clinic');
}
// R016.2, R018.2
book_appointment_by_doctor() {
logger('book_appointment_by_doctor');
}
// // R017.1
// book_appointment_doctor_search({required String query}) {
// // doctor_search_query : value
// logger('book_appointment_doctor_search', parameters: {'doctor_search_query': query});
// }
//
// // R018.1
// book_appointment_select_clinic({required String appointment_type, clinic}) {
// // appointment_type: regular | livecare
// // clinic_type : $clinic_type
// logger('book_appointment_select_clinic', parameters: {'appointment_type': appointment_type, 'clinic_type': clinic});
// }
//
// // R019.1
// book_appointment_livecare_accept() {
// logger('book_appointment_livecare_accept');
// }
//
// // R019.2
// book_appointment_livecare_decline() {
// logger('book_appointment_livecare_decline');
// }
//
// // R020
// book_appointment_chief_complaints({
// required String appointment_type,
// ListClinicCentralized? clinic,
// HospitalsModel? hospital,
// ListDentalChiefComplain? treatment,
// }) {
// GAnalytics.TREATMENT_TYPE = treatment!.name;
// logger('book_appointment_chief_complaints', parameters: {
// 'appointment_type': appointment_type,
// 'clinic_type': clinic!.clinicDescription,
// 'hospital_name':hospital!=null ? hospital!.name :"",
// 'treatment_type': treatment.name,
// });
// }
//
// // R021
// book_appointment_select_doctor({required String appointment_type, required DoctorList doctor}) {
// // appointment_type, clinic_type, hospital_name, treatment_type, doctor_name, doctor_nationality, doctor_gender
// logger('book_appointment_select_doctor', parameters: {
// 'appointment_type': appointment_type,
// 'clinic_type': doctor.clinicName,
// 'hospital_name': doctor.projectName,
// 'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
// 'doctor_name': doctor.name,
// 'doctor_nationality': doctor.nationalityName,
// 'doctor_gender': doctor.genderDescription,
// });
// }
//
// // R022
// book_appointment_schedule({required String appointment_type, required DoctorList doctor}) {
// // appointment_type, clinic_type, hospital_name, treatment_type, doctor_name, doctor_nationality, doctor_gender
// logger('book_appointment_schedule', parameters: {
// 'appointment_type': appointment_type,
// 'clinic_type': doctor.clinicName,
// 'hospital_name': doctor.projectName,
// 'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
// 'doctor_name': doctor.name,
// 'doctor_nationality': doctor.nationalityName,
// 'doctor_gender': doctor.genderDescription,
// });
// }
//
// // R023
// book_appointment_date_selection({required String appointment_type, required day, required DoctorList doctor}) {
// logger('book_appointment_date_selection', parameters: {
// 'appointment_type': appointment_type,
// 'clinic_type': doctor.clinicName,
// 'hospital_name': doctor.projectName,
// 'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
// 'doctor_name': doctor.name,
// 'doctor_nationality': doctor.nationalityName,
// 'doctor_gender': doctor.genderDescription,
// 'appointment_day': day
// });
// }
//
// // R024.1
// book_appointment_time_selection({required String appointment_type, required DateTime? dateTime, required DoctorList doctor}) {
// final day = DateUtil.getWeekDay(dateTime!.weekday);
// final hour = DateFormat('HH').format(dateTime);
// logger('book_appointment_time_selection', parameters: {
// 'appointment_type': appointment_type,
// 'clinic_type': doctor.clinicName,
// 'hospital_name': doctor.projectName,
// 'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
// 'doctor_name': doctor.name,
// 'doctor_nationality': doctor.nationalityName,
// 'doctor_gender': doctor.genderDescription,
// 'appointment_day': day,
// 'appointment_hour': hour
// });
// }
//
// // R024.2
// book_appointment_review({required String appointment_type, required DateTime dateTime, required DoctorList doctor}) {
// final day = DateUtil.getWeekDay(dateTime.weekday);
// final hour = DateFormat('HH').format(dateTime);
// logger('book_appointment_review', parameters: {
// 'appointment_type': appointment_type,
// 'clinic_type': doctor.clinicName,
// 'hospital_name': doctor.projectName,
// 'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
// 'doctor_name': doctor.name,
// 'doctor_nationality': doctor.nationalityName,
// 'doctor_gender': doctor.genderDescription,
// 'appointment_day': day,
// 'appointment_hour': hour
// });
// }
//
// // R025
// book_appointment_click_confirm({required String appointment_type, required DateTime dateTime, required DoctorList doctor}) {
// final day = DateUtil.getWeekDay(dateTime.weekday);
// final hour = DateFormat('HH').format(dateTime);
// logger('book_appointment_click_confirm', parameters: {
// 'appointment_type': appointment_type,
// 'clinic_type': doctor.clinicName,
// 'hospital_name': doctor.projectName,
// 'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
// 'doctor_name': doctor.name,
// 'doctor_nationality': doctor.nationalityName,
// 'doctor_gender': doctor.genderDescription,
// 'appointment_day': day,
// 'appointment_hour': hour // '5-6'
// });
// }
//
// // R026
// book_appointment_confirmation_success({required String appointment_type, required DateTime dateTime, required DoctorList doctor}) {
// final day = DateUtil.getWeekDay(dateTime.weekday);
// final hour = DateFormat('HH').format(dateTime);
// logger('book_appointment_confirmation_success', parameters: {
// 'appointment_type': appointment_type,
// 'clinic_type': doctor.clinicName,
// 'hospital_name': doctor.projectName,
// 'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
// 'doctor_name': doctor.name,
// 'doctor_nationality': doctor.nationalityName,
// 'doctor_gender': doctor.genderDescription,
// 'appointment_day': day,
// 'appointment_hour': hour
// });
// }
//
// // R049.1 // should be for appointment flow
// appointment_actions(AppoitmentAllHistoryResultList appointment, String action) {
// logger('appointment_actions', parameters: {
// 'action_type': action,
// 'flow_type': GAnalytics.APPOINTMENT_DETAIL_FLOW_TYPE,
// 'appointment_type': appointment.appointmentType,
// 'clinic_type_online': appointment.clinicName,
// 'hospital_name': appointment.projectName,
// 'doctor_name': (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
// 'payment_type': 'appointment',
// });
// }
//
// // R027
// appointment_reminder(bool value) {
// logger('appointment_reminder', parameters: {'reminder': value ? 'yes' : 'no'});
// }
//
// // R028
// appointment_reminder_time({required String reminde_before}) {
// logger('appointment_reminder_time', parameters: {'reminder_before': reminde_before});
// }
//
// // R053
// // Note : - Payment flow beyond this step are same as listed under Advance Payment section of this document
// pay_now_for_appointment({required String appointment_type, required DoctorList doctorDetail, bool payNow = true}) {
// logger('pay_now_for_appointment', parameters: {
// 'appointment_type': appointment_type,
// 'clinic_type': doctorDetail.clinicName,
// 'hospital_name': doctorDetail.projectName,
// 'doctor_name': doctorDetail.name,
// 'payment_type': 'appointment'
// });
// }
//
// // R033
// payment_method({required String appointment_type, clinic, payment_method, payment_type}) {
// logger('payment_method', parameters: {'appointment_type': appointment_type, 'clinic_type': clinic, 'payment_method': payment_method, 'payment_type': payment_type});
// }
//
// // R036
// payment_success({required String appointment_type, clinic, hospital, payment_method, payment_type, txn_number, txn_amount, txn_currency}) {
// logger('payment_success', parameters: {
// 'appointment_type': appointment_type,
// 'payment_method': payment_method,
// 'payment_type': payment_type,
// 'hospital_name': hospital,
// 'clinic_type_online': clinic,
// 'transaction_number': txn_number,
// 'transaction_amount': txn_amount,
// 'transaction_currency': txn_currency,
// });
// }
//
// payment_fail({required String appointment_type, clinic, hospital, payment_method, payment_type, txn_amount, txn_currency, error_type}) {
// logger('payment_fail', parameters: {
// 'appointment_type': appointment_type,
// 'payment_method': payment_method,
// 'payment_type': payment_type,
// 'hospital_name': hospital,
// 'clinic_type_online': clinic,
// 'transaction_amount': txn_amount,
// 'transaction_currency': txn_currency,
// 'error_type': error_type
// });
// }
//
// // Note : - Payment flow beyond this step are same as listed under Advance Payment section of this document
// appointment_detail_action({required AppoitmentAllHistoryResultList appointment, required String action}) {
// logger('appointment_detail_action', parameters: {
// 'action_type': action,
// 'flow_type': GAnalytics.APPOINTMENT_DETAIL_FLOW_TYPE,
// });
// }
//
// // Note : - Payment flow beyond this step are same as listed under Advance Payment section of this document
// appointment_details_confirm({required AppoitmentAllHistoryResultList appointment}) {
// logger('appointment_details_confirm', parameters: {});
// }
//
// // R053
// // Note : - Payment flow beyond this step are same as listed under Advance Payment section of this document
// appointment_details_cancel({required AppoitmentAllHistoryResultList appointment, appointment_type}) {
// logger('cancel_appointment', parameters: {
// 'flow_type': GAnalytics.APPOINTMENT_DETAIL_FLOW_TYPE,
// 'appointment_type': appointment_type,
// 'clinic_type_online': appointment.clinicName,
// 'hospital_name': appointment.projectName,
// 'doctor_name': (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName
// });
// }
// }
}

@ -0,0 +1,16 @@
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
class ErrorTracking{
final GALogger logger;
ErrorTracking(this.logger);
log(String type, {String? error}){
logger('errors', parameters: {
'error_type' : type ?? 'unknown',
'error' : error ?? 'unknown',
});
}
}

@ -0,0 +1,16 @@
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
class HamburgerMenu{
final hamburger_menu = 'hamburger_menu';
final GALogger logger;
HamburgerMenu(this.logger);
logMenuItemClick(String value){
logger(hamburger_menu, parameters: {
'menu_item' : value
});
}
}

@ -0,0 +1,19 @@
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
class HMGServices{
final hmg_services = 'hmg_services';
final GALogger logger;
HMGServices(this.logger);
logServiceName(String value){
logger('hmg_services', parameters: {
'services_name' : value
});
}
viewAll(){
logger('hmg_services', parameters: {
'services_name' : 'view all services'
});
}
}

@ -0,0 +1,102 @@
import 'package:flutter/cupertino.dart';
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
class LiveCare{
final GALogger logger;
LiveCare(this.logger);
// R030.1
livecare_immediate_consultation(){
logger('livecare_immediate_consultation');
}
// R030.2
livecare_schedule_video_call(){
logger('livecare_schedule_video_call');
}
// R031.1
livecare_clinic_schedule({required String clinic}){
logger('livecare_clinic_schedule', parameters: {
'clinic_type_online' : clinic
});
}
// R031.2
livecare_immediate_consultation_clinic({required String clinic}){
logger('livecare_immediate_consultation_clinic', parameters: {
'clinic_type_online' : clinic
});
}
// R031.2
livecare_schedule_video_call_clinic({required String clinic}){
logger('livecare_schedule_video_call_clinic', parameters: {
'clinic_type_online' : clinic
});
}
// R032
livecare_immediate_consultation_TnC({required String clinic}){
logger('livecare_immediate_consultation_tandc', parameters: {
'clinic_type_online' : clinic
});
}
// R033
payment_method({required String appointment_type, clinic, payment_method, payment_type}){
logger('payment_method', parameters: {
'appointment_type' : appointment_type,
'clinic_type_online' : clinic,
'payment_method' : payment_method,
'payment_type' : payment_type
});
}
// R034
payment_confirm({required String appointment_type, clinic, payment_method, payment_type}){
logger('payment_confirm', parameters: {
'appointment_type' : appointment_type,
'clinic_type_online' : clinic,
'payment_method' : payment_method,
'payment_type' : payment_type
});
}
// R035
payment_pay({required String appointment_type, clinic, hospital, payment_method, payment_type}){
// logger('payment_pay', parameters: {
// 'appointment_type' : appointment_type,
// 'clinic_type_online' : clinic,
// 'payment_method' : payment_method,
// 'payment_type' : payment_type,
// 'hospital_name' : hospital
// });
}
// R036
payment_success({required String appointment_type, clinic, hospital, payment_method, payment_type, txn_number, txn_amount, txn_currency}){
// appointment_type
// clinic_type_online
// payment_method
// payment_type
// hospital_name
// transaction_number
// transaction_amount
// transaction_currency
}
// R037
livecare_immediate_consultation_payment_failed({required String appointment_type, clinic, payment_method, payment_type, txn_amount, txn_currency, error_message}){
logger('livecare_immediate_consult_payment_fail', parameters: {
'payment_method' : payment_method,
'appointment_type' : appointment_type,
'payment_type' : payment_type,
'clinic_type_online' : clinic,
'transaction_amount' : txn_amount,
'transaction_currency' : txn_currency,
'error_type' : error_message
});
}
}

@ -0,0 +1,156 @@
import 'package:flutter/cupertino.dart';
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
class LoginRegistration{
static int loginMethod = 0;
static int verificationMethod = 0;
final GALogger logger;
LoginRegistration(this.logger);
// R004.1
login_register_initiate(){
logger('login_register_initiate');
}
// R005.1
visited_alhabib_group(bool value){
// selection_type: yes/no
logger('visited_alhabib_group', parameters: {
'selection_type' : value ? 'yes' : 'no'
});
}
// R006.1, R007.1, R008.1, R009.1
registration_cancel({required String step}){
// registration_step : enter details
// registration_step : personal info
// registration_step : patient info
// fourth (verification)
logger('registration_cancel', parameters: {
'registration_step' : step
});
}
// R006.2
registration_enter_details(){
logger('registration_enter_details');
}
// R007.2
registration_personal_info(){
logger('registration_personal_info');
}
// R008.2
registration_patient_info(){
logger('registration_patient_info');
}
// R009.2
registration_verification_option(){
logger('registration_verification_option');
}
// R010:registration_confirmation
registration_confirmation(){
// verification_method: by
logger('registration_confirmation');
}
registration_fail({required String errorType}){
// verification_method: by
logger('registration_fail', parameters: {
'error_type' : errorType
});
}
// R011.1
login_start({required String method}){
logger('login_start', parameters: {
'login_method' : method
});
}
// R011:login_verify_otp | R009:registration_verification_option
verify_otp_method({bool forRegistration = false}){
if(forRegistration == false)
logger("login_verify_otp", parameters: {
'login_method' : _getLoginMethod(),
'verification_method' : _getVerificationMethod(),
});
else
logger("registration_verification_option", parameters: {
'verification_method' : _getVerificationMethod()
});
}
// R011:login_verify_otp | R009:registration_verification_option
login_verfication({bool forRegistration = false}){
if(forRegistration == false)
logger("login_verfication", parameters: {
'login_method' : _getLoginMethod(),
'verification_method' : _getVerificationMethod(),
});
else
logger("login_varification_register", parameters: {
'login_method' : _getLoginMethod(),
'verification_method' : _getVerificationMethod(),
});
}
// R011.2
forget_file_number(){
logger('forget_file_number');
}
// R011.3
register_now(){
logger('register_now');
}
// R012.1, R014.1
login_successful(){
logger('login_successful', parameters: {
'login_method' : _getVerificationMethod()
});
}
// R012.4
login_unsuccessful({required String method, error}){
logger('login_unsuccessful', parameters: {
'login_method' : method
});
}
login_fail({error}){
logger('login_unsuccessful', parameters: {
'login_method' : loginMethod,
'error': error
});
}
// R013
recover_file_number(){
logger('recover_file_number');
}
// R014.2
login_with_other_account(){
logger('login_with_other_account');
}
_getLoginMethod(){
if(loginMethod == 1) return 'national id';
if(loginMethod == 2) return 'file number';
return 'otp';
}
String _getVerificationMethod(){
if(verificationMethod == 1) return 'sms';
if(verificationMethod == 2) return 'fingerprint';
if(verificationMethod == 3) return 'face id';
if(verificationMethod == 4) return 'whatsapp';
return "unknown";
}
}

@ -0,0 +1,17 @@
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
class OfferAndPromotion{
final GALogger logger;
OfferAndPromotion(this.logger);
final offers_and_promotion = 'offers_&_promotion';
log(){
logger('offers_and_promotion', parameters: {
'promotion_name' : "offer"
});
}
}

@ -0,0 +1,111 @@
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
class TodoList{
final GALogger logger;
TodoList(this.logger);
// R047.1
// to_do_list_pay_now(AppoitmentAllHistoryResultList appointment){
// logger('to_do_list_pay_now', parameters: {
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
// 'clinic_type_online' : appointment.clinicName,
// 'hospital_name' : appointment.projectName,
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
// 'payment_type' : 'appointment',
// });
// }
// // R047.2
// to_do_list_more_details(AppoitmentAllHistoryResultList appointment){
// logger('to_do_list_more_details', parameters: {
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
// 'clinic_type_online' : appointment.clinicName,
// 'hospital_name' : appointment.projectName,
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
// 'payment_type' : 'appointment',
// });
// }
//
// // R048
// to_do_list_confirm_payment_details(AppoitmentAllHistoryResultList appointment){
// logger('to_do_list_confirm_payment_details', parameters: {
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
// 'clinic_type_online' : appointment.clinicName,
// 'hospital_name' : appointment.projectName,
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
// 'payment_type' : 'appointment',
// });
// }
//
// // R048
// to_do_list_cancel_payment_details(AppoitmentAllHistoryResultList appointment){
// logger('to_do_list_cancel_payment_details', parameters: {
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
// 'clinic_type_online' : appointment.clinicName,
// 'hospital_name' : appointment.projectName,
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
// 'payment_type' : 'appointment',
// });
// }
//
//
//
// // R049.2
// to_do_list_cancel_appointment(AppoitmentAllHistoryResultList appointment){
// logger('to_do_list_cancel_appointment', parameters: {
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
// 'clinic_type_online' : appointment.clinicName,
// 'hospital_name' : appointment.projectName,
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
// 'payment_type' : 'appointment',
// });
// }
//
// // R049.3
// to_do_list_confirm_appointment(AppoitmentAllHistoryResultList appointment){
// logger('confirm_appointment', parameters: {
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
// 'flow_type' : 'todo list',
// 'clinic_type_online' : appointment.clinicName,
// 'hospital_name' : appointment.projectName,
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
// 'payment_type' : 'appointment',
// });
// }
//
// // R050
// to_do_list_check_in(AppoitmentAllHistoryResultList appointment){
// logger('to_do_list_check_in', parameters: {
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
// 'clinic_type_online' : appointment.clinicName,
// 'hospital_name' : appointment.projectName,
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
// 'payment_type' : 'appointment',
// });
// }
//
// // R051
// to_do_list_nfc(AppoitmentAllHistoryResultList appointment){
// logger('to_do_list_nfc', parameters: {
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
// 'clinic_type_online' : appointment.clinicName,
// 'hospital_name' : appointment.projectName,
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
// 'payment_type' : 'appointment',
// });
// }
//
// // R052
// to_do_list_nfc_cancel(AppoitmentAllHistoryResultList appointment){
// logger('to_do_list_nfc_cancel', parameters: {
// 'appointment_type' : appointment.isLiveCareAppointment != null ? appointment.isLiveCareAppointment! ? 'livecare' : 'regular' : 'regular',
// 'clinic_type_online' : appointment.clinicName,
// 'hospital_name' : appointment.projectName,
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
// 'payment_type' : 'appointment',
// });
// }
}

@ -6,9 +6,10 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/presentation/authantication/login.dart';
// import 'package:hmg_patient_app_new/presentation/authantication/login.dart';
import 'package:hmg_patient_app_new/presentation/home/landing_page.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart';
@ -24,10 +25,7 @@ class SplashPage extends StatefulWidget {
}
class _SplashScreenState extends State<SplashPage> {
@override
void initState() {
super.initState();
print("Splash init called.............");
Future<void> initializeStuff() async {
Timer(
Duration(milliseconds: 500),
() async {
@ -39,12 +37,11 @@ class _SplashScreenState extends State<SplashPage> {
LocalNotification.init(onNotificationClick: (payload) {});
Navigator.of(context).pushReplacement(
FadePage(
// page: LandingPage(),
page: LoginScreen(),
page: LandingPage(),
// page: LoginScreen(),
),
);
});
var zoom = ZoomVideoSdk();
InitConfig initConfig = InitConfig(
domain: "zoom.us",
@ -53,6 +50,8 @@ class _SplashScreenState extends State<SplashPage> {
zoom.initSdk(initConfig);
}
/// load the Privilege from service
Future loadPrivilege() async {
// ProjectViewModel projectProvider = Provider.of<ProjectViewModel>(context, listen: false);
@ -71,6 +70,13 @@ class _SplashScreenState extends State<SplashPage> {
PushNotificationHandler().init(context); // Asyncronously
}
@override
void initState() {
super.initState();
initializeStuff();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -80,7 +86,8 @@ class _SplashScreenState extends State<SplashPage> {
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 53),
child: Image.asset(AppAssets.hmg_logo, fit: BoxFit.fitWidth, width: MediaQuery.of(context).size.width),
child: Image.asset(AppAssets.hmg_logo,
fit: BoxFit.fitWidth, width: MediaQuery.of(context).size.width),
),
Align(
alignment: Alignment.bottomCenter,
@ -89,12 +96,18 @@ class _SplashScreenState extends State<SplashPage> {
children: [
Text(
"Powered by",
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: AppColors.textColor, letterSpacing: -0.56, height: 16 / 14),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: AppColors.textColor,
letterSpacing: -0.56,
height: 16 / 14),
),
SizedBox(
height: 5,
),
Utils.buildSvgWithAssets(icon: AppAssets.cloud_logo, width: 40, height: 40),
Utils.buildSvgWithAssets(
icon: AppAssets.cloud_logo, width: 40, height: 40),
SizedBox(height: 7),
// Text(
// "Version 1.1.0",

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
class AppColors {
static const transparent = Colors.transparent;
static const mainPurple = Color(0xFF7954F7);
static const purpleBg = Color(0xFFAEA4FC);
static const deepPurple = Color(0xFF7C65E7);

@ -29,10 +29,10 @@ packages:
dependency: transitive
description:
name: async
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
url: "https://pub.dev"
source: hosted
version: "2.13.0"
version: "2.12.0"
audio_session:
dependency: transitive
description:
@ -161,6 +161,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.8"
dartz:
dependency: "direct main"
description:
name: dartz
sha256: e6acf34ad2e31b1eb00948692468c30ab48ac8250e0f0df661e29f12dd252168
url: "https://pub.dev"
source: hosted
version: "0.10.1"
dbus:
dependency: transitive
description:
@ -219,7 +227,7 @@ packages:
source: hosted
version: "0.0.2"
equatable:
dependency: transitive
dependency: "direct main"
description:
name: equatable
sha256: "567c64b3cb4cf82397aac55f4f0cbd3ca20d77c6c03bedbc4ceaddc08904aef7"
@ -230,10 +238,10 @@ packages:
dependency: transitive
description:
name: fake_async
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
url: "https://pub.dev"
source: hosted
version: "1.3.3"
version: "1.3.2"
ffi:
dependency: transitive
description:
@ -290,6 +298,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.9.3+4"
firebase_analytics:
dependency: "direct main"
description:
name: firebase_analytics
sha256: "4f85b161772e1d54a66893ef131c0a44bd9e552efa78b33d5f4f60d2caa5c8a3"
url: "https://pub.dev"
source: hosted
version: "11.6.0"
firebase_analytics_platform_interface:
dependency: transitive
description:
name: firebase_analytics_platform_interface
sha256: a44b6d1155ed5cae7641e3de7163111cfd9f6f6c954ca916dc6a3bdfa86bf845
url: "https://pub.dev"
source: hosted
version: "4.4.3"
firebase_analytics_web:
dependency: transitive
description:
name: firebase_analytics_web
sha256: c7d1ed1f86ae64215757518af5576ff88341c8ce5741988c05cc3b2e07b0b273
url: "https://pub.dev"
source: hosted
version: "0.5.10+16"
firebase_core:
dependency: "direct main"
description:
@ -615,6 +647,38 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.2.5"
get_it:
dependency: "direct main"
description:
name: get_it
sha256: a4292e7cf67193f8e7c1258203104eb2a51ec8b3a04baa14695f4064c144297b
url: "https://pub.dev"
source: hosted
version: "8.2.0"
google_api_availability:
dependency: "direct main"
description:
name: google_api_availability
sha256: "2ffdc91e1e0cf4e7974fef6c2988a24cefa81f03526ff04b694df6dc0fcbca03"
url: "https://pub.dev"
source: hosted
version: "5.0.1"
google_api_availability_android:
dependency: transitive
description:
name: google_api_availability_android
sha256: "4794147f43a8f3eee6b514d3ae30dbe6f7b9048cae8cd2a74cb4055cd28d74a8"
url: "https://pub.dev"
source: hosted
version: "1.1.1"
google_api_availability_platform_interface:
dependency: transitive
description:
name: google_api_availability_platform_interface
sha256: "65b7da62fe5b582bb3d508628ad827d36d890710ea274766a992a56fa5420da6"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
google_maps:
dependency: transitive
description:
@ -767,22 +831,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.2.2"
injector:
dependency: "direct main"
description:
name: injector
sha256: d692c37788872bfd4bd7c01b864b0712190a25ae5a346431ff69949d5728a2e1
url: "https://pub.dev"
source: hosted
version: "4.0.0"
intl:
dependency: transitive
description:
name: intl
sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5"
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.20.2"
version: "0.19.0"
json_annotation:
dependency: transitive
description:
@ -819,10 +875,10 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
url: "https://pub.dev"
source: hosted
version: "10.0.9"
version: "10.0.8"
leak_tracker_flutter_testing:
dependency: transitive
description:
@ -1099,10 +1155,10 @@ packages:
dependency: transitive
description:
name: petitparser
sha256: "1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1"
sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646"
url: "https://pub.dev"
source: hosted
version: "7.0.1"
version: "6.1.0"
platform:
dependency: transitive
description:
@ -1296,10 +1352,10 @@ packages:
dependency: transitive
description:
name: sqflite_common
sha256: "6ef422a4525ecc601db6c0a2233ff448c731307906e92cabc9ba292afaae16a6"
sha256: "84731e8bfd8303a3389903e01fb2141b6e59b5973cacbb0929021df08dddbe8b"
url: "https://pub.dev"
source: hosted
version: "2.5.6"
version: "2.5.5"
sqflite_darwin:
dependency: transitive
description:
@ -1384,10 +1440,10 @@ packages:
dependency: transitive
description:
name: synchronized
sha256: c254ade258ec8282947a0acbbc90b9575b4f19673533ee46f2f6e9b3aeefd7c0
sha256: "0669c70faae6270521ee4f05bffd2919892d42d1276e6c495be80174b6bc0ef6"
url: "https://pub.dev"
source: hosted
version: "3.4.0"
version: "3.3.1"
term_glyph:
dependency: transitive
description:
@ -1536,10 +1592,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
url: "https://pub.dev"
source: hosted
version: "15.0.0"
version: "14.3.1"
web:
dependency: "direct main"
description:
@ -1552,10 +1608,10 @@ packages:
dependency: transitive
description:
name: win32
sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03"
sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba"
url: "https://pub.dev"
source: hosted
version: "5.14.0"
version: "5.13.0"
win32_registry:
dependency: transitive
description:
@ -1576,10 +1632,10 @@ packages:
dependency: transitive
description:
name: xml
sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025"
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
url: "https://pub.dev"
source: hosted
version: "6.6.1"
version: "6.5.0"
sdks:
dart: ">=3.8.0 <4.0.0"
dart: ">=3.7.0 <4.0.0"
flutter: ">=3.29.0"

@ -62,6 +62,8 @@ dependencies:
flutter_zoom_videosdk: ^2.1.10
dartz: ^0.10.1
equatable: ^2.0.7
google_api_availability: ^5.0.1
firebase_analytics: ^11.5.1
web: any
smooth_corner: ^1.1.1

Loading…
Cancel
Save