From d2d965d52489330d8355cf2430c177d9a77789ef Mon Sep 17 00:00:00 2001 From: Mariya Date: Thu, 25 Jan 2024 11:51:17 +0530 Subject: [PATCH] Uncomment the code for firebase --- .../dashboard/DashboardActivity.kt | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt index d0d64a7..395a194 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt @@ -189,41 +189,41 @@ class DashboardActivity : AppCompatActivity(), IDataCollector { override fun onResume() { super.onResume() -// val firebaseAppDistribution = FirebaseAppDistribution.getInstance() -// firebaseAppDistribution.updateIfNewReleaseAvailable() -// .addOnProgressListener { updateProgress -> -// -// if (updateProgress.apkBytesDownloaded > 0) { -// Toast.makeText( -// this, -// "${updateProgress.updateStatus}. ${updateProgress.apkBytesDownloaded / 1048576} /${updateProgress.apkFileTotalBytes / 1048576} MB", -// Toast.LENGTH_SHORT -// ).show() -// } -// } -// .addOnFailureListener { e -> -// // (Optional) Handle errors. -// if (e is FirebaseAppDistributionException) { -// when (e.errorCode) { -// FirebaseAppDistributionException.Status.NOT_IMPLEMENTED -> { -// // SDK did nothing. This is expected when building for Play. -// } -// -// else -> { -// // Handle other errors. -// Toast.makeText( -// this, -// "AppDistribution error, status: ${e.errorCode}", -// Toast.LENGTH_SHORT -// ).show() -// } -// } -// FirebaseCrashlytics.getInstance().recordException(e) -// } -// } -// .addOnSuccessListener { -//// Toast.makeText(this, "App Update: Success!", Toast.LENGTH_SHORT).show() -// } + val firebaseAppDistribution = FirebaseAppDistribution.getInstance() + firebaseAppDistribution.updateIfNewReleaseAvailable() + .addOnProgressListener { updateProgress -> + + if (updateProgress.apkBytesDownloaded > 0) { + Toast.makeText( + this, + "${updateProgress.updateStatus}. ${updateProgress.apkBytesDownloaded / 1048576} /${updateProgress.apkFileTotalBytes / 1048576} MB", + Toast.LENGTH_SHORT + ).show() + } + } + .addOnFailureListener { e -> + // (Optional) Handle errors. + if (e is FirebaseAppDistributionException) { + when (e.errorCode) { + FirebaseAppDistributionException.Status.NOT_IMPLEMENTED -> { + // SDK did nothing. This is expected when building for Play. + } + + else -> { + // Handle other errors. + Toast.makeText( + this, + "AppDistribution error, status: ${e.errorCode}", + Toast.LENGTH_SHORT + ).show() + } + } + FirebaseCrashlytics.getInstance().recordException(e) + } + } + .addOnSuccessListener { +// Toast.makeText(this, "App Update: Success!", Toast.LENGTH_SHORT).show() + } } override fun setConnect(connect: Boolean) {