From dd1144d8848466d373346ea8c4482b1a0f62d40e Mon Sep 17 00:00:00 2001 From: Mariya Date: Thu, 8 Feb 2024 20:48:26 +0530 Subject: [PATCH 1/2] Molbio Flags are updated --- .../data/model/molbioresult/MolbioV2Result.kt | 8 +-- .../presentation/dashboard/HomeFragment.kt | 66 +++++++++++++++---- 2 files changed, 58 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/example/hpostesting/data/model/molbioresult/MolbioV2Result.kt b/app/src/main/java/com/example/hpostesting/data/model/molbioresult/MolbioV2Result.kt index 3e3c698..ab01bec 100644 --- a/app/src/main/java/com/example/hpostesting/data/model/molbioresult/MolbioV2Result.kt +++ b/app/src/main/java/com/example/hpostesting/data/model/molbioresult/MolbioV2Result.kt @@ -4,7 +4,7 @@ import com.example.hpostesting.data.model.patient.HemoCubeTestData data class MolbioV2Result( val age: Int? = 31, - val analysisDate: String? = "", + val analysisDate: String? = "2024-02-08 16:33:56", val analysisId: String? = "", val analysisStatus: String? = "", val analysisType: String? = "HPOS", @@ -12,11 +12,11 @@ data class MolbioV2Result( val bloodGroup: String? = "", val coefficients: List? = listOf(22, 22), val collectionLocation: List? = listOf(), - val collectionTime: String? = "", + val collectionTime: String? = "2024-02-08 16:33:56", val collector: String? = "", val curveFitting: String? = "Linear", val deviceName: String? = "HPOS", - val expiryTime: String? = "", + val expiryTime: String? = "2024-02-08 16:33:56", val gender: String? = "", val interpretation: String? = "", val `operator`: String? = "", @@ -30,7 +30,7 @@ data class MolbioV2Result( val testId: String? = "", val testResult: String? = "", val testStatus: String? = "", - val testTime: String? = "", + val testTime: String? = "2024-02-08 16:33:56", val testType: String? = "", val thresholds: String? = "", val underMedication: Boolean? = false, diff --git a/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt index fac8a0f..89e26b1 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt @@ -119,6 +119,40 @@ class HomeFragment : Fragment() { setSearch() checkForLocalDBData() checkForTokenAndUpdate() + + hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList -> + val resultList = MolbioV2ResultRequest(mutableListOf(MolbioV2Result())) + userDataList.forEach { userData -> + if (!userData.molbioFlag && isTokenAvailable) { + resultList.results?.add( + MolbioV2Result( + rawData = userData, + analysisId = userData._id, + analysisDate = "2024-02-08 16:33:56", + analysisStatus = userData.classificationResult, + thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId].toString(), + interpretation = userData.classificationResult, + testId = userData._id, + testTime = userData.testTime, + collectionTime = "2024-02-08 16:33:56",//userData.testTime, + expiryTime = "2024-02-08 16:33:56"//userData.testTime, + ) + ) + } + if (!userData.molbioFlag && isTokenAvailable) { + userData.molbioFlag = true + hemoCubeViewModel.uploadResult(resultList) + } + if (!userData.localFlag) { + userData.localFlag = true + hemoCubeViewModel.bulkAddResultTestToDb(userData) + } + + } + + } + + } else { binding.internetAvailableCL.visibility = View.GONE binding.internetNotAvailableCL.visibility = View.VISIBLE @@ -165,6 +199,8 @@ class HomeFragment : Fragment() { } } } + + binding.btnNewKit.setOnClickListener { with(sharedPreference.edit()) { putString(Constants.KIT_NUMBER, "") @@ -192,18 +228,20 @@ class HomeFragment : Fragment() { val accessToken = sharedPreference.getString(Constants.ACCESS_TOKEN, "").toString() val password = sharedPreference.getString(Constants.DEVICE_PASSWORD_API, "").toString() val userID = sharedPreference.getString(Constants.DEVICE_ID_API, "").toString() + if (userID.isNotEmpty() && password.isNotEmpty()) { - if (accessToken.isEmpty()) { + if (!isTokenAvailable) { hemoCubeViewModel.login(createLoginRequestData(userID, password)) } else { if (isTokenExpired(accessToken)) { hemoCubeViewModel.login(createLoginRequestData(userID, password)) } else { isTokenAvailable = true + hemoCubeViewModel.deviceUpdate(createDeviceUpdateRequestData()) hemoCubeViewModel.uploadLogs() hemoCubeViewModel.startPeriodicCheckUpdate() - + } } } else { @@ -213,6 +251,7 @@ class HomeFragment : Fragment() { Toast.LENGTH_SHORT ).show() } + hemoCubeViewModel.loginResponse.observe(viewLifecycleOwner) { response -> when (response) { is Result.Success -> { @@ -594,29 +633,32 @@ class HomeFragment : Fragment() { hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList -> val resultList = MolbioV2ResultRequest(mutableListOf(MolbioV2Result())) userDataList.forEach { userData -> - if (!userData.localFlag) { - userData.localFlag = true - hemoCubeViewModel.bulkAddResultTestToDb(userData) if (!userData.molbioFlag && isTokenAvailable) { resultList.results?.add( MolbioV2Result( rawData = userData, analysisId = userData._id, - analysisDate = userData.testTime, + analysisDate = "2024-02-08 16:33:56", //userData.reportUploadTime, analysisStatus = userData.classificationResult, thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId].toString(), interpretation = userData.classificationResult, testId = userData._id, testTime = userData.testTime, - collectionTime = userData.testTime, - expiryTime = userData.testTime, + collectionTime = "2024-02-08 16:33:56",//userData.testTime, + expiryTime = "2024-02-08 16:33:56",//userData.testTime, ) ) - } + + } + + if(!userData.localFlag){ + userData.localFlag = true + hemoCubeViewModel.bulkAddResultTestToDb(userData) + } + if (!userData.molbioFlag && isTokenAvailable) { + userData.molbioFlag = true + hemoCubeViewModel.uploadResult(resultList) } - } - if (isTokenAvailable) { - hemoCubeViewModel.uploadResult(resultList) } dialog.dismiss() } From 8c9903c75957036ff34c408f58cc3d6d08d81d6a Mon Sep 17 00:00:00 2001 From: Mariya Date: Mon, 12 Feb 2024 16:57:56 +0530 Subject: [PATCH 2/2] changes added for bulkupload the devices --- app/build.gradle | 6 +- app/google-services.json | 186 ++++++++++++++++-- app/src/main/AndroidManifest.xml | 11 +- .../hpostesting/presentation/MainActivity.kt | 9 + .../dashboard/DashboardActivity.kt | 2 +- .../presentation/dashboard/HomeFragment.kt | 4 +- app/src/main/res/layout/fragment_home.xml | 18 +- 7 files changed, 200 insertions(+), 36 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1db8587..8a0a2be 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,11 +16,11 @@ android { // dev - development, quality - qc, uat - User Acceptance Test, preprod - preproduction, prod - production defaultConfig { - applicationId "in.sminnovations.hpostesting.quality" + applicationId "in.sminnovations.hpostesting.dev" minSdk 21 targetSdk 34 - versionCode 106 - versionName "2.1.106" + versionCode 111 + versionName "2.1.111" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/google-services.json b/app/google-services.json index 7f4a67b..a73fe1e 100644 --- a/app/google-services.json +++ b/app/google-services.json @@ -1,45 +1,205 @@ { "project_info": { - "project_number": "1004619739289", - "project_id": "hpos-qa", - "storage_bucket": "hpos-qa.appspot.com" + "project_number": "650071678820", + "project_id": "hpos-af3cc", + "storage_bucket": "hpos-af3cc.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:1004619739289:android:f669b47552748433e5c808", + "mobilesdk_app_id": "1:650071678820:android:f1435a1c07f710036c6471", "android_client_info": { - "package_name": "in.sminnovations.hposregistration.quality" + "package_name": "com.example.hposconsentform" } }, - "oauth_client": [], + "oauth_client": [ + { + "client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com", + "client_type": 3 + } + ], "api_key": [ { - "current_key": "AIzaSyC4d4GhWHr_NMJAeBvnztQ_yQ3Qe9MAnLs" + "current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I" } ], "services": { "appinvite_service": { - "other_platform_oauth_client": [] + "other_platform_oauth_client": [ + { + "client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com", + "client_type": 3 + } + ] } } }, { "client_info": { - "mobilesdk_app_id": "1:1004619739289:android:8397cd1f0357bd89e5c808", + "mobilesdk_app_id": "1:650071678820:android:7865bef608cdee6f6c6471", "android_client_info": { - "package_name": "in.sminnovations.hpostesting.quality" + "package_name": "com.smi.counselling" } }, - "oauth_client": [], + "oauth_client": [ + { + "client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com", + "client_type": 3 + } + ], "api_key": [ { - "current_key": "AIzaSyC4d4GhWHr_NMJAeBvnztQ_yQ3Qe9MAnLs" + "current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I" } ], "services": { "appinvite_service": { - "other_platform_oauth_client": [] + "other_platform_oauth_client": [ + { + "client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:650071678820:android:2925e9ce3417d2386c6471", + "android_client_info": { + "package_name": "in.sminnovations.hemocube" + } + }, + "oauth_client": [ + { + "client_id": "650071678820-srhm9spm9hjn4frcd3r6o02gdhdbtd15.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "in.sminnovations.hemocube", + "certificate_hash": "7714b9268a81d0cf0fb178b0af8dbb630f8fc70a" + } + }, + { + "client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:650071678820:android:7569c1cad4fc99916c6471", + "android_client_info": { + "package_name": "in.sminnovations.hposregistration" + } + }, + "oauth_client": [ + { + "client_id": "650071678820-70kp5jvjda4r5diqch2kn4lc40p4f42g.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "in.sminnovations.hposregistration", + "certificate_hash": "7714b9268a81d0cf0fb178b0af8dbb630f8fc70a" + } + }, + { + "client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:650071678820:android:f96be19e5d43102b6c6471", + "android_client_info": { + "package_name": "in.sminnovations.hpostesting" + } + }, + "oauth_client": [ + { + "client_id": "650071678820-l87dnr0bdj95get0khgnvfv2an1k6ogq.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "in.sminnovations.hpostesting", + "certificate_hash": "7714b9268a81d0cf0fb178b0af8dbb630f8fc70a" + } + }, + { + "client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:650071678820:android:a53292637abb7c0d6c6471", + "android_client_info": { + "package_name": "in.sminnovations.hpostesting.dev" + } + }, + "oauth_client": [ + { + "client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com", + "client_type": 3 + } + ] } } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 718ca72..ae4b9fb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -119,13 +119,8 @@ android:noHistory="true" android:theme="@style/AppTheme.NoActionBar"> - - - - - - - + + { + binding.cvItem1.visibility = View.VISIBLE + binding.cvItem3.visibility = View.VISIBLE + binding.cvItem2.visibility = View.GONE + binding.cvItem4.visibility = View.GONE + DataHolder.deviceType.postValue(Constants.DEVICE_TYPE_HEMOCUBE) + Constants.DEVICE_TYPE_HEMOCUBE + } + device.productId == Constants.DEVICE_PRODUCT_ID && device.vendorId == Constants.DEVICE_VENDOR_ID -> { Log.d( TAG, diff --git a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt index 63b7cd9..7aab41f 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt @@ -158,7 +158,7 @@ class DashboardActivity : AppCompatActivity(), IDataCollector { val uri: Uri = FileProvider.getUriForFile( this, - "com.example.hpostesting.fileprovider", + "com.example.hpostesting.qa.fileprovider", file ) diff --git a/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt index 89e26b1..56397fb 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt @@ -183,9 +183,9 @@ class HomeFragment : Fragment() { val btnSaveLocalVisibility = if (userData.any { it.testStatus == true }) View.VISIBLE else View.GONE - binding.btnSaveLocal.visibility = btnSaveLocalVisibility + binding.downloadCSV.visibility = btnSaveLocalVisibility - binding.btnSaveLocal.setOnClickListener { + binding.downloadCSV.setOnClickListener { if (btnSaveLocalVisibility == View.VISIBLE) { // Execute the action when the button is visible (testStatus is true for at least one user) showDownloadDialog(requireContext()) diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index df38b54..7343952 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -115,15 +115,15 @@ tools:listitem="@layout/offline_user_list_view" /> - + + + + + + + + +