update without app distribution done
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.example.hpostesting.presentation.dashboard
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.AlertDialog
|
||||
import android.app.DownloadManager
|
||||
import android.content.BroadcastReceiver
|
||||
@@ -1049,6 +1050,7 @@ class HomeFragment : Fragment() {
|
||||
val matchResult = regex.find(receivedData)
|
||||
return matchResult?.groups?.get(1)?.value ?: ""
|
||||
}
|
||||
@SuppressLint("SuspiciousIndentation")
|
||||
private fun checkForUpdate() {
|
||||
try {
|
||||
val db = Firebase.firestore
|
||||
@@ -1076,10 +1078,11 @@ class HomeFragment : Fragment() {
|
||||
|
||||
val globalUpdateIgnore = documentIn!!.globalUpdateIgnore
|
||||
val deviceUpdateAvailable = documentIn.deviceUpdateAvailable
|
||||
val globalUpdateDone = documentIn.globalUpdateDone
|
||||
val updatePath = documentIn.updatePath
|
||||
if(globalUpdateIgnore){
|
||||
if(deviceUpdateAvailable){
|
||||
val update = db.collection("devices").document(it.id).update("deviceUpdateAvailable","false")
|
||||
val update = db.collection("devices").document(it.id).update("deviceUpdateAvailable",false)
|
||||
update.addOnSuccessListener {
|
||||
Log.d("HomeFragmentUpdate","Device local update done")
|
||||
|
||||
@@ -1091,13 +1094,15 @@ class HomeFragment : Fragment() {
|
||||
Log.d("HomeFragmentUpdate","Device update not available")
|
||||
}
|
||||
}else{
|
||||
val update = db.collection("devices").document(it.id).update("globalUpdateDone","true")
|
||||
update.addOnSuccessListener {
|
||||
Log.d("HomeFragmentUpdate","Device global update done")
|
||||
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.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user