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