added deviceUpdateGlobal field in HomeFragment
This commit is contained in:
@@ -1159,7 +1159,7 @@ class HomeFragment : Fragment() {
|
||||
val deviceUpdateAvailableGlobal= deviceData.deviceUpdateAvailable
|
||||
val updatePathGlobal= deviceData.updatePath
|
||||
|
||||
// if(deviceUpdateAvailableGlobal){
|
||||
|
||||
db.collection("devices").whereEqualTo("deviceId", deviceId).get().addOnSuccessListener { documentSnapshotNew ->
|
||||
if (documentSnapshotNew.documents.isNotEmpty()) {
|
||||
documentSnapshotNew.documents.forEach{
|
||||
@@ -1183,14 +1183,24 @@ class HomeFragment : Fragment() {
|
||||
Log.d("HomeFragmentUpdate","Device update not available")
|
||||
}
|
||||
}else{
|
||||
if(!globalUpdateDone){
|
||||
val update = db.collection("devices").document(it.id).update("globalUpdateDone",true)
|
||||
update.addOnSuccessListener {
|
||||
Log.d("HomeFragmentUpdate","Device global update done")
|
||||
if(deviceUpdateAvailableGlobal) {
|
||||
if (!globalUpdateDone) {
|
||||
val update =
|
||||
db.collection("devices").document(it.id)
|
||||
.update("globalUpdateDone", true)
|
||||
update.addOnSuccessListener {
|
||||
Log.d(
|
||||
"HomeFragmentUpdate",
|
||||
"Device global update done"
|
||||
)
|
||||
|
||||
initiateUpdate(updatePathGlobal)
|
||||
}.addOnFailureListener{
|
||||
Log.e("fetchDeviceUpdate", "update fail.")
|
||||
initiateUpdate(updatePathGlobal)
|
||||
}.addOnFailureListener {
|
||||
Log.e(
|
||||
"fetchDeviceUpdate",
|
||||
"update fail."
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1212,8 +1222,7 @@ class HomeFragment : Fragment() {
|
||||
"fetchDeviceCredentials",
|
||||
"deviceVersion: $deviceVersion, Password: $deviceUpdateAvailableGlobal, updatePath: $updatePathGlobal"
|
||||
)
|
||||
|
||||
// } ?: Log.e("fetchDeviceUpdate", "Failed to parse device data.")
|
||||
// ?: Log.e("fetchDeviceUpdate", "Failed to parse device data.")
|
||||
} else {
|
||||
Log.e("fetchDeviceUpdate", "Document does not exist.")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user