remove a state check

This commit is contained in:
Pritimay Sarkar
2024-02-16 20:48:48 +05:30
parent 09d4bb56fc
commit 515d154e50

View File

@@ -148,36 +148,38 @@ class HemoCubeFragment : Fragment() {
if (result == "Success") { if (result == "Success") {
uploadedToCloud = true uploadedToCloud = true
showToast(R.string.test_upload) showToast(R.string.test_upload)
hemoCubeViewModel.resultUpload.observe(viewLifecycleOwner) { if (Constants.MOLBIO_INTEGRATION) {
when (it) { hemoCubeViewModel.resultUpload.observe(viewLifecycleOwner) {
is Result.Success -> { when (it) {
uploadedToMolbio = true is Result.Success -> {
if (Constants.MOLBIO_INTEGRATION) { uploadedToMolbio = true
it.data.data?.get(0)?.rawData?.let { it1 -> it.data.data?.get(0)?.rawData?.let { it1 ->
hemoCubeViewModel.updateMolbioFlag( hemoCubeViewModel.updateMolbioFlag(
it1._id it1._id
) )
} }
handleReadingFinish()
} }
handleReadingFinish()
}
is Result.Error -> { is Result.Error -> {
binding.btnSubmit.visibility = View.VISIBLE binding.btnSubmit.visibility = View.VISIBLE
//Remove this line of code while deploying to IOCL //Remove this line of code while deploying to IOCL
it.exception.let { message -> it.exception.let { message ->
Toast.makeText( Toast.makeText(
activity, activity,
"An error occurred: $message", "An error occurred: $message",
Toast.LENGTH_LONG Toast.LENGTH_LONG
) )
.show() .show()
}
handleReadingFinish()
} }
handleReadingFinish()
}
else -> {} else -> {}
}
} }
} else {
handleReadingFinish()
} }
} }
if (result == "Local") { if (result == "Local") {
@@ -406,11 +408,6 @@ class HemoCubeFragment : Fragment() {
fetchResult() fetchResult()
} }
(resultData.contains("#RS") && this.testStatusCode < TestStatus.EPROM_ADC_RETRIEVAL_STARTED.code) -> {
this.testStatusCode = TestStatus.EPROM_ADC_RETRIEVAL_STARTED.code
hemoCubeViewModel.messages.postValue("EPROM ADC Fetch")
}
(resultData.contains("#RC") && this.testStatusCode < TestStatus.EPROM_ADC_RETRIEVAL_COMPLETED.code) -> { (resultData.contains("#RC") && this.testStatusCode < TestStatus.EPROM_ADC_RETRIEVAL_COMPLETED.code) -> {
this.testStatusCode = TestStatus.EPROM_ADC_RETRIEVAL_COMPLETED.code this.testStatusCode = TestStatus.EPROM_ADC_RETRIEVAL_COMPLETED.code
hemoCubeViewModel.messages.postValue("EPROM ADC Loaded") hemoCubeViewModel.messages.postValue("EPROM ADC Loaded")