remove start buffer and sample button from prod build
- add firebase exception log
This commit is contained in:
@@ -22,6 +22,7 @@ import com.example.hpostesting.presentation.UsbServiceListener
|
|||||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
||||||
import com.example.hpostesting.presentation.utils.MyDialogListener
|
import com.example.hpostesting.presentation.utils.MyDialogListener
|
||||||
import com.example.hpostesting.presentation.utils.UIUtils
|
import com.example.hpostesting.presentation.utils.UIUtils
|
||||||
|
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||||
import com.google.firebase.firestore.FirebaseFirestore
|
import com.google.firebase.firestore.FirebaseFirestore
|
||||||
import com.google.firebase.firestore.ktx.firestore
|
import com.google.firebase.firestore.ktx.firestore
|
||||||
import com.google.firebase.ktx.Firebase
|
import com.google.firebase.ktx.Firebase
|
||||||
@@ -46,7 +47,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
private var isTestOngoing = false
|
private var isTestOngoing = false
|
||||||
private var startListening = MutableLiveData<Boolean>(false)
|
private var startListening = MutableLiveData<Boolean>(false)
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
|
||||||
): View {
|
): View {
|
||||||
binding = FragmentHemoCubeReferenceBinding.inflate(inflater, container, false)
|
binding = FragmentHemoCubeReferenceBinding.inflate(inflater, container, false)
|
||||||
sharedPreferences =
|
sharedPreferences =
|
||||||
@@ -58,7 +59,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
initViews()
|
initViews()
|
||||||
observeViewModel()
|
observeViewModel()
|
||||||
// checkAndStartProcess()
|
checkAndStartProcess()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initViews() {
|
private fun initViews() {
|
||||||
@@ -80,16 +81,6 @@ class HemoCubeFragment : Fragment() {
|
|||||||
binding.btnSubmit.isClickable = false
|
binding.btnSubmit.isClickable = false
|
||||||
|
|
||||||
|
|
||||||
binding.btnSamplestart.setOnClickListener {
|
|
||||||
startSampleProcess()
|
|
||||||
it.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.btnPlacebuffer.setOnClickListener {
|
|
||||||
checkAndStartProcess()
|
|
||||||
it.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.btnKit.setOnClickListener {
|
binding.btnKit.setOnClickListener {
|
||||||
if (isTestOngoing) {
|
if (isTestOngoing) {
|
||||||
val title = "WARNING"
|
val title = "WARNING"
|
||||||
@@ -187,31 +178,31 @@ class HemoCubeFragment : Fragment() {
|
|||||||
hemoCubeViewModel.messages.observe(viewLifecycleOwner) {
|
hemoCubeViewModel.messages.observe(viewLifecycleOwner) {
|
||||||
binding.tvSubtitle4.text = it
|
binding.tvSubtitle4.text = it
|
||||||
}
|
}
|
||||||
startListening.observe(viewLifecycleOwner) {
|
// startListening.observe(viewLifecycleOwner) {
|
||||||
if (it) {
|
// if (it) {
|
||||||
lifecycleScope.launch {
|
// lifecycleScope.launch {
|
||||||
delay(1000)
|
// delay(1000)
|
||||||
if (binding.tvSubtitle4.text.toString().isEmpty()) {
|
// if (binding.tvSubtitle4.text.toString().isEmpty()) {
|
||||||
(activity as HemocubeActivity).reconnectDevice()
|
// (activity as HemocubeActivity).reconnectDevice()
|
||||||
if (isBufferValueAvailable()) {
|
// if (isBufferValueAvailable()) {
|
||||||
showBufferAlertDialog()
|
// showBufferAlertDialog()
|
||||||
} else {
|
// } else {
|
||||||
listenToHemoCube()
|
// listenToHemoCube()
|
||||||
startBufferProcess()
|
// startBufferProcess()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkAndStartProcess() {
|
private fun checkAndStartProcess() {
|
||||||
// if (isBufferValueAvailable()) {
|
if (isBufferValueAvailable()) {
|
||||||
// showBufferAlertDialog()
|
showBufferAlertDialog()
|
||||||
// } else {
|
} else {
|
||||||
listenToHemoCube()
|
listenToHemoCube()
|
||||||
startBufferProcess()
|
startBufferProcess()
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isBufferValueAvailable(): Boolean {
|
private fun isBufferValueAvailable(): Boolean {
|
||||||
@@ -278,6 +269,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
})
|
})
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showToast("test is going on")
|
showToast("test is going on")
|
||||||
|
Firebase.crashlytics.recordException(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,12 +284,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
when {
|
when {
|
||||||
stringData.contains("ERROR 500") -> showError500Dialog()
|
stringData.contains("ERROR 500") -> showError500Dialog()
|
||||||
stringData.contains("ERROR 501") -> showError501Dialog()
|
stringData.contains("ERROR 501") -> showError501Dialog()
|
||||||
stringData.contains("#Buffer Completed") ->
|
stringData.contains("#Buffer Completed") -> showStartSampleDialog()
|
||||||
activity?.runOnUiThread {
|
|
||||||
binding.btnSamplestart.visibility = View.VISIBLE
|
|
||||||
binding.btnSamplestart.isClickable = true
|
|
||||||
}
|
|
||||||
|
|
||||||
stringData.contains("#Sample Completed") -> {
|
stringData.contains("#Sample Completed") -> {
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
binding.btnSubmit.isEnabled = true
|
binding.btnSubmit.isEnabled = true
|
||||||
@@ -469,15 +456,14 @@ class HemoCubeFragment : Fragment() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
} catch (_: Exception) {
|
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
"Error while processing device data",
|
"Error while processing device data",
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
|
Firebase.crashlytics.recordException(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findResult(calculatedRatio: Double?): String {
|
private fun findResult(calculatedRatio: Double?): String {
|
||||||
@@ -485,23 +471,24 @@ class HemoCubeFragment : Fragment() {
|
|||||||
if (calculatedRatio != null) {
|
if (calculatedRatio != null) {
|
||||||
if (calculatedRatio < 0.085)
|
if (calculatedRatio < 0.085)
|
||||||
return "Inconclusive. Very low Absorbance - Repeat test with Higher Blood Volume"
|
return "Inconclusive. Very low Absorbance - Repeat test with Higher Blood Volume"
|
||||||
if (calculatedRatio in 0.085 .. 0.155)
|
if (calculatedRatio in 0.085..0.155)
|
||||||
return "Normal"
|
return "Normal"
|
||||||
if (calculatedRatio in 0.155 .. 0.175)
|
if (calculatedRatio in 0.155..0.175)
|
||||||
return "Negative Borderline. Repeat Test"
|
return "Negative Borderline. Repeat Test"
|
||||||
if (calculatedRatio in 0.175 .. 0.22)
|
if (calculatedRatio in 0.175..0.22)
|
||||||
return "Sickle Cell Trait"
|
return "Sickle Cell Trait"
|
||||||
if (calculatedRatio in 0.22 .. 0.25)
|
if (calculatedRatio in 0.22..0.25)
|
||||||
return "Positive for Sickle Cell. HPLC for Confirmation"
|
return "Positive for Sickle Cell. HPLC for Confirmation"
|
||||||
if (calculatedRatio in 0.25 .. 0.35)
|
if (calculatedRatio in 0.25..0.35)
|
||||||
return "Sickle Cell Disease"
|
return "Sickle Cell Disease"
|
||||||
if (calculatedRatio > 0.35)
|
if (calculatedRatio > 0.35)
|
||||||
return "Inconclusive. Repeat with test with lower volume of blood"
|
return "Inconclusive. Repeat with test with lower volume of blood"
|
||||||
} else {
|
} else {
|
||||||
return "NULL"
|
return "NULL"
|
||||||
}
|
}
|
||||||
} catch (_: Exception) {
|
} catch (e: Exception) {
|
||||||
showToast("error while performing classification")
|
showToast("error while performing classification")
|
||||||
|
Firebase.crashlytics.recordException(e)
|
||||||
return "ERROR"
|
return "ERROR"
|
||||||
}
|
}
|
||||||
return "NULL"
|
return "NULL"
|
||||||
|
|||||||
@@ -61,34 +61,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<!-- <Button-->
|
||||||
android:visibility="gone"
|
<!-- android:visibility="gone"-->
|
||||||
android:id="@+id/btn_samplestart"
|
<!-- android:id="@+id/btn_samplestart"-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_marginHorizontal="16dp"
|
<!-- android:layout_marginHorizontal="16dp"-->
|
||||||
android:layout_marginTop="24dp"
|
<!-- android:layout_marginTop="24dp"-->
|
||||||
android:clickable="false"
|
<!-- android:clickable="false"-->
|
||||||
android:text="@string/Start_Sample"
|
<!-- android:text="@string/Start_Sample"-->
|
||||||
android:textColor="@color/white"
|
<!-- android:textColor="@color/white"-->
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
app:layout_constraintTop_toBottomOf="@id/til_blood_group" />
|
<!-- app:layout_constraintTop_toBottomOf="@id/til_blood_group" />-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<!-- <Button-->
|
||||||
android:id="@+id/btn_placebuffer"
|
<!-- android:id="@+id/btn_placebuffer"-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_marginHorizontal="16dp"
|
<!-- android:layout_marginHorizontal="16dp"-->
|
||||||
android:layout_marginTop="24dp"
|
<!-- android:layout_marginTop="24dp"-->
|
||||||
android:clickable="false"
|
<!-- android:clickable="false"-->
|
||||||
android:text="@string/place_buffer"
|
<!-- android:text="@string/place_buffer"-->
|
||||||
android:textColor="@color/white"
|
<!-- android:textColor="@color/white"-->
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
app:layout_constraintTop_toBottomOf="@id/btn_submit" />
|
<!-- app:layout_constraintTop_toBottomOf="@id/btn_submit" />-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/btn_samplestart" />
|
app:layout_constraintTop_toBottomOf="@id/til_blood_group" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/til_blood_group"
|
android:id="@+id/til_blood_group"
|
||||||
|
|||||||
Reference in New Issue
Block a user