diff --git a/app/build.gradle b/app/build.gradle index b36fef6..2a45189 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 b2092ca..9bc14ac 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"> - - - - - - - + + ? = 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/MainActivity.kt b/app/src/main/java/com/example/hpostesting/presentation/MainActivity.kt index dfd8997..f1d0992 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/MainActivity.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/MainActivity.kt @@ -149,6 +149,15 @@ class MainActivity : AppCompatActivity() { Constants.DEVICE_TYPE_HEMOCUBE } + device.productId == 4614 && device.vendorId == 7111 -> { + 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/HomeFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt index cd62ff2..d93476d 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 @@ -126,6 +126,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 @@ -156,9 +190,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()) @@ -172,6 +206,8 @@ class HomeFragment : Fragment() { } } } + + binding.btnNewKit.setOnClickListener { with(sharedPreference.edit()) { putString(Constants.KIT_NUMBER, "") @@ -199,14 +235,16 @@ 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() @@ -221,10 +259,6 @@ class HomeFragment : Fragment() { ).show() } - - - - hemoCubeViewModel.loginResponse.observe(viewLifecycleOwner) { response -> when (response) { is Result.Success -> { @@ -698,29 +732,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() } 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" /> - + + + + + + + + +