From 0df5dc94a7bd6cb489cc3dd404007f4e64c2bfc2 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Tue, 25 Nov 2025 15:51:54 -0300 Subject: [PATCH] Open app when tapping repo update notification --- next/src/main/kotlin/org/fdroid/NotificationManager.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/next/src/main/kotlin/org/fdroid/NotificationManager.kt b/next/src/main/kotlin/org/fdroid/NotificationManager.kt index d36111cc2..cbfce6aef 100644 --- a/next/src/main/kotlin/org/fdroid/NotificationManager.kt +++ b/next/src/main/kotlin/org/fdroid/NotificationManager.kt @@ -6,6 +6,7 @@ import android.app.PendingIntent.FLAG_IMMUTABLE import android.app.PendingIntent.FLAG_UPDATE_CURRENT import android.content.Context import android.content.Intent +import android.content.Intent.ACTION_MAIN import android.content.pm.PackageManager.PERMISSION_GRANTED import androidx.annotation.StringRes import androidx.core.app.NotificationChannelCompat @@ -91,6 +92,7 @@ class NotificationManager @Inject constructor( .setCategory(CATEGORY_SERVICE) .setContentTitle(context.getString(R.string.banner_updating_repositories)) .setContentText(msg) + .setContentIntent(getMainActivityPendingIntent(context)) .setOngoing(true) .setProgress(100, progress ?: 0, progress == null) @@ -173,6 +175,14 @@ class NotificationManager @Inject constructor( return builder } + private fun getMainActivityPendingIntent(context: Context): PendingIntent { + val i = Intent(ACTION_MAIN).apply { + setClass(context, MainActivity::class.java) + } + val flags = FLAG_UPDATE_CURRENT or FLAG_IMMUTABLE + return PendingIntent.getActivity(context, 0, i, flags) + } + private fun getMyAppsPendingIntent(context: Context): PendingIntent { val i = Intent(ACTION_MY_APPS).apply { setClass(context, MainActivity::class.java)