From 1453fa38ac6179b78bd37b63b1c0d6d212c716f2 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Thu, 9 Oct 2025 15:11:13 +0800 Subject: [PATCH] Drop installation error bottom sheet for notifications Post user-readable error message in the notification as we already log the exception in the logcat. Signed-off-by: Aayush Gupta --- .../aurora/store/data/work/DownloadWorker.kt | 12 +- .../com/aurora/store/util/NotificationUtil.kt | 5 +- .../view/ui/sheets/InstallErrorDialogSheet.kt | 59 --------- .../main/res/layout/sheet_install_error.xml | 118 ------------------ .../main/res/navigation/mobile_navigation.xml | 18 --- 5 files changed, 12 insertions(+), 200 deletions(-) delete mode 100644 app/src/main/java/com/aurora/store/view/ui/sheets/InstallErrorDialogSheet.kt delete mode 100644 app/src/main/res/layout/sheet_install_error.xml diff --git a/app/src/main/java/com/aurora/store/data/work/DownloadWorker.kt b/app/src/main/java/com/aurora/store/data/work/DownloadWorker.kt index 1656979ac..8669d1d35 100644 --- a/app/src/main/java/com/aurora/store/data/work/DownloadWorker.kt +++ b/app/src/main/java/com/aurora/store/data/work/DownloadWorker.kt @@ -220,7 +220,7 @@ class DownloadWorker @AssistedInject constructor( } else -> { - notifyStatus(DownloadStatus.FAILED) + notifyStatus(status = DownloadStatus.FAILED, exception = exception) AuroraApp.events.send( InstallerEvent.Failed( packageName = download.packageName, @@ -390,7 +390,11 @@ class DownloadWorker @AssistedInject constructor( * Notifies the user of the current status of the download. * @param status Current [DownloadStatus] */ - private suspend fun notifyStatus(status: DownloadStatus, isProgress: Boolean = false) { + private suspend fun notifyStatus( + status: DownloadStatus, + isProgress: Boolean = false, + exception: Exception? = null + ) { // Update status in database download.downloadStatus = status downloadDao.updateStatus(download.packageName, status) @@ -408,7 +412,9 @@ class DownloadWorker @AssistedInject constructor( else -> {} } - val notification = NotificationUtil.getDownloadNotification(context, download, icon) + val notification = NotificationUtil.getDownloadNotification( + context, download, icon, exception?.message + ) notificationManager.notify( if (isProgress) NOTIFICATION_ID else download.packageName.hashCode(), notification diff --git a/app/src/main/java/com/aurora/store/util/NotificationUtil.kt b/app/src/main/java/com/aurora/store/util/NotificationUtil.kt index 5851fa3fb..e23ed6977 100644 --- a/app/src/main/java/com/aurora/store/util/NotificationUtil.kt +++ b/app/src/main/java/com/aurora/store/util/NotificationUtil.kt @@ -90,7 +90,8 @@ object NotificationUtil { fun getDownloadNotification( context: Context, download: AuroraDownload, - largeIcon: Bitmap? = null + largeIcon: Bitmap? = null, + message: String? = null ): Notification { val builder = NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_DOWNLOADS) builder.setSmallIcon(R.drawable.ic_notification_outlined) @@ -120,7 +121,7 @@ object NotificationUtil { DownloadStatus.FAILED -> { builder.setSmallIcon(R.drawable.ic_download_fail) - builder.setContentText(context.getString(R.string.download_failed)) + builder.setContentText(message ?: context.getString(R.string.download_failed)) builder.color = Color.RED builder.setCategory(Notification.CATEGORY_ERROR) } diff --git a/app/src/main/java/com/aurora/store/view/ui/sheets/InstallErrorDialogSheet.kt b/app/src/main/java/com/aurora/store/view/ui/sheets/InstallErrorDialogSheet.kt deleted file mode 100644 index c551b1354..000000000 --- a/app/src/main/java/com/aurora/store/view/ui/sheets/InstallErrorDialogSheet.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Aurora Store - * Copyright (C) 2021, Rahul Kumar Patel - * - * Aurora Store is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * Aurora Store is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Aurora Store. If not, see . - * - */ - -package com.aurora.store.view.ui.sheets - -import android.os.Bundle -import android.view.View -import androidx.navigation.fragment.navArgs -import coil3.load -import coil3.request.transformations -import coil3.transform.CircleCropTransformation -import com.aurora.extensions.copyToClipBoard -import com.aurora.extensions.toast -import com.aurora.store.R -import com.aurora.store.databinding.SheetInstallErrorBinding -import dagger.hilt.android.AndroidEntryPoint - -@AndroidEntryPoint -class InstallErrorDialogSheet : BaseDialogSheet() { - - private val args: InstallErrorDialogSheetArgs by navArgs() - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - - binding.imgIcon.load(args.app.iconArtwork.url) { - transformations(CircleCropTransformation()) - } - - binding.txtLine1.text = args.app.displayName - binding.txtLine2.text = args.error - binding.txtLine3.text = args.extra - - binding.btnPrimary.setOnClickListener { - dismissAllowingStateLoss() - } - - binding.btnSecondary.setOnClickListener { - requireContext().copyToClipBoard(args.extra) - requireContext().toast(R.string.toast_clipboard_copied) - } - } -} diff --git a/app/src/main/res/layout/sheet_install_error.xml b/app/src/main/res/layout/sheet_install_error.xml deleted file mode 100644 index 6216bd365..000000000 --- a/app/src/main/res/layout/sheet_install_error.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml index 8e0082697..8e4f619b4 100644 --- a/app/src/main/res/navigation/mobile_navigation.xml +++ b/app/src/main/res/navigation/mobile_navigation.xml @@ -253,24 +253,6 @@ android:name="com.aurora.store.view.ui.sheets.DeviceMiuiSheet" android:label="DeviceMiuiSheet" tools:layout="@layout/sheet_device_miui" /> - - - - - -