diff --git a/android/app/build.gradle b/android/app/build.gradle index bdabb828..965934fd 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -21,6 +21,12 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + apply plugin: 'com.android.application' apply plugin: 'com.huawei.agconnect' apply plugin: 'kotlin-android' @@ -51,29 +57,29 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.ejada.hmg" minSdkVersion 21 - targetSdkVersion 30 + targetSdkVersion 33 versionCode flutterVersionCode.toInteger() versionName flutterVersionName multiDexEnabled true } signingConfigs { - config{ - storeFile file('key') - keyAlias 'hmg' - storePassword 'HmGsa123' - keyPassword 'HmGsa123' + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword keystoreProperties['storePassword'] } } buildTypes { debug { debuggable true - signingConfig signingConfigs.config + signingConfig signingConfigs.release } release { debuggable false - signingConfig signingConfigs.config + signingConfig signingConfigs.release minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' @@ -127,10 +133,11 @@ dependencies { implementation 'com.github.kittinunf.fuel:fuel-android:2.3.0' implementation 'com.google.android.gms:play-services-location:17.1.0'//for Android implementation 'com.google.android.gms:play-services-basement:17.5.0' - implementation "com.opentok.android:opentok-android-sdk:2.19.1" + implementation "com.opentok.android:opentok-android-sdk:2.21.4" implementation 'com.facebook.stetho:stetho:1.5.1' implementation 'com.facebook.stetho:stetho-urlconnection:1.5.1' implementation 'androidx.core:core-ktx:1.6.0' implementation 'androidx.appcompat:appcompat:1.3.1' + androidTestImplementation "androidx.test:core:1.4.0" } diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index ab5e631b..6c937f09 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -4,4 +4,4 @@ to allow setting breakpoints, to provide hot reload, etc. --> - + \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index e6601b40..ef4a8f83 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -34,9 +34,9 @@ - + - + @@ -49,7 +49,6 @@ android:showOnLockScreen="true" android:screenOrientation="sensorPortrait" android:allowBackup="false" - tools:replace="android:allowBackup,android:label" android:label="Dr. Alhabib"> @@ -89,23 +88,23 @@ - - - - - - + + + + + + - - + + - + @@ -117,20 +116,19 @@ Huawei Push Notifications Set push kit auto enable to true (for obtaining the token on initialize) --> - + + + - + - + android:enabled="true" + android:exported="false" /> - - - - + + + + diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceBroadcastReceiver.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceBroadcastReceiver.kt index 2820daae..2ed2daf4 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceBroadcastReceiver.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceBroadcastReceiver.kt @@ -1,7 +1,6 @@ - - package com.ejada.hmg.geofence.intent_receivers +import android.annotation.SuppressLint import android.content.BroadcastReceiver import android.content.Context import android.content.Intent @@ -13,37 +12,60 @@ import com.google.android.gms.location.GeofenceStatusCodes import com.google.android.gms.location.GeofencingEvent class GeofenceBroadcastReceiver : BroadcastReceiver() { - private val LOG_TAG = "GeofenceBroadcastReceiver" - override fun onReceive(context: Context, intent: Intent) { - - val geofencingEvent = GeofencingEvent.fromIntent(intent) - if (geofencingEvent.hasError()) { - val errorMessage = GeofenceErrorMessages.getErrorString(context, geofencingEvent.errorCode) - Log.e(LOG_TAG, errorMessage) - - Logs.GeofenceEvent.save(context,LOG_TAG,"Error while triggering geofence event",Logs.STATUS.ERROR) - doReRegisterIfRequired(context,geofencingEvent.errorCode) - - return - } + private val LOG_TAG = "GeofenceBroadcastReceiver" + + @SuppressLint("LongLogTag") + override fun onReceive(context: Context, intent: Intent) { + + val geofencingEvent = GeofencingEvent.fromIntent(intent) + if (geofencingEvent != null) { + if (geofencingEvent.hasError()) { + val errorMessage = + GeofenceErrorMessages.getErrorString(context, geofencingEvent.errorCode) + Log.e(LOG_TAG, errorMessage) - Logs.GeofenceEvent.save(context,LOG_TAG,"Geofence event triggered: ${GeofenceTransition.fromInt(geofencingEvent.geofenceTransition).value} for ${geofencingEvent.triggeringGeofences.map {it.requestId}}",Logs.STATUS.SUCCESS) - HMG_Geofence.shared(context).handleEvent(geofencingEvent.triggeringGeofences,geofencingEvent.triggeringLocation, GeofenceTransition.fromInt(geofencingEvent.geofenceTransition)); - - } + Logs.GeofenceEvent.save( + context, + LOG_TAG, + "Error while triggering geofence event", + Logs.STATUS.ERROR + ) + doReRegisterIfRequired(context, geofencingEvent.errorCode) - fun doReRegisterIfRequired(context: Context, errorCode: Int){ - val errorRequiredReregister = listOf( + return + } + } + if (geofencingEvent != null) { + Logs.GeofenceEvent.save( + context, + LOG_TAG, + "Geofence event triggered: ${GeofenceTransition.fromInt(geofencingEvent.geofenceTransition).value} for ${geofencingEvent.triggeringGeofences?.map { it.requestId }}", + Logs.STATUS.SUCCESS + ) + geofencingEvent.triggeringLocation?.let { + geofencingEvent.triggeringGeofences?.let { it1 -> + HMG_Geofence.shared(context).handleEvent( + it1, + it, GeofenceTransition.fromInt(geofencingEvent.geofenceTransition) + ) + } + } + }; + + } + + fun doReRegisterIfRequired(context: Context, errorCode: Int) { + val errorRequiredReregister = listOf( GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE, GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES, GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS, GeofenceStatusCodes.GEOFENCE_REQUEST_TOO_FREQUENT - ) + ) - if(errorRequiredReregister.contains(errorCode)) - HMG_Geofence.shared(context).register(){ status, error -> + if (errorRequiredReregister.contains(errorCode)) + HMG_Geofence.shared(context).register() { status, error -> - } + } - } + } } \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceTransitionsJobIntentService.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceTransitionsJobIntentService.kt index 21090f0f..b083e04e 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceTransitionsJobIntentService.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceTransitionsJobIntentService.kt @@ -59,18 +59,25 @@ class GeofenceTransitionsJobIntentService : JobIntentService() { override fun onHandleWork(intent: Intent) { val geofencingEvent = GeofencingEvent.fromIntent(intent) - if (geofencingEvent.hasError()) { - val errorMessage = GeofenceErrorMessages.getErrorString(context_!!, geofencingEvent.errorCode) - Log.e(LOG_TAG, errorMessage) + if (geofencingEvent != null) { + if (geofencingEvent.hasError()) { + val errorMessage = GeofenceErrorMessages.getErrorString(context_!!, geofencingEvent.errorCode) + Log.e(LOG_TAG, errorMessage) - saveLog(context_!!,LOG_TAG,errorMessage) - doReRegisterIfRequired(context_!!, geofencingEvent.errorCode) + saveLog(context_!!,LOG_TAG,errorMessage) + doReRegisterIfRequired(context_!!, geofencingEvent.errorCode) - return - } + return + } + } - HMG_Geofence.shared(context_!!).handleEvent(geofencingEvent.triggeringGeofences,geofencingEvent.triggeringLocation, GeofenceTransition.fromInt(geofencingEvent.geofenceTransition)); + if (geofencingEvent != null) { + geofencingEvent.triggeringGeofences?.let { geofencingEvent.triggeringLocation?.let { it1 -> + HMG_Geofence.shared(context_!!).handleEvent(it, + it1, GeofenceTransition.fromInt(geofencingEvent.geofenceTransition)) + } } + }; } diff --git a/android/build.gradle b/android/build.gradle index edb27f2a..e723adba 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -11,7 +11,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.0.3' + classpath 'com.android.tools.build:gradle:7.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.3.8' // classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1' diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 6e8ae021..1acad296 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index f43f5eaf..5fea0490 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -19,10 +19,10 @@ 76815B27275F381C00E66E94 /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76815B26275F381C00E66E94 /* HealthKit.framework */; }; 76962ECE28AE5C10004EAE09 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 76962ECD28AE5C10004EAE09 /* GoogleService-Info.plist */; }; 76F2556127F1FFED0062C1CD /* PassKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76F2556027F1FFED0062C1CD /* PassKit.framework */; }; - 888788C5457DD4B4291ED407 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBECDFA177FC32F0D92001A8 /* Pods_Runner.framework */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + B40C32A62DF065A3A0414845 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B99ADD0B93AC14DD8D0BAB0 /* Pods_Runner.framework */; }; E91B5396256AAA6500E96549 /* GlobalHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B538D256AAA6500E96549 /* GlobalHelper.swift */; }; E91B5397256AAA6500E96549 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B538E256AAA6500E96549 /* Extensions.swift */; }; E91B5398256AAA6500E96549 /* API.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B538F256AAA6500E96549 /* API.swift */; }; @@ -63,7 +63,6 @@ 306FE6C7271D790C002D6EFC /* OpenTokPlatformBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenTokPlatformBridge.swift; sourceTree = ""; }; 306FE6CA271D8B73002D6EFC /* OpenTok.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenTok.swift; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 7339683046E679D7577A50D3 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 762D738C274E42650063CE73 /* ring_30Sec.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = ring_30Sec.caf; path = ../../assets/sounds/ring_30Sec.caf; sourceTree = ""; }; @@ -71,7 +70,9 @@ 76815B26275F381C00E66E94 /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; }; 76962ECD28AE5C10004EAE09 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 76F2556027F1FFED0062C1CD /* PassKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PassKit.framework; path = System/Library/Frameworks/PassKit.framework; sourceTree = SDKROOT; }; + 7805E271E86E72F39E68ADCC /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 8B99ADD0B93AC14DD8D0BAB0 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -79,9 +80,7 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - C43E6143D6D42F3BF36E6E30 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - DBECDFA177FC32F0D92001A8 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - E88A1DAFD417EE86EE2F7F02 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + BC1BA79F1F6E9D7BE59D2AE4 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; E91B538D256AAA6500E96549 /* GlobalHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GlobalHelper.swift; sourceTree = ""; }; E91B538E256AAA6500E96549 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; E91B538F256AAA6500E96549 /* API.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = API.swift; sourceTree = ""; }; @@ -100,6 +99,7 @@ E9C8C135256BACDA00EFFB62 /* HMG_Guest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMG_Guest.swift; sourceTree = ""; }; E9E27167256E3A4000F49B69 /* LocalizedFromFlutter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalizedFromFlutter.swift; sourceTree = ""; }; E9F7623A25922BCE00FB5CCF /* FlutterConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlutterConstants.swift; sourceTree = ""; }; + EBA301C32F4CA9F09D2D7713 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -110,7 +110,7 @@ 76F2556127F1FFED0062C1CD /* PassKit.framework in Frameworks */, 76815B27275F381C00E66E94 /* HealthKit.framework in Frameworks */, E9620805255C2ED100D3A35D /* NetworkExtension.framework in Frameworks */, - 888788C5457DD4B4291ED407 /* Pods_Runner.framework in Frameworks */, + B40C32A62DF065A3A0414845 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -133,7 +133,7 @@ 76F2556027F1FFED0062C1CD /* PassKit.framework */, 76815B26275F381C00E66E94 /* HealthKit.framework */, E9620804255C2ED100D3A35D /* NetworkExtension.framework */, - DBECDFA177FC32F0D92001A8 /* Pods_Runner.framework */, + 8B99ADD0B93AC14DD8D0BAB0 /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -141,9 +141,9 @@ 605039E5DDF72C245F9765FE /* Pods */ = { isa = PBXGroup; children = ( - C43E6143D6D42F3BF36E6E30 /* Pods-Runner.debug.xcconfig */, - 7339683046E679D7577A50D3 /* Pods-Runner.release.xcconfig */, - E88A1DAFD417EE86EE2F7F02 /* Pods-Runner.profile.xcconfig */, + EBA301C32F4CA9F09D2D7713 /* Pods-Runner.debug.xcconfig */, + 7805E271E86E72F39E68ADCC /* Pods-Runner.release.xcconfig */, + BC1BA79F1F6E9D7BE59D2AE4 /* Pods-Runner.profile.xcconfig */, ); path = Pods; sourceTree = ""; @@ -246,15 +246,15 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 6CEC06A85A1BC01F415967B9 /* [CP] Check Pods Manifest.lock */, + A37FFD337A0067237A8DACD6 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - EB708D648E256F1D924823C6 /* [CP] Embed Pods Frameworks */, - 1FDB0C9B620EC9533D2358F3 /* [CP] Copy Pods Resources */, + E1D6AED972DEFC56AA7DB402 /* [CP] Embed Pods Frameworks */, + 541D1D49FBD13BE6BA6DA5BC /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -320,7 +320,21 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 1FDB0C9B620EC9533D2358F3 /* [CP] Copy Pods Resources */ = { + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n"; + }; + 541D1D49FBD13BE6BA6DA5BC /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -337,21 +351,21 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Thin Binary"; + name = "Run Script"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - 6CEC06A85A1BC01F415967B9 /* [CP] Check Pods Manifest.lock */ = { + A37FFD337A0067237A8DACD6 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -373,21 +387,7 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 9740EEB61CF901F6004384FC /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; - }; - EB708D648E256F1D924823C6 /* [CP] Embed Pods Frameworks */ = { + E1D6AED972DEFC56AA7DB402 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -538,7 +538,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.56; + MARKETING_VERSION = 4.5.57; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -682,7 +682,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.56; + MARKETING_VERSION = 4.5.57; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -720,7 +720,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.56; + MARKETING_VERSION = 4.5.57; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/lib/config/config.dart b/lib/config/config.dart index a7676855..ca5380d9 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -411,7 +411,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnar var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; var IP_ADDRESS = '10.20.10.20'; -var VERSION_ID = 9.8; +var VERSION_ID = 9.9; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; @@ -773,7 +773,6 @@ class AppGlobal { request.generalid = GENERAL_ID; //'Cs2020@2016\$2958'; request.PatientOutSA = 0; request.SessionID = "wEVNbagIkaNhGECWZjHaA"; - request.TokenID = "@dm!n"; request.isDentalAllowedBackend = false; request.DeviceTypeID = Platform.isIOS ? 1 : 2; request.DeviceType = Platform.isIOS ? "iOS" : "Android"; diff --git a/lib/core/model/eye/AppoimentAllHistoryResult.dart b/lib/core/model/eye/AppoimentAllHistoryResult.dart index 71c9573b..b431943d 100644 --- a/lib/core/model/eye/AppoimentAllHistoryResult.dart +++ b/lib/core/model/eye/AppoimentAllHistoryResult.dart @@ -178,7 +178,7 @@ class AppoimentAllHistoryResultList { doctorImageURL = json['DoctorImageURL']; doctorNameObj = json['DoctorNameObj']; doctorRate = json['DoctorRate']; - doctorSpeciality = json['DoctorSpeciality'].cast(); + if (doctorSpeciality != null) doctorSpeciality = json['DoctorSpeciality'].cast(); doctorTitle = json['DoctorTitle']; gender = json['Gender']; genderDescription = json['GenderDescription']; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 38e63391..6a421073 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -149,7 +149,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 3649158; //3844083 + // body['PatientID'] = 2001273; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart index 5a098b6f..ea9af54d 100644 --- a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart @@ -5,7 +5,7 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:geocoding/geocoding.dart'; -import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:google_maps_place_picker_mb/google_maps_place_picker.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart index fbef90e6..f45d2942 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart @@ -25,7 +25,7 @@ import 'package:flutter/material.dart'; import 'package:geocoding/geocoding.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:google_maps_place_picker_mb/google_maps_place_picker.dart'; import 'package:huawei_hmsavailability/huawei_hmsavailability.dart'; import 'package:provider/provider.dart'; diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart index 87d55b72..e846d31c 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart @@ -20,7 +20,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:google_maps_place_picker_mb/google_maps_place_picker.dart'; import 'package:permission_handler/permission_handler.dart'; import 'cmc_location_page.dart'; diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart index e96ddcc7..78e13982 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart @@ -23,7 +23,7 @@ import 'package:flutter/material.dart'; import 'package:geocoding/geocoding.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:google_maps_place_picker_mb/google_maps_place_picker.dart'; import 'package:huawei_hmsavailability/huawei_hmsavailability.dart'; import 'package:provider/provider.dart'; diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart index 7984cbbf..3a59b21e 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart @@ -12,7 +12,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:google_maps_place_picker_mb/google_maps_place_picker.dart'; import 'package:provider/provider.dart'; class NewHomeHealthCareStepOnePage extends StatefulWidget { diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart index 5328bfba..79f10be7 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/ import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -21,7 +22,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:google_maps_place_picker_mb/google_maps_place_picker.dart'; import 'location_page.dart'; @@ -53,6 +54,7 @@ class _NewHomeHealthCareStepTowPageState extends State mapController = Completer(); + LocationUtils locationUtils; @override void initState() { @@ -62,7 +64,6 @@ class _NewHomeHealthCareStepTowPageState extends State with SingleTickerProv return DoctorCard( onTap: () => ancillaryOrdersDetails(model.ancillaryLists[0].ancillaryOrderList[index], model.ancillaryLists[0].projectID), isInOutPatient: true, - name: TranslationBase.of(context).dr.toString() + " " + (model.ancillaryLists[0].ancillaryOrderList[index].doctorName), + name: TranslationBase.of(context).dr.toString() + " " + (model.ancillaryLists[0].ancillaryOrderList[index].doctorName ?? ""), billNo: model.ancillaryLists[0].ancillaryOrderList[index].orderNo.toString(), profileUrl: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png", subName: model.ancillaryLists[0].projectName, diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 9b5374ef..71c9d0b2 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -300,9 +300,10 @@ class _DocAvailableAppointmentsState extends State wit } getDoctorFreeSlots(context, DoctorList docObject) { + print(DocAvailableAppointments.initialSlotDuration); GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, context).then((res) { + service.getDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, context, projectViewModel).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['FreeTimeSlots'].length != 0) { diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index d69ed4f3..057cb5c2 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -102,19 +102,23 @@ class _PickupLocationState extends State { ), child: InkWell( onTap: () { - Navigator.push( - context, - FadePage( - page: PickupLocationFromMap( - latitude: projectViewModel.latitude ?? 0, - longitude: projectViewModel.longitude ?? 0, - onPick: (value) { - setState(() { - _result = value; - }); - }, - )), - ); + if (projectViewModel.latitude != null && projectViewModel.longitude != null) { + Navigator.push( + context, + FadePage( + page: PickupLocationFromMap( + latitude: projectViewModel.latitude ?? 0, + longitude: projectViewModel.longitude ?? 0, + onPick: (value) { + setState(() { + _result = value; + }); + }, + )), + ); + } else { + locationUtils.getCurrentLocation(); + } }, child: Row( children: [ @@ -438,20 +442,24 @@ class _PickupLocationState extends State { ), child: InkWell( onTap: () { - Navigator.push( - context, - FadePage( - page: PickupLocationFromMap( - latitude: projectViewModel.latitude, - longitude: projectViewModel.longitude, - onPick: (value) { - setState(() { - _result = value; - }); - }, + if (projectViewModel.latitude != null && projectViewModel.longitude != null) { + Navigator.push( + context, + FadePage( + page: PickupLocationFromMap( + latitude: projectViewModel.latitude, + longitude: projectViewModel.longitude, + onPick: (value) { + setState(() { + _result = value; + }); + }, + ), ), - ), - ); + ); + } else { + locationUtils.getCurrentLocation(); + } }, child: Row( children: [ diff --git a/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart b/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart index 2008ef4c..56033e8c 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart @@ -309,6 +309,11 @@ class RRTRequestPickupAddressPageState extends State with SingleTickerProviderStateMixin { return DoctorCard( onTap: () => ancillaryOrdersDetails(widget.ancillaryLists[0].ancillaryOrderList[index], widget.ancillaryLists[0].projectID), isInOutPatient: true, - name: TranslationBase.of(context).dr.toString() + " " + (widget.ancillaryLists[0].ancillaryOrderList[index].doctorName), + name: TranslationBase.of(context).dr.toString() + " " + (widget.ancillaryLists[0].ancillaryOrderList[index].doctorName ?? ""), billNo: widget.ancillaryLists[0].ancillaryOrderList[index].orderNo.toString(), profileUrl: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png", subName: widget.ancillaryLists[0].projectName, diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index 39a54f1a..4bd1ae81 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -25,8 +25,8 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; -import 'package:speech_to_text/speech_recognition_error.dart'; -import 'package:speech_to_text/speech_to_text.dart' as stt; +// import 'package:speech_to_text/speech_recognition_error.dart'; +// import 'package:speech_to_text/speech_to_text.dart' as stt; class SendFeedbackPage extends StatefulWidget { final AppoitmentAllHistoryResultList appointment; @@ -49,7 +49,7 @@ class _SendFeedbackPageState extends State { final formKey = GlobalKey(); MessageType messageType = MessageType.NON; var _currentLocaleId; - stt.SpeechToText speech = stt.SpeechToText(); + // stt.SpeechToText speech = stt.SpeechToText(); var reconizedWord; int selectedStatusIndex = 5; var event = RobotProvider(); @@ -218,17 +218,17 @@ class _SendFeedbackPageState extends State { inputWidget(TranslationBase.of(context).subject, "", titleController), SizedBox(height: 12), inputWidget(TranslationBase.of(context).message, "", messageController, lines: 11, suffixTap: () async { - if (Platform.isAndroid) { - if (await PermissionService.isMicrophonePermissionEnabled()) { - openSpeechReco(); - } else { - Utils.showPermissionConsentDialog(context, TranslationBase.of(context).recordAudioPermission, () { - openSpeechReco(); - }); - } - } else { - openSpeechReco(); - } + // if (Platform.isAndroid) { + // if (await PermissionService.isMicrophonePermissionEnabled()) { + // openSpeechReco(); + // } else { + // Utils.showPermissionConsentDialog(context, TranslationBase.of(context).recordAudioPermission, () { + // openSpeechReco(); + // }); + // } + // } else { + // openSpeechReco(); + // } }), SizedBox(height: 12), InkWell( @@ -517,26 +517,26 @@ class _SendFeedbackPageState extends State { return; } - openSpeechReco() async { - new RoboSearch(context: context).showAlertDialog(context); - _currentLocaleId = TranslationBase.of(AppGlobal.context).locale.languageCode; - bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); - if (available) { - speech.listen( - onResult: resultListener, - listenMode: stt.ListenMode.confirmation, - localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', - ); - } else { - print("The user has denied the use of speech recognition."); - } - } - - void errorListener(SpeechRecognitionError error) { - event.setValue({"searchText": 'null'}); - //SpeechToText.closeAlertDialog(context); - print(error); - } + // openSpeechReco() async { + // new RoboSearch(context: context).showAlertDialog(context); + // _currentLocaleId = TranslationBase.of(AppGlobal.context).locale.languageCode; + // bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); + // if (available) { + // speech.listen( + // onResult: resultListener, + // listenMode: stt.ListenMode.confirmation, + // localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', + // ); + // } else { + // print("The user has denied the use of speech recognition."); + // } + // } + // + // void errorListener(SpeechRecognitionError error) { + // event.setValue({"searchText": 'null'}); + // //SpeechToText.closeAlertDialog(context); + // print(error); + // } void statusListener(String status) { reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; @@ -556,14 +556,14 @@ class _SendFeedbackPageState extends State { setState(() { messageController.text += reconizedWord + '\n'; RoboSearch.closeAlertDialog(context); - speech.stop(); + // speech.stop(); }); } } - Future initSpeechState() async { - bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener); - print(hasSpeech); - if (!mounted) return; - } + // Future initSpeechState() async { + // bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener); + // print(hasSpeech); + // if (!mounted) return; + // } } diff --git a/lib/pages/insurance/insurance_page.dart b/lib/pages/insurance/insurance_page.dart index 75acbffb..2ea4213f 100644 --- a/lib/pages/insurance/insurance_page.dart +++ b/lib/pages/insurance/insurance_page.dart @@ -143,10 +143,10 @@ class InsurancePage extends StatelessWidget { } getDetails({String setupID, int projectID, String patientIdentificationID, int patientID, String name, bool isFamily, int parentID = 0, BuildContext context}) { - // GifLoaderDialogUtils.showMyDialog(context); - // _insuranceCardService.getPatientInsuranceDetails(setupID: setupID, projectID: projectID, patientID: patientID, patientIdentificationID: patientIdentificationID, isFamily: isFamily, parentID: parentID).then((value) { - // GifLoaderDialogUtils.hideDialog(context); - // if (!_insuranceCardService.hasError && _insuranceCardService.isHaveInsuranceCard) { + GifLoaderDialogUtils.showMyDialog(context); + _insuranceCardService.getPatientInsuranceDetails(setupID: setupID, projectID: projectID, patientID: patientID, patientIdentificationID: patientIdentificationID, isFamily: isFamily, parentID: parentID).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (!_insuranceCardService.hasError && _insuranceCardService.isHaveInsuranceCard) { Navigator.push( context, FadePage( @@ -158,9 +158,9 @@ class InsurancePage extends StatelessWidget { ))).then((value) { model.getInsuranceUpdated(); }); - // } else { - // AppToast.showErrorToast(message: _insuranceCardService.error); - // } - // }); + } else { + AppToast.showErrorToast(message: _insuranceCardService.error); + } + }); } } diff --git a/lib/pages/livecare/widgets/LiveCarePendingRequest.dart b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart index 7f22c7b6..c8519cfd 100644 --- a/lib/pages/livecare/widgets/LiveCarePendingRequest.dart +++ b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart @@ -112,6 +112,12 @@ class _LiveCarePendingRequestState extends State { // cancelLiveCareRequest(); }), ), + // DefaultButton( + // TranslationBase.of(context).cancel, + // () { + // cancelLiveCareRequest(); + // }, + // ), ], ), ), @@ -200,30 +206,6 @@ class _LiveCarePendingRequestState extends State { // " Patients", // style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), // ), - // Container( - // transform: Matrix4.translationValues(0.0, 110.0, 0.0), - // alignment: Alignment.bottomCenter, - // width: MediaQuery.of(context).size.width, - // child: ButtonTheme( - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(10.0), - // ), - // minWidth: MediaQuery.of(context).size.width, - // height: 45.0, - // child: RaisedButton( - // color: Colors.red[800], - // textColor: Colors.white, - // elevation: 0, - // disabledTextColor: Colors.white, - // disabledColor: new Color(0xFFbcc2c4), - // onPressed: () { - // cancelLiveCareRequest(); - // }, - // child: Text(TranslationBase.of(context).cancel, - // style: TextStyle(fontSize: 18.0)), - // ), - // ), - // ), // ], // ), ); diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index f132741e..1ca32e02 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -57,8 +57,8 @@ class _PatientSickLeavePageState extends State { subName: model.sickLeaveList[index].clinicName, isSortByClinic: false, isInOutPatient: model.sickLeaveList[index].isInOutPatient, - isSickLeave: true, - sickLeaveStatus: model.sickLeaveList[index].status, + // isSickLeave: true, + // sickLeaveStatus: model.sickLeaveList[index].status, onEmailTap: () { showConfirmMessage(model, index); }, @@ -69,13 +69,13 @@ class _PatientSickLeavePageState extends State { } void showConfirmMessage(PatientSickLeaveViewMode model, int index) { - if (model.sickLeaveList[index].status == 1) { - openWorkPlaceUpdatePage(model.sickLeaveList[index].requestNo, model.sickLeaveList[index].setupID, model, index, model.sickLeaveList[index].projectID); - } else if (model.sickLeaveList[index].status == 2) { + // if (model.sickLeaveList[index].status == 1) { + // openWorkPlaceUpdatePage(model.sickLeaveList[index].requestNo, model.sickLeaveList[index].setupID, model, index, model.sickLeaveList[index].projectID); + // } else if (model.sickLeaveList[index].status == 2) { showEmailDialog(model, index); - } else { - showApprovalDialog(); - } + // } else { + // showApprovalDialog(); + // } } void showApprovalDialog() { diff --git a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart index dcc4b299..f57bb478 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart @@ -1,22 +1,20 @@ import 'dart:async'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/app_map/google_huawei_map.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/pickupLocation/PickupLocationFromMap.dart'; import 'package:flutter/material.dart'; import 'package:geocoding/geocoding.dart'; -import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:provider/provider.dart'; class AddAddressPage extends StatefulWidget { @@ -37,6 +35,7 @@ class _AddAddressPageState extends State { LatLng currentPostion; Completer mapController = Completer(); Placemark selectedPlace; + LocationUtils locationUtils; static CameraPosition _kGooglePlex = CameraPosition( target: LatLng(37.42796133580664, -122.085749655962), @@ -93,13 +92,28 @@ class _AddAddressPageState extends State { } _getCurrentLocation() async { - await Geolocator.getLastKnownPosition().then((value) { - _latitude = value.latitude; - _longitude = value.longitude; - }).catchError((e) { - _longitude = 0; - _latitude = 0; - }); + if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { + var lat = await this.sharedPref.getDouble(USER_LAT); + var long = await this.sharedPref.getDouble(USER_LONG); + _latitude = lat; + _longitude = long; + currentPostion = LatLng(lat, long); + setMap(); + } else { + locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); + locationUtils.getCurrentLocation(callBack: (value) { + print(value); + setMap(); + }); + } + + // await Geolocator.getLastKnownPosition().then((value) { + // _latitude = value.latitude; + // _longitude = value.longitude; + // }).catchError((e) { + // _longitude = 0; + // _latitude = 0; + // }); } @override @@ -184,8 +198,8 @@ class _AddAddressPageState extends State { // widget.onPick(value); // }, // ), - ), - ); + ), + ); // ); } } diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index ca65e4de..6cf2251b 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -253,7 +253,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorFreeSlots(int docID, int clinicID, int projectID, BuildContext context) async { + Future getDoctorFreeSlots(int docID, int clinicID, int projectID, BuildContext context, [ProjectViewModel projectViewModel]) async { Map request; var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); @@ -276,6 +276,16 @@ class DoctorsListService extends BaseService { "DeviceTypeID": 1 }; + if (clinicID == 253) { + List procedureID = projectViewModel.selectedBodyPartList.map((element) => element.id.toString()).toList(); + request["GeneralProcedureList"] = procedureID; + if (procedureID.length == 1 && procedureID[0] == "1") { + request["ProcedureSlotDuration"] = 90; + } else { + request["ProcedureSlotDuration"] = projectViewModel.laserSelectionDuration; + } + } + dynamic localRes; await baseAppClient.post(GET_DOCTOR_FREE_SLOTS, onSuccess: (response, statusCode) async { diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index 3d31e84b..af0db957 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -28,109 +28,158 @@ class LocalNotification { } } - _initialize() { - var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); - var initializationSettingsIOS = IOSInitializationSettings(onDidReceiveLocalNotification: null); - var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); - flutterLocalNotificationsPlugin.initialize(initializationSettings, onSelectNotification: _onNotificationClick); - } - - var _random = new Random(); + _initialize() async { + try { + var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); + var initializationSettingsIOS = DarwinInitializationSettings(onDidReceiveLocalNotification: null); + var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); + await flutterLocalNotificationsPlugin.initialize( + initializationSettings, + onDidReceiveNotificationResponse: + (NotificationResponse notificationResponse) { + switch (notificationResponse.notificationResponseType) { + case NotificationResponseType.selectedNotification: + // selectNotificationStream.add(notificationResponse.payload); + break; + case NotificationResponseType.selectedNotificationAction: + // if (notificationResponse.actionId == navigationActionId) { + // selectNotificationStream.add(notificationResponse.payload); + // } + break; + } + }, + onDidReceiveBackgroundNotificationResponse: notificationTapBackground, + ); + } catch(ex) {} + // flutterLocalNotificationsPlugin.initialize(initializationSettings, onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) + // { + // switch (notificationResponse.notificationResponseType) { + // case NotificationResponseType.selectedNotification: + // // selectNotificationStream.add(notificationResponse.payload); + // break; + // case NotificationResponseType.selectedNotificationAction: + // // if (notificationResponse.actionId == navigationActionId) { + // // selectNotificationStream.add(notificationResponse.payload); + // } + // // break; + // },} + // + // , + // + // ); +} - _randomNumber({int from = 100000}) { - return _random.nextInt(from); + void notificationTapBackground(NotificationResponse notificationResponse) { + // ignore: avoid_print + print('notification(${notificationResponse.id}) action tapped: ' + '${notificationResponse.actionId} with' + ' payload: ${notificationResponse.payload}'); + if (notificationResponse.input?.isNotEmpty ?? false) { + // ignore: avoid_print + print( + 'notification action tapped with input: ${notificationResponse.input}'); + } } - _vibrationPattern() { - var vibrationPattern = Int64List(4); - vibrationPattern[0] = 0; - vibrationPattern[1] = 1000; - vibrationPattern[2] = 5000; - vibrationPattern[3] = 2000; +var _random = new Random(); - return vibrationPattern; - } +_randomNumber({int from = 100000}) { + return _random.nextInt(from); +} - Future showNow({@required String title, @required String subtitle, String payload}) { - Future.delayed(Duration(seconds: 1)).then((result) async { - var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', - channelDescription: 'HMG', importance: Importance.max, priority: Priority.high, ticker: 'ticker', vibrationPattern: _vibrationPattern()); - var iOSPlatformChannelSpecifics = IOSNotificationDetails(); - var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { - print(err); - }); - }); - } +_vibrationPattern() { + var vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 1000; + vibrationPattern[2] = 5000; + vibrationPattern[3] = 2000; + + return vibrationPattern; +} - Future scheduleNotification({@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async { - ///vibrationPattern - var vibrationPattern = Int64List(4); - vibrationPattern[0] = 0; - vibrationPattern[1] = 1000; - vibrationPattern[2] = 5000; - vibrationPattern[3] = 2000; - - var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', - channelDescription: 'ActivePrescriptionsDescription', - // icon: 'secondary_icon', - sound: RawResourceAndroidNotificationSound('slow_spring_board'), - - ///change it to be as ionic - // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic - vibrationPattern: vibrationPattern, - enableLights: true, - color: const Color.fromARGB(255, 255, 0, 0), - ledColor: const Color.fromARGB(255, 255, 0, 0), - ledOnMs: 1000, - ledOffMs: 500); - var iOSPlatformChannelSpecifics = IOSNotificationDetails(sound: 'slow_spring_board.aiff'); - - // /change it to be as ionic +Future showNow({@required String title, @required String subtitle, String payload}) { + Future.delayed(Duration(seconds: 1)).then((result) async { + var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', + channelDescription: 'HMG', + importance: Importance.max, + priority: Priority.high, + ticker: 'ticker', + vibrationPattern: _vibrationPattern()); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); - } + await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { + print(err); + }); + }); +} - ///Repeat notification every day at approximately 10:00:00 am - Future showDailyAtTime() async { - var time = Time(10, 0, 0); - var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', channelDescription: 'repeatDailyAtTime description'); - var iOSPlatformChannelSpecifics = IOSNotificationDetails(); - // var platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.showDailyAtTime( - // 0, - // 'show daily title', - // 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - // time, - // platformChannelSpecifics); - } +Future scheduleNotification({@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async { + ///vibrationPattern + var vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 1000; + vibrationPattern[2] = 5000; + vibrationPattern[3] = 2000; + + var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', + channelDescription: 'ActivePrescriptionsDescription', + // icon: 'secondary_icon', + sound: RawResourceAndroidNotificationSound('slow_spring_board'), + + ///change it to be as ionic + // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic + vibrationPattern: vibrationPattern, + enableLights: true, + color: const Color.fromARGB(255, 255, 0, 0), + ledColor: const Color.fromARGB(255, 255, 0, 0), + ledOnMs: 1000, + ledOffMs: 500); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(sound: 'slow_spring_board.aiff'); + + // /change it to be as ionic + var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); +} - ///Repeat notification weekly on Monday at approximately 10:00:00 am - Future showWeeklyAtDayAndTime() async { - var time = Time(10, 0, 0); - var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', channelDescription: 'show weekly description'); - var iOSPlatformChannelSpecifics = IOSNotificationDetails(); - // var platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( - // 0, - // 'show weekly title', - // 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - // Day.Monday, - // time, - // platformChannelSpecifics); - } +///Repeat notification every day at approximately 10:00:00 am +Future showDailyAtTime() async { + var time = Time(10, 0, 0); + var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', channelDescription: 'repeatDailyAtTime description'); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showDailyAtTime( + // 0, + // 'show daily title', + // 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // time, + // platformChannelSpecifics); +} - String _toTwoDigitString(int value) { - return value.toString().padLeft(2, '0'); - } +///Repeat notification weekly on Monday at approximately 10:00:00 am +Future showWeeklyAtDayAndTime() async { + var time = Time(10, 0, 0); + var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', channelDescription: 'show weekly description'); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( + // 0, + // 'show weekly title', + // 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // Day.Monday, + // time, + // platformChannelSpecifics); +} - Future cancelNotification() async { - await flutterLocalNotificationsPlugin.cancel(0); - } +String _toTwoDigitString(int value) { + return value.toString().padLeft(2, '0'); +} - Future cancelAllNotifications() async { - await flutterLocalNotificationsPlugin.cancelAll(); - } +Future cancelNotification() async { + await flutterLocalNotificationsPlugin.cancel(0); } + +Future cancelAllNotifications() async { + await flutterLocalNotificationsPlugin.cancelAll(); +}} diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index bb215613..3eb6388f 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -24,6 +24,7 @@ class LocationUtils { bool isShowConfirmDialog; BuildContext context; bool isHuawei; + final GeolocatorPlatform _geolocatorPlatform = GeolocatorPlatform.instance; LocationUtils({@required this.isShowConfirmDialog, @required this.context, this.isHuawei = false}); @@ -43,11 +44,16 @@ class LocationUtils { if (permission == LocationPermission.denied || permission == LocationPermission.deniedForever) { if (Platform.isAndroid) { - Utils.showPermissionConsentDialog(context, TranslationBase.of(context).locationPermissionDialog, () { - Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.medium, timeLimit: Duration(seconds: 10)).then((value) { - setLocation(value); - if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); - }); + Utils.showPermissionConsentDialog(context, TranslationBase.of(context).locationPermissionDialog, () async { + final hasPermission = await _handlePermission(); + if (hasPermission) { + Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.medium, timeLimit: Duration(seconds: 10)).then((value) { + setLocation(value); + if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); + }); + } else { + if (isShowConfirmDialog) showErrorLocationDialog(false); + } }); } else { if (await Permission.location.request().isGranted) { @@ -70,6 +76,29 @@ class LocationUtils { } } + Future _handlePermission() async { + bool serviceEnabled; + LocationPermission permission; + + serviceEnabled = await _geolocatorPlatform.isLocationServiceEnabled(); + if (!serviceEnabled) { + return false; + } + + permission = await _geolocatorPlatform.checkPermission(); + if (permission == LocationPermission.denied) { + permission = await _geolocatorPlatform.requestPermission(); + if (permission == LocationPermission.denied) { + return false; + } + } + + if (permission == LocationPermission.deniedForever) { + return false; + } + return true; + } + LocationCallback _locationCallback; _getHMSCurrentLocation(Function(LatLng) callBack) async { diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart index 2cea20f3..49fa571d 100644 --- a/lib/uitl/push-notification-handler.dart +++ b/lib/uitl/push-notification-handler.dart @@ -223,12 +223,14 @@ class PushNotificationHandler { // if (Platform.isAndroid && (!await FlutterHmsGmsAvailability.isHmsAvailable)) { if (Platform.isAndroid) { - await hmsApiAvailability.isHMSAvailable().then((value) async { - if (value != 0) { - final fcmToken = await FirebaseMessaging.instance.getToken(); - if (fcmToken != null) onToken(fcmToken); - } - }); + try { + await hmsApiAvailability.isHMSAvailable().then((value) async { + if (value != 0) { + final fcmToken = await FirebaseMessaging.instance.getToken(); + if (fcmToken != null) onToken(fcmToken); + } + }); + } catch (ex) {} } if (Platform.isIOS) { diff --git a/lib/widgets/app_map/google_huawei_map.dart b/lib/widgets/app_map/google_huawei_map.dart index 57e23d81..35eabfdc 100644 --- a/lib/widgets/app_map/google_huawei_map.dart +++ b/lib/widgets/app_map/google_huawei_map.dart @@ -47,6 +47,7 @@ class AppMapState extends State { checkIsHuawei() async { await hmsApiAvailability.isHMSAvailable().then((value) { isHuawei = value == 0 ? true : false; + hmsMap.HuaweiMapInitializer.initializeMap(); }); print(isHuawei); setState(() {}); diff --git a/lib/widgets/others/bottom_bar.dart b/lib/widgets/others/bottom_bar.dart index 03622a7a..a21eb817 100644 --- a/lib/widgets/others/bottom_bar.dart +++ b/lib/widgets/others/bottom_bar.dart @@ -33,9 +33,9 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_tts/flutter_tts.dart'; import 'package:permission_handler/permission_handler.dart'; -import 'package:speech_to_text/speech_recognition_error.dart'; -import 'package:speech_to_text/speech_recognition_result.dart'; -import 'package:speech_to_text/speech_to_text.dart'; +// import 'package:speech_to_text/speech_recognition_error.dart'; +// import 'package:speech_to_text/speech_recognition_result.dart'; +// import 'package:speech_to_text/speech_to_text.dart'; class BottomBarSearch extends StatefulWidget { @override @@ -47,7 +47,7 @@ class _SearchBot extends State { RobotProvider Provider = RobotProvider(); bool isLoading = false; bool isError = false; - final SpeechToText speech = SpeechToText(); + // final SpeechToText speech = SpeechToText(); String error = ''; String _currentLocaleId = ""; String lastError; @@ -98,8 +98,8 @@ class _SearchBot extends State { }); // await flutterTts.speak("Hello!"); //Future.delayed(const Duration(seconds: 1), () { - initSpeechState() - .then((value) => startVoiceSearch()); + // initSpeechState() + // .then((value) => startVoiceSearch()); //}); }, )), @@ -111,34 +111,34 @@ class _SearchBot extends State { ); } - startVoiceSearch() async { - speech.listen( - onResult: resultListener, - listenFor: Duration(seconds: 10), - localeId: _currentLocaleId, - onSoundLevelChange: soundLevelListener, - cancelOnError: true, - partialResults: true, - onDevice: true, - listenMode: ListenMode.confirmation); - } - - void resultListener(SpeechRecognitionResult result) { - // lastWords = "${result.recognizedWords} - ${result.finalResult}"; - - if (result.finalResult == true) { - // setState(() { - reconizedWord = result.recognizedWords; - //}); - setState(() { - searchController.text = reconizedWord; - }); - Future.delayed(const Duration(seconds: 1), () { - _speak(reconizedWord); - }); - } - //}); - } + // startVoiceSearch() async { + // speech.listen( + // onResult: resultListener, + // listenFor: Duration(seconds: 10), + // localeId: _currentLocaleId, + // onSoundLevelChange: soundLevelListener, + // cancelOnError: true, + // partialResults: true, + // onDevice: true, + // listenMode: ListenMode.confirmation); + // } + + // void resultListener(SpeechRecognitionResult result) { + // // lastWords = "${result.recognizedWords} - ${result.finalResult}"; + // + // if (result.finalResult == true) { + // // setState(() { + // reconizedWord = result.recognizedWords; + // //}); + // setState(() { + // searchController.text = reconizedWord; + // }); + // Future.delayed(const Duration(seconds: 1), () { + // _speak(reconizedWord); + // }); + // } + // //}); + // } Future _speak(reconizedWord) async { //await flutterTts.speak(reconizedWord); @@ -161,23 +161,23 @@ class _SearchBot extends State { ].request(); } - Future initSpeechState() async { - await speech.initialize(onError: errorListener, onStatus: statusListener); - - _currentLocaleId = - TranslationBase.of(AppGlobal.context).locale.languageCode == 'en' - ? 'en-GB' - : 'ar-SA'; // systemLocale.localeId; - flutterTts.setLanguage(_currentLocaleId); - - // if (!mounted) return; - } - - void errorListener(SpeechRecognitionError error) { - //setState(() { - // reconizedWord = "${error.errorMsg} - ${error.permanent}"; - //}); - } + // Future initSpeechState() async { + // await speech.initialize(onError: errorListener, onStatus: statusListener); + // + // _currentLocaleId = + // TranslationBase.of(AppGlobal.context).locale.languageCode == 'en' + // ? 'en-GB' + // : 'ar-SA'; // systemLocale.localeId; + // flutterTts.setLanguage(_currentLocaleId); + // + // // if (!mounted) return; + // } + + // void errorListener(SpeechRecognitionError error) { + // //setState(() { + // // reconizedWord = "${error.errorMsg} - ${error.permanent}"; + // //}); + // } void statusListener(String status) { //setState(() { diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 10f30b71..5a571df8 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -66,8 +66,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_tts/flutter_tts.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; -import 'package:speech_to_text/speech_recognition_error.dart'; -import 'package:speech_to_text/speech_to_text.dart' as stt; +// import 'package:speech_to_text/speech_recognition_error.dart'; +// import 'package:speech_to_text/speech_to_text.dart' as stt; import 'package:url_launcher/url_launcher.dart'; class FloatingSearchButton extends StatefulWidget { @@ -83,7 +83,7 @@ class _FloatingSearchButton extends State with TickerProvi RobotProvider eventProvider = RobotProvider(); bool isLoading = false; bool isError = false; - stt.SpeechToText speech = stt.SpeechToText(); + // stt.SpeechToText speech = stt.SpeechToText(); String error = ''; String _currentLocaleId = ""; String lastError; @@ -143,7 +143,7 @@ class _FloatingSearchButton extends State with TickerProvi if (p['startPopUp'] == 'true') { if (this.mounted) { new RoboSearch(context: context).showAlertDialog(context); - initSpeechState().then((value) => {startVoiceSearch()}); + // initSpeechState().then((value) => {startVoiceSearch()}); } } }); @@ -192,20 +192,20 @@ class _FloatingSearchButton extends State with TickerProvi : Image.asset('assets/images/gif/robot-idle.gif'), ), onTap: () async { - if (Platform.isAndroid) { - if (await PermissionService.isMicrophonePermissionEnabled()) { - new RoboSearch(context: context).showAlertDialog(context); - initSpeechState().then((value) => {startVoiceSearch()}); - } else { - Utils.showPermissionConsentDialog(context, TranslationBase.of(context).recordAudioPermission, () { - new RoboSearch(context: context).showAlertDialog(context); - initSpeechState().then((value) => {startVoiceSearch()}); - }); - } - } else { - new RoboSearch(context: context).showAlertDialog(context); - initSpeechState().then((value) => {startVoiceSearch()}); - } + // if (Platform.isAndroid) { + // if (await PermissionService.isMicrophonePermissionEnabled()) { + // new RoboSearch(context: context).showAlertDialog(context); + // initSpeechState().then((value) => {startVoiceSearch()}); + // } else { + // Utils.showPermissionConsentDialog(context, TranslationBase.of(context).recordAudioPermission, () { + // new RoboSearch(context: context).showAlertDialog(context); + // initSpeechState().then((value) => {startVoiceSearch()}); + // }); + // } + // } else { + // new RoboSearch(context: context).showAlertDialog(context); + // initSpeechState().then((value) => {startVoiceSearch()}); + // } }, ), Positioned( @@ -234,31 +234,31 @@ class _FloatingSearchButton extends State with TickerProvi ])); } - startVoiceSearch() async { - bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); - _currentLocaleId = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - - if (available) { - speech.listen( - onResult: resultListener, - //listenMode: ListenMode.confirmation, - localeId: _currentLocaleId == 'en' ? 'en_US' : 'ar_SA', - ); - } else { - print("The user has denied the use of speech recognition."); - } - // some time later... - //speech.stop(); - // speech.listen( - // onResult: resultListener, - // listenFor: Duration(seconds: 10), - // localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', - // onSoundLevelChange: soundLevelListener, - // cancelOnError: true, - // partialResults: true, - // onDevice: true, - // listenMode: ListenMode.deviceDefault); - } + // startVoiceSearch() async { + // bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); + // _currentLocaleId = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + // + // if (available) { + // speech.listen( + // onResult: resultListener, + // //listenMode: ListenMode.confirmation, + // localeId: _currentLocaleId == 'en' ? 'en_US' : 'ar_SA', + // ); + // } else { + // print("The user has denied the use of speech recognition."); + // } + // // some time later... + // //speech.stop(); + // // speech.listen( + // // onResult: resultListener, + // // listenFor: Duration(seconds: 10), + // // localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', + // // onSoundLevelChange: soundLevelListener, + // // cancelOnError: true, + // // partialResults: true, + // // onDevice: true, + // // listenMode: ListenMode.deviceDefault); + // } void resultListener(result) { reconizedWord = result.recognizedWords; @@ -305,7 +305,7 @@ class _FloatingSearchButton extends State with TickerProvi isArabic = Provider.of(context, listen: false).isArabic; await requestPermissions(); getUserData(); - await speech.initialize(onError: errorListener, onStatus: statusListener); + // await speech.initialize(onError: errorListener, onStatus: statusListener); //initialSpeak(); if (!mounted) return; @@ -315,10 +315,10 @@ class _FloatingSearchButton extends State with TickerProvi // }); } - void errorListener(SpeechRecognitionError error) { - event.setValue({"searchText": 'null'}); - RoboSearch.closeAlertDialog(context); - } + // void errorListener(SpeechRecognitionError error) { + // event.setValue({"searchText": 'null'}); + // RoboSearch.closeAlertDialog(context); + // } void statusListener(String status) { //setState(() { @@ -951,7 +951,7 @@ class _MyStatefulBuilderState extends State { var searchText; static StreamSubscription streamSubscription; static var isClosed = false; - stt.SpeechToText speech = stt.SpeechToText(); + // stt.SpeechToText speech = stt.SpeechToText(); @override void initState() { @@ -1019,7 +1019,7 @@ class _MyStatefulBuilderState extends State { TranslationBase.of(context).ok, () { RoboSearch.closeAlertDialog(context); - speech.stop(); + // speech.stop(); // event.setValue({"searchText": { // 'isIOSFeedback':true, // diff --git a/lib/widgets/pickupLocation/PickupLocationFromMap.dart b/lib/widgets/pickupLocation/PickupLocationFromMap.dart index e5639f5c..d8aa1642 100644 --- a/lib/widgets/pickupLocation/PickupLocationFromMap.dart +++ b/lib/widgets/pickupLocation/PickupLocationFromMap.dart @@ -13,7 +13,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:geocoding/geocoding.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:google_maps_place_picker_mb/google_maps_place_picker.dart'; import 'package:huawei_hmsavailability/huawei_hmsavailability.dart'; import 'package:provider/provider.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index 7acc49ed..0f8af947 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.005+4050005 +version: 4.5.008+4050008 environment: sdk: ">=2.7.0 <3.0.0" @@ -22,7 +22,8 @@ dependencies: connectivity: ^3.0.6 async: ^2.8.1 - audio_wave: ^0.1.2 + audio_wave: ^0.1.4 +# audio_session: ^0.1.13 # State Management provider: ^6.0.1 @@ -36,7 +37,7 @@ dependencies: fl_chart: ^0.40.2 #Camera Preview - camera: ^0.9.4+5 + camera: ^0.10.1 # Permissions permission_handler: ^8.3.0 @@ -89,8 +90,8 @@ dependencies: google_maps_flutter: ^2.1.1 # Huawei - huawei_map: 6.0.1+305 - huawei_push: ^5.3.0+304 + huawei_map: 6.5.0+301 + huawei_push: ^6.5.0+300 # Qr code Scanner TODO fix it # barcode_scanner: ^1.0.1 @@ -98,7 +99,7 @@ dependencies: location: ^4.3.0 # Qr code Scanner # barcode_scan_fix: ^1.0.2 - barcode_scan2: ^4.2.1 + barcode_scan2: ^4.2.2 # Rating Stars rating_bar: ^0.2.0 @@ -113,13 +114,13 @@ dependencies: manage_calendar_events: ^2.0.1 #InAppBrowser -# flutter_inappwebview: ^5.3.2 + flutter_inappwebview: 5.7.2+3 #Circular progress bar for reverse timer circular_countdown_timer: ^0.2.0 #Just Audio to play ringing for incoming video call - just_audio: ^0.9.18 + just_audio: ^0.9.30 #hijri hijri: ^2.0.3 @@ -130,13 +131,13 @@ dependencies: carousel_pro: ^1.0.0 #local_notifications - flutter_local_notifications: ^9.1.4 + flutter_local_notifications: ^10.0.0 #device_calendar device_calendar: ^4.2.0 #Handle Geolocation - geolocator: ^7.7.1 + geolocator: ^9.0.2 #Handle lat long to address geocoding: ^2.0.1 @@ -150,7 +151,8 @@ dependencies: #google maps places - google_maps_place_picker: ^2.1.0-nullsafety.3 + google_maps_place_picker_mb: ^3.0.0 +# google_maps_place_picker: ^2.1.0-nullsafety.3 map_launcher: ^1.1.3 #countdown timer for Upcoming List flutter_countdown_timer: ^4.1.0 @@ -170,8 +172,8 @@ dependencies: flutter_nfc_kit: ^3.3.1 - speech_to_text: - path: speech_to_text +# speech_to_text: ^6.1.1 +# path: speech_to_text in_app_update: ^3.0.0 @@ -209,9 +211,9 @@ dependency_overrides: permission_handler : ^6.0.1+1 flutter_svg: ^1.0.0 # firebase_messaging_platform_interface: any - flutter_inappwebview: - git: - url: https://github.com/CodeEagle/flutter_inappwebview +# flutter_inappwebview: 5.7.2+3 +# git: +# url: https://github.com/CodeEagle/flutter_inappwebview dev_dependencies: