diff --git a/android/app/agconnect-services.json b/android/app/agconnect-services.json
index 66f04d15..c6f88f84 100644
--- a/android/app/agconnect-services.json
+++ b/android/app/agconnect-services.json
@@ -1 +1,110 @@
-{"agcgw":{"url":"connect-drcn.dbankcloud.cn","backurl":"connect-drcn.hispace.hicloud.com","websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn","websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com"},"agcgw_all":{"SG":"connect-dra.dbankcloud.cn","SG_back":"connect-dra.hispace.hicloud.com","CN":"connect-drcn.dbankcloud.cn","CN_back":"connect-drcn.hispace.hicloud.com","RU":"connect-drru.hispace.dbankcloud.ru","RU_back":"connect-drru.hispace.dbankcloud.cn","DE":"connect-dre.dbankcloud.cn","DE_back":"connect-dre.hispace.hicloud.com"},"websocketgw_all":{"SG":"connect-ws-dra.hispace.dbankcloud.cn","SG_back":"connect-ws-dra.hispace.dbankcloud.com","CN":"connect-ws-drcn.hispace.dbankcloud.cn","CN_back":"connect-ws-drcn.hispace.dbankcloud.com","RU":"connect-ws-drru.hispace.dbankcloud.ru","RU_back":"connect-ws-drru.hispace.dbankcloud.cn","DE":"connect-ws-dre.hispace.dbankcloud.cn","DE_back":"connect-ws-dre.hispace.dbankcloud.com"},"client":{"cp_id":"2640966000002322881","product_id":"736430079244816567","client_id":"563735388191982656","client_secret":"650C7C799812AFFD53A10C7756CF05FB9F215A7E49032ABA8EBF3E14B77535CF","project_id":"736430079244816567","app_id":"116912301","api_key":"CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI","package_name":"com.cloudsolutions.HMGPatientApp"},"oauth_client":{"client_id":"116912301","client_type":1},"app_info":{"app_id":"116912301","package_name":"com.cloudsolutions.HMGPatientApp"},"service":{"analytics":{"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn","collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn","collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn","collector_url_ru":"datacollector-drru.dt.dbankcloud.ru,datacollector-drru.dt.hicloud.com","collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn","resource_id":"p1","channel_id":""},"ml":{"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"},"cloudstorage":{"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn","storage_url_ru":"https://agc-storage-drru.cloud.huawei.ru","storage_url_sg":"https://ops-dra.agcstorage.link","storage_url_de":"https://ops-dre.agcstorage.link","storage_url_cn":"https://agc-storage-drcn.platform.dbankcloud.cn","storage_url_ru_back":"https://agc-storage-drru.cloud.huawei.ru","storage_url_sg_back":"https://agc-storage-dra.cloud.huawei.asia","storage_url_de_back":"https://agc-storage-dre.cloud.huawei.eu","storage_url_cn_back":"https://agc-storage-drcn.cloud.huawei.com.cn"},"search":{"url":"https://search-drcn.cloud.huawei.com"},"edukit":{"edu_url":"edukit.cloud.huawei.com.cn","dh_url":"edukit.cloud.huawei.com.cn"}},"region":"CN","configuration_version":"3.0","appInfos":[{"package_name":"com.cloudsolutions.HMGPatientApp","client":{"app_id":"116912301"},"app_info":{"package_name":"com.cloudsolutions.HMGPatientApp","app_id":"116912301"},"oauth_client":{"client_type":1,"client_id":"116912301"}},{"package_name":"com.ejada.hmg","client":{"app_id":"102857389"},"app_info":{"package_name":"com.ejada.hmg","app_id":"102857389"},"oauth_client":{"client_type":1,"client_id":"102857389"}}]}
\ No newline at end of file
+{
+ "agcgw": {
+ "url": "connect-drcn.dbankcloud.cn",
+ "backurl": "connect-drcn.hispace.hicloud.com",
+ "websocketurl": "connect-ws-drcn.hispace.dbankcloud.cn",
+ "websocketbackurl": "connect-ws-drcn.hispace.dbankcloud.com"
+ },
+ "agcgw_all": {
+ "SG": "connect-dra.dbankcloud.cn",
+ "SG_back": "connect-dra.hispace.hicloud.com",
+ "CN": "connect-drcn.dbankcloud.cn",
+ "CN_back": "connect-drcn.hispace.hicloud.com",
+ "RU": "connect-drru.hispace.dbankcloud.ru",
+ "RU_back": "connect-drru.hispace.dbankcloud.cn",
+ "DE": "connect-dre.dbankcloud.cn",
+ "DE_back": "connect-dre.hispace.hicloud.com"
+ },
+ "websocketgw_all": {
+ "SG": "connect-ws-dra.hispace.dbankcloud.cn",
+ "SG_back": "connect-ws-dra.hispace.dbankcloud.com",
+ "CN": "connect-ws-drcn.hispace.dbankcloud.cn",
+ "CN_back": "connect-ws-drcn.hispace.dbankcloud.com",
+ "RU": "connect-ws-drru.hispace.dbankcloud.ru",
+ "RU_back": "connect-ws-drru.hispace.dbankcloud.cn",
+ "DE": "connect-ws-dre.hispace.dbankcloud.cn",
+ "DE_back": "connect-ws-dre.hispace.dbankcloud.com"
+ },
+ "client": {
+ "cp_id": "2640966000002322881",
+ "product_id": "736430079244816567",
+ "client_id": "563735388191982656",
+ "client_secret": "650C7C799812AFFD53A10C7756CF05FB9F215A7E49032ABA8EBF3E14B77535CF",
+ "project_id": "736430079244816567",
+ "app_id": "116912301",
+ "api_key": "CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI",
+ "package_name": "com.cloudsolutions.HMGPatientApp"
+ },
+ "oauth_client": {
+ "client_id": "116912301",
+ "client_type": 1
+ },
+ "app_info": {
+ "app_id": "116912301",
+ "package_name": "com.cloudsolutions.HMGPatientApp"
+ },
+ "service": {
+ "analytics": {
+ "collector_url": "datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
+ "collector_url_cn": "datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
+ "collector_url_de": "datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn",
+ "collector_url_ru": "datacollector-drru.dt.dbankcloud.ru,datacollector-drru.dt.hicloud.com",
+ "collector_url_sg": "datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn",
+ "resource_id": "p1",
+ "channel_id": ""
+ },
+ "ml": {
+ "mlservice_url": "ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"
+ },
+ "cloudstorage": {
+ "storage_url": "https://agc-storage-drcn.platform.dbankcloud.cn",
+ "storage_url_ru": "https://agc-storage-drru.cloud.huawei.ru",
+ "storage_url_sg": "https://ops-dra.agcstorage.link",
+ "storage_url_de": "https://ops-dre.agcstorage.link",
+ "storage_url_cn": "https://agc-storage-drcn.platform.dbankcloud.cn",
+ "storage_url_ru_back": "https://agc-storage-drru.cloud.huawei.ru",
+ "storage_url_sg_back": "https://agc-storage-dra.cloud.huawei.asia",
+ "storage_url_de_back": "https://agc-storage-dre.cloud.huawei.eu",
+ "storage_url_cn_back": "https://agc-storage-drcn.cloud.huawei.com.cn"
+ },
+ "search": {
+ "url": "https://search-drcn.cloud.huawei.com"
+ },
+ "edukit": {
+ "edu_url": "edukit.cloud.huawei.com.cn",
+ "dh_url": "edukit.cloud.huawei.com.cn"
+ }
+ },
+ "region": "CN",
+ "configuration_version": "3.0",
+ "appInfos": [
+ {
+ "package_name": "com.cloudsolutions.HMGPatientApp",
+ "client": {
+ "app_id": "116912301"
+ },
+ "app_info": {
+ "package_name": "com.cloudsolutions.HMGPatientApp",
+ "app_id": "116912301"
+ },
+ "oauth_client": {
+ "client_type": 1,
+ "client_id": "116912301"
+ }
+ },
+ {
+ "package_name": "com.ejada.hmg",
+ "client": {
+ "app_id": "102857389"
+ },
+ "app_info": {
+ "package_name": "com.ejada.hmg",
+ "app_id": "102857389"
+ },
+ "oauth_client": {
+ "client_type": 1,
+ "client_id": "102857389"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
index 347ab714..78f16774 100644
--- a/android/app/build.gradle.kts
+++ b/android/app/build.gradle.kts
@@ -70,22 +70,22 @@ android {
signingConfigs {
create("release") {
- keyAlias = keystoreProperties.getProperty("keyAlias")
- keyPassword = keystoreProperties.getProperty("keyPassword")
- storeFile = keystoreProperties.getProperty("storeFile")?.let { file(it) }
- storePassword = keystoreProperties.getProperty("storePassword")
+ keyAlias = "hmg"//keystoreProperties.getProperty("keyAlias")"
+ keyPassword = "HmGsa123"//keystoreProperties.getProperty("keyPassword")
+ storeFile = rootProject.file("./key")//keystoreProperties.getProperty("storeFile")?.let { file(it) }
+ storePassword = "HmGsa123"//keystoreProperties.getProperty("storePassword")
}
}
buildTypes {
getByName("debug") {
isDebuggable = true
- signingConfig = signingConfigs.getByName("debug")
+ signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = false
isShrinkResources = false
}
getByName("release") {
- isDebuggable = false
+ isDebuggable = true
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = true
isShrinkResources = true
@@ -193,7 +193,7 @@ dependencies {
implementation(files("libs/Penguin.aar"))
implementation(files("libs/PenguinRenderer.aar"))
api(files("libs/samsung-health-data-api.aar"))
- implementation("com.huawei.hms:health:6.11.0.300")
+ implementation("com.huawei.hms:health:6.15.0.300")
implementation("com.huawei.hms:hmscoreinstaller:6.6.0.300")
implementation("com.github.kittinunf.fuel:fuel:2.3.1")
diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro
index 94ad242d..03981852 100644
--- a/android/app/proguard-rules.pro
+++ b/android/app/proguard-rules.pro
@@ -77,4 +77,8 @@
-keep class com.peng.pennavmap.db.** { *; }
-keep class com.hiennv.flutter_callkit_incoming.** { *; }
--keepattributes Signature, Annotation, InnerClasses, EnclosingMethod
\ No newline at end of file
+-keepattributes Signature, Annotation, InnerClasses, EnclosingMethod
+
+
+-keepattributes SourceFile,LineNumberTable
+-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index ffa3a908..98d02941 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -135,6 +135,10 @@
android:usesCleartextTraffic="true"
android:extractNativeLibs="true"
tools:replace="android:label">
+
+
diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/MainActivity.kt b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/MainActivity.kt
index fdb4d7ad..2f28d594 100644
--- a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/MainActivity.kt
+++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/MainActivity.kt
@@ -7,6 +7,7 @@ import android.util.Log
import android.view.WindowManager
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi
+import com.cloudsolutions.HMGPatientApp.watch.huawei.HuaweiWatch
import com.cloudsolutions.HMGPatientApp.watch.samsung_watch.SamsungWatch
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
@@ -24,6 +25,7 @@ class MainActivity: FlutterFragmentActivity() {
PenguinInPlatformBridge(flutterEngine, this).create()
SamsungWatch(flutterEngine, this)
+ HuaweiWatch(flutterEngine, this)
}
override fun onRequestPermissionsResult(
diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/watch/huawei/Huaweiwatch.kt b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/watch/huawei/Huaweiwatch.kt
new file mode 100644
index 00000000..763d7c63
--- /dev/null
+++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/watch/huawei/Huaweiwatch.kt
@@ -0,0 +1,83 @@
+package com.cloudsolutions.HMGPatientApp.watch.huawei
+
+import android.os.Build
+import android.util.Log
+import androidx.annotation.RequiresApi
+import com.cloudsolutions.HMGPatientApp.MainActivity
+import com.cloudsolutions.HMGPatientApp.watch.samsung_watch.model.Vitals
+import com.huawei.hms.adapter.AvailableAdapter
+import com.huawei.hms.adapter.internal.AvailableCode
+import com.samsung.android.sdk.health.data.HealthDataStore
+import com.samsung.android.sdk.health.data.permission.AccessType
+import com.samsung.android.sdk.health.data.permission.Permission
+import com.samsung.android.sdk.health.data.request.DataType
+import com.samsung.android.sdk.health.data.request.DataTypes
+import com.samsung.android.sdk.health.data.request.LocalTimeFilter
+import com.samsung.android.sdk.health.data.request.LocalTimeGroup
+import com.samsung.android.sdk.health.data.request.LocalTimeGroupUnit
+import com.samsung.android.sdk.health.data.request.Ordering
+import io.flutter.embedding.engine.FlutterEngine
+import io.flutter.plugin.common.MethodCall
+import io.flutter.plugin.common.MethodChannel
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.SupervisorJob
+import kotlinx.coroutines.launch
+import java.time.LocalDateTime
+import java.time.LocalTime
+
+
+class HuaweiWatch(
+ private var flutterEngine: FlutterEngine,
+ private var mainActivity: MainActivity
+) {
+
+ private lateinit var channel: MethodChannel
+ private lateinit var dataStore: HealthDataStore
+ private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
+ private val TAG = "HuaweiWatch"
+
+
+ private lateinit var vitals: MutableMap>
+ companion object {
+ private const val CHANNEL = "huawei_watch"
+
+ }
+ init{
+ create()
+ }
+
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ fun create() {
+ Log.d(TAG, "create: is called")
+// openTok = OpenTok(mainActivity, flutterEngine)
+ channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
+ channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result ->
+ when (call.method) {
+ "init" -> {
+ init(result)
+ }
+
+
+ else -> {
+ result.notImplemented()
+ }
+ }
+ }
+ }
+
+ fun init(methodResult: MethodChannel.Result) {
+ val availableAdapter = AvailableAdapter(60400312)
+ val result = availableAdapter.isHuaweiMobileServicesAvailable(mainActivity) // context indicates a context object.
+ if (result != AvailableCode.SUCCESS) {
+ availableAdapter.startResolution(mainActivity, object : AvailableAdapter.AvailableCallBack {
+ override fun onComplete(result: Int) {
+ Log.d(TAG, "onComplete result: " + result)
+ }
+ })
+ }else {
+ methodResult.error("failure", "Unable to install hms" , null )
+ }
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/main/kotlin/com/ejada/hmg/watch/huawei/HuaweiWatch.kt b/android/app/src/main/kotlin/com/ejada/hmg/watch/huawei/HuaweiWatch.kt
new file mode 100644
index 00000000..a52ca733
--- /dev/null
+++ b/android/app/src/main/kotlin/com/ejada/hmg/watch/huawei/HuaweiWatch.kt
@@ -0,0 +1,333 @@
+package com.ejada.hmg.watch.huawei
+
+
+
+import android.content.Intent
+import android.os.Build
+import android.util.Log
+import androidx.annotation.RequiresApi
+import com.ejada.hmg.MainActivity
+import com.ejada.hmg.watch.huawei.samsung_watch.model.Vitals
+import com.huawei.hms.adapter.AvailableAdapter
+import com.huawei.hms.adapter.internal.AvailableCode
+import com.huawei.hms.hihealth.HuaweiHiHealth
+import com.huawei.hms.hihealth.SettingController
+import com.huawei.hms.hihealth.data.Scopes
+
+import io.flutter.embedding.engine.FlutterEngine
+import io.flutter.plugin.common.MethodCall
+import io.flutter.plugin.common.MethodChannel
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.SupervisorJob
+import kotlinx.coroutines.cancel
+import java.time.Instant
+import java.time.temporal.ChronoUnit
+import java.util.Date
+
+
+class HuaweiWatch(
+ private var flutterEngine: FlutterEngine,
+ private var mainActivity: MainActivity
+) {
+
+ private lateinit var channel: MethodChannel
+ lateinit var mSettingController: SettingController
+ val REQUEST_AUTH: Int = 1002
+
+
+ private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
+ val TAG = "HuaweiWatch"
+
+ var result : MethodChannel.Result? = null
+ var startDate: Date? = null
+ var endDate: Date? = null
+
+
+
+ private lateinit var vitals: MutableMap>
+ companion object {
+ private const val CHANNEL = "huawei_watch"
+
+ }
+ init{
+ create()
+ val now = Instant.now()
+ endDate = Date.from(now)
+ startDate = Date.from(now.minus(365, ChronoUnit.DAYS))
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ fun create() {
+ Log.d(TAG, "create: is called")
+// openTok = OpenTok(mainActivity, flutterEngine)
+ channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
+ channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result ->
+ when (call.method) {
+ "init" -> {
+ this.result = result
+
+ Log.d(TAG, "onMethodCall: init called")
+ mSettingController = HuaweiHiHealth.getSettingController(mainActivity);
+ val availableAdapter = AvailableAdapter(60400312)
+ val results= availableAdapter.isHuaweiMobileServicesAvailable(mainActivity) // context indicates a context object.
+ if (results != AvailableCode.SUCCESS) {
+ availableAdapter.startResolution(mainActivity, object : AvailableAdapter.AvailableCallBack {
+ override fun onComplete(result: Int) {
+ Log.d(TAG, "onComplete result: " + result)
+ }
+ })
+ }
+ result.success("init success")
+ }
+
+ "getPermission"->{
+ if(!this::mSettingController.isInitialized)
+ result.error("DataStoreNotInitialized", "Please call init before requesting permissions", null)
+
+ // Add scopes to apply for. The following only shows an example. You need to add scopes according to your specific needs.
+ val scopes = arrayOf( // View and store step count data in Health Service Kit.
+ Scopes.HEALTHKIT_STEP_READ, Scopes.HEALTHKIT_OXYGEN_SATURATION_READ, // View and store height and weight data in Health Service Kit.
+ Scopes.HEALTHKIT_HEARTRATE_READ, Scopes.HEALTHKIT_SLEEP_READ,
+ Scopes.HEALTHKIT_BODYTEMPERATURE_READ, Scopes.HEALTHKIT_CALORIES_READ
+ )
+ // Obtain the intent of the authorization process. Value true indicates that the authorization process of the Huawei Health app is enabled, and false indicates that the authorization process is disabled.
+ val intent: Intent? = mSettingController.requestAuthorizationIntent(scopes, true)
+
+ // Open the authorization process screen.
+ Log.i(TAG, "start authorization activity")
+ intent?.let{
+ mainActivity.startActivityForResult(intent, REQUEST_AUTH)
+ }
+ }
+
+ "getHeartRate"->{
+ val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365)
+ val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now())
+ val readRequest = DataTypes.HEART_RATE.readDataRequestBuilder
+ .setLocalTimeFilter(localTimeFilter)
+ .setOrdering(Ordering.DESC)
+ .build()
+
+ scope.launch {
+ val heartRateList = dataStore.readData(readRequest).dataList
+ processHeartVital(heartRateList)
+ Log.d("TAG"," the data is ${vitals}")
+ print("the data is ${vitals}")
+ result.success("Data is obtained")
+ }
+ }
+//
+//
+// "getSleepData" -> {
+// val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365)
+// val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now())
+// val readRequest = DataTypes.SLEEP.readDataRequestBuilder
+// .setLocalTimeFilter(localTimeFilter)
+// .setOrdering(Ordering.ASC)
+// .build()
+// scope.launch {
+// val sleepData = dataStore.readData(readRequest).dataList
+// processSleepVital(sleepData)
+// print("the data is $vitals")
+// Log.d(TAG, "the data is $vitals")
+// result.success("Data is obtained")
+// }
+//
+// }
+//
+// "steps"->{
+// val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365)
+// val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now())
+// val localTimeGroup = LocalTimeGroup.of(LocalTimeGroupUnit.HOURLY, 1)
+// val aggregateRequest = DataType.StepsType.TOTAL.requestBuilder
+// .setLocalTimeFilterWithGroup(localTimeFilter, localTimeGroup)
+// .setOrdering(Ordering.ASC)
+// .build()
+//
+// scope.launch {
+// val steps = dataStore.aggregateData(aggregateRequest)
+// processStepsCount(steps)
+// print("the data is $vitals")
+// Log.d(TAG, "the data is $vitals")
+// result.success("Data is obtained")
+// }
+// }
+//
+// "activitySummary"->{
+// val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365)
+// val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now())
+// val localTimeGroup = LocalTimeGroup.of(LocalTimeGroupUnit.HOURLY, 1)
+// val readRequest = DataType.ActivitySummaryType.TOTAL_CALORIES_BURNED.requestBuilder
+// .setLocalTimeFilterWithGroup(localTimeFilter, localTimeGroup)
+// .setOrdering(Ordering.DESC)
+// .build()
+//
+// scope.launch {
+// val activityResult = dataStore.aggregateData(readRequest).dataList
+// processActivity(activityResult)
+// Log.d("TAG"," the data is ${vitals}")
+// print("the data is ${vitals}")
+// result.success("Data is obtained")
+// }
+// }
+//
+// "bloodOxygen"->{
+// val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365)
+// val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now())
+// val readRequest = DataTypes.BLOOD_OXYGEN.readDataRequestBuilder
+// .setLocalTimeFilter(localTimeFilter)
+// .setOrdering(Ordering.DESC)
+// .build()
+//
+// scope.launch {
+// val bloodOxygenList = dataStore.readData(readRequest).dataList
+// processBloodOxygen(bloodOxygenList)
+// Log.d("TAG"," the data is ${vitals}")
+// print("the data is ${vitals["bloodOxygen"]}")
+// result.success("Data is obtained")
+// }
+// }
+//
+//
+// "bodyTemperature"->{
+// val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365)
+// val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now())
+// val readRequest = DataTypes.BODY_TEMPERATURE.readDataRequestBuilder
+// .setLocalTimeFilter(localTimeFilter)
+// .setOrdering(Ordering.DESC)
+// .build()
+//
+// scope.launch {
+// val bodyTemperatureList = dataStore.readData(readRequest).dataList
+// processBodyTemperature(bodyTemperatureList)
+// Log.d("TAG"," the data is ${vitals}")
+// print("the data is ${vitals["bodyTemperature"]}")
+// result.success("Data is obtained")
+// }
+// }
+//
+// "retrieveData"->{
+// if(vitals.isEmpty()){
+// result.error("NoDataFound", "No Data was obtained", null)
+// return@setMethodCallHandler
+// }
+// result.success("""
+// {
+// "heartRate": ${vitals["heartRate"]},
+// "steps": ${vitals["steps"]},
+// "sleep": ${vitals["sleep"]},
+// "activity": ${vitals["activity"]},
+// "bloodOxygen": ${vitals["bloodOxygen"]},
+// "bodyTemperature": ${vitals["bodyTemperature"]}
+// }
+// """.trimIndent())
+// }
+
+
+ "closeCoroutineScope"->{
+ destroy()
+ result.success("Coroutine Scope Cancelled")
+ }
+
+ else -> {
+ result.notImplemented()
+ }
+ }
+ }
+ }
+
+ /**
+ * Check whether users have enabled Health Service Kit.
+ */
+ fun getHealthAppAuthorization() {
+
+ mSettingController.healthAppAuthorization
+ .addOnFailureListener { result?.error("UnAuthorized", "User denied the permission", null) }
+ .addOnSuccessListener { result?.success("permission granted"); }
+ }
+
+ private fun CoroutineScope.processBodyTemperature( bodyTemperatureList :List) {
+ vitals["bodyTemperature"] = mutableListOf()
+ bodyTemperatureList.forEach { stepData ->
+ val vitalData = Vitals().apply {
+ value = stepData.getValue(DataType.BodyTemperatureType.BODY_TEMPERATURE).toString()
+ timeStamp = stepData.endTime.toString()
+ }
+ (vitals["bodyTemperature"] as MutableList).add(vitalData)
+ }
+ }
+
+ private fun CoroutineScope.processBloodOxygen( bloodOxygenList :List) {
+ vitals["bloodOxygen"] = mutableListOf()
+ bloodOxygenList.forEach { stepData ->
+ val vitalData = Vitals().apply {
+ value = stepData.getValue(DataType.BloodOxygenType.OXYGEN_SATURATION).toString()
+ timeStamp = stepData.endTime.toString()
+ }
+ (vitals["bloodOxygen"] as MutableList).add(vitalData)
+ }
+ }
+
+
+ private fun CoroutineScope.processActivity(activityResult: List>) {
+
+ vitals["activity"] = mutableListOf()
+ activityResult.forEach { stepData ->
+ val vitalData = Vitals().apply {
+ value = stepData.value.toString()
+ timeStamp = stepData.endTime.toString()
+ }
+ (vitals["activity"] as MutableList).add(vitalData)
+ }
+ }
+
+ private fun CoroutineScope.processStepsCount(result: DataResponse>) {
+ val stepCount = ArrayList>()
+ var totalSteps: Long = 0
+ vitals["steps"] = mutableListOf()
+ result.dataList.forEach { stepData ->
+ val vitalData = Vitals().apply {
+ value = (stepData.value as Long).toString()
+ timeStamp = stepData.startTime.toString()
+ }
+ (vitals["steps"] as MutableList).add(vitalData)
+ }
+
+ }
+
+ private fun CoroutineScope.processSleepVital(sleepData: List) {
+ vitals["sleep"] = mutableListOf()
+ sleepData.forEach {
+ (vitals["sleep"] as MutableList).add(
+ Vitals().apply {
+ timeStamp = it.startTime.toString()
+ value = (it.getValue(DataType.SleepType.DURATION)?.toString().toString())
+ }
+ )
+ }
+ }
+
+ private suspend fun CoroutineScope.processHeartVital(
+ heartRateList: List,
+ ) {
+ vitals["heartRate"] = mutableListOf()
+ heartRateList.forEach {
+ (vitals["heartRate"] as MutableList).add(processHeartRateData(it))
+ }
+ }
+
+ private fun processHeartRateData(heartRateData: HealthDataPoint) =
+ Vitals().apply {
+ heartRateData.getValue(DataType.HeartRateType.MAX_HEART_RATE)?.let {
+ value = it.toString()
+ }
+ timeStamp = heartRateData.startTime.toString()
+ }
+
+
+ fun destroy() {
+ scope.cancel()
+ }
+
+}
diff --git a/key.properties b/key.properties
index 5f99fd60..ca377a8c 100644
--- a/key.properties
+++ b/key.properties
@@ -1,4 +1,4 @@
storePassword=HmGsa123
keyPassword=HmGsa123
keyAlias=hmg
-storeFile=key
\ No newline at end of file
+storeFile=./key
\ No newline at end of file
diff --git a/lib/features/smartwatch_health_data/health_service.dart b/lib/features/smartwatch_health_data/health_service.dart
index 7d42092d..a6c22cb9 100644
--- a/lib/features/smartwatch_health_data/health_service.dart
+++ b/lib/features/smartwatch_health_data/health_service.dart
@@ -189,13 +189,13 @@ class HealthService {
return null;
}
try {
- await watchHelper!.getHeartRate();
- await watchHelper!.getSleep();
+ // await watchHelper!.getHeartRate();
+ // await watchHelper!.getSleep();
await watchHelper!.getSteps();
- await watchHelper!.getActivity();
- await watchHelper!.getBodyTemperature();
- await watchHelper!.getDistance();
- await watchHelper!.getBloodOxygen();
+ // await watchHelper!.getActivity();
+ // await watchHelper!.getBodyTemperature();
+ // await watchHelper!.getDistance();
+ // await watchHelper!.getBloodOxygen();
Result data = await watchHelper!.retrieveData();
if(data.isError) {
print('Unable to get the data');
diff --git a/lib/features/smartwatch_health_data/watch_connectors/health_connect_helper.dart b/lib/features/smartwatch_health_data/watch_connectors/health_connect_helper.dart
index 87e1cf3a..0c00dd7d 100644
--- a/lib/features/smartwatch_health_data/watch_connectors/health_connect_helper.dart
+++ b/lib/features/smartwatch_health_data/watch_connectors/health_connect_helper.dart
@@ -28,7 +28,6 @@ class HealthConnectHelper extends WatchHelper {
try {
final types = HealthDataType.HEART_RATE;
final endDate = DateTime.now();
- // final startDate = endDate.subtract(Duration(days: 365));
final startDate = endDate.subtract(Duration(days: 365));
final data = await getHeartData(startDate, endDate, types);
addDataToMap("heartRate",data );
diff --git a/lib/features/smartwatch_health_data/watch_connectors/huawei_watch_connecter.dart b/lib/features/smartwatch_health_data/watch_connectors/huawei_watch_connecter.dart
index a8300e2d..bce7d885 100644
--- a/lib/features/smartwatch_health_data/watch_connectors/huawei_watch_connecter.dart
+++ b/lib/features/smartwatch_health_data/watch_connectors/huawei_watch_connecter.dart
@@ -1,13 +1,22 @@
import 'dart:async';
+import 'dart:developer';
import 'package:async/src/result/result.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
+import 'package:hmg_patient_app_new/features/smartwatch_health_data/model/Vitals.dart';
import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/watch_helper.dart';
+import 'package:http/http.dart';
import 'package:huawei_health/huawei_health.dart';
+import '../../../presentation/smartwatches/huawei_health_example.dart';
+
class HuaweiHealthDataConnector extends WatchHelper{
final MethodChannel _channel = MethodChannel('huawei_watch');
+
+ DataController? _dataController;
+ Map> mappedData = {};
+
@override
Future> initDevice() async{
try{
@@ -18,19 +27,76 @@ class HuaweiHealthDataConnector extends WatchHelper{
}
// List of scopes to ask for authorization.
// Note: These scopes should also be authorized on the Huawei Developer Console.
- List scopes = [
- Scope.HEALTHKIT_STEP_READ, Scope.HEALTHKIT_OXYGEN_SATURATION_READ, // View and store height and weight data in Health Service Kit.
- Scope.HEALTHKIT_HEARTRATE_READ, Scope.HEALTHKIT_SLEEP_READ,
- Scope.HEALTHKIT_BODYTEMPERATURE_READ, Scope.HEALTHKIT_CALORIES_READ
+ // List scopes = [
+ // Scope.HEALTHKIT_STEP_READ, Scope.HEALTHKIT_OXYGEN_SATURATION_READ, // View and store height and weight data in Health Service Kit.
+ // Scope.HEALTHKIT_HEARTRATE_READ, Scope.HEALTHKIT_SLEEP_READ,
+ // Scope.HEALTHKIT_BODYTEMPERATURE_READ, Scope.HEALTHKIT_CALORIES_READ,
+ // Scope.HEALTHKIT_STEP_READ,
+ // ];
+
+ final List scopes = [
+ Scope.HEALTHKIT_ACTIVITY_READ,
+ Scope.HEALTHKIT_ACTIVITY_WRITE,
+ Scope.HEALTHKIT_BLOODGLUCOSE_READ,
+ Scope.HEALTHKIT_BLOODGLUCOSE_WRITE,
+ Scope.HEALTHKIT_CALORIES_READ,
+ Scope.HEALTHKIT_CALORIES_WRITE,
+ Scope.HEALTHKIT_DISTANCE_READ,
+ Scope.HEALTHKIT_DISTANCE_WRITE,
+ Scope.HEALTHKIT_HEARTRATE_READ,
+ Scope.HEALTHKIT_HEARTRATE_WRITE,
+ Scope.HEALTHKIT_HEIGHTWEIGHT_READ,
+ Scope.HEALTHKIT_HEIGHTWEIGHT_WRITE,
+ Scope.HEALTHKIT_LOCATION_READ,
+ Scope.HEALTHKIT_LOCATION_WRITE,
+ Scope.HEALTHKIT_PULMONARY_READ,
+ Scope.HEALTHKIT_PULMONARY_WRITE,
+ Scope.HEALTHKIT_SLEEP_READ,
+ Scope.HEALTHKIT_SLEEP_WRITE,
+ Scope.HEALTHKIT_SPEED_READ,
+ Scope.HEALTHKIT_SPEED_WRITE,
+ Scope.HEALTHKIT_STEP_READ,
+ Scope.HEALTHKIT_STEP_WRITE,
+ Scope.HEALTHKIT_STRENGTH_READ,
+ Scope.HEALTHKIT_STRENGTH_WRITE,
+ Scope.HEALTHKIT_BODYFAT_READ,
+ Scope.HEALTHKIT_BODYFAT_WRITE,
+ Scope.HEALTHKIT_NUTRITION_READ,
+ Scope.HEALTHKIT_NUTRITION_WRITE,
+ Scope.HEALTHKIT_BLOODPRESSURE_READ,
+ Scope.HEALTHKIT_BLOODPRESSURE_WRITE,
+ Scope.HEALTHKIT_BODYTEMPERATURE_READ,
+ Scope.HEALTHKIT_BODYTEMPERATURE_WRITE,
+ Scope.HEALTHKIT_OXYGENSTATURATION_READ,
+ Scope.HEALTHKIT_OXYGENSTATURATION_WRITE,
+ Scope.HEALTHKIT_REPRODUCTIVE_READ,
+ Scope.HEALTHKIT_REPRODUCTIVE_WRITE,
+ Scope.HEALTHKIT_ACTIVITY_RECORD_READ,
+ Scope.HEALTHKIT_ACTIVITY_RECORD_WRITE,
+ Scope.HEALTHKIT_HEARTRATE_REALTIME,
+ Scope.HEALTHKIT_STEP_REALTIME,
+ Scope.HEALTHKIT_HEARTHEALTH_WRITE,
+ Scope.HEALTHKIT_HEARTHEALTH_READ,
+ Scope.HEALTHKIT_STRESS_WRITE,
+ Scope.HEALTHKIT_STRESS_READ,
+ Scope.HEALTHKIT_OXYGEN_SATURATION_WRITE,
+ Scope.HEALTHKIT_OXYGEN_SATURATION_READ,
+ Scope.HEALTHKIT_HISTORYDATA_OPEN_WEEK,
+ Scope.HEALTHKIT_HISTORYDATA_OPEN_MONTH,
+ Scope.HEALTHKIT_HISTORYDATA_OPEN_YEAR,
];
try {
- bool? result = await SettingController.getHealthAppAuthorization();
- debugPrint(
- 'Granted Scopes for result == is $result}',
- );
+ var healthResult = await HealthAuth.signIn(scopes,);
+ // var result = await SettingController.requestAuthorizationIntent(scopes,true);
+ // AuthHuaweiId? id = await HealthAuth.signIn(scopes);
+ _dataController = await DataController.init();
+ // debugPrint(
+ // 'Granted Scopes for result == is ${result.status?.statusCode}',
+ // );
return Result.value(true);
- } catch (e) {
- debugPrint('Error on authorization, Error:${e.toString()}');
+ } on PlatformException catch (e) {
+
+ print('Error on authorization, Error:${e.toString()}');
return Result.error(false);
}
}
@@ -67,8 +133,20 @@ class HuaweiHealthDataConnector extends WatchHelper{
}
@override
- FutureOr getSteps() {
- throw UnimplementedError();
+ FutureOr getSteps() async{
+ try {
+ final types = DataType.DT_INSTANTANEOUS_STEPS_RATE;
+ final endDate = DateTime.now();
+ final startDate = endDate.subtract(Duration(days: 20));
+ final data = await readDataType(types,startDate, endDate);
+ if(data == null){
+ mappedData["heartRate"] = [];
+ return;
+ }
+ addDataToMap("heartRate",data);
+ } catch (e) {
+ print('Error getting Steps rate: $e');
+ }
}
@@ -83,4 +161,92 @@ class HuaweiHealthDataConnector extends WatchHelper{
throw UnimplementedError();
}
+ Future readDataType(
+ DataType dataType,
+ DateTime startTime,
+ DateTime endTime,
+
+ ) async {
+ DataCollector dataCollector = DataCollector(
+ dataType: dataType,
+ dataGenerateType: DataGenerateType.DATA_TYPE_RAW,
+
+ );
+
+ // Build the time range for the query: start time and end time.
+ ReadOptions readOptions = ReadOptions(
+ dataCollectors: [
+ dataCollector,
+ ],
+ startTime: startTime,
+ endTime: endTime,
+ allowRemoteInquiry: true,
+ )..groupByTime(1, timeUnit: TimeUnit.HOURS);
+
+ // Call the api with the constructed ReadOptions instance.
+ try {
+ ReadReply? readReply = await _dataController?.read(readOptions);
+ log(
+ 'read',
+ LogOptions.success,
+ result: readReply.toString(),
+ );
+ return readReply;
+ } on PlatformException catch (e) {
+ log(
+ 'read',
+ LogOptions.error,
+ error: e.message,
+ );
+ return null;
+ }
+ }
+
+ /// Prints the specified text on both the console and the specified text controller.
+ void log(
+ String methodName,
+ LogOptions logOption, {
+ String? result = '',
+ String? error = '',
+ }) {
+ final now = DateTime.now();
+ final timestamp = '${now.hour.toString().padLeft(2, '0')}:'
+ '${now.minute.toString().padLeft(2, '0')}:'
+ '${now.second.toString().padLeft(2, '0')}';
+ String log = '';
+ switch (logOption) {
+ case LogOptions.call:
+ log = '[$timestamp] $methodName called';
+ break;
+ case LogOptions.success:
+ log = '[$timestamp] $methodName [Success: $result]';
+ break;
+ case LogOptions.error:
+ log =
+ '[$timestamp] $methodName [Error: $error] [Error Description: ${HiHealthStatusCodes.getStatusCodeMessage(error ?? '')}]';
+ break;
+ case LogOptions.custom:
+ log = '[$timestamp] $methodName';
+ break;
+ }
+ print(log);
+
+ }
+
+ void addDataToMap(String s, ReadReply data) {
+ mappedData[s] = [];
+ for (var point in data.groups) {
+ if(point.sampleSets == null){
+ continue;
+ }
+ for (var points in point.sampleSets!) {
+ debugPrint("the stART AND END TIME ARE ${point.startTime} ${point.endTime}");
+ print("the pair is ${points.pairs}");
+ for (var value in points.samplePoints) {
+ debugPrint("the value is ${value.fieldValues}");
+ // mappedData[s]?.add(Vitals(value: value, time: DateTime.fromMillisecondsSinceEpoch(point.startTime)));
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/lib/presentation/tele_consultation/zoom/call_screen.dart b/lib/presentation/tele_consultation/zoom/call_screen.dart
index 59be70e0..51edf9ed 100644
--- a/lib/presentation/tele_consultation/zoom/call_screen.dart
+++ b/lib/presentation/tele_consultation/zoom/call_screen.dart
@@ -1,1839 +1,1838 @@
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:flutter/cupertino.dart';
-import 'package:flutter/foundation.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
-import 'package:flutter_hooks/flutter_hooks.dart';
-import 'package:flutter_ios_voip_kit_karmm/flutter_ios_voip_kit.dart';
-import 'package:flutter_zoom_videosdk/flutter_zoom_view.dart';
-import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart';
-import 'package:flutter_zoom_videosdk/native/zoom_videosdk_camera_device.dart';
-import 'package:flutter_zoom_videosdk/native/zoom_videosdk_cmd_channel.dart';
-import 'package:flutter_zoom_videosdk/native/zoom_videosdk_event_listener.dart';
-import 'package:flutter_zoom_videosdk/native/zoom_videosdk_live_transcription_message_info.dart';
-import 'package:flutter_zoom_videosdk/native/zoom_videosdk_share_action.dart';
-import 'package:flutter_zoom_videosdk/native/zoom_videosdk_user.dart';
-import 'package:hmg_patient_app_new/core/app_export.dart';
-import 'package:hmg_patient_app_new/core/cache_consts.dart';
-import 'package:hmg_patient_app_new/core/utils/jwt.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/presentation/home/navigation_screen.dart';
-import 'package:hmg_patient_app_new/presentation/tele_consultation/zoom/video_view.dart';
-import 'package:hmg_patient_app_new/theme/colors.dart';
-import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
-import 'package:image_picker/image_picker.dart';
-
-class CallScreen extends StatefulHookWidget {
- const CallScreen({Key? key}) : super(key: key);
-
- @override
- State createState() => _CallScreenState();
-}
-
-class _CallScreenState extends State {
- static TextEditingController changeNameController = TextEditingController();
- double opacityLevel = 1.0;
-
- final voIPKit = FlutterIOSVoIPKit.instance;
-
- bool isScreenBeingShared = false;
-
- void _changeOpacity() {
- setState(() => opacityLevel = opacityLevel == 0 ? 1.0 : 0.0);
- }
-
- @override
- Widget build(BuildContext context) {
- var zoom = ZoomVideoSdk();
- var eventListener = ZoomVideoSdkEventListener();
- var isInSession = useState(false);
- var sessionName = useState('');
- var sessionPassword = useState('');
- var users = useState([]);
- var fullScreenUser = useState(null);
- var sharingUser = useState(null);
- var videoInfo = useState('');
- var isSharing = useState(false);
- var isMuted = useState(true);
- var isVideoOn = useState(false);
- var isSpeakerOn = useState(false);
- var isRenameModalVisible = useState(false);
- var isRecordingStarted = useState(false);
- var isMicOriginalOn = useState(false);
- var isMounted = useIsMounted();
- var audioStatusFlag = useState(false);
- var videoStatusFlag = useState(false);
- var userNameFlag = useState(false);
- var userShareStatusFlag = useState(false);
- var isReceiveSpokenLanguageContentEnabled = useState(false);
- var isVideoMirrored = useState(false);
- var isOriginalAspectRatio = useState(false);
- var isPiPView = useState(false);
- var isSharedCamera = useState(false);
- CameraShareView cameraShareView = const CameraShareView(creationParams: {});
-
- //hide status bar
- SystemChrome.setEnabledSystemUIMode(SystemUiMode.leanBack);
- var circleButtonSize = 65.0;
- Color backgroundColor = const Color(0xFF232323);
- Color buttonBackgroundColor = const Color.fromRGBO(0, 0, 0, 0.6);
- Color chatTextColor = const Color(0xFFAAAAAA);
- Widget changeNamePopup;
- final args = ModalRoute.of(context)!.settings.arguments as CallArguments;
-
- useEffect(() {
- Future.microtask(() async {
- var token = generateJwt(args.sessionName, args.role);
-
- Utils.removeFromPrefs(CacheConst.isAppOpenedFromCall);
-
- try {
- Map SDKaudioOptions = {"connect": true, "mute": false, "autoAdjustSpeakerVolume": false};
- Map SDKvideoOptions = {
- "localVideoOn": true,
- };
- JoinSessionConfig joinSession = JoinSessionConfig(
- sessionName: args.sessionName,
- sessionPassword: args.sessionPwd,
- token: token,
- userName: args.displayName,
- audioOptions: SDKaudioOptions,
- videoOptions: SDKvideoOptions,
- sessionIdleTimeoutMins: int.parse(args.sessionIdleTimeoutMins),
- );
- await zoom.joinSession(joinSession);
- } catch (e) {
- const AlertDialog(
- title: Text("Error"),
- content: Text("Failed to join the session"),
- );
- Future.delayed(const Duration(milliseconds: 1000)).asStream().listen((event) {
- Navigator.pushAndRemoveUntil(
- context,
- CustomPageRoute(
- page: LandingNavigation(),
- ),
- (r) => false);
- });
- }
- });
- return null;
- }, []);
-
- useEffect(() {
- final sessionJoinListener = eventListener.addListener(EventType.onSessionJoin, (data) async {
- data = data as Map;
- isInSession.value = true;
- zoom.session.getSessionName().then((value) => sessionName.value = value!);
- sessionPassword.value = await zoom.session.getSessionPassword();
- debugPrint("sessionPhonePasscode: ${await zoom.session.getSessionPhonePasscode()}");
- ZoomVideoSdkUser mySelf = ZoomVideoSdkUser.fromJson(jsonDecode(data['sessionUser']));
- List? remoteUsers = await zoom.session.getRemoteUsers();
- var muted = await mySelf.audioStatus?.isMuted();
- var videoOn = await mySelf.videoStatus?.isOn();
- var speakerOn = await zoom.audioHelper.getSpeakerStatus();
- fullScreenUser.value = mySelf;
- remoteUsers?.insert(0, mySelf);
- isMuted.value = muted!;
- isSpeakerOn.value = speakerOn;
- isVideoOn.value = videoOn!;
- users.value = remoteUsers!;
- isReceiveSpokenLanguageContentEnabled.value = await zoom.liveTranscriptionHelper.isReceiveSpokenLanguageContentEnabled();
- });
-
- final sessionLeaveListener = eventListener.addListener(EventType.onSessionLeave, (data) async {
- data = data as Map;
- debugPrint("onSessionLeave: ${data['reason']}");
- isInSession.value = false;
- users.value = [];
- fullScreenUser.value = null;
- // Navigator.popAndPushNamed(
- // context,
- // "Join",
- // arguments: JoinArguments(args.isJoin, sessionName.value, sessionPassword.value, args.displayName, args.sessionIdleTimeoutMins, args.role),
- // );
- Navigator.pushAndRemoveUntil(
- context,
- CustomPageRoute(
- page: LandingNavigation(),
- ),
- (r) => false);
- });
-
- final sessionNeedPasswordListener = eventListener.addListener(EventType.onSessionNeedPassword, (data) async {
- showDialog(
- context: context,
- builder: (BuildContext context) => AlertDialog(
- title: const Text('Session Need Password'),
- content: const Text('Password is required'),
- actions: [
- TextButton(
- onPressed: () async => {
- Navigator.pushAndRemoveUntil(
- context,
- CustomPageRoute(
- page: LandingNavigation(),
- ),
- (r) => false),
- await zoom.leaveSession(false),
- },
- child: const Text('OK'),
- ),
- ],
- ),
- );
- });
-
- final sessionPasswordWrongListener = eventListener.addListener(EventType.onSessionPasswordWrong, (data) async {
- showDialog(
- context: context,
- builder: (BuildContext context) => AlertDialog(
- title: const Text('Session Password Incorrect'),
- content: const Text('Password is wrong'),
- actions: [
- TextButton(
- onPressed: () async => {
- Navigator.popAndPushNamed(context, 'Join', arguments: JoinArguments(args.isJoin, args.sessionName, "", args.displayName, args.sessionIdleTimeoutMins, args.role)),
- await zoom.leaveSession(false),
- },
- child: const Text('OK'),
- ),
- ],
- ),
- );
- });
-
- final userVideoStatusChangedListener = eventListener.addListener(EventType.onUserVideoStatusChanged, (data) async {
- data = data as Map;
- ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
- var userListJson = jsonDecode(data['changedUsers']) as List;
- List userList = userListJson.map((userJson) => ZoomVideoSdkUser.fromJson(userJson)).toList();
- for (var user in userList) {
- {
- if (user.userId == mySelf?.userId) {
- mySelf?.videoStatus?.isOn().then((on) => isVideoOn.value = on);
- }
- }
- }
- videoStatusFlag.value = !videoStatusFlag.value;
- });
-
- final userAudioStatusChangedListener = eventListener.addListener(EventType.onUserAudioStatusChanged, (data) async {
- data = data as Map;
- ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
- var userListJson = jsonDecode(data['changedUsers']) as List;
- List userList = userListJson.map((userJson) => ZoomVideoSdkUser.fromJson(userJson)).toList();
- for (var user in userList) {
- {
- if (user.userId == mySelf?.userId) {
- mySelf?.audioStatus?.isMuted().then((muted) => isMuted.value = muted);
- }
- }
- }
- audioStatusFlag.value = !audioStatusFlag.value;
- });
-
- final userShareStatusChangeListener = eventListener.addListener(EventType.onUserShareStatusChanged, (data) async {
- data = data as Map;
- ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
- ZoomVideoSdkUser shareUser = ZoomVideoSdkUser.fromJson(jsonDecode(data['user'].toString()));
- ZoomVideoSdkShareAction? shareAction = ZoomVideoSdkShareAction.fromJson(jsonDecode(data['shareAction']));
-
- if (shareAction.shareStatus == ShareStatus.Start || shareAction.shareStatus == ShareStatus.Resume) {
- sharingUser.value = shareUser;
- fullScreenUser.value = shareUser;
- isSharing.value = (shareUser.userId == mySelf?.userId);
-
- setState(() {
- isScreenBeingShared = true;
- });
- Future.delayed(const Duration(seconds: 2), () {
- setState(() {
- isScreenBeingShared = false;
- });
- });
- } else {
- sharingUser.value = null;
- isSharing.value = false;
- isSharedCamera.value = false;
- fullScreenUser.value = mySelf;
- isScreenBeingShared = false;
- setState(() {
- isScreenBeingShared = true;
- });
- Future.delayed(const Duration(seconds: 2), () {
- setState(() {
- isScreenBeingShared = false;
- });
- });
- }
- userShareStatusFlag.value = !userShareStatusFlag.value;
- });
-
- final shareContentChangedListener = eventListener.addListener(EventType.onShareContentChanged, (data) async {
- data = data as Map;
- ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
- ZoomVideoSdkUser shareUser = ZoomVideoSdkUser.fromJson(jsonDecode(data['user'].toString()));
- ZoomVideoSdkShareAction? shareAction = ZoomVideoSdkShareAction.fromJson(jsonDecode(data['shareAction']));
- if (shareAction.shareType == ShareType.Camera) {
- debugPrint("Camera share started");
- isSharedCamera.value = (shareUser.userId == mySelf?.userId);
- }
- });
-
- final userJoinListener = eventListener.addListener(EventType.onUserJoin, (data) async {
- if (!isMounted()) return;
- data = data as Map;
- ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
- var userListJson = jsonDecode(data['remoteUsers']) as List;
- List remoteUserList = userListJson.map((userJson) => ZoomVideoSdkUser.fromJson(userJson)).toList();
- remoteUserList.insert(0, mySelf!);
- users.value = remoteUserList;
- });
-
- final userLeaveListener = eventListener.addListener(EventType.onUserLeave, (data) async {
- if (!isMounted()) return;
- ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
- data = data as Map;
- List? remoteUserList = await zoom.session.getRemoteUsers();
- var leftUserListJson = jsonDecode(data['leftUsers']) as List;
- List leftUserLis = leftUserListJson.map((userJson) => ZoomVideoSdkUser.fromJson(userJson)).toList();
- if (fullScreenUser.value != null) {
- for (var user in leftUserLis) {
- {
- if (fullScreenUser.value?.userId == user.userId) {
- fullScreenUser.value = mySelf;
- }
- }
- }
- } else {
- fullScreenUser.value = mySelf;
- }
- remoteUserList?.add(mySelf!);
- users.value = remoteUserList!;
- });
-
- final userNameChangedListener = eventListener.addListener(EventType.onUserNameChanged, (data) async {
- if (!isMounted()) return;
- data = data as Map;
- ZoomVideoSdkUser? changedUser = ZoomVideoSdkUser.fromJson(jsonDecode(data['changedUser']));
- int index;
- for (var user in users.value) {
- if (user.userId == changedUser.userId) {
- index = users.value.indexOf(user);
- users.value[index] = changedUser;
- }
- }
- userNameFlag.value = !userNameFlag.value;
- });
-
- final commandReceived = eventListener.addListener(EventType.onCommandReceived, (data) async {
- data = data as Map;
- debugPrint("sender: ${ZoomVideoSdkUser.fromJson(jsonDecode(data['sender']))}, command: ${data['command']}");
- });
-
- final liveStreamStatusChangeListener = eventListener.addListener(EventType.onLiveStreamStatusChanged, (data) async {
- data = data as Map;
- debugPrint("onLiveStreamStatusChanged: status: ${data['status']}");
- });
-
- final liveTranscriptionStatusChangeListener = eventListener.addListener(EventType.onLiveTranscriptionStatus, (data) async {
- data = data as Map;
- debugPrint("onLiveTranscriptionStatus: status: ${data['status']}");
- });
-
- final cloudRecordingStatusListener = eventListener.addListener(EventType.onCloudRecordingStatus, (data) async {
- data = data as Map;
- debugPrint("onCloudRecordingStatus: status: ${data['status']}");
- ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
- if (data['status'] == RecordingStatus.Start) {
- if (mySelf != null && !mySelf.isHost!) {
- await zoom.acceptRecordingConsent();
- // showDialog(
- // context: context,
- // builder: (BuildContext context) => AlertDialog(
- // content: const Text('The session is being recorded.'),
- // actions: [
- // TextButton(
- // onPressed: () async {
- // await zoom.acceptRecordingConsent();
- // if (context.mounted) {
- // Navigator.pop(context);
- // }
- // ;
- // },
- // child: const Text('accept'),
- // ),
- // TextButton(
- // onPressed: () async {
- // String currentConsentType = await zoom.getRecordingConsentType();
- // if (currentConsentType == ConsentType.ConsentType_Individual) {
- // await zoom.declineRecordingConsent();
- // Navigator.pop(context);
- // } else {
- // await zoom.declineRecordingConsent();
- // zoom.leaveSession(false);
- // if (!context.mounted) return;
- // Navigator.popAndPushNamed(
- // context,
- // "Join",
- // arguments: JoinArguments(args.isJoin, sessionName.value, sessionPassword.value, args.displayName, args.sessionIdleTimeoutMins, args.role),
- // );
- // }
- // },
- // child: const Text('decline'),
- // ),
- // ],
- // ),
- // );
- }
- isRecordingStarted.value = true;
- } else {
- isRecordingStarted.value = false;
- }
- });
-
- final liveTranscriptionMsgInfoReceivedListener = eventListener.addListener(EventType.onLiveTranscriptionMsgInfoReceived, (data) async {
- data = data as Map;
- ZoomVideoSdkLiveTranscriptionMessageInfo? messageInfo = ZoomVideoSdkLiveTranscriptionMessageInfo.fromJson(jsonDecode(data['messageInfo']));
- debugPrint("onLiveTranscriptionMsgInfoReceived: content: ${messageInfo.messageContent}");
- });
-
- final inviteByPhoneStatusListener = eventListener.addListener(EventType.onInviteByPhoneStatus, (data) async {
- data = data as Map;
- debugPrint("onInviteByPhoneStatus: status: ${data['status']}, reason: ${data['reason']}");
- });
-
- final multiCameraStreamStatusChangedListener = eventListener.addListener(EventType.onMultiCameraStreamStatusChanged, (data) async {
- data = data as Map;
- ZoomVideoSdkUser? changedUser = ZoomVideoSdkUser.fromJson(jsonDecode(data['changedUser']));
- var status = data['status'];
- for (var user in users.value) {
- {
- if (changedUser.userId == user.userId) {
- if (status == MultiCameraStreamStatus.Joined) {
- user.hasMultiCamera = true;
- } else if (status == MultiCameraStreamStatus.Left) {
- user.hasMultiCamera = false;
- }
- }
- }
- }
- });
-
- final requireSystemPermission = eventListener.addListener(EventType.onRequireSystemPermission, (data) async {
- data = data as Map;
- ZoomVideoSdkUser? changedUser = ZoomVideoSdkUser.fromJson(jsonDecode(data['changedUser']));
- var permissionType = data['permissionType'];
- switch (permissionType) {
- case SystemPermissionType.Camera:
- showDialog(
- context: context,
- builder: (BuildContext context) => AlertDialog(
- title: const Text("Can't Access Camera"),
- content: const Text("please turn on the toggle in system settings to grant permission"),
- actions: [
- TextButton(
- onPressed: () => Navigator.pop(context, 'OK'),
- child: const Text('OK'),
- ),
- ],
- ),
- );
- break;
- case SystemPermissionType.Microphone:
- showDialog(
- context: context,
- builder: (BuildContext context) => AlertDialog(
- title: const Text("Can't Access Microphone"),
- content: const Text("please turn on the toggle in system settings to grant permission"),
- actions: [
- TextButton(
- onPressed: () => Navigator.pop(context, 'OK'),
- child: const Text('OK'),
- ),
- ],
- ),
- );
- break;
- }
- });
-
- final networkStatusChangeListener = eventListener.addListener(EventType.onUserVideoNetworkStatusChanged, (data) async {
- data = data as Map;
- ZoomVideoSdkUser? networkUser = ZoomVideoSdkUser.fromJson(jsonDecode(data['user']));
-
- if (data['status'] == NetworkStatus.Bad) {
- debugPrint("onUserVideoNetworkStatusChanged: status: ${data['status']}, user: ${networkUser.userName}");
- }
- });
-
- final eventErrorListener = eventListener.addListener(EventType.onError, (data) async {
- data = data as Map;
- String errorType = data['errorType'];
- showDialog(
- context: context,
- builder: (BuildContext context) => AlertDialog(
- title: const Text("Error"),
- content: Text(errorType),
- actions: [
- TextButton(
- onPressed: () => Navigator.pop(context, 'OK'),
- child: const Text('OK'),
- ),
- ],
- ),
- );
- if (errorType == Errors.SessionJoinFailed || errorType == Errors.SessionDisconnecting) {
- Timer(
- const Duration(milliseconds: 1000),
- () => {
- Navigator.popAndPushNamed(
- context,
- "Join",
- arguments: JoinArguments(args.isJoin, sessionName.value, sessionPassword.value, args.displayName, args.sessionIdleTimeoutMins, args.role),
- ),
- });
- }
- });
-
- final userRecordingConsentListener = eventListener.addListener(EventType.onUserRecordingConsent, (data) async {
- data = data as Map;
- ZoomVideoSdkUser? user = ZoomVideoSdkUser.fromJson(jsonDecode(data['user']));
- debugPrint('userRecordingConsentListener: user= ${user.userName}');
- });
-
- final callCRCDeviceStatusListener = eventListener.addListener(EventType.onCallCRCDeviceStatusChanged, (data) async {
- data = data as Map;
- debugPrint('onCallCRCDeviceStatusChanged: status = ${data['status']}');
- });
-
- final originalLanguageMsgReceivedListener = eventListener.addListener(EventType.onOriginalLanguageMsgReceived, (data) async {
- data = data as Map;
- ZoomVideoSdkLiveTranscriptionMessageInfo? messageInfo = ZoomVideoSdkLiveTranscriptionMessageInfo.fromJson(jsonDecode(data['messageInfo']));
- debugPrint("onOriginalLanguageMsgReceived: content: ${messageInfo.messageContent}");
- });
-
- final chatPrivilegeChangedListener = eventListener.addListener(EventType.onChatPrivilegeChanged, (data) async {
- data = data as Map;
- String type = data['privilege'];
- debugPrint('chatPrivilegeChangedListener: type= $type');
- });
-
- final testMicStatusListener = eventListener.addListener(EventType.onTestMicStatusChanged, (data) async {
- data = data as Map;
- String status = data['status'];
- debugPrint('testMicStatusListener: status= $status');
- });
-
- final micSpeakerVolumeChangedListener = eventListener.addListener(EventType.onMicSpeakerVolumeChanged, (data) async {
- data = data as Map;
- int type = data['micVolume'];
- debugPrint('onMicSpeakerVolumeChanged: micVolume= $type, speakerVolume');
- });
-
- final cameraControlRequestResultListener = eventListener.addListener(EventType.onCameraControlRequestResult, (data) async {
- data = data as Map;
- bool approved = data['approved'];
- debugPrint('onCameraControlRequestResult: approved= $approved');
- });
-
- final callOutUserJoinListener = eventListener.addListener(EventType.onCalloutJoinSuccess, (data) async {
- data = data as Map;
- String phoneNumber = data['phoneNumber'];
- ZoomVideoSdkUser? user = ZoomVideoSdkUser.fromJson(jsonDecode(data['user']));
- debugPrint('onCalloutJoinSuccess: phoneNumber= $phoneNumber, user= ${user.userName}');
- });
-
- return () => {
- sessionJoinListener.cancel(),
- sessionLeaveListener.cancel(),
- sessionPasswordWrongListener.cancel(),
- sessionNeedPasswordListener.cancel(),
- userVideoStatusChangedListener.cancel(),
- userAudioStatusChangedListener.cancel(),
- userJoinListener.cancel(),
- userLeaveListener.cancel(),
- userNameChangedListener.cancel(),
- userShareStatusChangeListener.cancel(),
- liveStreamStatusChangeListener.cancel(),
- cloudRecordingStatusListener.cancel(),
- inviteByPhoneStatusListener.cancel(),
- eventErrorListener.cancel(),
- commandReceived.cancel(),
- liveTranscriptionStatusChangeListener.cancel(),
- liveTranscriptionMsgInfoReceivedListener.cancel(),
- multiCameraStreamStatusChangedListener.cancel(),
- requireSystemPermission.cancel(),
- userRecordingConsentListener.cancel(),
- networkStatusChangeListener.cancel(),
- callCRCDeviceStatusListener.cancel(),
- originalLanguageMsgReceivedListener.cancel(),
- chatPrivilegeChangedListener.cancel(),
- testMicStatusListener.cancel(),
- micSpeakerVolumeChangedListener.cancel(),
- cameraControlRequestResultListener.cancel(),
- callOutUserJoinListener.cancel(),
- shareContentChangedListener.cancel(),
- };
- }, [zoom, users.value, isMounted]);
-
- void selectVirtualBackgroundItem() async {
- final ImagePicker picker = ImagePicker();
- // Pick an image.
- final XFile? image = await picker.pickImage(source: ImageSource.gallery);
- await zoom.virtualBackgroundHelper.addVirtualBackgroundItem(image!.path);
- }
-
- void onPressAudio() async {
- ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
- if (mySelf != null) {
- final audioStatus = mySelf.audioStatus;
- if (audioStatus != null) {
- var muted = await audioStatus.isMuted();
- if (muted) {
- await zoom.audioHelper.unMuteAudio(mySelf.userId);
- } else {
- await zoom.audioHelper.muteAudio(mySelf.userId);
- }
- }
- }
- }
-
- void onPressVideo() async {
- ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
- if (mySelf != null) {
- final videoStatus = mySelf.videoStatus;
- if (videoStatus != null) {
- var videoOn = await videoStatus.isOn();
- if (videoOn) {
- await zoom.videoHelper.stopVideo();
- } else {
- await zoom.videoHelper.startVideo();
- }
- }
- }
- }
-
- void onPressShare() async {
- var isOtherSharing = await zoom.shareHelper.isOtherSharing();
- var isShareLocked = await zoom.shareHelper.isShareLocked();
- String? shareCameraViewResult = Errors.InternalError;
-
- if (isOtherSharing) {
- showDialog(
- context: context,
- builder: (BuildContext context) => AlertDialog(
- title: const Text("Error"),
- content: const Text('Other is sharing'),
- actions: [
- TextButton(
- onPressed: () => Navigator.pop(context, 'OK'),
- child: const Text('OK'),
- ),
- ],
- ),
- );
- } else if (isShareLocked) {
- showDialog(
- context: context,
- builder: (BuildContext context) => AlertDialog(
- title: const Text("Error"),
- content: const Text('Share is locked by host'),
- actions: [
- TextButton(
- onPressed: () => Navigator.pop(context, 'OK'),
- child: const Text('OK'),
- ),
- ],
- ),
- );
- } else if (isSharing.value) {
- zoom.shareHelper.stopShare();
- } else {
- List options = [
- ListTile(
- title: Text(
- 'Share Device Screen',
- style: TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.normal,
- color: Colors.black,
- ),
- ),
- onTap: () async => {
- zoom.shareHelper.shareScreen(),
- Navigator.of(context).pop(),
- },
- ),
- ListTile(
- title: Text(
- 'Share Camera',
- style: TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.normal,
- color: Colors.black,
- ),
- ),
- onTap: () async => {
- shareCameraViewResult = await zoom.shareHelper.startShareCamera(cameraShareView),
- debugPrint('start camera: $shareCameraViewResult'),
- Navigator.of(context).pop(),
- },
- ),
- ];
- showDialog(
- context: context,
- builder: (context) {
- return Dialog(
- elevation: 0.0,
- insetPadding: const EdgeInsets.symmetric(horizontal: 40),
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
- child: SizedBox(
- height: options.length * 60,
- child: Scrollbar(
- child: ListView(
- shrinkWrap: true,
- scrollDirection: Axis.vertical,
- children: ListTile.divideTiles(
- context: context,
- tiles: options,
- ).toList(),
- ),
- ),
- ),
- );
- });
- }
- }
-
- void onSelectedUserVolume(ZoomVideoSdkUser user) async {
- var isShareAudio = user.isSharing;
- bool canSetVolume = await user.canSetUserVolume(user.userId, isShareAudio);
- num userVolume;
-
- List options = [
- ListTile(
- title: Text(
- 'Adjust Volume',
- style: const TextStyle(
- fontSize: 18,
- fontWeight: FontWeight.w600,
- color: Colors.black,
- ),
- ),
- ),
- ListTile(
- title: Text(
- 'Current volume',
- style: const TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.normal,
- color: Colors.black,
- ),
- ),
- onTap: () async => {
- debugPrint('user volume'),
- userVolume = await user.getUserVolume(user.userId, isShareAudio),
- debugPrint('user ${user.userName}\'s volume is ${userVolume!}'),
- },
- ),
- ];
- if (canSetVolume) {
- options.add(
- ListTile(
- title: Text(
- 'Volume up',
- style: const TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.normal,
- color: Colors.black,
- ),
- ),
- onTap: () async => {
- userVolume = await user.getUserVolume(user.userId, isShareAudio),
- if (userVolume < 10)
- {
- await user.setUserVolume(user.userId, userVolume + 1, isShareAudio),
- }
- else
- {
- debugPrint("Cannot volume up."),
- }
- },
- ),
- );
- options.add(
- ListTile(
- title: Text(
- 'Volume down',
- style: const TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.normal,
- color: Colors.black,
- ),
- ),
- onTap: () async => {
- userVolume = await user.getUserVolume(user.userId, isShareAudio),
- if (userVolume > 0)
- {
- await user.setUserVolume(user.userId, userVolume - 1, isShareAudio),
- }
- else
- {
- debugPrint("Cannot volume down."),
- }
- },
- ),
- );
- }
- showDialog(
- context: context,
- builder: (context) {
- return Dialog(
- elevation: 0.0,
- insetPadding: const EdgeInsets.symmetric(horizontal: 40),
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
- child: SizedBox(
- height: options.length * 58,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- ListView(
- shrinkWrap: true,
- children: ListTile.divideTiles(
- context: context,
- tiles: options,
- ).toList(),
- ),
- ],
- ),
- ));
- });
- }
-
- void onPressCameraList() async {
- List options = [];
- List cameraList = await zoom.videoHelper.getCameraList();
- for (var camera in cameraList) {
- options.add(
- ListTile(
- title: Text(
- camera.deviceName,
- style: const TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.normal,
- color: Colors.black,
- ),
- ),
- onTap: () async => {
- await zoom.videoHelper.switchCamera(camera.deviceId),
- Navigator.of(context).pop(),
- },
- ),
- );
- }
- options.add(
- ListTile(
- title: Text(
- "Cancel",
- style: const TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.normal,
- color: Colors.black,
- ),
- ),
- onTap: () async => {
- Navigator.of(context).pop(),
- },
- ),
- );
- showDialog(
- context: context,
- builder: (context) {
- return Dialog(
- elevation: 0.0,
- insetPadding: const EdgeInsets.symmetric(horizontal: 40),
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
- child: SizedBox(
- height: options.length * 60,
- child: Scrollbar(
- child: ListView(
- shrinkWrap: true,
- scrollDirection: Axis.vertical,
- children: ListTile.divideTiles(
- context: context,
- tiles: options,
- ).toList(),
- ),
- ),
- ),
- );
- });
- }
-
- // Future onPressMore() async {
- // ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
- // bool isShareLocked = await zoom.shareHelper.isShareLocked();
- // bool canSwitchSpeaker = await zoom.audioHelper.canSwitchSpeaker();
- // bool canStartRecording = (await zoom.recordingHelper.canStartRecording()) == Errors.Success;
- // debugPrint("canStartRecording ${await zoom.recordingHelper.canStartRecording()}");
- // var startLiveTranscription = (await zoom.liveTranscriptionHelper.getLiveTranscriptionStatus()) == LiveTranscriptionStatus.Start;
- // bool canStartLiveTranscription = await zoom.liveTranscriptionHelper.canStartLiveTranscription();
- // bool isHost = (mySelf != null) ? (await mySelf.getIsHost()) : false;
- // isOriginalAspectRatio.value = await zoom.videoHelper.isOriginalAspectRatioEnabled();
- // bool canCallOutToCRC = await zoom.CRCHelper.isCRCEnabled();
- // bool supportVB = await zoom.virtualBackgroundHelper.isSupportVirtualBackground();
- // List? shareActionList = await mySelf?.getShareActionList();
- //
- // List options = [
- // ListTile(
- // title: Text(
- // 'More',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 18,
- // fontWeight: FontWeight.w600,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // ),
- // ListTile(
- // title: Text(
- // 'Get Chat Privilege',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // debugPrint("Chat Privilege = ${await zoom.chatHelper.getChatPrivilege()}"),
- // Navigator.of(context).pop(),
- // },
- // ),
- // ListTile(
- // title: Text(
- // 'Get Session Dial-in Number infos',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // debugPrint("session number = ${await zoom.session.getSessionNumber()}"),
- // Navigator.of(context).pop(),
- // },
- // ),
- // ListTile(
- // title: Text(
- // 'Get Camera List',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // debugPrint("camera list= ${await zoom.videoHelper.getCameraList()}"),
- // onPressCameraList(),
- // Navigator.of(context).pop(),
- // },
- // ),
- // ListTile(
- // title: Text(
- // '${isMicOriginalOn.value ? 'Disable' : 'Enable'} Original Sound',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // debugPrint("${isMicOriginalOn.value}"),
- // await zoom.audioSettingHelper.enableMicOriginalInput(!isMicOriginalOn.value),
- // isMicOriginalOn.value = await zoom.audioSettingHelper.isMicOriginalInputEnable(),
- // debugPrint("Original sound ${isMicOriginalOn.value ? 'Enabled' : 'Disabled'}"),
- // Navigator.of(context).pop(),
- // },
- // )
- // ];
- //
- // if (supportVB) {
- // options.add(
- // ListTile(
- // title: Text(
- // 'Add Virtual Background',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // selectVirtualBackgroundItem(),
- // Navigator.of(context).pop(),
- // },
- // ),
- // );
- // }
- //
- // if (canCallOutToCRC) {
- // options.add(ListTile(
- // title: Text(
- // 'Call-out to CRC devices',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // debugPrint('CRC result = ${await zoom.CRCHelper.callCRCDevice("bjn.vc", ZoomVideoSdkCRCProtocolType.SIP)}'),
- // Navigator.of(context).pop(),
- // },
- // ));
- // options.add(ListTile(
- // title: Text(
- // 'Cancel call-out to CRC devices',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // debugPrint('cancel result= ${await zoom.CRCHelper.cancelCallCRCDevice()}'),
- // Navigator.of(context).pop(),
- // },
- // ));
- // }
- //
- // if (canSwitchSpeaker) {
- // options.add(ListTile(
- // title: Text(
- // 'Turn ${isSpeakerOn.value ? 'off' : 'on'} Speaker',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // await zoom.audioHelper.setSpeaker(!isSpeakerOn.value),
- // isSpeakerOn.value = await zoom.audioHelper.getSpeakerStatus(),
- // debugPrint('Turned ${isSpeakerOn.value ? 'on' : 'off'} Speaker'),
- // Navigator.of(context).pop(),
- // },
- // ));
- // }
- //
- // if (isHost) {
- // options.add(ListTile(
- // title: Text(
- // '${isShareLocked ? 'Unlock' : 'Lock'} Share',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // debugPrint("isShareLocked = ${await zoom.shareHelper.lockShare(!isShareLocked)}"),
- // Navigator.of(context).pop(),
- // }));
- // options.add(ListTile(
- // title: Text(
- // 'Change Name',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () => {
- // isRenameModalVisible.value = true,
- // Navigator.of(context).pop(),
- // },
- // ));
- // }
- //
- // if (canStartLiveTranscription) {
- // options.add(ListTile(
- // title: Text(
- // "${startLiveTranscription ? 'Stop' : 'Start'} Live Transcription",
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // if (startLiveTranscription)
- // {
- // debugPrint('stopLiveTranscription= ${await zoom.liveTranscriptionHelper.stopLiveTranscription()}'),
- // }
- // else
- // {
- // debugPrint('startLiveTranscription= ${await zoom.liveTranscriptionHelper.startLiveTranscription()}'),
- // },
- // Navigator.of(context).pop(),
- // },
- // ));
- // options.add(ListTile(
- // title: Text(
- // '${isReceiveSpokenLanguageContentEnabled.value ? 'Disable' : 'Enable'} receiving original caption',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // await zoom.liveTranscriptionHelper.enableReceiveSpokenLanguageContent(!isReceiveSpokenLanguageContentEnabled.value),
- // isReceiveSpokenLanguageContentEnabled.value = await zoom.liveTranscriptionHelper.isReceiveSpokenLanguageContentEnabled(),
- // debugPrint("isReceiveSpokenLanguageContentEnabled = ${isReceiveSpokenLanguageContentEnabled.value}"),
- // Navigator.of(context).pop(),
- // }));
- // }
- //
- // if (canStartRecording) {
- // options.add(ListTile(
- // title: Text(
- // '${isRecordingStarted.value ? 'Stop' : 'Start'} Recording',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // if (!isRecordingStarted.value)
- // {
- // debugPrint('isRecordingStarted = ${await zoom.recordingHelper.startCloudRecording()}'),
- // }
- // else
- // {
- // debugPrint('isRecordingStarted = ${await zoom.recordingHelper.stopCloudRecording()}'),
- // },
- // Navigator.of(context).pop(),
- // }));
- // }
- //
- // if (Platform.isAndroid) {
- // bool isFlashlightSupported = await zoom.videoHelper.isSupportFlashlight();
- // bool isFlashlightOn = await zoom.videoHelper.isFlashlightOn();
- // if (isFlashlightSupported) {
- // options.add(ListTile(
- // title: Text(
- // '${isFlashlightOn ? 'Turn Off' : 'Turn On'} Flashlight',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // if (!isFlashlightOn)
- // {
- // await zoom.videoHelper.turnOnOrOffFlashlight(true),
- // }
- // else
- // {
- // await zoom.videoHelper.turnOnOrOffFlashlight(false),
- // },
- // Navigator.of(context).pop(),
- // }));
- // }
- // }
- //
- // if (Platform.isIOS) {
- // options.add(ListTile(
- // title: Text(
- // '${isPiPView.value ? 'Disable' : 'Enable'} picture in picture view',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // isPiPView.value = !isPiPView.value,
- // Navigator.of(context).pop(),
- // }));
- // }
- //
- // if (isVideoOn.value) {
- // options.add(ListTile(
- // title: Text(
- // 'Mirror the video',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // await zoom.videoHelper.mirrorMyVideo(!isVideoMirrored.value),
- // isVideoMirrored.value = await zoom.videoHelper.isMyVideoMirrored(),
- // Navigator.of(context).pop(),
- // }));
- // options.add(ListTile(
- // title: Text(
- // '${isOriginalAspectRatio.value ? 'Enable' : 'Disable'} original aspect ratio',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.normal,
- // color: Colors.black,
- // ),
- // ),
- // ),
- // onTap: () async => {
- // await zoom.videoHelper.enableOriginalAspectRatio(!isOriginalAspectRatio.value),
- // isOriginalAspectRatio.value = await zoom.videoHelper.isOriginalAspectRatioEnabled(),
- // debugPrint("isOriginalAspectRatio= ${isOriginalAspectRatio.value}"),
- // Navigator.of(context).pop(),
- // }));
- // }
- //
- // showDialog(
- // context: context,
- // builder: (context) {
- // return Dialog(
- // elevation: 0.0,
- // insetPadding: const EdgeInsets.symmetric(horizontal: 40),
- // shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
- // child: SizedBox(
- // height: 500,
- // child: Scrollbar(
- // child: ListView(
- // shrinkWrap: true,
- // scrollDirection: Axis.vertical,
- // children: ListTile.divideTiles(
- // context: context,
- // tiles: options,
- // ).toList(),
- // ),
- // ),
- // ),
- // );
- // });
- // }
-
- void onLeaveSession(bool isEndSession) async {
- await zoom.leaveSession(isEndSession);
- Navigator.pushAndRemoveUntil(
- context,
- CustomPageRoute(
- page: LandingNavigation(),
- ),
- (r) => false);
- }
-
- void showLeaveOptions() async {
- ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
- bool isHost = await mySelf!.getIsHost();
-
- Widget endSession;
- Widget leaveSession;
- Widget cancel = TextButton(
- child: const Text('Cancel'),
- onPressed: () {
- Navigator.pop(context); //close Dialog
- },
- );
-
- switch (defaultTargetPlatform) {
- case TargetPlatform.android:
- endSession = TextButton(
- child: const Text('End Session'),
- onPressed: () => onLeaveSession(true),
- );
- leaveSession = TextButton(
- child: const Text('Leave Session'),
- onPressed: () => onLeaveSession(false),
- );
- break;
- default:
- endSession = CupertinoActionSheetAction(
- isDestructiveAction: true,
- child: const Text('End Session'),
- onPressed: () => onLeaveSession(true),
- );
- leaveSession = CupertinoActionSheetAction(
- child: const Text('Leave Session'),
- onPressed: () => onLeaveSession(false),
- );
- break;
- }
-
- List options = [
- leaveSession,
- cancel,
- ];
-
- if (Platform.isAndroid) {
- if (isHost) {
- options.removeAt(1);
- options.insert(0, endSession);
- }
- showDialog(
- context: context,
- builder: (context) {
- return AlertDialog(
- content: const Text("Do you want to leave this session?"),
- shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(2.0))),
- actions: options,
- );
- });
- } else {
- options.removeAt(1);
- if (isHost) {
- options.insert(1, endSession);
- }
- showCupertinoModalPopup(
- context: context,
- builder: (context) => CupertinoActionSheet(
- message: const Text('Are you sure that you want to leave the session?'),
- actions: options,
- cancelButton: cancel,
- ),
- );
- }
- }
-
- final chatMessageController = TextEditingController();
-
- void sendChatMessage(String message) async {
- await zoom.chatHelper.sendChatToAll(message);
- ZoomVideoSdkUser? self = await zoom.session.getMySelf();
- ZoomVideoSdkCmdChannel cmdChannel = zoom.cmdChannel;
- for (var user in users.value) {
- if (user.userId != self?.userId) {
- await zoom.cmdChannel.sendCommand(user.userId, message);
- }
- }
- chatMessageController.clear();
- // send the chat as a command
- }
-
- void onSelectedUser(ZoomVideoSdkUser user) async {
- setState(() {
- fullScreenUser.value = user;
- });
- }
-
- changeNamePopup = Center(
- child: Stack(
- children: [
- Visibility(
- visible: isRenameModalVisible.value,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Container(
- alignment: Alignment.bottomLeft,
- decoration: const BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(10)),
- color: Colors.white,
- ),
- width: MediaQuery.of(context).size.width - 130,
- height: MediaQuery.of(context).size.height * 0.2,
- child: Center(
- child: (Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Padding(
- padding: const EdgeInsets.only(top: 20, left: 20),
- child: Text(
- 'Change Name',
- style: const TextStyle(
- fontSize: 18,
- fontWeight: FontWeight.w500,
- ),
- ),
- ),
- Padding(
- padding: const EdgeInsets.only(top: 10, left: 20),
- child: SizedBox(
- width: MediaQuery.of(context).size.width - 230,
- child: TextField(
- onEditingComplete: () {},
- autofocus: true,
- cursorColor: Colors.black,
- controller: changeNameController,
- decoration: InputDecoration(
- isDense: true,
- hintText: 'New name',
- hintStyle: TextStyle(
- fontSize: 14.0,
- color: chatTextColor,
- ),
- ),
- ),
- ),
- ),
- Padding(
- padding: const EdgeInsets.only(top: 15),
- child: Row(
- children: [
- Padding(
- padding: const EdgeInsets.only(left: 40),
- child: InkWell(
- child: Text(
- 'Apply',
- style: const TextStyle(
- fontSize: 16,
- ),
- ),
- onTap: () async {
- if (fullScreenUser.value != null) {
- ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
- await zoom.userHelper.changeName((mySelf?.userId)!, changeNameController.text);
- changeNameController.clear();
- }
- isRenameModalVisible.value = false;
- },
- ),
- ),
- Padding(
- padding: const EdgeInsets.only(left: 40),
- child: InkWell(
- child: Text(
- 'Cancel',
- style: const TextStyle(
- fontSize: 16,
- ),
- ),
- onTap: () async {
- isRenameModalVisible.value = false;
- },
- ),
- )
- ],
- ),
- )
- ],
- )),
- ),
- ),
- ],
- )),
- ],
- ),
- );
-
- Widget fullScreenView;
- Widget smallView;
- Widget cameraView;
-
- if (isInSession.value && fullScreenUser.value != null && users.value.isNotEmpty) {
- fullScreenView = AnimatedOpacity(
- opacity: opacityLevel,
- duration: const Duration(seconds: 3),
- child: VideoView(
- user: users.value.length > 1 ? users.value[1] : users.value[0],
- hasMultiCamera: false,
- isPiPView: isPiPView.value,
- sharing: sharingUser.value == null ? false : (sharingUser.value?.userId == fullScreenUser.value?.userId),
- preview: false,
- focused: false,
- multiCameraIndex: "0",
- videoAspect: VideoAspect.Original,
- fullScreen: true,
- resolution: VideoResolution.Resolution360,
- ),
- );
-
- smallView = Container(
- height: 110,
- margin: const EdgeInsets.only(left: 20, right: 20),
- alignment: Alignment.center,
- child: ListView.separated(
- scrollDirection: Axis.horizontal,
- itemCount: users.value.length,
- itemBuilder: (BuildContext context, int index) {
- return InkWell(
- onTap: () async {
- onSelectedUser(users.value[index]);
- },
- onDoubleTap: () async {
- onSelectedUserVolume(users.value[index]);
- },
- child: Center(
- child: VideoView(
- user: users.value[index],
- hasMultiCamera: false,
- isPiPView: false,
- sharing: false,
- preview: false,
- focused: false,
- multiCameraIndex: "0",
- videoAspect: VideoAspect.Original,
- fullScreen: false,
- resolution: VideoResolution.Resolution180,
- ),
- ),
- );
- },
- separatorBuilder: (BuildContext context, int index) => const Divider(),
- ),
- );
- } else {
- fullScreenView = Container(
- color: Colors.black,
- child: const Center(
- child: Text(
- "Connecting...",
- style: TextStyle(
- fontSize: 20,
- color: Colors.white,
- ),
- ),
- ));
- smallView = Container(
- height: 110,
- color: Colors.transparent,
- );
- }
-
- cameraView = Offstage(
- offstage: !isSharedCamera.value,
- child: AnimatedOpacity(
- opacity: isSharedCamera.value ? 1.0 : 0.0,
- duration: const Duration(milliseconds: 300),
- child: cameraShareView,
- ),
- );
-
- _changeOpacity;
- return Scaffold(
- resizeToAvoidBottomInset: false,
- backgroundColor: backgroundColor,
- body: Stack(
- children: [
- // isScreenBeingShared ? fullScreenView : SizedBox.shrink(),
- isScreenBeingShared ? SizedBox.shrink() : fullScreenView,
- cameraView,
- Container(
- padding: const EdgeInsets.only(top: 35),
- child: Stack(
- children: [
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- height: 80,
- width: 180,
- margin: const EdgeInsets.only(top: 16, left: 8),
- padding: const EdgeInsets.all(8),
- alignment: Alignment.topLeft,
- decoration: BoxDecoration(
- borderRadius: const BorderRadius.all(Radius.circular(8.0)),
- // color: buttonBackgroundColor,
- ),
- // child: InkWell(
- // onTap: () async {
- // showDialog(
- // context: context,
- // builder: (context) {
- // return Dialog(
- // elevation: 0.0,
- // insetPadding: const EdgeInsets.symmetric(horizontal: 40),
- // shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
- // child: FractionallySizedBox(
- // heightFactor: 0.2,
- // widthFactor: 0.3,
- // child: Column(
- // crossAxisAlignment: CrossAxisAlignment.stretch,
- // children: [
- // ListView(
- // shrinkWrap: true,
- // children: ListTile.divideTiles(
- // context: context,
- // tiles: [
- // ListTile(
- // title: Text(
- // 'Session Information',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 18,
- // fontWeight: FontWeight.w600,
- // ),
- // ),
- // ),
- // ),
- // ListTile(
- // title: Text(
- // 'Session Name',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // ),
- // ),
- // ),
- // subtitle: Text(
- // sessionName.value,
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 12,
- // ),
- // ),
- // ),
- // ),
- // ListTile(
- // title: Text(
- // 'Session Password',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // ),
- // ),
- // ),
- // subtitle: Text(
- // sessionPassword.value,
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 12,
- // ),
- // ),
- // ),
- // ),
- // ListTile(
- // title: Text(
- // 'Participants',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // ),
- // ),
- // ),
- // subtitle: Text(
- // '${users.value.length}',
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 12,
- // ),
- // ),
- // ),
- // ),
- // ],
- // ).toList(),
- // ),
- // ],
- // ),
- // ));
- // });
- // },
- // child: Stack(
- // children: [
- // Column(
- // children: [
- // const Padding(padding: EdgeInsets.symmetric(vertical: 4)),
- // Align(
- // alignment: Alignment.centerLeft,
- // child: Text(
- // sessionName.value,
- // overflow: TextOverflow.ellipsis,
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.w600,
- // color: Colors.white,
- // ),
- // ),
- // ),
- // ),
- // const Padding(padding: EdgeInsets.symmetric(vertical: 5)),
- // Align(
- // alignment: Alignment.centerLeft,
- // child: Text(
- // "Participants: ${users.value.length}",
- // style: GoogleFonts.lato(
- // textStyle: const TextStyle(
- // fontSize: 14,
- // fontWeight: FontWeight.w600,
- // color: Colors.white,
- // ),
- // ),
- // ),
- // )
- // ],
- // ),
- // Container(
- // alignment: Alignment.centerRight,
- // child: Image.asset(
- // "assets/icons/unlocked@2x.png",
- // height: 22,
- // )),
- // ],
- // ),
- // ),
- ),
- TextButton(
- onPressed: (showLeaveOptions),
- child: Container(
- alignment: Alignment.topRight,
- margin: const EdgeInsets.only(top: 16, right: 8),
- padding: const EdgeInsets.only(top: 5, bottom: 5, left: 16, right: 16),
- height: 28,
- decoration: BoxDecoration(
- borderRadius: const BorderRadius.all(Radius.circular(20.0)),
- color: buttonBackgroundColor,
- ),
- child: const Text(
- "LEAVE",
- style: TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.bold,
- color: Color(0xFFE02828),
- ),
- ),
- )),
- ],
- ),
- Align(
- alignment: Alignment.centerRight,
- child: FractionallySizedBox(
- widthFactor: 0.2,
- heightFactor: 0.6,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- IconButton(
- onPressed: onPressAudio,
- icon: isMuted.value ? Image.asset("assets/images/png/zoom/unmute@2x.png") : Image.asset("assets/images/png/zoom/mute@2x.png"),
- iconSize: circleButtonSize,
- tooltip: isMuted.value == true ? "Unmute" : "Mute",
- ),
- // IconButton(
- // onPressed: onPressShare,
- // icon: isSharing.value ? Image.asset("assets/images/png/zoom/share-off@2x.png") : Image.asset("assets/images/png/zoom/share-on@2x.png"),
- // iconSize: circleButtonSize,
- // ),
- IconButton(
- onPressed: onPressVideo,
- iconSize: circleButtonSize,
- icon: isVideoOn.value ? Image.asset("assets/images/png/zoom/video-off@2x.png") : Image.asset("assets/images/png/zoom/video-on@2x.png"),
- ),
- Column(
- children: [
- IconButton(
- onPressed: () async {
- onPressCameraList();
- },
- icon: Icon(Icons.cameraswitch, color: Colors.white),
- color: Colors.white,
- iconSize: 40.h,
- ),
- "Switch Camera".toText12(color: AppColors.whiteColor, isCenter: true, isBold: true)
- ],
- ),
- ],
- ),
- )),
- // Container(
- // margin: const EdgeInsets.only(left: 16, right: 16, bottom: 40, top: 10),
- // alignment: Alignment.bottomCenter,
- // child: SizedBox(
- // height: MediaQuery.of(context).viewInsets.bottom == 0 ? 65 : MediaQuery.of(context).viewInsets.bottom + 18,
- // child: TextField(
- // maxLines: 1,
- // textAlign: TextAlign.left,
- // style: TextStyle(color: chatTextColor),
- // cursorColor: chatTextColor,
- // textAlignVertical: TextAlignVertical.center,
- // controller: chatMessageController,
- // decoration: InputDecoration(
- // contentPadding: const EdgeInsets.only(left: 16, top: 10, bottom: 10, right: 16),
- // enabledBorder: OutlineInputBorder(
- // borderSide: BorderSide(width: 1, color: chatTextColor), //<-- SEE HERE
- // ),
- // hintText: 'Type your message here...',
- // hintStyle: TextStyle(
- // fontSize: 14.0,
- // color: chatTextColor,
- // ),
- // ),
- // onSubmitted: (String str) {
- // sendChatMessage(str);
- // },
- // ),
- // ),
- // ),
- Container(
- alignment: Alignment.bottomLeft,
- margin: const EdgeInsets.only(bottom: 120),
- child: smallView,
- ),
- // CommentList(zoom: zoom, eventListener: eventListener),
- changeNamePopup,
- ],
- )),
- ],
- ));
- }
-}
-
-class CallArguments {
- final bool isJoin;
- final String sessionName;
- final String sessionPwd;
- final String displayName;
- final String sessionIdleTimeoutMins;
- final String role;
- final int callType;
-
- CallArguments(this.sessionName, this.sessionPwd, this.displayName, this.sessionIdleTimeoutMins, this.role, this.isJoin, this.callType);
-}
-
-class JoinArguments {
- final bool isJoin;
- final String sessionName;
- final String sessionPwd;
- final String displayName;
- final String sessionTimeout;
- final String roleType;
-
- JoinArguments(this.isJoin, this.sessionName, this.sessionPwd, this.displayName, this.sessionTimeout, this.roleType);
-}
+// import 'dart:async';
+// import 'dart:convert';
+// import 'dart:io';
+//
+// import 'package:flutter/cupertino.dart';
+// import 'package:flutter/foundation.dart';
+// import 'package:flutter/material.dart';
+// import 'package:flutter/services.dart';
+// import 'package:flutter_hooks/flutter_hooks.dart';
+// import 'package:flutter_ios_voip_kit_karmm/flutter_ios_voip_kit.dart';
+// import 'package:flutter_zoom_videosdk/flutter_zoom_view.dart';
+// import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart';
+// import 'package:flutter_zoom_videosdk/native/zoom_videosdk_camera_device.dart';
+// import 'package:flutter_zoom_videosdk/native/zoom_videosdk_cmd_channel.dart';
+// import 'package:flutter_zoom_videosdk/native/zoom_videosdk_event_listener.dart';
+// import 'package:flutter_zoom_videosdk/native/zoom_videosdk_live_transcription_message_info.dart';
+// import 'package:flutter_zoom_videosdk/native/zoom_videosdk_share_action.dart';
+// import 'package:flutter_zoom_videosdk/native/zoom_videosdk_user.dart';
+// import 'package:hmg_patient_app_new/core/app_export.dart';
+// import 'package:hmg_patient_app_new/core/cache_consts.dart';
+// import 'package:hmg_patient_app_new/core/utils/jwt.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/presentation/home/navigation_screen.dart';
+// import 'package:hmg_patient_app_new/presentation/tele_consultation/zoom/video_view.dart';
+// import 'package:hmg_patient_app_new/theme/colors.dart';
+// import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
+// import 'package:image_picker/image_picker.dart';
+//
+// class CallScreen extends StatefulHookWidget {
+// const CallScreen({Key? key}) : super(key: key);
+//
+// @override
+// State createState() => _CallScreenState();
+// }
+//
+// class _CallScreenState extends State {
+// static TextEditingController changeNameController = TextEditingController();
+// double opacityLevel = 1.0;
+//
+// final voIPKit = FlutterIOSVoIPKit.instance;
+//
+// bool isScreenBeingShared = false;
+//
+// void _changeOpacity() {
+// setState(() => opacityLevel = opacityLevel == 0 ? 1.0 : 0.0);
+// }
+//
+// @override
+// Widget build(BuildContext context) {
+// var zoom = ZoomVideoSdk();
+// var eventListener = ZoomVideoSdkEventListener();
+// var isInSession = useState(false);
+// var sessionName = useState('');
+// var sessionPassword = useState('');
+// var users = useState([]);
+// var fullScreenUser = useState(null);
+// var sharingUser = useState(null);
+// var videoInfo = useState('');
+// var isSharing = useState(false);
+// var isMuted = useState(true);
+// var isVideoOn = useState(false);
+// var isSpeakerOn = useState(false);
+// var isRenameModalVisible = useState(false);
+// var isRecordingStarted = useState(false);
+// var isMicOriginalOn = useState(false);
+// var isMounted = useIsMounted();
+// var audioStatusFlag = useState(false);
+// var videoStatusFlag = useState(false);
+// var userNameFlag = useState(false);
+// var userShareStatusFlag = useState(false);
+// var isReceiveSpokenLanguageContentEnabled = useState(false);
+// var isVideoMirrored = useState(false);
+// var isOriginalAspectRatio = useState(false);
+// var isPiPView = useState(false);
+// var isSharedCamera = useState(false);
+// CameraShareView cameraShareView = const CameraShareView(creationParams: {});
+//
+// //hide status bar
+// SystemChrome.setEnabledSystemUIMode(SystemUiMode.leanBack);
+// var circleButtonSize = 65.0;
+// Color backgroundColor = const Color(0xFF232323);
+// Color buttonBackgroundColor = const Color.fromRGBO(0, 0, 0, 0.6);
+// Color chatTextColor = const Color(0xFFAAAAAA);
+// Widget changeNamePopup;
+// final args = ModalRoute.of(context)!.settings.arguments as CallArguments;
+//
+// useEffect(() {
+// Future.microtask(() async {
+// var token = generateJwt(args.sessionName, args.role);
+//
+// Utils.removeFromPrefs(CacheConst.isAppOpenedFromCall);
+//
+// try {
+// Map SDKaudioOptions = {"connect": true, "mute": false, "autoAdjustSpeakerVolume": false};
+// Map SDKvideoOptions = {
+// "localVideoOn": true,
+// };
+// JoinSessionConfig joinSession = JoinSessionConfig(
+// sessionName: args.sessionName,
+// sessionPassword: args.sessionPwd,
+// token: token,
+// userName: args.displayName,
+// audioOptions: SDKaudioOptions,
+// videoOptions: SDKvideoOptions,
+// sessionIdleTimeoutMins: int.parse(args.sessionIdleTimeoutMins),
+// );
+// await zoom.joinSession(joinSession);
+// } catch (e) {
+// const AlertDialog(
+// title: Text("Error"),
+// content: Text("Failed to join the session"),
+// );
+// Future.delayed(const Duration(milliseconds: 1000)).asStream().listen((event) {
+// Navigator.pushAndRemoveUntil(
+// context,
+// CustomPageRoute(
+// page: LandingNavigation(),
+// ),
+// (r) => false);
+// });
+// }
+// });
+// return null;
+// }, []);
+//
+// useEffect(() {
+// final sessionJoinListener = eventListener.addListener(EventType.onSessionJoin, (data) async {
+// data = data as Map;
+// isInSession.value = true;
+// zoom.session.getSessionName().then((value) => sessionName.value = value!);
+// sessionPassword.value = await zoom.session.getSessionPassword();
+// debugPrint("sessionPhonePasscode: ${await zoom.session.getSessionPhonePasscode()}");
+// ZoomVideoSdkUser mySelf = ZoomVideoSdkUser.fromJson(jsonDecode(data['sessionUser']));
+// List? remoteUsers = await zoom.session.getRemoteUsers();
+// var muted = await mySelf.audioStatus?.isMuted();
+// var videoOn = await mySelf.videoStatus?.isOn();
+// var speakerOn = await zoom.audioHelper.getSpeakerStatus();
+// fullScreenUser.value = mySelf;
+// remoteUsers?.insert(0, mySelf);
+// isMuted.value = muted!;
+// isSpeakerOn.value = speakerOn;
+// isVideoOn.value = videoOn!;
+// users.value = remoteUsers!;
+// isReceiveSpokenLanguageContentEnabled.value = await zoom.liveTranscriptionHelper.isReceiveSpokenLanguageContentEnabled();
+// });
+//
+// final sessionLeaveListener = eventListener.addListener(EventType.onSessionLeave, (data) async {
+// data = data as Map;
+// debugPrint("onSessionLeave: ${data['reason']}");
+// isInSession.value = false;
+// users.value = [];
+// fullScreenUser.value = null;
+// // Navigator.popAndPushNamed(
+// // context,
+// // "Join",
+// // arguments: JoinArguments(args.isJoin, sessionName.value, sessionPassword.value, args.displayName, args.sessionIdleTimeoutMins, args.role),
+// // );
+// Navigator.pushAndRemoveUntil(
+// context,
+// CustomPageRoute(
+// page: LandingNavigation(),
+// ),
+// (r) => false);
+// });
+//
+// final sessionNeedPasswordListener = eventListener.addListener(EventType.onSessionNeedPassword, (data) async {
+// showDialog(
+// context: context,
+// builder: (BuildContext context) => AlertDialog(
+// title: const Text('Session Need Password'),
+// content: const Text('Password is required'),
+// actions: [
+// TextButton(
+// onPressed: () async => {
+// Navigator.pushAndRemoveUntil(
+// context,
+// CustomPageRoute(
+// page: LandingNavigation(),
+// ),
+// (r) => false),
+// await zoom.leaveSession(false),
+// },
+// child: const Text('OK'),
+// ),
+// ],
+// ),
+// );
+// });
+//
+// final sessionPasswordWrongListener = eventListener.addListener(EventType.onSessionPasswordWrong, (data) async {
+// showDialog(
+// context: context,
+// builder: (BuildContext context) => AlertDialog(
+// title: const Text('Session Password Incorrect'),
+// content: const Text('Password is wrong'),
+// actions: [
+// TextButton(
+// onPressed: () async => {
+// Navigator.popAndPushNamed(context, 'Join', arguments: JoinArguments(args.isJoin, args.sessionName, "", args.displayName, args.sessionIdleTimeoutMins, args.role)),
+// await zoom.leaveSession(false),
+// },
+// child: const Text('OK'),
+// ),
+// ],
+// ),
+// );
+// });
+//
+// final userVideoStatusChangedListener = eventListener.addListener(EventType.onUserVideoStatusChanged, (data) async {
+// data = data as Map;
+// ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
+// var userListJson = jsonDecode(data['changedUsers']) as List;
+// List userList = userListJson.map((userJson) => ZoomVideoSdkUser.fromJson(userJson)).toList();
+// for (var user in userList) {
+// {
+// if (user.userId == mySelf?.userId) {
+// mySelf?.videoStatus?.isOn().then((on) => isVideoOn.value = on);
+// }
+// }
+// }
+// videoStatusFlag.value = !videoStatusFlag.value;
+// });
+//
+// final userAudioStatusChangedListener = eventListener.addListener(EventType.onUserAudioStatusChanged, (data) async {
+// data = data as Map;
+// ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
+// var userListJson = jsonDecode(data['changedUsers']) as List;
+// List userList = userListJson.map((userJson) => ZoomVideoSdkUser.fromJson(userJson)).toList();
+// for (var user in userList) {
+// {
+// if (user.userId == mySelf?.userId) {
+// mySelf?.audioStatus?.isMuted().then((muted) => isMuted.value = muted);
+// }
+// }
+// }
+// audioStatusFlag.value = !audioStatusFlag.value;
+// });
+//
+// final userShareStatusChangeListener = eventListener.addListener(EventType.onUserShareStatusChanged, (data) async {
+// data = data as Map;
+// ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
+// ZoomVideoSdkUser shareUser = ZoomVideoSdkUser.fromJson(jsonDecode(data['user'].toString()));
+// ZoomVideoSdkShareAction? shareAction = ZoomVideoSdkShareAction.fromJson(jsonDecode(data['shareAction']));
+//
+// if (shareAction.shareStatus == ShareStatus.Start || shareAction.shareStatus == ShareStatus.Resume) {
+// sharingUser.value = shareUser;
+// fullScreenUser.value = shareUser;
+// isSharing.value = (shareUser.userId == mySelf?.userId);
+//
+// setState(() {
+// isScreenBeingShared = true;
+// });
+// Future.delayed(const Duration(seconds: 2), () {
+// setState(() {
+// isScreenBeingShared = false;
+// });
+// });
+// } else {
+// sharingUser.value = null;
+// isSharing.value = false;
+// isSharedCamera.value = false;
+// fullScreenUser.value = mySelf;
+// isScreenBeingShared = false;
+// setState(() {
+// isScreenBeingShared = true;
+// });
+// Future.delayed(const Duration(seconds: 2), () {
+// setState(() {
+// isScreenBeingShared = false;
+// });
+// });
+// }
+// userShareStatusFlag.value = !userShareStatusFlag.value;
+// });
+//
+// final shareContentChangedListener = eventListener.addListener(EventType.onShareContentChanged, (data) async {
+// data = data as Map;
+// ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
+// ZoomVideoSdkUser shareUser = ZoomVideoSdkUser.fromJson(jsonDecode(data['user'].toString()));
+// ZoomVideoSdkShareAction? shareAction = ZoomVideoSdkShareAction.fromJson(jsonDecode(data['shareAction']));
+// if (shareAction.shareType == ShareType.Camera) {
+// debugPrint("Camera share started");
+// isSharedCamera.value = (shareUser.userId == mySelf?.userId);
+// }
+// });
+//
+// final userJoinListener = eventListener.addListener(EventType.onUserJoin, (data) async {
+// if (!isMounted()) return;
+// data = data as Map;
+// ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
+// var userListJson = jsonDecode(data['remoteUsers']) as List;
+// List remoteUserList = userListJson.map((userJson) => ZoomVideoSdkUser.fromJson(userJson)).toList();
+// remoteUserList.insert(0, mySelf!);
+// users.value = remoteUserList;
+// });
+//
+// final userLeaveListener = eventListener.addListener(EventType.onUserLeave, (data) async {
+// if (!isMounted()) return;
+// ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
+// data = data as Map;
+// List? remoteUserList = await zoom.session.getRemoteUsers();
+// var leftUserListJson = jsonDecode(data['leftUsers']) as List;
+// List leftUserLis = leftUserListJson.map((userJson) => ZoomVideoSdkUser.fromJson(userJson)).toList();
+// if (fullScreenUser.value != null) {
+// for (var user in leftUserLis) {
+// {
+// if (fullScreenUser.value?.userId == user.userId) {
+// fullScreenUser.value = mySelf;
+// }
+// }
+// }
+// } else {
+// fullScreenUser.value = mySelf;
+// }
+// remoteUserList?.add(mySelf!);
+// users.value = remoteUserList!;
+// });
+//
+// final userNameChangedListener = eventListener.addListener(EventType.onUserNameChanged, (data) async {
+// if (!isMounted()) return;
+// data = data as Map;
+// ZoomVideoSdkUser? changedUser = ZoomVideoSdkUser.fromJson(jsonDecode(data['changedUser']));
+// int index;
+// for (var user in users.value) {
+// if (user.userId == changedUser.userId) {
+// index = users.value.indexOf(user);
+// users.value[index] = changedUser;
+// }
+// }
+// userNameFlag.value = !userNameFlag.value;
+// });
+//
+// final commandReceived = eventListener.addListener(EventType.onCommandReceived, (data) async {
+// data = data as Map;
+// debugPrint("sender: ${ZoomVideoSdkUser.fromJson(jsonDecode(data['sender']))}, command: ${data['command']}");
+// });
+//
+// final liveStreamStatusChangeListener = eventListener.addListener(EventType.onLiveStreamStatusChanged, (data) async {
+// data = data as Map;
+// debugPrint("onLiveStreamStatusChanged: status: ${data['status']}");
+// });
+//
+// final liveTranscriptionStatusChangeListener = eventListener.addListener(EventType.onLiveTranscriptionStatus, (data) async {
+// data = data as Map;
+// debugPrint("onLiveTranscriptionStatus: status: ${data['status']}");
+// });
+//
+// final cloudRecordingStatusListener = eventListener.addListener(EventType.onCloudRecordingStatus, (data) async {
+// data = data as Map;
+// debugPrint("onCloudRecordingStatus: status: ${data['status']}");
+// ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
+// if (data['status'] == RecordingStatus.Start) {
+// if (mySelf != null && !mySelf.isHost!) {
+// showDialog(
+// context: context,
+// builder: (BuildContext context) => AlertDialog(
+// content: const Text('The session is being recorded.'),
+// actions: [
+// TextButton(
+// onPressed: () async {
+// await zoom.acceptRecordingConsent();
+// if (context.mounted) {
+// Navigator.pop(context);
+// }
+// ;
+// },
+// child: const Text('accept'),
+// ),
+// TextButton(
+// onPressed: () async {
+// String currentConsentType = await zoom.getRecordingConsentType();
+// if (currentConsentType == ConsentType.ConsentType_Individual) {
+// await zoom.declineRecordingConsent();
+// Navigator.pop(context);
+// } else {
+// await zoom.declineRecordingConsent();
+// zoom.leaveSession(false);
+// if (!context.mounted) return;
+// Navigator.popAndPushNamed(
+// context,
+// "Join",
+// arguments: JoinArguments(args.isJoin, sessionName.value, sessionPassword.value, args.displayName, args.sessionIdleTimeoutMins, args.role),
+// );
+// }
+// },
+// child: const Text('decline'),
+// ),
+// ],
+// ),
+// );
+// }
+// isRecordingStarted.value = true;
+// } else {
+// isRecordingStarted.value = false;
+// }
+// });
+//
+// final liveTranscriptionMsgInfoReceivedListener = eventListener.addListener(EventType.onLiveTranscriptionMsgInfoReceived, (data) async {
+// data = data as Map;
+// ZoomVideoSdkLiveTranscriptionMessageInfo? messageInfo = ZoomVideoSdkLiveTranscriptionMessageInfo.fromJson(jsonDecode(data['messageInfo']));
+// debugPrint("onLiveTranscriptionMsgInfoReceived: content: ${messageInfo.messageContent}");
+// });
+//
+// final inviteByPhoneStatusListener = eventListener.addListener(EventType.onInviteByPhoneStatus, (data) async {
+// data = data as Map;
+// debugPrint("onInviteByPhoneStatus: status: ${data['status']}, reason: ${data['reason']}");
+// });
+//
+// final multiCameraStreamStatusChangedListener = eventListener.addListener(EventType.onMultiCameraStreamStatusChanged, (data) async {
+// data = data as Map;
+// ZoomVideoSdkUser? changedUser = ZoomVideoSdkUser.fromJson(jsonDecode(data['changedUser']));
+// var status = data['status'];
+// for (var user in users.value) {
+// {
+// if (changedUser.userId == user.userId) {
+// if (status == MultiCameraStreamStatus.Joined) {
+// user.hasMultiCamera = true;
+// } else if (status == MultiCameraStreamStatus.Left) {
+// user.hasMultiCamera = false;
+// }
+// }
+// }
+// }
+// });
+//
+// final requireSystemPermission = eventListener.addListener(EventType.onRequireSystemPermission, (data) async {
+// data = data as Map;
+// ZoomVideoSdkUser? changedUser = ZoomVideoSdkUser.fromJson(jsonDecode(data['changedUser']));
+// var permissionType = data['permissionType'];
+// switch (permissionType) {
+// case SystemPermissionType.Camera:
+// showDialog(
+// context: context,
+// builder: (BuildContext context) => AlertDialog(
+// title: const Text("Can't Access Camera"),
+// content: const Text("please turn on the toggle in system settings to grant permission"),
+// actions: [
+// TextButton(
+// onPressed: () => Navigator.pop(context, 'OK'),
+// child: const Text('OK'),
+// ),
+// ],
+// ),
+// );
+// break;
+// case SystemPermissionType.Microphone:
+// showDialog(
+// context: context,
+// builder: (BuildContext context) => AlertDialog(
+// title: const Text("Can't Access Microphone"),
+// content: const Text("please turn on the toggle in system settings to grant permission"),
+// actions: [
+// TextButton(
+// onPressed: () => Navigator.pop(context, 'OK'),
+// child: const Text('OK'),
+// ),
+// ],
+// ),
+// );
+// break;
+// }
+// });
+//
+// final networkStatusChangeListener = eventListener.addListener(EventType.onUserVideoNetworkStatusChanged, (data) async {
+// data = data as Map;
+// ZoomVideoSdkUser? networkUser = ZoomVideoSdkUser.fromJson(jsonDecode(data['user']));
+//
+// if (data['status'] == NetworkStatus.Bad) {
+// debugPrint("onUserVideoNetworkStatusChanged: status: ${data['status']}, user: ${networkUser.userName}");
+// }
+// });
+//
+// final eventErrorListener = eventListener.addListener(EventType.onError, (data) async {
+// data = data as Map;
+// String errorType = data['errorType'];
+// showDialog(
+// context: context,
+// builder: (BuildContext context) => AlertDialog(
+// title: const Text("Error"),
+// content: Text(errorType),
+// actions: [
+// TextButton(
+// onPressed: () => Navigator.pop(context, 'OK'),
+// child: const Text('OK'),
+// ),
+// ],
+// ),
+// );
+// if (errorType == Errors.SessionJoinFailed || errorType == Errors.SessionDisconnecting) {
+// Timer(
+// const Duration(milliseconds: 1000),
+// () => {
+// Navigator.popAndPushNamed(
+// context,
+// "Join",
+// arguments: JoinArguments(args.isJoin, sessionName.value, sessionPassword.value, args.displayName, args.sessionIdleTimeoutMins, args.role),
+// ),
+// });
+// }
+// });
+//
+// final userRecordingConsentListener = eventListener.addListener(EventType.onUserRecordingConsent, (data) async {
+// data = data as Map;
+// ZoomVideoSdkUser? user = ZoomVideoSdkUser.fromJson(jsonDecode(data['user']));
+// debugPrint('userRecordingConsentListener: user= ${user.userName}');
+// });
+//
+// final callCRCDeviceStatusListener = eventListener.addListener(EventType.onCallCRCDeviceStatusChanged, (data) async {
+// data = data as Map;
+// debugPrint('onCallCRCDeviceStatusChanged: status = ${data['status']}');
+// });
+//
+// final originalLanguageMsgReceivedListener = eventListener.addListener(EventType.onOriginalLanguageMsgReceived, (data) async {
+// data = data as Map;
+// ZoomVideoSdkLiveTranscriptionMessageInfo? messageInfo = ZoomVideoSdkLiveTranscriptionMessageInfo.fromJson(jsonDecode(data['messageInfo']));
+// debugPrint("onOriginalLanguageMsgReceived: content: ${messageInfo.messageContent}");
+// });
+//
+// final chatPrivilegeChangedListener = eventListener.addListener(EventType.onChatPrivilegeChanged, (data) async {
+// data = data as Map;
+// String type = data['privilege'];
+// debugPrint('chatPrivilegeChangedListener: type= $type');
+// });
+//
+// final testMicStatusListener = eventListener.addListener(EventType.onTestMicStatusChanged, (data) async {
+// data = data as Map;
+// String status = data['status'];
+// debugPrint('testMicStatusListener: status= $status');
+// });
+//
+// final micSpeakerVolumeChangedListener = eventListener.addListener(EventType.onMicSpeakerVolumeChanged, (data) async {
+// data = data as Map;
+// int type = data['micVolume'];
+// debugPrint('onMicSpeakerVolumeChanged: micVolume= $type, speakerVolume');
+// });
+//
+// final cameraControlRequestResultListener = eventListener.addListener(EventType.onCameraControlRequestResult, (data) async {
+// data = data as Map;
+// bool approved = data['approved'];
+// debugPrint('onCameraControlRequestResult: approved= $approved');
+// });
+//
+// final callOutUserJoinListener = eventListener.addListener(EventType.onCalloutJoinSuccess, (data) async {
+// data = data as Map;
+// String phoneNumber = data['phoneNumber'];
+// ZoomVideoSdkUser? user = ZoomVideoSdkUser.fromJson(jsonDecode(data['user']));
+// debugPrint('onCalloutJoinSuccess: phoneNumber= $phoneNumber, user= ${user.userName}');
+// });
+//
+// return () => {
+// sessionJoinListener.cancel(),
+// sessionLeaveListener.cancel(),
+// sessionPasswordWrongListener.cancel(),
+// sessionNeedPasswordListener.cancel(),
+// userVideoStatusChangedListener.cancel(),
+// userAudioStatusChangedListener.cancel(),
+// userJoinListener.cancel(),
+// userLeaveListener.cancel(),
+// userNameChangedListener.cancel(),
+// userShareStatusChangeListener.cancel(),
+// liveStreamStatusChangeListener.cancel(),
+// cloudRecordingStatusListener.cancel(),
+// inviteByPhoneStatusListener.cancel(),
+// eventErrorListener.cancel(),
+// commandReceived.cancel(),
+// liveTranscriptionStatusChangeListener.cancel(),
+// liveTranscriptionMsgInfoReceivedListener.cancel(),
+// multiCameraStreamStatusChangedListener.cancel(),
+// requireSystemPermission.cancel(),
+// userRecordingConsentListener.cancel(),
+// networkStatusChangeListener.cancel(),
+// callCRCDeviceStatusListener.cancel(),
+// originalLanguageMsgReceivedListener.cancel(),
+// chatPrivilegeChangedListener.cancel(),
+// testMicStatusListener.cancel(),
+// micSpeakerVolumeChangedListener.cancel(),
+// cameraControlRequestResultListener.cancel(),
+// callOutUserJoinListener.cancel(),
+// shareContentChangedListener.cancel(),
+// };
+// }, [zoom, users.value, isMounted]);
+//
+// void selectVirtualBackgroundItem() async {
+// final ImagePicker picker = ImagePicker();
+// // Pick an image.
+// final XFile? image = await picker.pickImage(source: ImageSource.gallery);
+// await zoom.virtualBackgroundHelper.addVirtualBackgroundItem(image!.path);
+// }
+//
+// void onPressAudio() async {
+// ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
+// if (mySelf != null) {
+// final audioStatus = mySelf.audioStatus;
+// if (audioStatus != null) {
+// var muted = await audioStatus.isMuted();
+// if (muted) {
+// await zoom.audioHelper.unMuteAudio(mySelf.userId);
+// } else {
+// await zoom.audioHelper.muteAudio(mySelf.userId);
+// }
+// }
+// }
+// }
+//
+// void onPressVideo() async {
+// ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
+// if (mySelf != null) {
+// final videoStatus = mySelf.videoStatus;
+// if (videoStatus != null) {
+// var videoOn = await videoStatus.isOn();
+// if (videoOn) {
+// await zoom.videoHelper.stopVideo();
+// } else {
+// await zoom.videoHelper.startVideo();
+// }
+// }
+// }
+// }
+//
+// void onPressShare() async {
+// var isOtherSharing = await zoom.shareHelper.isOtherSharing();
+// var isShareLocked = await zoom.shareHelper.isShareLocked();
+// String? shareCameraViewResult = Errors.InternalError;
+//
+// if (isOtherSharing) {
+// showDialog(
+// context: context,
+// builder: (BuildContext context) => AlertDialog(
+// title: const Text("Error"),
+// content: const Text('Other is sharing'),
+// actions: [
+// TextButton(
+// onPressed: () => Navigator.pop(context, 'OK'),
+// child: const Text('OK'),
+// ),
+// ],
+// ),
+// );
+// } else if (isShareLocked) {
+// showDialog(
+// context: context,
+// builder: (BuildContext context) => AlertDialog(
+// title: const Text("Error"),
+// content: const Text('Share is locked by host'),
+// actions: [
+// TextButton(
+// onPressed: () => Navigator.pop(context, 'OK'),
+// child: const Text('OK'),
+// ),
+// ],
+// ),
+// );
+// } else if (isSharing.value) {
+// zoom.shareHelper.stopShare();
+// } else {
+// List options = [
+// ListTile(
+// title: Text(
+// 'Share Device Screen',
+// style: TextStyle(
+// fontSize: 14,
+// fontWeight: FontWeight.normal,
+// color: Colors.black,
+// ),
+// ),
+// onTap: () async => {
+// zoom.shareHelper.shareScreen(),
+// Navigator.of(context).pop(),
+// },
+// ),
+// ListTile(
+// title: Text(
+// 'Share Camera',
+// style: TextStyle(
+// fontSize: 14,
+// fontWeight: FontWeight.normal,
+// color: Colors.black,
+// ),
+// ),
+// onTap: () async => {
+// shareCameraViewResult = await zoom.shareHelper.startShareCamera(cameraShareView),
+// debugPrint('start camera: $shareCameraViewResult'),
+// Navigator.of(context).pop(),
+// },
+// ),
+// ];
+// showDialog(
+// context: context,
+// builder: (context) {
+// return Dialog(
+// elevation: 0.0,
+// insetPadding: const EdgeInsets.symmetric(horizontal: 40),
+// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
+// child: SizedBox(
+// height: options.length * 60,
+// child: Scrollbar(
+// child: ListView(
+// shrinkWrap: true,
+// scrollDirection: Axis.vertical,
+// children: ListTile.divideTiles(
+// context: context,
+// tiles: options,
+// ).toList(),
+// ),
+// ),
+// ),
+// );
+// });
+// }
+// }
+//
+// void onSelectedUserVolume(ZoomVideoSdkUser user) async {
+// var isShareAudio = user.isSharing;
+// bool canSetVolume = await user.canSetUserVolume(user.userId, isShareAudio);
+// num userVolume;
+//
+// List options = [
+// ListTile(
+// title: Text(
+// 'Adjust Volume',
+// style: const TextStyle(
+// fontSize: 18,
+// fontWeight: FontWeight.w600,
+// color: Colors.black,
+// ),
+// ),
+// ),
+// ListTile(
+// title: Text(
+// 'Current volume',
+// style: const TextStyle(
+// fontSize: 14,
+// fontWeight: FontWeight.normal,
+// color: Colors.black,
+// ),
+// ),
+// onTap: () async => {
+// debugPrint('user volume'),
+// userVolume = await user.getUserVolume(user.userId, isShareAudio),
+// debugPrint('user ${user.userName}\'s volume is ${userVolume!}'),
+// },
+// ),
+// ];
+// if (canSetVolume) {
+// options.add(
+// ListTile(
+// title: Text(
+// 'Volume up',
+// style: const TextStyle(
+// fontSize: 14,
+// fontWeight: FontWeight.normal,
+// color: Colors.black,
+// ),
+// ),
+// onTap: () async => {
+// userVolume = await user.getUserVolume(user.userId, isShareAudio),
+// if (userVolume < 10)
+// {
+// await user.setUserVolume(user.userId, userVolume + 1, isShareAudio),
+// }
+// else
+// {
+// debugPrint("Cannot volume up."),
+// }
+// },
+// ),
+// );
+// options.add(
+// ListTile(
+// title: Text(
+// 'Volume down',
+// style: const TextStyle(
+// fontSize: 14,
+// fontWeight: FontWeight.normal,
+// color: Colors.black,
+// ),
+// ),
+// onTap: () async => {
+// userVolume = await user.getUserVolume(user.userId, isShareAudio),
+// if (userVolume > 0)
+// {
+// await user.setUserVolume(user.userId, userVolume - 1, isShareAudio),
+// }
+// else
+// {
+// debugPrint("Cannot volume down."),
+// }
+// },
+// ),
+// );
+// }
+// showDialog(
+// context: context,
+// builder: (context) {
+// return Dialog(
+// elevation: 0.0,
+// insetPadding: const EdgeInsets.symmetric(horizontal: 40),
+// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
+// child: SizedBox(
+// height: options.length * 58,
+// child: Column(
+// crossAxisAlignment: CrossAxisAlignment.stretch,
+// children: [
+// ListView(
+// shrinkWrap: true,
+// children: ListTile.divideTiles(
+// context: context,
+// tiles: options,
+// ).toList(),
+// ),
+// ],
+// ),
+// ));
+// });
+// }
+//
+// void onPressCameraList() async {
+// List options = [];
+// List cameraList = await zoom.videoHelper.getCameraList();
+// for (var camera in cameraList) {
+// options.add(
+// ListTile(
+// title: Text(
+// camera.deviceName,
+// style: const TextStyle(
+// fontSize: 14,
+// fontWeight: FontWeight.normal,
+// color: Colors.black,
+// ),
+// ),
+// onTap: () async => {
+// await zoom.videoHelper.switchCamera(camera.deviceId),
+// Navigator.of(context).pop(),
+// },
+// ),
+// );
+// }
+// options.add(
+// ListTile(
+// title: Text(
+// "Cancel",
+// style: const TextStyle(
+// fontSize: 14,
+// fontWeight: FontWeight.normal,
+// color: Colors.black,
+// ),
+// ),
+// onTap: () async => {
+// Navigator.of(context).pop(),
+// },
+// ),
+// );
+// showDialog(
+// context: context,
+// builder: (context) {
+// return Dialog(
+// elevation: 0.0,
+// insetPadding: const EdgeInsets.symmetric(horizontal: 40),
+// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
+// child: SizedBox(
+// height: options.length * 60,
+// child: Scrollbar(
+// child: ListView(
+// shrinkWrap: true,
+// scrollDirection: Axis.vertical,
+// children: ListTile.divideTiles(
+// context: context,
+// tiles: options,
+// ).toList(),
+// ),
+// ),
+// ),
+// );
+// });
+// }
+//
+// // Future onPressMore() async {
+// // ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
+// // bool isShareLocked = await zoom.shareHelper.isShareLocked();
+// // bool canSwitchSpeaker = await zoom.audioHelper.canSwitchSpeaker();
+// // bool canStartRecording = (await zoom.recordingHelper.canStartRecording()) == Errors.Success;
+// // debugPrint("canStartRecording ${await zoom.recordingHelper.canStartRecording()}");
+// // var startLiveTranscription = (await zoom.liveTranscriptionHelper.getLiveTranscriptionStatus()) == LiveTranscriptionStatus.Start;
+// // bool canStartLiveTranscription = await zoom.liveTranscriptionHelper.canStartLiveTranscription();
+// // bool isHost = (mySelf != null) ? (await mySelf.getIsHost()) : false;
+// // isOriginalAspectRatio.value = await zoom.videoHelper.isOriginalAspectRatioEnabled();
+// // bool canCallOutToCRC = await zoom.CRCHelper.isCRCEnabled();
+// // bool supportVB = await zoom.virtualBackgroundHelper.isSupportVirtualBackground();
+// // List? shareActionList = await mySelf?.getShareActionList();
+// //
+// // List options = [
+// // ListTile(
+// // title: Text(
+// // 'More',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 18,
+// // fontWeight: FontWeight.w600,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // ),
+// // ListTile(
+// // title: Text(
+// // 'Get Chat Privilege',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // debugPrint("Chat Privilege = ${await zoom.chatHelper.getChatPrivilege()}"),
+// // Navigator.of(context).pop(),
+// // },
+// // ),
+// // ListTile(
+// // title: Text(
+// // 'Get Session Dial-in Number infos',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // debugPrint("session number = ${await zoom.session.getSessionNumber()}"),
+// // Navigator.of(context).pop(),
+// // },
+// // ),
+// // ListTile(
+// // title: Text(
+// // 'Get Camera List',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // debugPrint("camera list= ${await zoom.videoHelper.getCameraList()}"),
+// // onPressCameraList(),
+// // Navigator.of(context).pop(),
+// // },
+// // ),
+// // ListTile(
+// // title: Text(
+// // '${isMicOriginalOn.value ? 'Disable' : 'Enable'} Original Sound',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // debugPrint("${isMicOriginalOn.value}"),
+// // await zoom.audioSettingHelper.enableMicOriginalInput(!isMicOriginalOn.value),
+// // isMicOriginalOn.value = await zoom.audioSettingHelper.isMicOriginalInputEnable(),
+// // debugPrint("Original sound ${isMicOriginalOn.value ? 'Enabled' : 'Disabled'}"),
+// // Navigator.of(context).pop(),
+// // },
+// // )
+// // ];
+// //
+// // if (supportVB) {
+// // options.add(
+// // ListTile(
+// // title: Text(
+// // 'Add Virtual Background',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // selectVirtualBackgroundItem(),
+// // Navigator.of(context).pop(),
+// // },
+// // ),
+// // );
+// // }
+// //
+// // if (canCallOutToCRC) {
+// // options.add(ListTile(
+// // title: Text(
+// // 'Call-out to CRC devices',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // debugPrint('CRC result = ${await zoom.CRCHelper.callCRCDevice("bjn.vc", ZoomVideoSdkCRCProtocolType.SIP)}'),
+// // Navigator.of(context).pop(),
+// // },
+// // ));
+// // options.add(ListTile(
+// // title: Text(
+// // 'Cancel call-out to CRC devices',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // debugPrint('cancel result= ${await zoom.CRCHelper.cancelCallCRCDevice()}'),
+// // Navigator.of(context).pop(),
+// // },
+// // ));
+// // }
+// //
+// // if (canSwitchSpeaker) {
+// // options.add(ListTile(
+// // title: Text(
+// // 'Turn ${isSpeakerOn.value ? 'off' : 'on'} Speaker',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // await zoom.audioHelper.setSpeaker(!isSpeakerOn.value),
+// // isSpeakerOn.value = await zoom.audioHelper.getSpeakerStatus(),
+// // debugPrint('Turned ${isSpeakerOn.value ? 'on' : 'off'} Speaker'),
+// // Navigator.of(context).pop(),
+// // },
+// // ));
+// // }
+// //
+// // if (isHost) {
+// // options.add(ListTile(
+// // title: Text(
+// // '${isShareLocked ? 'Unlock' : 'Lock'} Share',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // debugPrint("isShareLocked = ${await zoom.shareHelper.lockShare(!isShareLocked)}"),
+// // Navigator.of(context).pop(),
+// // }));
+// // options.add(ListTile(
+// // title: Text(
+// // 'Change Name',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () => {
+// // isRenameModalVisible.value = true,
+// // Navigator.of(context).pop(),
+// // },
+// // ));
+// // }
+// //
+// // if (canStartLiveTranscription) {
+// // options.add(ListTile(
+// // title: Text(
+// // "${startLiveTranscription ? 'Stop' : 'Start'} Live Transcription",
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // if (startLiveTranscription)
+// // {
+// // debugPrint('stopLiveTranscription= ${await zoom.liveTranscriptionHelper.stopLiveTranscription()}'),
+// // }
+// // else
+// // {
+// // debugPrint('startLiveTranscription= ${await zoom.liveTranscriptionHelper.startLiveTranscription()}'),
+// // },
+// // Navigator.of(context).pop(),
+// // },
+// // ));
+// // options.add(ListTile(
+// // title: Text(
+// // '${isReceiveSpokenLanguageContentEnabled.value ? 'Disable' : 'Enable'} receiving original caption',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // await zoom.liveTranscriptionHelper.enableReceiveSpokenLanguageContent(!isReceiveSpokenLanguageContentEnabled.value),
+// // isReceiveSpokenLanguageContentEnabled.value = await zoom.liveTranscriptionHelper.isReceiveSpokenLanguageContentEnabled(),
+// // debugPrint("isReceiveSpokenLanguageContentEnabled = ${isReceiveSpokenLanguageContentEnabled.value}"),
+// // Navigator.of(context).pop(),
+// // }));
+// // }
+// //
+// // if (canStartRecording) {
+// // options.add(ListTile(
+// // title: Text(
+// // '${isRecordingStarted.value ? 'Stop' : 'Start'} Recording',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // if (!isRecordingStarted.value)
+// // {
+// // debugPrint('isRecordingStarted = ${await zoom.recordingHelper.startCloudRecording()}'),
+// // }
+// // else
+// // {
+// // debugPrint('isRecordingStarted = ${await zoom.recordingHelper.stopCloudRecording()}'),
+// // },
+// // Navigator.of(context).pop(),
+// // }));
+// // }
+// //
+// // if (Platform.isAndroid) {
+// // bool isFlashlightSupported = await zoom.videoHelper.isSupportFlashlight();
+// // bool isFlashlightOn = await zoom.videoHelper.isFlashlightOn();
+// // if (isFlashlightSupported) {
+// // options.add(ListTile(
+// // title: Text(
+// // '${isFlashlightOn ? 'Turn Off' : 'Turn On'} Flashlight',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // if (!isFlashlightOn)
+// // {
+// // await zoom.videoHelper.turnOnOrOffFlashlight(true),
+// // }
+// // else
+// // {
+// // await zoom.videoHelper.turnOnOrOffFlashlight(false),
+// // },
+// // Navigator.of(context).pop(),
+// // }));
+// // }
+// // }
+// //
+// // if (Platform.isIOS) {
+// // options.add(ListTile(
+// // title: Text(
+// // '${isPiPView.value ? 'Disable' : 'Enable'} picture in picture view',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // isPiPView.value = !isPiPView.value,
+// // Navigator.of(context).pop(),
+// // }));
+// // }
+// //
+// // if (isVideoOn.value) {
+// // options.add(ListTile(
+// // title: Text(
+// // 'Mirror the video',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // await zoom.videoHelper.mirrorMyVideo(!isVideoMirrored.value),
+// // isVideoMirrored.value = await zoom.videoHelper.isMyVideoMirrored(),
+// // Navigator.of(context).pop(),
+// // }));
+// // options.add(ListTile(
+// // title: Text(
+// // '${isOriginalAspectRatio.value ? 'Enable' : 'Disable'} original aspect ratio',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.normal,
+// // color: Colors.black,
+// // ),
+// // ),
+// // ),
+// // onTap: () async => {
+// // await zoom.videoHelper.enableOriginalAspectRatio(!isOriginalAspectRatio.value),
+// // isOriginalAspectRatio.value = await zoom.videoHelper.isOriginalAspectRatioEnabled(),
+// // debugPrint("isOriginalAspectRatio= ${isOriginalAspectRatio.value}"),
+// // Navigator.of(context).pop(),
+// // }));
+// // }
+// //
+// // showDialog(
+// // context: context,
+// // builder: (context) {
+// // return Dialog(
+// // elevation: 0.0,
+// // insetPadding: const EdgeInsets.symmetric(horizontal: 40),
+// // shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
+// // child: SizedBox(
+// // height: 500,
+// // child: Scrollbar(
+// // child: ListView(
+// // shrinkWrap: true,
+// // scrollDirection: Axis.vertical,
+// // children: ListTile.divideTiles(
+// // context: context,
+// // tiles: options,
+// // ).toList(),
+// // ),
+// // ),
+// // ),
+// // );
+// // });
+// // }
+//
+// void onLeaveSession(bool isEndSession) async {
+// await zoom.leaveSession(isEndSession);
+// Navigator.pushAndRemoveUntil(
+// context,
+// CustomPageRoute(
+// page: LandingNavigation(),
+// ),
+// (r) => false);
+// }
+//
+// void showLeaveOptions() async {
+// ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
+// bool isHost = await mySelf!.getIsHost();
+//
+// Widget endSession;
+// Widget leaveSession;
+// Widget cancel = TextButton(
+// child: const Text('Cancel'),
+// onPressed: () {
+// Navigator.pop(context); //close Dialog
+// },
+// );
+//
+// switch (defaultTargetPlatform) {
+// case TargetPlatform.android:
+// endSession = TextButton(
+// child: const Text('End Session'),
+// onPressed: () => onLeaveSession(true),
+// );
+// leaveSession = TextButton(
+// child: const Text('Leave Session'),
+// onPressed: () => onLeaveSession(false),
+// );
+// break;
+// default:
+// endSession = CupertinoActionSheetAction(
+// isDestructiveAction: true,
+// child: const Text('End Session'),
+// onPressed: () => onLeaveSession(true),
+// );
+// leaveSession = CupertinoActionSheetAction(
+// child: const Text('Leave Session'),
+// onPressed: () => onLeaveSession(false),
+// );
+// break;
+// }
+//
+// List options = [
+// leaveSession,
+// cancel,
+// ];
+//
+// if (Platform.isAndroid) {
+// if (isHost) {
+// options.removeAt(1);
+// options.insert(0, endSession);
+// }
+// showDialog(
+// context: context,
+// builder: (context) {
+// return AlertDialog(
+// content: const Text("Do you want to leave this session?"),
+// shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(2.0))),
+// actions: options,
+// );
+// });
+// } else {
+// options.removeAt(1);
+// if (isHost) {
+// options.insert(1, endSession);
+// }
+// showCupertinoModalPopup(
+// context: context,
+// builder: (context) => CupertinoActionSheet(
+// message: const Text('Are you sure that you want to leave the session?'),
+// actions: options,
+// cancelButton: cancel,
+// ),
+// );
+// }
+// }
+//
+// final chatMessageController = TextEditingController();
+//
+// void sendChatMessage(String message) async {
+// await zoom.chatHelper.sendChatToAll(message);
+// ZoomVideoSdkUser? self = await zoom.session.getMySelf();
+// ZoomVideoSdkCmdChannel cmdChannel = zoom.cmdChannel;
+// for (var user in users.value) {
+// if (user.userId != self?.userId) {
+// await zoom.cmdChannel.sendCommand(user.userId, message);
+// }
+// }
+// chatMessageController.clear();
+// // send the chat as a command
+// }
+//
+// void onSelectedUser(ZoomVideoSdkUser user) async {
+// setState(() {
+// fullScreenUser.value = user;
+// });
+// }
+//
+// changeNamePopup = Center(
+// child: Stack(
+// children: [
+// Visibility(
+// visible: isRenameModalVisible.value,
+// child: Row(
+// mainAxisSize: MainAxisSize.min,
+// children: [
+// Container(
+// alignment: Alignment.bottomLeft,
+// decoration: const BoxDecoration(
+// borderRadius: BorderRadius.all(Radius.circular(10)),
+// color: Colors.white,
+// ),
+// width: MediaQuery.of(context).size.width - 130,
+// height: MediaQuery.of(context).size.height * 0.2,
+// child: Center(
+// child: (Column(
+// crossAxisAlignment: CrossAxisAlignment.start,
+// children: [
+// Padding(
+// padding: const EdgeInsets.only(top: 20, left: 20),
+// child: Text(
+// 'Change Name',
+// style: const TextStyle(
+// fontSize: 18,
+// fontWeight: FontWeight.w500,
+// ),
+// ),
+// ),
+// Padding(
+// padding: const EdgeInsets.only(top: 10, left: 20),
+// child: SizedBox(
+// width: MediaQuery.of(context).size.width - 230,
+// child: TextField(
+// onEditingComplete: () {},
+// autofocus: true,
+// cursorColor: Colors.black,
+// controller: changeNameController,
+// decoration: InputDecoration(
+// isDense: true,
+// hintText: 'New name',
+// hintStyle: TextStyle(
+// fontSize: 14.0,
+// color: chatTextColor,
+// ),
+// ),
+// ),
+// ),
+// ),
+// Padding(
+// padding: const EdgeInsets.only(top: 15),
+// child: Row(
+// children: [
+// Padding(
+// padding: const EdgeInsets.only(left: 40),
+// child: InkWell(
+// child: Text(
+// 'Apply',
+// style: const TextStyle(
+// fontSize: 16,
+// ),
+// ),
+// onTap: () async {
+// if (fullScreenUser.value != null) {
+// ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
+// await zoom.userHelper.changeName((mySelf?.userId)!, changeNameController.text);
+// changeNameController.clear();
+// }
+// isRenameModalVisible.value = false;
+// },
+// ),
+// ),
+// Padding(
+// padding: const EdgeInsets.only(left: 40),
+// child: InkWell(
+// child: Text(
+// 'Cancel',
+// style: const TextStyle(
+// fontSize: 16,
+// ),
+// ),
+// onTap: () async {
+// isRenameModalVisible.value = false;
+// },
+// ),
+// )
+// ],
+// ),
+// )
+// ],
+// )),
+// ),
+// ),
+// ],
+// )),
+// ],
+// ),
+// );
+//
+// Widget fullScreenView;
+// Widget smallView;
+// Widget cameraView;
+//
+// if (isInSession.value && fullScreenUser.value != null && users.value.isNotEmpty) {
+// fullScreenView = AnimatedOpacity(
+// opacity: opacityLevel,
+// duration: const Duration(seconds: 3),
+// child: VideoView(
+// user: users.value.length > 1 ? users.value[1] : users.value[0],
+// hasMultiCamera: false,
+// isPiPView: isPiPView.value,
+// sharing: sharingUser.value == null ? false : (sharingUser.value?.userId == fullScreenUser.value?.userId),
+// preview: false,
+// focused: false,
+// multiCameraIndex: "0",
+// videoAspect: VideoAspect.Original,
+// fullScreen: true,
+// resolution: VideoResolution.Resolution360,
+// ),
+// );
+//
+// smallView = Container(
+// height: 110,
+// margin: const EdgeInsets.only(left: 20, right: 20),
+// alignment: Alignment.center,
+// child: ListView.separated(
+// scrollDirection: Axis.horizontal,
+// itemCount: users.value.length,
+// itemBuilder: (BuildContext context, int index) {
+// return InkWell(
+// onTap: () async {
+// onSelectedUser(users.value[index]);
+// },
+// onDoubleTap: () async {
+// onSelectedUserVolume(users.value[index]);
+// },
+// child: Center(
+// child: VideoView(
+// user: users.value[index],
+// hasMultiCamera: false,
+// isPiPView: false,
+// sharing: false,
+// preview: false,
+// focused: false,
+// multiCameraIndex: "0",
+// videoAspect: VideoAspect.Original,
+// fullScreen: false,
+// resolution: VideoResolution.Resolution180,
+// ),
+// ),
+// );
+// },
+// separatorBuilder: (BuildContext context, int index) => const Divider(),
+// ),
+// );
+// } else {
+// fullScreenView = Container(
+// color: Colors.black,
+// child: const Center(
+// child: Text(
+// "Connecting...",
+// style: TextStyle(
+// fontSize: 20,
+// color: Colors.white,
+// ),
+// ),
+// ));
+// smallView = Container(
+// height: 110,
+// color: Colors.transparent,
+// );
+// }
+//
+// cameraView = Offstage(
+// offstage: !isSharedCamera.value,
+// child: AnimatedOpacity(
+// opacity: isSharedCamera.value ? 1.0 : 0.0,
+// duration: const Duration(milliseconds: 300),
+// child: cameraShareView,
+// ),
+// );
+//
+// _changeOpacity;
+// return Scaffold(
+// resizeToAvoidBottomInset: false,
+// backgroundColor: backgroundColor,
+// body: Stack(
+// children: [
+// // isScreenBeingShared ? fullScreenView : SizedBox.shrink(),
+// isScreenBeingShared ? SizedBox.shrink() : fullScreenView,
+// cameraView,
+// Container(
+// padding: const EdgeInsets.only(top: 35),
+// child: Stack(
+// children: [
+// Row(
+// crossAxisAlignment: CrossAxisAlignment.start,
+// mainAxisAlignment: MainAxisAlignment.spaceBetween,
+// children: [
+// Container(
+// height: 80,
+// width: 180,
+// margin: const EdgeInsets.only(top: 16, left: 8),
+// padding: const EdgeInsets.all(8),
+// alignment: Alignment.topLeft,
+// decoration: BoxDecoration(
+// borderRadius: const BorderRadius.all(Radius.circular(8.0)),
+// // color: buttonBackgroundColor,
+// ),
+// // child: InkWell(
+// // onTap: () async {
+// // showDialog(
+// // context: context,
+// // builder: (context) {
+// // return Dialog(
+// // elevation: 0.0,
+// // insetPadding: const EdgeInsets.symmetric(horizontal: 40),
+// // shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
+// // child: FractionallySizedBox(
+// // heightFactor: 0.2,
+// // widthFactor: 0.3,
+// // child: Column(
+// // crossAxisAlignment: CrossAxisAlignment.stretch,
+// // children: [
+// // ListView(
+// // shrinkWrap: true,
+// // children: ListTile.divideTiles(
+// // context: context,
+// // tiles: [
+// // ListTile(
+// // title: Text(
+// // 'Session Information',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 18,
+// // fontWeight: FontWeight.w600,
+// // ),
+// // ),
+// // ),
+// // ),
+// // ListTile(
+// // title: Text(
+// // 'Session Name',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // ),
+// // ),
+// // ),
+// // subtitle: Text(
+// // sessionName.value,
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 12,
+// // ),
+// // ),
+// // ),
+// // ),
+// // ListTile(
+// // title: Text(
+// // 'Session Password',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // ),
+// // ),
+// // ),
+// // subtitle: Text(
+// // sessionPassword.value,
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 12,
+// // ),
+// // ),
+// // ),
+// // ),
+// // ListTile(
+// // title: Text(
+// // 'Participants',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // ),
+// // ),
+// // ),
+// // subtitle: Text(
+// // '${users.value.length}',
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 12,
+// // ),
+// // ),
+// // ),
+// // ),
+// // ],
+// // ).toList(),
+// // ),
+// // ],
+// // ),
+// // ));
+// // });
+// // },
+// // child: Stack(
+// // children: [
+// // Column(
+// // children: [
+// // const Padding(padding: EdgeInsets.symmetric(vertical: 4)),
+// // Align(
+// // alignment: Alignment.centerLeft,
+// // child: Text(
+// // sessionName.value,
+// // overflow: TextOverflow.ellipsis,
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.w600,
+// // color: Colors.white,
+// // ),
+// // ),
+// // ),
+// // ),
+// // const Padding(padding: EdgeInsets.symmetric(vertical: 5)),
+// // Align(
+// // alignment: Alignment.centerLeft,
+// // child: Text(
+// // "Participants: ${users.value.length}",
+// // style: GoogleFonts.lato(
+// // textStyle: const TextStyle(
+// // fontSize: 14,
+// // fontWeight: FontWeight.w600,
+// // color: Colors.white,
+// // ),
+// // ),
+// // ),
+// // )
+// // ],
+// // ),
+// // Container(
+// // alignment: Alignment.centerRight,
+// // child: Image.asset(
+// // "assets/icons/unlocked@2x.png",
+// // height: 22,
+// // )),
+// // ],
+// // ),
+// // ),
+// ),
+// TextButton(
+// onPressed: (showLeaveOptions),
+// child: Container(
+// alignment: Alignment.topRight,
+// margin: const EdgeInsets.only(top: 16, right: 8),
+// padding: const EdgeInsets.only(top: 5, bottom: 5, left: 16, right: 16),
+// height: 28,
+// decoration: BoxDecoration(
+// borderRadius: const BorderRadius.all(Radius.circular(20.0)),
+// color: buttonBackgroundColor,
+// ),
+// child: const Text(
+// "LEAVE",
+// style: TextStyle(
+// fontSize: 14,
+// fontWeight: FontWeight.bold,
+// color: Color(0xFFE02828),
+// ),
+// ),
+// )),
+// ],
+// ),
+// Align(
+// alignment: Alignment.centerRight,
+// child: FractionallySizedBox(
+// widthFactor: 0.2,
+// heightFactor: 0.6,
+// child: Column(
+// mainAxisAlignment: MainAxisAlignment.center,
+// children: [
+// IconButton(
+// onPressed: onPressAudio,
+// icon: isMuted.value ? Image.asset("assets/images/png/zoom/unmute@2x.png") : Image.asset("assets/images/png/zoom/mute@2x.png"),
+// iconSize: circleButtonSize,
+// tooltip: isMuted.value == true ? "Unmute" : "Mute",
+// ),
+// IconButton(
+// onPressed: onPressShare,
+// icon: isSharing.value ? Image.asset("assets/images/png/zoom/share-off@2x.png") : Image.asset("assets/images/png/zoom/share-on@2x.png"),
+// iconSize: circleButtonSize,
+// ),
+// IconButton(
+// onPressed: onPressVideo,
+// iconSize: circleButtonSize,
+// icon: isVideoOn.value ? Image.asset("assets/images/png/zoom/video-off@2x.png") : Image.asset("assets/images/png/zoom/video-on@2x.png"),
+// ),
+// Column(
+// children: [
+// IconButton(
+// onPressed: () async {
+// onPressCameraList();
+// },
+// icon: Icon(Icons.cameraswitch, color: Colors.white),
+// color: Colors.white,
+// iconSize: 40.h,
+// ),
+// "Switch Camera".toText12(color: AppColors.whiteColor, isCenter: true, isBold: true)
+// ],
+// ),
+// ],
+// ),
+// )),
+// Container(
+// margin: const EdgeInsets.only(left: 16, right: 16, bottom: 40, top: 10),
+// alignment: Alignment.bottomCenter,
+// child: SizedBox(
+// height: MediaQuery.of(context).viewInsets.bottom == 0 ? 65 : MediaQuery.of(context).viewInsets.bottom + 18,
+// child: TextField(
+// maxLines: 1,
+// textAlign: TextAlign.left,
+// style: TextStyle(color: chatTextColor),
+// cursorColor: chatTextColor,
+// textAlignVertical: TextAlignVertical.center,
+// controller: chatMessageController,
+// decoration: InputDecoration(
+// contentPadding: const EdgeInsets.only(left: 16, top: 10, bottom: 10, right: 16),
+// enabledBorder: OutlineInputBorder(
+// borderSide: BorderSide(width: 1, color: chatTextColor), //<-- SEE HERE
+// ),
+// hintText: 'Type your message here...',
+// hintStyle: TextStyle(
+// fontSize: 14.0,
+// color: chatTextColor,
+// ),
+// ),
+// onSubmitted: (String str) {
+// sendChatMessage(str);
+// },
+// ),
+// ),
+// ),
+// Container(
+// alignment: Alignment.bottomLeft,
+// margin: const EdgeInsets.only(bottom: 120),
+// child: smallView,
+// ),
+// // CommentList(zoom: zoom, eventListener: eventListener),
+// changeNamePopup,
+// ],
+// )),
+// ],
+// ));
+// }
+// }
+//
+// class CallArguments {
+// final bool isJoin;
+// final String sessionName;
+// final String sessionPwd;
+// final String displayName;
+// final String sessionIdleTimeoutMins;
+// final String role;
+// final int callType;
+//
+// CallArguments(this.sessionName, this.sessionPwd, this.displayName, this.sessionIdleTimeoutMins, this.role, this.isJoin, this.callType);
+// }
+//
+// class JoinArguments {
+// final bool isJoin;
+// final String sessionName;
+// final String sessionPwd;
+// final String displayName;
+// final String sessionTimeout;
+// final String roleType;
+//
+// JoinArguments(this.isJoin, this.sessionName, this.sessionPwd, this.displayName, this.sessionTimeout, this.roleType);
+// }
diff --git a/lib/presentation/tele_consultation/zoom/video_view.dart b/lib/presentation/tele_consultation/zoom/video_view.dart
index 4c1e0494..a6b2428f 100644
--- a/lib/presentation/tele_consultation/zoom/video_view.dart
+++ b/lib/presentation/tele_consultation/zoom/video_view.dart
@@ -1,258 +1,258 @@
-import 'dart:async';
-
-import 'package:flutter/material.dart';
-import 'package:flutter_hooks/flutter_hooks.dart';
-import 'package:flutter_zoom_videosdk/flutter_zoom_view.dart' as FlutterZoomView;
-import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart';
-
-const SHOW_TALKING_ICON_DURATION = 2000;
-
-class VideoView extends FlutterZoomView.ZoomView {
- const VideoView({
- super.key,
- required super.user,
- required super.sharing,
- required super.preview,
- required super.focused,
- required super.hasMultiCamera,
- required super.multiCameraIndex,
- required super.videoAspect,
- required super.fullScreen,
- required super.resolution,
- required super.isPiPView,
- });
-
- @override
- Widget build(BuildContext context) {
- var isVideoOn = useState(false);
- var isTalking = useState(false);
- var isMuted = useState(false);
- var isMounted = useIsMounted();
- var zoom = ZoomVideoSdk();
- var isSharing = useState(false);
- user?.audioStatus?.isMuted().then((muted) => isMuted.value = muted);
-
- useEffect(() {
- updateVideoStatus() {
- if (user == null) return;
- Future.microtask(() async {
- if (isMounted()) {
- isVideoOn.value = (await user!.videoStatus!.isOn());
- isSharing.value = sharing;
- }
- });
- }
-
- resetAudioStatus() {
- isTalking.value = false;
- isMuted.value = false;
- }
-
- updateAudioStatus() async {
- if (!isMounted()) return;
- var talking = await user?.audioStatus?.isTalking();
- var muted = await user?.audioStatus?.isMuted();
- isMuted.value = muted!;
- isTalking.value = talking!;
- if (talking) {
- Timer(
- const Duration(milliseconds: SHOW_TALKING_ICON_DURATION),
- () => {
- if (isMounted())
- {
- isTalking.value = false,
- }
- });
- }
- }
-
- updateVideoStatus();
- return null;
- }, [zoom, user]);
-
- ImageIcon audioStatusIcon;
- if (isTalking.value) {
- audioStatusIcon = const ImageIcon(
- AssetImage("assets/images/png/zoom/talking@2x.png"),
- );
- } else if (isMuted.value) {
- audioStatusIcon = const ImageIcon(
- AssetImage("assets/images/png/zoom/muted@2x.png"),
- );
- }
- // Pass parameters to the platform side.
- final Map creationParams = {};
- creationParams.putIfAbsent("userId", () => user?.userId);
- creationParams.putIfAbsent("sharing", () => sharing);
- creationParams.putIfAbsent("preview", () => preview);
- creationParams.putIfAbsent("focused", () => focused);
- creationParams.putIfAbsent("hasMultiCamera", () => hasMultiCamera);
- if (videoAspect.isEmpty) {
- creationParams.putIfAbsent("videoAspect", () => VideoAspect.PanAndScan);
- } else {
- creationParams.putIfAbsent("videoAspect", () => videoAspect);
- }
- creationParams.putIfAbsent("fullScreen", () => fullScreen);
- if (resolution.isNotEmpty) {
- creationParams.putIfAbsent("videoAspect", () => videoAspect);
- }
-
- if (fullScreen) {
- if (sharing) {
- return Container(
- height: MediaQuery.of(context).size.height,
- width: MediaQuery.of(context).size.width,
- alignment: Alignment.center,
- child: FlutterZoomView.View(creationParams: creationParams),
- );
- } else if (isVideoOn.value) {
- return Container(
- height: MediaQuery.of(context).size.height,
- width: MediaQuery.of(context).size.width,
- alignment: Alignment.center,
- child: FlutterZoomView.View(creationParams: creationParams),
- );
- } else {
- return Container(
- margin: const EdgeInsets.symmetric(vertical: 0),
- child: Container(
- alignment: Alignment.center,
- child: const Image(
- image: AssetImage("assets/images/png/zoom/default-avatar.png"),
- )),
- );
- }
- } else {
- if (isVideoOn.value || sharing) {
- return Container(
- padding: const EdgeInsets.symmetric(horizontal: 8),
- height: 110,
- width: 110,
- child: Stack(
- children: [
- Container(
- height: 110,
- width: 110,
- decoration: BoxDecoration(
- color: const Color(0xff232323),
- border: Border.all(
- color: const Color(0xff666666),
- width: 1,
- ),
- borderRadius: const BorderRadius.all(Radius.circular(8)),
- ),
- alignment: Alignment.center,
- child: FlutterZoomView.View(creationParams: creationParams),
- ),
- Container(
- height: 110,
- width: 110,
- decoration: const BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(8)),
- ),
- ),
- Container(
- alignment: Alignment.bottomCenter,
- child: Container(
- height: 20,
- width: 110,
- decoration: const BoxDecoration(
- color: Colors.black26,
- borderRadius: BorderRadius.all(Radius.circular(8)),
- ),
- ),
- ),
- Container(
- alignment: Alignment.bottomLeft,
- margin: const EdgeInsets.only(left: 5),
- child: Text(
- user!.userName,
- textAlign: TextAlign.left,
- style: const TextStyle(
- color: Colors.white,
- fontSize: 12,
- ),
- ),
- ),
- Container(
- alignment: Alignment.bottomRight,
- margin: const EdgeInsets.only(right: 5, bottom: 5),
- // height: 110,
- // width: 110,
- child: Image(
- height: 12,
- width: 12,
- image: isMuted.value ? const AssetImage("assets/images/png/zoom/muted@2x.png") : const AssetImage("assets/images/png/zoom/talking@2x.png"),
- fit: BoxFit.cover,
- ),
- )
- ],
- ),
- );
- } else {
- return Container(
- padding: const EdgeInsets.symmetric(horizontal: 8),
- height: 110,
- width: 110,
- child: Stack(
- children: [
- Container(
- height: 110,
- width: 110,
- decoration: BoxDecoration(
- color: const Color(0xff232323),
- border: Border.all(
- color: const Color(0xff666666),
- width: 1,
- ),
- borderRadius: const BorderRadius.all(Radius.circular(8)),
- ),
- alignment: Alignment.center,
- child: Container(
- alignment: Alignment.center,
- child: const Image(
- height: 60,
- width: 60,
- image: AssetImage("assets/images/png/zoom/default-avatar.png"),
- )),
- ),
- Align(
- alignment: Alignment.bottomCenter,
- child: Container(
- height: 20,
- width: 110,
- decoration: const BoxDecoration(
- color: Colors.black26,
- borderRadius: BorderRadius.all(Radius.circular(8)),
- ),
- ),
- ),
- Container(
- alignment: Alignment.bottomLeft,
- margin: const EdgeInsets.only(left: 5),
- child: Text(
- user!.userName,
- textAlign: TextAlign.left,
- style: const TextStyle(
- color: Colors.white,
- fontSize: 12,
- ),
- ),
- ),
- Container(
- alignment: Alignment.bottomRight,
- margin: const EdgeInsets.only(right: 5, bottom: 5),
- child: Image(
- height: 12,
- width: 12,
- image: isMuted.value ? const AssetImage("assets/images/png/zoom/muted@2x.png") : const AssetImage("assets/images/png/zoom/talking@2x.png"),
- fit: BoxFit.cover,
- ),
- ),
- ],
- ),
- );
- }
- }
- }
-}
+// import 'dart:async';
+//
+// import 'package:flutter/material.dart';
+// import 'package:flutter_hooks/flutter_hooks.dart';
+// import 'package:flutter_zoom_videosdk/flutter_zoom_view.dart' as FlutterZoomView;
+// import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart';
+//
+// const SHOW_TALKING_ICON_DURATION = 2000;
+//
+// class VideoView extends FlutterZoomView.ZoomView {
+// const VideoView({
+// super.key,
+// required super.user,
+// required super.sharing,
+// required super.preview,
+// required super.focused,
+// required super.hasMultiCamera,
+// required super.multiCameraIndex,
+// required super.videoAspect,
+// required super.fullScreen,
+// required super.resolution,
+// required super.isPiPView,
+// });
+//
+// @override
+// Widget build(BuildContext context) {
+// var isVideoOn = useState(false);
+// var isTalking = useState(false);
+// var isMuted = useState(false);
+// var isMounted = useIsMounted();
+// var zoom = ZoomVideoSdk();
+// var isSharing = useState(false);
+// user?.audioStatus?.isMuted().then((muted) => isMuted.value = muted);
+//
+// useEffect(() {
+// updateVideoStatus() {
+// if (user == null) return;
+// Future.microtask(() async {
+// if (isMounted()) {
+// isVideoOn.value = (await user!.videoStatus!.isOn());
+// isSharing.value = sharing;
+// }
+// });
+// }
+//
+// resetAudioStatus() {
+// isTalking.value = false;
+// isMuted.value = false;
+// }
+//
+// updateAudioStatus() async {
+// if (!isMounted()) return;
+// var talking = await user?.audioStatus?.isTalking();
+// var muted = await user?.audioStatus?.isMuted();
+// isMuted.value = muted!;
+// isTalking.value = talking!;
+// if (talking) {
+// Timer(
+// const Duration(milliseconds: SHOW_TALKING_ICON_DURATION),
+// () => {
+// if (isMounted())
+// {
+// isTalking.value = false,
+// }
+// });
+// }
+// }
+//
+// updateVideoStatus();
+// return null;
+// }, [zoom, user]);
+//
+// ImageIcon audioStatusIcon;
+// if (isTalking.value) {
+// audioStatusIcon = const ImageIcon(
+// AssetImage("assets/images/png/zoom/talking@2x.png"),
+// );
+// } else if (isMuted.value) {
+// audioStatusIcon = const ImageIcon(
+// AssetImage("assets/images/png/zoom/muted@2x.png"),
+// );
+// }
+// // Pass parameters to the platform side.
+// final Map creationParams = {};
+// creationParams.putIfAbsent("userId", () => user?.userId);
+// creationParams.putIfAbsent("sharing", () => sharing);
+// creationParams.putIfAbsent("preview", () => preview);
+// creationParams.putIfAbsent("focused", () => focused);
+// creationParams.putIfAbsent("hasMultiCamera", () => hasMultiCamera);
+// if (videoAspect.isEmpty) {
+// creationParams.putIfAbsent("videoAspect", () => VideoAspect.PanAndScan);
+// } else {
+// creationParams.putIfAbsent("videoAspect", () => videoAspect);
+// }
+// creationParams.putIfAbsent("fullScreen", () => fullScreen);
+// if (resolution.isNotEmpty) {
+// creationParams.putIfAbsent("videoAspect", () => videoAspect);
+// }
+//
+// if (fullScreen) {
+// if (sharing) {
+// return Container(
+// height: MediaQuery.of(context).size.height,
+// width: MediaQuery.of(context).size.width,
+// alignment: Alignment.center,
+// child: FlutterZoomView.View(creationParams: creationParams),
+// );
+// } else if (isVideoOn.value) {
+// return Container(
+// height: MediaQuery.of(context).size.height,
+// width: MediaQuery.of(context).size.width,
+// alignment: Alignment.center,
+// child: FlutterZoomView.View(creationParams: creationParams),
+// );
+// } else {
+// return Container(
+// margin: const EdgeInsets.symmetric(vertical: 0),
+// child: Container(
+// alignment: Alignment.center,
+// child: const Image(
+// image: AssetImage("assets/images/png/zoom/default-avatar.png"),
+// )),
+// );
+// }
+// } else {
+// if (isVideoOn.value || sharing) {
+// return Container(
+// padding: const EdgeInsets.symmetric(horizontal: 8),
+// height: 110,
+// width: 110,
+// child: Stack(
+// children: [
+// Container(
+// height: 110,
+// width: 110,
+// decoration: BoxDecoration(
+// color: const Color(0xff232323),
+// border: Border.all(
+// color: const Color(0xff666666),
+// width: 1,
+// ),
+// borderRadius: const BorderRadius.all(Radius.circular(8)),
+// ),
+// alignment: Alignment.center,
+// child: FlutterZoomView.View(creationParams: creationParams),
+// ),
+// Container(
+// height: 110,
+// width: 110,
+// decoration: const BoxDecoration(
+// borderRadius: BorderRadius.all(Radius.circular(8)),
+// ),
+// ),
+// Container(
+// alignment: Alignment.bottomCenter,
+// child: Container(
+// height: 20,
+// width: 110,
+// decoration: const BoxDecoration(
+// color: Colors.black26,
+// borderRadius: BorderRadius.all(Radius.circular(8)),
+// ),
+// ),
+// ),
+// Container(
+// alignment: Alignment.bottomLeft,
+// margin: const EdgeInsets.only(left: 5),
+// child: Text(
+// user!.userName,
+// textAlign: TextAlign.left,
+// style: const TextStyle(
+// color: Colors.white,
+// fontSize: 12,
+// ),
+// ),
+// ),
+// Container(
+// alignment: Alignment.bottomRight,
+// margin: const EdgeInsets.only(right: 5, bottom: 5),
+// // height: 110,
+// // width: 110,
+// child: Image(
+// height: 12,
+// width: 12,
+// image: isMuted.value ? const AssetImage("assets/images/png/zoom/muted@2x.png") : const AssetImage("assets/images/png/zoom/talking@2x.png"),
+// fit: BoxFit.cover,
+// ),
+// )
+// ],
+// ),
+// );
+// } else {
+// return Container(
+// padding: const EdgeInsets.symmetric(horizontal: 8),
+// height: 110,
+// width: 110,
+// child: Stack(
+// children: [
+// Container(
+// height: 110,
+// width: 110,
+// decoration: BoxDecoration(
+// color: const Color(0xff232323),
+// border: Border.all(
+// color: const Color(0xff666666),
+// width: 1,
+// ),
+// borderRadius: const BorderRadius.all(Radius.circular(8)),
+// ),
+// alignment: Alignment.center,
+// child: Container(
+// alignment: Alignment.center,
+// child: const Image(
+// height: 60,
+// width: 60,
+// image: AssetImage("assets/images/png/zoom/default-avatar.png"),
+// )),
+// ),
+// Align(
+// alignment: Alignment.bottomCenter,
+// child: Container(
+// height: 20,
+// width: 110,
+// decoration: const BoxDecoration(
+// color: Colors.black26,
+// borderRadius: BorderRadius.all(Radius.circular(8)),
+// ),
+// ),
+// ),
+// Container(
+// alignment: Alignment.bottomLeft,
+// margin: const EdgeInsets.only(left: 5),
+// child: Text(
+// user!.userName,
+// textAlign: TextAlign.left,
+// style: const TextStyle(
+// color: Colors.white,
+// fontSize: 12,
+// ),
+// ),
+// ),
+// Container(
+// alignment: Alignment.bottomRight,
+// margin: const EdgeInsets.only(right: 5, bottom: 5),
+// child: Image(
+// height: 12,
+// width: 12,
+// image: isMuted.value ? const AssetImage("assets/images/png/zoom/muted@2x.png") : const AssetImage("assets/images/png/zoom/talking@2x.png"),
+// fit: BoxFit.cover,
+// ),
+// ),
+// ],
+// ),
+// );
+// }
+// }
+// }
+// }
diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart
index f22c6805..2d2cb217 100644
--- a/lib/routes/app_routes.dart
+++ b/lib/routes/app_routes.dart
@@ -102,7 +102,7 @@ class AppRoutes {
register: (context) => RegisterNew(),
registerStepTwo: (context) => RegisterNewStep2(),
medicalFilePage: (context) => MedicalFilePage(),
- zoomCallPage: (context) => CallScreen(),
+ zoomCallPage: (context) => MedicalFilePage(),
eReferralPage: (context) => NewReferralPage(),
comprehensiveCheckupPage: (context) => ComprehensiveCheckupPage(),
homeHealthCarePage: (context) => HhcProceduresPage(),
diff --git a/lib/services/zoom_service.dart b/lib/services/zoom_service.dart
index 9af543dc..d49f8228 100644
--- a/lib/services/zoom_service.dart
+++ b/lib/services/zoom_service.dart
@@ -1,25 +1,25 @@
// lib/services/zoom_service.dart
-import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart';
+// import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart';
class ZoomService {
static final ZoomService _instance = ZoomService._internal();
factory ZoomService() => _instance;
ZoomService._internal();
- ZoomVideoSdk? _zoom;
+ // ZoomVideoSdk? _zoom;
bool _isInitialized = false;
Future initializeZoomSDK() async {
if (_isInitialized) return;
try {
- _zoom = ZoomVideoSdk();
- InitConfig initConfig = InitConfig(
- domain: "zoom.us",
- enableLog: true, // Enable for debugging
- );
+ // _zoom = ZoomVideoSdk();
+ // InitConfig initConfig = InitConfig(
+ // domain: "zoom.us",
+ // enableLog: true, // Enable for debugging
+ // );
- await _zoom!.initSdk(initConfig);
+ // await _zoom!.initSdk(initConfig);
_isInitialized = true;
print("Zoom SDK initialized successfully");
} catch (e) {
@@ -28,6 +28,6 @@ class ZoomService {
}
}
- ZoomVideoSdk? get zoom => _zoom;
+ // ZoomVideoSdk? get zoom => _zoom;
bool get isInitialized => _isInitialized;
}
\ No newline at end of file
diff --git a/lib/splashPage.dart b/lib/splashPage.dart
index 64518f30..657da361 100644
--- a/lib/splashPage.dart
+++ b/lib/splashPage.dart
@@ -3,7 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_callkit_incoming/entities/call_event.dart';
import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart';
-import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart';
+// import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart';
import 'package:get_it/get_it.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
@@ -87,14 +87,14 @@ class _SplashScreenState extends State {
Navigator.of(GetIt.instance().navigatorKey.currentContext!)
.pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: LandingNavigation())));
- Navigator.pushReplacementNamed(
- // context,
- GetIt.instance().navigatorKey.currentContext!,
- AppRoutes.zoomCallPage,
- // arguments: CallArguments(appointmentID, "111", "Patient", "40", "1", true, 1),
- arguments: CallArguments(roomID, "123", "Patient", "40", "0", true, 1),
- // arguments: CallArguments("SmallDailyStandup9875", "123", "Patient", "40", "0", false, int.parse(widget.incomingCallData!.appointmentNo!)),
- );
+ // Navigator.pushReplacementNamed(
+ // // context,
+ // GetIt.instance().navigatorKey.currentContext!,
+ // AppRoutes.zoomCallPage,
+ // // arguments: CallArguments(appointmentID, "111", "Patient", "40", "1", true, 1),
+ // arguments: CallArguments(roomID, "123", "Patient", "40", "0", true, 1),
+ // // arguments: CallArguments("SmallDailyStandup9875", "123", "Patient", "40", "0", false, int.parse(widget.incomingCallData!.appointmentNo!)),
+ // );
}
Future listenerEvent() async {
diff --git a/pubspec.lock b/pubspec.lock
index 8395a120..2d9cd430 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -117,10 +117,10 @@ packages:
dependency: transitive
description:
name: characters
- sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
+ sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
url: "https://pub.dev"
source: hosted
- version: "1.4.0"
+ version: "1.4.1"
chewie:
dependency: transitive
description:
@@ -237,35 +237,31 @@ packages:
device_calendar_plus:
dependency: "direct main"
description:
- name: device_calendar_plus
- sha256: d11a70d98eb123e8eb09fdcfaf220ca4f1aa65a1512e12092f176f4b54983507
- url: "https://pub.dev"
- source: hosted
- version: "0.3.3"
+ path: "package/device_calendar_plus"
+ relative: true
+ source: path
+ version: "0.3.1"
device_calendar_plus_android:
dependency: transitive
description:
- name: device_calendar_plus_android
- sha256: a341ef29fa0251251287d63c1d009dfd35c1459dc6a129fd5e03f5ac92d8d7ff
- url: "https://pub.dev"
- source: hosted
- version: "0.3.3"
+ path: "package/device_calendar_plus/package/device_calendar_plus_android"
+ relative: true
+ source: path
+ version: "0.3.1"
device_calendar_plus_ios:
dependency: transitive
description:
- name: device_calendar_plus_ios
- sha256: "3b2f84ce1ed002be8460e214a3229e66748bbaad4077603f2c734d67c42033ff"
- url: "https://pub.dev"
- source: hosted
- version: "0.3.3"
+ path: "package/device_calendar_plus/package/device_calendar_plus_ios"
+ relative: true
+ source: path
+ version: "0.3.1"
device_calendar_plus_platform_interface:
dependency: transitive
description:
- name: device_calendar_plus_platform_interface
- sha256: "0ce7511c094ca256831a48e16efe8f1e97e7bd00a5ff3936296ffd650a1d76b5"
- url: "https://pub.dev"
- source: hosted
- version: "0.3.3"
+ path: "package/device_calendar_plus/package/device_calendar_plus_platform_interface"
+ relative: true
+ source: path
+ version: "0.3.1"
device_info_plus:
dependency: "direct main"
description:
@@ -511,14 +507,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.0"
- flutter_hooks:
- dependency: transitive
- description:
- name: flutter_hooks
- sha256: cde36b12f7188c85286fba9b38cc5a902e7279f36dd676967106c041dc9dde70
- url: "https://pub.dev"
- source: hosted
- version: "0.20.5"
flutter_inappwebview:
dependency: "direct main"
description:
@@ -710,14 +698,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.17.0"
- flutter_zoom_videosdk:
- dependency: "direct main"
- description:
- name: flutter_zoom_videosdk
- sha256: "46a4dea664b1c969099328a499c198a1755adf9ac333dea28bea5187910b3bf9"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.10"
fluttertoast:
dependency: "direct main"
description:
@@ -978,10 +958,10 @@ packages:
dependency: "direct main"
description:
name: huawei_health
- sha256: "52fb9990e1fc857e2fa1b1251dde63b2146086a13b2d9c50bdfc3c4f715c8a12"
+ sha256: "87949d33fa47553cf4ecaf88d252c13845668469256474c87d3b6ee4b334e620"
url: "https://pub.dev"
source: hosted
- version: "6.16.0+300"
+ version: "6.17.0+300"
huawei_location:
dependency: "direct main"
description:
@@ -993,12 +973,11 @@ packages:
huawei_map:
dependency: "direct main"
description:
- path: flutter-hms-map
- ref: HEAD
- resolved-ref: "9a16541e4016e3bf58a2571e6aa658a4751af399"
- url: "https://github.com/fleoparra/hms-flutter-plugin.git"
- source: git
- version: "6.11.2+303"
+ name: huawei_map
+ sha256: "03bd37d565874281be10e7649d09990d88bc5bf724f45051f8cfaca7620fc273"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.12.0+301"
image_picker:
dependency: "direct main"
description:
@@ -1267,26 +1246,26 @@ packages:
dependency: transitive
description:
name: matcher
- sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
+ sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
url: "https://pub.dev"
source: hosted
- version: "0.12.17"
+ version: "0.12.19"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
- sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
+ sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
url: "https://pub.dev"
source: hosted
- version: "0.11.1"
+ version: "0.13.0"
meta:
dependency: transitive
description:
name: meta
- sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
+ sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
url: "https://pub.dev"
source: hosted
- version: "1.16.0"
+ version: "1.17.0"
mime:
dependency: transitive
description:
@@ -1816,10 +1795,10 @@ packages:
dependency: transitive
description:
name: test_api
- sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
+ sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
url: "https://pub.dev"
source: hosted
- version: "0.7.6"
+ version: "0.7.10"
time:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index d561347c..0288b320 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -62,7 +62,7 @@ dependencies:
geolocator: ^14.0.2
dropdown_search: ^6.0.2
google_maps_flutter: ^2.13.1
- flutter_zoom_videosdk: 2.1.10
+# flutter_zoom_videosdk: 2.1.10
dart_jsonwebtoken: ^3.2.0
dartz: ^0.10.1
equatable: ^2.0.7
@@ -91,7 +91,7 @@ dependencies:
location: ^8.0.1
gms_check: ^1.0.4
huawei_location: ^6.14.2+301
- huawei_health: ^6.15.0+300
+ huawei_health: ^6.17.0+300
intl: ^0.20.2
flutter_widget_from_html: ^0.17.1
huawei_map: ^6.12.0+301