updated the uto sumbit
This commit is contained in:
@@ -4,4 +4,10 @@
|
||||
### Release key
|
||||
|
||||
key0: prime24
|
||||
|
||||
### Version 133.3
|
||||
|
||||
Printer not added yet
|
||||
|
||||
//update it when it is completed
|
||||
|
||||
@@ -21,7 +21,7 @@ android {
|
||||
minSdk 30
|
||||
targetSdk 34
|
||||
versionCode 138
|
||||
versionName "2.1.133"
|
||||
versionName "2.1.133.3"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
|
||||
@@ -15,7 +15,7 @@ std::vector<std::pair<int, std::pair<std::string, std::unordered_map<std::string
|
||||
extern "C"
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_com_example_hpostesting_firebase_FirebaseManager_getFirebaseDataMap(JNIEnv *env,jobject thiz) {
|
||||
jclass mapClass = env->FindClass("java/util/LinkedHashMap"); // ✅ preserves insertion order
|
||||
jclass mapClass = env->FindClass("java/util/LinkedHashMap");
|
||||
jmethodID init = env->GetMethodID(mapClass, "<init>", "()V");
|
||||
jmethodID put = env->GetMethodID(mapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
|
||||
jobject outerMap = env->NewObject(mapClass, init);
|
||||
|
||||
@@ -32,7 +32,6 @@ import retrofit2.http.PUT
|
||||
import retrofit2.http.Part
|
||||
|
||||
interface MolbioResultApi {
|
||||
|
||||
@PUT("deviceService/results/HPOS")
|
||||
suspend fun uploadResults(
|
||||
@Body molbioV2ResultRequest: MolbioV2ResultRequest,
|
||||
@@ -47,6 +46,7 @@ interface MolbioResultApi {
|
||||
// suspend fun deviceUpdate(
|
||||
// @Body deviceUpdateRequest: DeviceUpdateRequest,
|
||||
// ): ResponseBody
|
||||
|
||||
@POST("deviceService/device/getUpdate")
|
||||
suspend fun deviceUpdate(
|
||||
@Body deviceUpdateRequest: DeviceUpdateRequest,
|
||||
@@ -62,7 +62,6 @@ interface MolbioResultApi {
|
||||
@Part logFile: MultipartBody.Part,
|
||||
): UploadLogsResponse
|
||||
|
||||
|
||||
@PUT("deviceService/device/uploadDeviceDiagnostics")
|
||||
suspend fun deviceDiagnostics(
|
||||
@Body deviceDiagnosticsRequest: DeviceDiagnosticsRequest
|
||||
|
||||
@@ -36,7 +36,6 @@ class FirebaseManager @Inject constructor(private val context: Context) {
|
||||
init {
|
||||
System.loadLibrary("native-server") //use NDK ro secure somethings
|
||||
}
|
||||
|
||||
}
|
||||
private val sharedPreferencesServerConfig = context.getSharedPreferences("FirebaseConfigPrefs", Context.MODE_PRIVATE)
|
||||
private val sharedPreferencesDev = context.getSharedPreferences("DevMode",Context.MODE_PRIVATE)
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.example.hpostesting.presentation.main_base.DashboardActivity
|
||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import `in`.sminnovations.hpostesting.databinding.FragmentDeviceProvisionBinding
|
||||
import okio.ByteString.Companion.decodeBase64
|
||||
import java.io.File
|
||||
|
||||
class DeviceProvisionFragment : Fragment() {
|
||||
@@ -147,17 +148,18 @@ class DeviceProvisionFragment : Fragment() {
|
||||
DashboardActivity::class.java
|
||||
)
|
||||
)
|
||||
|
||||
} else {
|
||||
Toast.makeText(
|
||||
activity,
|
||||
"An error in device provision: ${response.data.message}",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
Log.d("Error in hpos network", "observeViewModel:${response.data.message} ")
|
||||
binding.btnSubmit.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
is Result.Error -> {
|
||||
response.exception.let { message ->
|
||||
Toast.makeText(
|
||||
@@ -165,7 +167,9 @@ class DeviceProvisionFragment : Fragment() {
|
||||
"An error occurred in device provision: $message",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
Log.d("Error in hpos network 2", "observeViewModel:$message} ")
|
||||
}
|
||||
Log.d("Error in hpos network 3", "observeViewModel: $response} ")
|
||||
}
|
||||
|
||||
is Result.Loading -> {
|
||||
|
||||
@@ -29,6 +29,8 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.transition.Visibility
|
||||
import com.example.hpostesting.data.constant.DataHolder
|
||||
import com.example.hpostesting.util.Result
|
||||
import com.example.hpostesting.data.constant.Constants
|
||||
@@ -45,6 +47,9 @@ import com.google.firebase.crashlytics.ktx.crashlytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import `in`.sminnovations.hpostesting.R
|
||||
import `in`.sminnovations.hpostesting.databinding.FragmentHemoCubeReferenceBinding
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.log10
|
||||
import kotlin.random.Random
|
||||
@@ -142,6 +147,7 @@ class TrueHemeTestFragment : Fragment() {
|
||||
return binding.root
|
||||
}
|
||||
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
initViews()
|
||||
@@ -150,10 +156,52 @@ class TrueHemeTestFragment : Fragment() {
|
||||
observeViewModel()
|
||||
}
|
||||
|
||||
|
||||
private fun autoSmbt(ignoreCuvette : Boolean = true){
|
||||
submitClick = true
|
||||
checkSubmit = true
|
||||
lifecycleScope.launch {
|
||||
delay(100)
|
||||
}
|
||||
activity?.runOnUiThread {
|
||||
|
||||
if (checkSubmit) {
|
||||
with(sharedPreferences.edit()) {
|
||||
putBoolean(Constants.QUICK_CAPTURE, false)
|
||||
apply()
|
||||
}
|
||||
if (DataHolder.hemoCubeTestData!!.classificationResult != "Invalid") {
|
||||
DataHolder.sampleReadCounter++
|
||||
}
|
||||
binding.btnSubmit.isEnabled = false
|
||||
binding.btnSubmit.isClickable = false
|
||||
activity?.runOnUiThread {
|
||||
Log.d("HemoCubeFragment", "Test Process completed, result saved")
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
binding.btnSubmit.visibility = View.GONE
|
||||
}
|
||||
trueHemeTestViewModel.uploadHemoCubeResultToDatabase(
|
||||
isOnline,
|
||||
true,
|
||||
sharedPreferences.getString(Constants.KIT_NUMBER, ""),
|
||||
quickCapture
|
||||
)
|
||||
Toast.makeText(requireContext(), "Auto Sumbitted", Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
checkCuvettePresence()
|
||||
binding.btnSubmit.isEnabled = true
|
||||
binding.btnSubmit.isClickable = true
|
||||
Toast.makeText(requireContext(), "Auto Sumbit Failed ", Toast.LENGTH_SHORT).show()
|
||||
binding.btnSubmit.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun initViews() {
|
||||
binding.tvSubtitle4.movementMethod = ScrollingMovementMethod()
|
||||
binding.tvDeviceMessages.movementMethod = ScrollingMovementMethod()
|
||||
|
||||
binding.btnSubmit.setOnClickListener {
|
||||
// with(sharedPreferences.edit()) {
|
||||
// putBoolean(Constants.QUICK_CAPTURE, false)
|
||||
@@ -451,7 +499,7 @@ class TrueHemeTestFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun showBufferAlertDialog() {
|
||||
private fun showBufferAlertDialog(){
|
||||
val title = "WARNING"
|
||||
val message = getString(R.string.do_exist)
|
||||
val negativeText = getString(R.string.no)
|
||||
@@ -658,6 +706,8 @@ class TrueHemeTestFragment : Fragment() {
|
||||
}
|
||||
showRetryButtonForCuvette()
|
||||
}
|
||||
|
||||
//need to change where check submit
|
||||
resultData.contains("#CIN") && this.submitClick && this.testStatusCode < TestStatus.CUVETTE_PRESENTT.code -> {
|
||||
trueHemeTestViewModel.messages.postValue(getString(R.string.cuvette_presentt))
|
||||
this.testStatusCode = TestStatus.CUVETTE_PRESENTT.code
|
||||
@@ -665,6 +715,8 @@ class TrueHemeTestFragment : Fragment() {
|
||||
binding.testing.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resultData.contains("#AIN") && this.submitClick && this.testStatusCode <= TestStatus.CUVETTE_ABSENTT.code -> {
|
||||
trueHemeTestViewModel.messages.postValue(getString(R.string.cuvette_absentt))
|
||||
this.testStatusCode = TestStatus.CUVETTE_ABSENTT.code
|
||||
@@ -957,11 +1009,15 @@ class TrueHemeTestFragment : Fragment() {
|
||||
|
||||
if (readingsPerSample == 1) {
|
||||
activity?.runOnUiThread {
|
||||
binding.btnSubmit.visibility = View.VISIBLE
|
||||
binding.btnSubmit.isEnabled = true
|
||||
binding.btnSubmit.isClickable = true
|
||||
|
||||
//changing to invisible
|
||||
binding.btnSubmit.visibility = View.GONE
|
||||
// binding.btnSubmit.isEnabled = true
|
||||
// binding.btnSubmit.isClickable = true
|
||||
// binding.clParent.setBackgroundColor(Color.parseColor("#edfffd"))
|
||||
autoSmbt(true)
|
||||
binding.ivCheck.visibility = View.VISIBLE
|
||||
|
||||
}
|
||||
} else {
|
||||
trueHemeTestViewModel.uploadHemoCubeResultToDatabase(
|
||||
@@ -1769,4 +1825,7 @@ class TrueHemeTestFragment : Fragment() {
|
||||
private fun generateTwoDigitRandomNumber(): Int {
|
||||
return Random.nextInt(10, 100)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user