app distribution changes

- show progress update
	- show update success message
This commit is contained in:
Pritimay Sarkar
2023-10-02 18:57:50 +05:30
parent 8a56d0eb5f
commit 211429fb8f

View File

@@ -13,6 +13,8 @@ import androidx.navigation.ui.setupWithNavController
import com.google.android.material.navigation.NavigationView
import com.google.firebase.appdistribution.FirebaseAppDistribution
import com.google.firebase.appdistribution.FirebaseAppDistributionException
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.google.firebase.crashlytics.ktx.crashlytics
//import com.google.firebase.appdistribution.FirebaseAppDistribution
//import com.google.firebase.appdistribution.FirebaseAppDistributionException
import dagger.hilt.android.AndroidEntryPoint
@@ -64,7 +66,11 @@ class DashboardActivity : AppCompatActivity() {
val firebaseAppDistribution = FirebaseAppDistribution.getInstance()
firebaseAppDistribution.updateIfNewReleaseAvailable()
.addOnProgressListener { updateProgress ->
Toast.makeText(this, "Updating", Toast.LENGTH_SHORT).show()
Toast.makeText(
this,
"FirebaseAppDistribution progress: ${updateProgress.updateStatus}. ${updateProgress.apkBytesDownloaded}/${updateProgress.apkFileTotalBytes}",
Toast.LENGTH_SHORT
).show()
}
.addOnFailureListener { e ->
// (Optional) Handle errors.
@@ -78,9 +84,11 @@ class DashboardActivity : AppCompatActivity() {
// Handle other errors.
}
}
FirebaseCrashlytics.getInstance().recordException(e)
}
}
.addOnSuccessListener {
Toast.makeText(this, "App Update: Success!", Toast.LENGTH_SHORT).show()
}
}
}