NotificationUtil: Split and rename notification channels for install & exports

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2024-10-06 23:09:30 +05:30
parent ddfa99ec6d
commit 2eb129fbb7
54 changed files with 17 additions and 59 deletions

View File

@@ -37,7 +37,8 @@ object Constants {
const val UPDATE_URL_STABLE = "https://gitlab.com/AuroraOSS/AuroraStore/raw/master/updates.json"
const val UPDATE_URL_NIGHTLY = "https://auroraoss.com/downloads/AuroraStore/Feeds/nightly_feed.json"
const val NOTIFICATION_CHANNEL_ALERT = "NOTIFICATION_CHANNEL_ALERT"
const val NOTIFICATION_CHANNEL_EXPORT = "NOTIFICATION_CHANNEL_EXPORT"
const val NOTIFICATION_CHANNEL_INSTALL = "NOTIFICATION_CHANNEL_INSTALL"
const val NOTIFICATION_CHANNEL_DOWNLOADS = "NOTIFICATION_CHANNEL_DOWNLOADS"
const val NOTIFICATION_CHANNEL_UPDATES = "NOTIFICATION_CHANNEL_UPDATES"

View File

@@ -34,13 +34,20 @@ object NotificationUtil {
val channels = ArrayList<NotificationChannel>()
channels.add(
NotificationChannel(
Constants.NOTIFICATION_CHANNEL_ALERT,
context.getString(R.string.notification_channel_alert),
Constants.NOTIFICATION_CHANNEL_INSTALL,
context.getString(R.string.notification_channel_install),
NotificationManager.IMPORTANCE_HIGH
).apply {
setSound(null, null)
}
)
channels.add(
NotificationChannel(
Constants.NOTIFICATION_CHANNEL_EXPORT,
context.getString(R.string.notification_channel_export),
NotificationManager.IMPORTANCE_HIGH
)
)
channels.add(
NotificationChannel(
Constants.NOTIFICATION_CHANNEL_DOWNLOADS,
@@ -148,7 +155,7 @@ object NotificationUtil {
displayName: String,
packageName: String
): Notification {
return NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_ALERT)
return NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_INSTALL)
.setSmallIcon(R.drawable.ic_install)
.setLargeIcon(PackageUtil.getIconForPackage(context, packageName))
.setContentTitle(displayName)
@@ -163,7 +170,7 @@ object NotificationUtil {
displayName: String,
content: String?
): Notification {
return NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_ALERT)
return NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_INSTALL)
.setSmallIcon(R.drawable.ic_install)
.setContentTitle(displayName)
.setContentText(content)
@@ -238,7 +245,7 @@ object NotificationUtil {
}
fun getExportNotification(context: Context): Notification {
return NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_ALERT)
return NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_EXPORT)
.setSmallIcon(R.drawable.ic_file_copy)
.setContentTitle(context.getString(R.string.export_app_title))
.setContentText(context.getString(R.string.export_app_summary))
@@ -271,7 +278,7 @@ object NotificationUtil {
context.getString(R.string.export_app_summary_fail)
}
val builder = NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_ALERT)
val builder = NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_EXPORT)
.setSmallIcon(R.drawable.ic_file_copy)
.setContentTitle(displayName).setContentText(content)
.setContentIntent(getContentIntentForExport(context, uri))