Skip to content

Commit cef7203

Browse files
committed
fix(notification): open upload list for failed uploads
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent 566b580 commit cef7203

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

app/src/main/java/com/nextcloud/client/jobs/utils/UploadErrorNotificationManager.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import androidx.core.app.NotificationCompat
1515
import com.nextcloud.client.jobs.notification.WorkerNotificationManager
1616
import com.nextcloud.client.jobs.upload.FileUploadHelper
1717
import com.nextcloud.client.jobs.upload.UploadBroadcastAction
18+
import com.nextcloud.client.notifications.AppWideNotificationManager
1819
import com.nextcloud.utils.extensions.isFileSpecificError
1920
import com.owncloud.android.R
2021
import com.owncloud.android.authentication.AuthenticatorActivity
@@ -143,9 +144,12 @@ object UploadErrorNotificationManager {
143144
)
144145
}
145146

146-
if (result.code == ResultCode.UNAUTHORIZED) {
147-
setContentIntent(credentialPendingIntent(context, operation))
147+
val pendingIntent = if (result.code == ResultCode.UNAUTHORIZED) {
148+
credentialPendingIntent(context, operation)
149+
} else {
150+
AppWideNotificationManager.getUploadListPendingIntent(context)
148151
}
152+
setContentIntent(pendingIntent)
149153
}.build()
150154
}
151155

app/src/main/java/com/nextcloud/client/notifications/AppWideNotificationManager.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,21 @@ object AppWideNotificationManager {
3737

3838
private const val SYNC_CONFLICT_NOTIFICATION_ID = 112
3939

40-
fun showSyncConflictNotification(context: Context) {
40+
fun getUploadListPendingIntent(context: Context): PendingIntent {
4141
val intent = Intent(context, UploadListActivity::class.java).apply {
4242
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
4343
}
4444

45-
val pendingIntent = PendingIntent.getActivity(
45+
return PendingIntent.getActivity(
4646
context,
4747
SYNC_CONFLICT_NOTIFICATION_INTENT_REQ_CODE,
4848
intent,
4949
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
5050
)
51+
}
52+
53+
fun showSyncConflictNotification(context: Context) {
54+
val pendingIntent = getUploadListPendingIntent(context)
5155

5256
val actionIntent = Intent(context, SyncConflictNotificationBroadcastReceiver::class.java).apply {
5357
putExtra(SyncConflictNotificationBroadcastReceiver.NOTIFICATION_ID, SYNC_CONFLICT_NOTIFICATION_ID)

0 commit comments

Comments
 (0)