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