Added condition check for firebase integration enable, for trueheme device, if it enables only the data will upload to firebase, otherwise it will go to molbio server only,
This commit is contained in:
@@ -22,6 +22,7 @@ object Constants {
|
||||
const val ABHA_APP_PACKAGE = "in.ndhm.phr"
|
||||
|
||||
const val MOLBIO_INTEGRATION = true
|
||||
const val FIREBASE_INTEGRATION = false
|
||||
const val deviceProvisionEmail = "HPOS_provisioner@bigtec.co.in"
|
||||
const val deviceProvisionPassword = "f2ab0e7f9d69"
|
||||
const val DEVICE_ID_API = "deviceIDAPI"
|
||||
|
||||
@@ -321,8 +321,9 @@ class HomeFragment : Fragment() {
|
||||
|
||||
}*/
|
||||
hemoCubeViewModel.sendDataToMolbio()
|
||||
// hemoCubeViewModel.sendDataToFirebase()
|
||||
|
||||
if(Constants.FIREBASE_INTEGRATION){
|
||||
hemoCubeViewModel.sendDataToFirebase()
|
||||
}
|
||||
} else {
|
||||
binding.internetAvailableCL.visibility = View.GONE
|
||||
binding.pendingTest.visibility = View.GONE
|
||||
|
||||
@@ -434,29 +434,30 @@ class HemoCubeViewModel @Inject constructor(
|
||||
"yyyy-MM-dd'T'HH:mm:ssZZZZZ",
|
||||
Locale.getDefault()
|
||||
).format(Calendar.getInstance().time)
|
||||
if(Constants.FIREBASE_INTEGRATION) {
|
||||
when (val response = repository.addTestToDatabase(testDetails)) {
|
||||
is Response.Success -> {
|
||||
val kitCount = sharedPreference.getInt(Constants.KIT_COUNT, 0)
|
||||
with(sharedPreference.edit()) {
|
||||
putInt(Constants.KIT_COUNT, kitCount.plus(1))
|
||||
apply()
|
||||
}
|
||||
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
||||
fireBaseUpload.postValue("Success")
|
||||
testDetails.localFlag = true
|
||||
|
||||
// when (val response = repository.addTestToDatabase(testDetails)) {
|
||||
// is Response.Success -> {
|
||||
// val kitCount = sharedPreference.getInt(Constants.KIT_COUNT, 0)
|
||||
// with(sharedPreference.edit()) {
|
||||
// putInt(Constants.KIT_COUNT, kitCount.plus(1))
|
||||
// apply()
|
||||
// }
|
||||
// Log.i("Testdb", "Data uploaded to Firestore successfully")
|
||||
// fireBaseUpload.postValue("Success")
|
||||
// testDetails.localFlag = true
|
||||
//
|
||||
// hemoCubeDao.insertAll(testDetails)
|
||||
// }
|
||||
//
|
||||
// is Response.Error -> {
|
||||
// Log.e("Testdb", "Error uploading data to Firestore: $response")
|
||||
// fireBaseUpload.postValue("Error")
|
||||
// hemoCubeDao.insertAll(testDetails)
|
||||
// }
|
||||
//
|
||||
// else -> {}
|
||||
// }
|
||||
hemoCubeDao.updateTest(testDetails)
|
||||
}
|
||||
|
||||
is Response.Error -> {
|
||||
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
||||
fireBaseUpload.postValue("Error")
|
||||
hemoCubeDao.updateTest(testDetails)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
if (Constants.MOLBIO_INTEGRATION) {
|
||||
val kitCount = sharedPreference.getInt(Constants.KIT_COUNT, 0)
|
||||
with(sharedPreference.edit()) {
|
||||
|
||||
Reference in New Issue
Block a user