WIP: huawei watch integration. the watch is integrated but some items are not being fetched

watch_integration
tahaalam 1 month ago
parent f84d5c6769
commit 7be7e99ea7

@ -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"}}]} {
"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"
}
}
]
}

@ -70,22 +70,22 @@ android {
signingConfigs { signingConfigs {
create("release") { create("release") {
keyAlias = keystoreProperties.getProperty("keyAlias") keyAlias = "hmg"//keystoreProperties.getProperty("keyAlias")"
keyPassword = keystoreProperties.getProperty("keyPassword") keyPassword = "HmGsa123"//keystoreProperties.getProperty("keyPassword")
storeFile = keystoreProperties.getProperty("storeFile")?.let { file(it) } storeFile = rootProject.file("./key")//keystoreProperties.getProperty("storeFile")?.let { file(it) }
storePassword = keystoreProperties.getProperty("storePassword") storePassword = "HmGsa123"//keystoreProperties.getProperty("storePassword")
} }
} }
buildTypes { buildTypes {
getByName("debug") { getByName("debug") {
isDebuggable = true isDebuggable = true
signingConfig = signingConfigs.getByName("debug") signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = false isMinifyEnabled = false
isShrinkResources = false isShrinkResources = false
} }
getByName("release") { getByName("release") {
isDebuggable = false isDebuggable = true
signingConfig = signingConfigs.getByName("release") signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = true isMinifyEnabled = true
isShrinkResources = true isShrinkResources = true
@ -193,7 +193,7 @@ dependencies {
implementation(files("libs/Penguin.aar")) implementation(files("libs/Penguin.aar"))
implementation(files("libs/PenguinRenderer.aar")) implementation(files("libs/PenguinRenderer.aar"))
api(files("libs/samsung-health-data-api.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.huawei.hms:hmscoreinstaller:6.6.0.300")
implementation("com.github.kittinunf.fuel:fuel:2.3.1") implementation("com.github.kittinunf.fuel:fuel:2.3.1")

@ -78,3 +78,7 @@
-keep class com.hiennv.flutter_callkit_incoming.** { *; } -keep class com.hiennv.flutter_callkit_incoming.** { *; }
-keepattributes Signature, Annotation, InnerClasses, EnclosingMethod -keepattributes Signature, Annotation, InnerClasses, EnclosingMethod
-keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile

@ -135,6 +135,10 @@
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
android:extractNativeLibs="true" android:extractNativeLibs="true"
tools:replace="android:label"> tools:replace="android:label">
<meta-data
android:name="com.huawei.hms.client.appid"
android:value="116912301" />
<!-- <activity--> <!-- <activity-->
<!-- android:name="com.cloud.hmg_patient_app.whatsapp.WhatsAppCodeActivity"--> <!-- android:name="com.cloud.hmg_patient_app.whatsapp.WhatsAppCodeActivity"-->
<!-- android:exported="true"--> <!-- android:exported="true"-->

@ -7,6 +7,7 @@ import android.util.Log
import android.view.WindowManager import android.view.WindowManager
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import com.cloudsolutions.HMGPatientApp.watch.huawei.HuaweiWatch
import com.cloudsolutions.HMGPatientApp.watch.samsung_watch.SamsungWatch import com.cloudsolutions.HMGPatientApp.watch.samsung_watch.SamsungWatch
import io.flutter.embedding.engine.FlutterEngine import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant import io.flutter.plugins.GeneratedPluginRegistrant
@ -24,6 +25,7 @@ class MainActivity: FlutterFragmentActivity() {
PenguinInPlatformBridge(flutterEngine, this).create() PenguinInPlatformBridge(flutterEngine, this).create()
SamsungWatch(flutterEngine, this) SamsungWatch(flutterEngine, this)
HuaweiWatch(flutterEngine, this)
} }
override fun onRequestPermissionsResult( override fun onRequestPermissionsResult(

@ -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<String, List<Vitals>>
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 )
}
}
}

@ -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<String, List<Vitals>>
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<String?>( // 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<HealthDataPoint>) {
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<HealthDataPoint>) {
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<AggregatedData<Float>>) {
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<AggregatedData<Long>>) {
val stepCount = ArrayList<AggregatedData<Long>>()
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<HealthDataPoint>) {
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<HealthDataPoint>,
) {
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()
}
}

@ -1,4 +1,4 @@
storePassword=HmGsa123 storePassword=HmGsa123
keyPassword=HmGsa123 keyPassword=HmGsa123
keyAlias=hmg keyAlias=hmg
storeFile=key storeFile=./key

@ -189,13 +189,13 @@ class HealthService {
return null; return null;
} }
try { try {
await watchHelper!.getHeartRate(); // await watchHelper!.getHeartRate();
await watchHelper!.getSleep(); // await watchHelper!.getSleep();
await watchHelper!.getSteps(); await watchHelper!.getSteps();
await watchHelper!.getActivity(); // await watchHelper!.getActivity();
await watchHelper!.getBodyTemperature(); // await watchHelper!.getBodyTemperature();
await watchHelper!.getDistance(); // await watchHelper!.getDistance();
await watchHelper!.getBloodOxygen(); // await watchHelper!.getBloodOxygen();
Result<dynamic> data = await watchHelper!.retrieveData(); Result<dynamic> data = await watchHelper!.retrieveData();
if(data.isError) { if(data.isError) {
print('Unable to get the data'); print('Unable to get the data');

@ -28,7 +28,6 @@ class HealthConnectHelper extends WatchHelper {
try { try {
final types = HealthDataType.HEART_RATE; final types = HealthDataType.HEART_RATE;
final endDate = DateTime.now(); final endDate = DateTime.now();
// final startDate = endDate.subtract(Duration(days: 365));
final startDate = endDate.subtract(Duration(days: 365)); final startDate = endDate.subtract(Duration(days: 365));
final data = await getHeartData(startDate, endDate, types); final data = await getHeartData(startDate, endDate, types);
addDataToMap("heartRate",data ); addDataToMap("heartRate",data );

@ -1,13 +1,22 @@
import 'dart:async'; import 'dart:async';
import 'dart:developer';
import 'package:async/src/result/result.dart'; import 'package:async/src/result/result.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/services.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: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 'package:huawei_health/huawei_health.dart';
import '../../../presentation/smartwatches/huawei_health_example.dart';
class HuaweiHealthDataConnector extends WatchHelper{ class HuaweiHealthDataConnector extends WatchHelper{
final MethodChannel _channel = MethodChannel('huawei_watch'); final MethodChannel _channel = MethodChannel('huawei_watch');
DataController? _dataController;
Map<String , List<Vitals>> mappedData = {};
@override @override
Future<Result<bool>> initDevice() async{ Future<Result<bool>> initDevice() async{
try{ try{
@ -18,19 +27,76 @@ class HuaweiHealthDataConnector extends WatchHelper{
} }
// List of scopes to ask for authorization. // List of scopes to ask for authorization.
// Note: These scopes should also be authorized on the Huawei Developer Console. // Note: These scopes should also be authorized on the Huawei Developer Console.
List<Scope> scopes = [ // List<Scope> scopes = [
Scope.HEALTHKIT_STEP_READ, Scope.HEALTHKIT_OXYGEN_SATURATION_READ, // View and store height and weight data in Health Service Kit. // 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_HEARTRATE_READ, Scope.HEALTHKIT_SLEEP_READ,
Scope.HEALTHKIT_BODYTEMPERATURE_READ, Scope.HEALTHKIT_CALORIES_READ // Scope.HEALTHKIT_BODYTEMPERATURE_READ, Scope.HEALTHKIT_CALORIES_READ,
// Scope.HEALTHKIT_STEP_READ,
// ];
final List<Scope> scopes = <Scope>[
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 { try {
bool? result = await SettingController.getHealthAppAuthorization(); var healthResult = await HealthAuth.signIn(scopes,);
debugPrint( // var result = await SettingController.requestAuthorizationIntent(scopes,true);
'Granted Scopes for result == is $result}', // AuthHuaweiId? id = await HealthAuth.signIn(scopes);
); _dataController = await DataController.init();
// debugPrint(
// 'Granted Scopes for result == is ${result.status?.statusCode}',
// );
return Result.value(true); return Result.value(true);
} catch (e) { } on PlatformException catch (e) {
debugPrint('Error on authorization, Error:${e.toString()}');
print('Error on authorization, Error:${e.toString()}');
return Result.error(false); return Result.error(false);
} }
} }
@ -67,8 +133,20 @@ class HuaweiHealthDataConnector extends WatchHelper{
} }
@override @override
FutureOr<void> getSteps() { FutureOr<void> getSteps() async{
throw UnimplementedError(); 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(); throw UnimplementedError();
} }
Future<ReadReply?> 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>[
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)));
}
}
}
}
} }

File diff suppressed because it is too large Load Diff

@ -1,258 +1,258 @@
import 'dart:async'; // import 'dart:async';
//
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; // import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_zoom_videosdk/flutter_zoom_view.dart' as FlutterZoomView; // import 'package:flutter_zoom_videosdk/flutter_zoom_view.dart' as FlutterZoomView;
import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart'; // import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart';
//
const SHOW_TALKING_ICON_DURATION = 2000; // const SHOW_TALKING_ICON_DURATION = 2000;
//
class VideoView extends FlutterZoomView.ZoomView { // class VideoView extends FlutterZoomView.ZoomView {
const VideoView({ // const VideoView({
super.key, // super.key,
required super.user, // required super.user,
required super.sharing, // required super.sharing,
required super.preview, // required super.preview,
required super.focused, // required super.focused,
required super.hasMultiCamera, // required super.hasMultiCamera,
required super.multiCameraIndex, // required super.multiCameraIndex,
required super.videoAspect, // required super.videoAspect,
required super.fullScreen, // required super.fullScreen,
required super.resolution, // required super.resolution,
required super.isPiPView, // required super.isPiPView,
}); // });
//
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
var isVideoOn = useState(false); // var isVideoOn = useState(false);
var isTalking = useState(false); // var isTalking = useState(false);
var isMuted = useState(false); // var isMuted = useState(false);
var isMounted = useIsMounted(); // var isMounted = useIsMounted();
var zoom = ZoomVideoSdk(); // var zoom = ZoomVideoSdk();
var isSharing = useState(false); // var isSharing = useState(false);
user?.audioStatus?.isMuted().then((muted) => isMuted.value = muted); // user?.audioStatus?.isMuted().then((muted) => isMuted.value = muted);
//
useEffect(() { // useEffect(() {
updateVideoStatus() { // updateVideoStatus() {
if (user == null) return; // if (user == null) return;
Future<void>.microtask(() async { // Future<void>.microtask(() async {
if (isMounted()) { // if (isMounted()) {
isVideoOn.value = (await user!.videoStatus!.isOn()); // isVideoOn.value = (await user!.videoStatus!.isOn());
isSharing.value = sharing; // isSharing.value = sharing;
} // }
}); // });
} // }
//
resetAudioStatus() { // resetAudioStatus() {
isTalking.value = false; // isTalking.value = false;
isMuted.value = false; // isMuted.value = false;
} // }
//
updateAudioStatus() async { // updateAudioStatus() async {
if (!isMounted()) return; // if (!isMounted()) return;
var talking = await user?.audioStatus?.isTalking(); // var talking = await user?.audioStatus?.isTalking();
var muted = await user?.audioStatus?.isMuted(); // var muted = await user?.audioStatus?.isMuted();
isMuted.value = muted!; // isMuted.value = muted!;
isTalking.value = talking!; // isTalking.value = talking!;
if (talking) { // if (talking) {
Timer( // Timer(
const Duration(milliseconds: SHOW_TALKING_ICON_DURATION), // const Duration(milliseconds: SHOW_TALKING_ICON_DURATION),
() => { // () => {
if (isMounted()) // if (isMounted())
{ // {
isTalking.value = false, // isTalking.value = false,
} // }
}); // });
} // }
} // }
//
updateVideoStatus(); // updateVideoStatus();
return null; // return null;
}, [zoom, user]); // }, [zoom, user]);
//
ImageIcon audioStatusIcon; // ImageIcon audioStatusIcon;
if (isTalking.value) { // if (isTalking.value) {
audioStatusIcon = const ImageIcon( // audioStatusIcon = const ImageIcon(
AssetImage("assets/images/png/zoom/talking@2x.png"), // AssetImage("assets/images/png/zoom/talking@2x.png"),
); // );
} else if (isMuted.value) { // } else if (isMuted.value) {
audioStatusIcon = const ImageIcon( // audioStatusIcon = const ImageIcon(
AssetImage("assets/images/png/zoom/muted@2x.png"), // AssetImage("assets/images/png/zoom/muted@2x.png"),
); // );
} // }
// Pass parameters to the platform side. // // Pass parameters to the platform side.
final Map<String, dynamic> creationParams = <String, dynamic>{}; // final Map<String, dynamic> creationParams = <String, dynamic>{};
creationParams.putIfAbsent("userId", () => user?.userId); // creationParams.putIfAbsent("userId", () => user?.userId);
creationParams.putIfAbsent("sharing", () => sharing); // creationParams.putIfAbsent("sharing", () => sharing);
creationParams.putIfAbsent("preview", () => preview); // creationParams.putIfAbsent("preview", () => preview);
creationParams.putIfAbsent("focused", () => focused); // creationParams.putIfAbsent("focused", () => focused);
creationParams.putIfAbsent("hasMultiCamera", () => hasMultiCamera); // creationParams.putIfAbsent("hasMultiCamera", () => hasMultiCamera);
if (videoAspect.isEmpty) { // if (videoAspect.isEmpty) {
creationParams.putIfAbsent("videoAspect", () => VideoAspect.PanAndScan); // creationParams.putIfAbsent("videoAspect", () => VideoAspect.PanAndScan);
} else { // } else {
creationParams.putIfAbsent("videoAspect", () => videoAspect); // creationParams.putIfAbsent("videoAspect", () => videoAspect);
} // }
creationParams.putIfAbsent("fullScreen", () => fullScreen); // creationParams.putIfAbsent("fullScreen", () => fullScreen);
if (resolution.isNotEmpty) { // if (resolution.isNotEmpty) {
creationParams.putIfAbsent("videoAspect", () => videoAspect); // creationParams.putIfAbsent("videoAspect", () => videoAspect);
} // }
//
if (fullScreen) { // if (fullScreen) {
if (sharing) { // if (sharing) {
return Container( // return Container(
height: MediaQuery.of(context).size.height, // height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width, // width: MediaQuery.of(context).size.width,
alignment: Alignment.center, // alignment: Alignment.center,
child: FlutterZoomView.View(creationParams: creationParams), // child: FlutterZoomView.View(creationParams: creationParams),
); // );
} else if (isVideoOn.value) { // } else if (isVideoOn.value) {
return Container( // return Container(
height: MediaQuery.of(context).size.height, // height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width, // width: MediaQuery.of(context).size.width,
alignment: Alignment.center, // alignment: Alignment.center,
child: FlutterZoomView.View(creationParams: creationParams), // child: FlutterZoomView.View(creationParams: creationParams),
); // );
} else { // } else {
return Container( // return Container(
margin: const EdgeInsets.symmetric(vertical: 0), // margin: const EdgeInsets.symmetric(vertical: 0),
child: Container( // child: Container(
alignment: Alignment.center, // alignment: Alignment.center,
child: const Image( // child: const Image(
image: AssetImage("assets/images/png/zoom/default-avatar.png"), // image: AssetImage("assets/images/png/zoom/default-avatar.png"),
)), // )),
); // );
} // }
} else { // } else {
if (isVideoOn.value || sharing) { // if (isVideoOn.value || sharing) {
return Container( // return Container(
padding: const EdgeInsets.symmetric(horizontal: 8), // 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, // height: 110,
// width: 110, // width: 110,
child: Image( // child: Stack(
height: 12, // children: [
width: 12, // Container(
image: isMuted.value ? const AssetImage("assets/images/png/zoom/muted@2x.png") : const AssetImage("assets/images/png/zoom/talking@2x.png"), // height: 110,
fit: BoxFit.cover, // width: 110,
), // decoration: BoxDecoration(
) // color: const Color(0xff232323),
], // border: Border.all(
), // color: const Color(0xff666666),
); // width: 1,
} else { // ),
return Container( // borderRadius: const BorderRadius.all(Radius.circular(8)),
padding: const EdgeInsets.symmetric(horizontal: 8), // ),
height: 110, // alignment: Alignment.center,
width: 110, // child: FlutterZoomView.View(creationParams: creationParams),
child: Stack( // ),
children: [ // Container(
Container( // height: 110,
height: 110, // width: 110,
width: 110, // decoration: const BoxDecoration(
decoration: BoxDecoration( // borderRadius: BorderRadius.all(Radius.circular(8)),
color: const Color(0xff232323), // ),
border: Border.all( // ),
color: const Color(0xff666666), // Container(
width: 1, // alignment: Alignment.bottomCenter,
), // child: Container(
borderRadius: const BorderRadius.all(Radius.circular(8)), // height: 20,
), // width: 110,
alignment: Alignment.center, // decoration: const BoxDecoration(
child: Container( // color: Colors.black26,
alignment: Alignment.center, // borderRadius: BorderRadius.all(Radius.circular(8)),
child: const Image( // ),
height: 60, // ),
width: 60, // ),
image: AssetImage("assets/images/png/zoom/default-avatar.png"), // Container(
)), // alignment: Alignment.bottomLeft,
), // margin: const EdgeInsets.only(left: 5),
Align( // child: Text(
alignment: Alignment.bottomCenter, // user!.userName,
child: Container( // textAlign: TextAlign.left,
height: 20, // style: const TextStyle(
width: 110, // color: Colors.white,
decoration: const BoxDecoration( // fontSize: 12,
color: Colors.black26, // ),
borderRadius: BorderRadius.all(Radius.circular(8)), // ),
), // ),
), // Container(
), // alignment: Alignment.bottomRight,
Container( // margin: const EdgeInsets.only(right: 5, bottom: 5),
alignment: Alignment.bottomLeft, // // height: 110,
margin: const EdgeInsets.only(left: 5), // // width: 110,
child: Text( // child: Image(
user!.userName, // height: 12,
textAlign: TextAlign.left, // width: 12,
style: const TextStyle( // image: isMuted.value ? const AssetImage("assets/images/png/zoom/muted@2x.png") : const AssetImage("assets/images/png/zoom/talking@2x.png"),
color: Colors.white, // fit: BoxFit.cover,
fontSize: 12, // ),
), // )
), // ],
), // ),
Container( // );
alignment: Alignment.bottomRight, // } else {
margin: const EdgeInsets.only(right: 5, bottom: 5), // return Container(
child: Image( // padding: const EdgeInsets.symmetric(horizontal: 8),
height: 12, // height: 110,
width: 12, // width: 110,
image: isMuted.value ? const AssetImage("assets/images/png/zoom/muted@2x.png") : const AssetImage("assets/images/png/zoom/talking@2x.png"), // child: Stack(
fit: BoxFit.cover, // 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,
// ),
// ),
// ],
// ),
// );
// }
// }
// }
// }

@ -102,7 +102,7 @@ class AppRoutes {
register: (context) => RegisterNew(), register: (context) => RegisterNew(),
registerStepTwo: (context) => RegisterNewStep2(), registerStepTwo: (context) => RegisterNewStep2(),
medicalFilePage: (context) => MedicalFilePage(), medicalFilePage: (context) => MedicalFilePage(),
zoomCallPage: (context) => CallScreen(), zoomCallPage: (context) => MedicalFilePage(),
eReferralPage: (context) => NewReferralPage(), eReferralPage: (context) => NewReferralPage(),
comprehensiveCheckupPage: (context) => ComprehensiveCheckupPage(), comprehensiveCheckupPage: (context) => ComprehensiveCheckupPage(),
homeHealthCarePage: (context) => HhcProceduresPage(), homeHealthCarePage: (context) => HhcProceduresPage(),

@ -1,25 +1,25 @@
// lib/services/zoom_service.dart // 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 { class ZoomService {
static final ZoomService _instance = ZoomService._internal(); static final ZoomService _instance = ZoomService._internal();
factory ZoomService() => _instance; factory ZoomService() => _instance;
ZoomService._internal(); ZoomService._internal();
ZoomVideoSdk? _zoom; // ZoomVideoSdk? _zoom;
bool _isInitialized = false; bool _isInitialized = false;
Future<void> initializeZoomSDK() async { Future<void> initializeZoomSDK() async {
if (_isInitialized) return; if (_isInitialized) return;
try { try {
_zoom = ZoomVideoSdk(); // _zoom = ZoomVideoSdk();
InitConfig initConfig = InitConfig( // InitConfig initConfig = InitConfig(
domain: "zoom.us", // domain: "zoom.us",
enableLog: true, // Enable for debugging // enableLog: true, // Enable for debugging
); // );
await _zoom!.initSdk(initConfig); // await _zoom!.initSdk(initConfig);
_isInitialized = true; _isInitialized = true;
print("Zoom SDK initialized successfully"); print("Zoom SDK initialized successfully");
} catch (e) { } catch (e) {
@ -28,6 +28,6 @@ class ZoomService {
} }
} }
ZoomVideoSdk? get zoom => _zoom; // ZoomVideoSdk? get zoom => _zoom;
bool get isInitialized => _isInitialized; bool get isInitialized => _isInitialized;
} }

@ -3,7 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_callkit_incoming/entities/call_event.dart'; import 'package:flutter_callkit_incoming/entities/call_event.dart';
import 'package:flutter_callkit_incoming/flutter_callkit_incoming.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:get_it/get_it.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart'; import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart';
@ -87,14 +87,14 @@ class _SplashScreenState extends State<SplashPage> {
Navigator.of(GetIt.instance<NavigationService>().navigatorKey.currentContext!) Navigator.of(GetIt.instance<NavigationService>().navigatorKey.currentContext!)
.pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: LandingNavigation()))); .pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: LandingNavigation())));
Navigator.pushReplacementNamed( // Navigator.pushReplacementNamed(
// context, // // context,
GetIt.instance<NavigationService>().navigatorKey.currentContext!, // GetIt.instance<NavigationService>().navigatorKey.currentContext!,
AppRoutes.zoomCallPage, // AppRoutes.zoomCallPage,
// arguments: CallArguments(appointmentID, "111", "Patient", "40", "1", true, 1), // // arguments: CallArguments(appointmentID, "111", "Patient", "40", "1", true, 1),
arguments: CallArguments(roomID, "123", "Patient", "40", "0", true, 1), // arguments: CallArguments(roomID, "123", "Patient", "40", "0", true, 1),
// arguments: CallArguments("SmallDailyStandup9875", "123", "Patient", "40", "0", false, int.parse(widget.incomingCallData!.appointmentNo!)), // // arguments: CallArguments("SmallDailyStandup9875", "123", "Patient", "40", "0", false, int.parse(widget.incomingCallData!.appointmentNo!)),
); // );
} }
Future<void> listenerEvent() async { Future<void> listenerEvent() async {

@ -117,10 +117,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.0" version: "1.4.1"
chewie: chewie:
dependency: transitive dependency: transitive
description: description:
@ -237,35 +237,31 @@ packages:
device_calendar_plus: device_calendar_plus:
dependency: "direct main" dependency: "direct main"
description: description:
name: device_calendar_plus path: "package/device_calendar_plus"
sha256: d11a70d98eb123e8eb09fdcfaf220ca4f1aa65a1512e12092f176f4b54983507 relative: true
url: "https://pub.dev" source: path
source: hosted version: "0.3.1"
version: "0.3.3"
device_calendar_plus_android: device_calendar_plus_android:
dependency: transitive dependency: transitive
description: description:
name: device_calendar_plus_android path: "package/device_calendar_plus/package/device_calendar_plus_android"
sha256: a341ef29fa0251251287d63c1d009dfd35c1459dc6a129fd5e03f5ac92d8d7ff relative: true
url: "https://pub.dev" source: path
source: hosted version: "0.3.1"
version: "0.3.3"
device_calendar_plus_ios: device_calendar_plus_ios:
dependency: transitive dependency: transitive
description: description:
name: device_calendar_plus_ios path: "package/device_calendar_plus/package/device_calendar_plus_ios"
sha256: "3b2f84ce1ed002be8460e214a3229e66748bbaad4077603f2c734d67c42033ff" relative: true
url: "https://pub.dev" source: path
source: hosted version: "0.3.1"
version: "0.3.3"
device_calendar_plus_platform_interface: device_calendar_plus_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: device_calendar_plus_platform_interface path: "package/device_calendar_plus/package/device_calendar_plus_platform_interface"
sha256: "0ce7511c094ca256831a48e16efe8f1e97e7bd00a5ff3936296ffd650a1d76b5" relative: true
url: "https://pub.dev" source: path
source: hosted version: "0.3.1"
version: "0.3.3"
device_info_plus: device_info_plus:
dependency: "direct main" dependency: "direct main"
description: description:
@ -511,14 +507,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.0" 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: flutter_inappwebview:
dependency: "direct main" dependency: "direct main"
description: description:
@ -710,14 +698,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.17.0" 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: fluttertoast:
dependency: "direct main" dependency: "direct main"
description: description:
@ -978,10 +958,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: huawei_health name: huawei_health
sha256: "52fb9990e1fc857e2fa1b1251dde63b2146086a13b2d9c50bdfc3c4f715c8a12" sha256: "87949d33fa47553cf4ecaf88d252c13845668469256474c87d3b6ee4b334e620"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.16.0+300" version: "6.17.0+300"
huawei_location: huawei_location:
dependency: "direct main" dependency: "direct main"
description: description:
@ -993,12 +973,11 @@ packages:
huawei_map: huawei_map:
dependency: "direct main" dependency: "direct main"
description: description:
path: flutter-hms-map name: huawei_map
ref: HEAD sha256: "03bd37d565874281be10e7649d09990d88bc5bf724f45051f8cfaca7620fc273"
resolved-ref: "9a16541e4016e3bf58a2571e6aa658a4751af399" url: "https://pub.dev"
url: "https://github.com/fleoparra/hms-flutter-plugin.git" source: hosted
source: git version: "6.12.0+301"
version: "6.11.2+303"
image_picker: image_picker:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1267,26 +1246,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.17" version: "0.12.19"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.11.1" version: "0.13.0"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.16.0" version: "1.17.0"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@ -1816,10 +1795,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.6" version: "0.7.10"
time: time:
dependency: transitive dependency: transitive
description: description:

@ -62,7 +62,7 @@ dependencies:
geolocator: ^14.0.2 geolocator: ^14.0.2
dropdown_search: ^6.0.2 dropdown_search: ^6.0.2
google_maps_flutter: ^2.13.1 google_maps_flutter: ^2.13.1
flutter_zoom_videosdk: 2.1.10 # flutter_zoom_videosdk: 2.1.10
dart_jsonwebtoken: ^3.2.0 dart_jsonwebtoken: ^3.2.0
dartz: ^0.10.1 dartz: ^0.10.1
equatable: ^2.0.7 equatable: ^2.0.7
@ -91,7 +91,7 @@ dependencies:
location: ^8.0.1 location: ^8.0.1
gms_check: ^1.0.4 gms_check: ^1.0.4
huawei_location: ^6.14.2+301 huawei_location: ^6.14.2+301
huawei_health: ^6.15.0+300 huawei_health: ^6.17.0+300
intl: ^0.20.2 intl: ^0.20.2
flutter_widget_from_html: ^0.17.1 flutter_widget_from_html: ^0.17.1
huawei_map: ^6.12.0+301 huawei_map: ^6.12.0+301

Loading…
Cancel
Save