diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt index 89e8c2fe7..880874a6f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt @@ -629,7 +629,12 @@ class NotificationReceiver : BroadcastReceiver() { action = Constants.SHORTCUT_LIBRARY_UPDATE_ERRORS flags = Intent.FLAG_ACTIVITY_CLEAR_TOP } - return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT) + return PendingIntent.getActivity( + context, + 0, + intent, + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE, + ) } /** diff --git a/domain/src/main/java/tachiyomi/domain/libraryUpdateError/interactor/InsertLibraryUpdateErrors.kt b/domain/src/main/java/tachiyomi/domain/libraryUpdateError/interactor/InsertLibraryUpdateErrors.kt index 1dff2b3e7..0da60d61f 100644 --- a/domain/src/main/java/tachiyomi/domain/libraryUpdateError/interactor/InsertLibraryUpdateErrors.kt +++ b/domain/src/main/java/tachiyomi/domain/libraryUpdateError/interactor/InsertLibraryUpdateErrors.kt @@ -1,20 +1,42 @@ package tachiyomi.domain.libraryUpdateError.interactor +import logcat.LogPriority +import tachiyomi.core.common.util.lang.withNonCancellableContext +import tachiyomi.core.common.util.system.logcat +import tachiyomi.domain.libraryUpdateError.interactor.DeleteLibraryUpdateErrors.Result import tachiyomi.domain.libraryUpdateError.model.LibraryUpdateError import tachiyomi.domain.libraryUpdateError.repository.LibraryUpdateErrorRepository class InsertLibraryUpdateErrors( private val libraryUpdateErrorRepository: LibraryUpdateErrorRepository, ) { - suspend fun upsert(libraryUpdateError: LibraryUpdateError) { - return libraryUpdateErrorRepository.upsert(libraryUpdateError) + suspend fun upsert(libraryUpdateError: LibraryUpdateError) = withNonCancellableContext { + try { + libraryUpdateErrorRepository.upsert(libraryUpdateError) + Result.Success + } catch (e: Exception) { + logcat(LogPriority.ERROR, e) + return@withNonCancellableContext Result.InternalError(e) + } } - suspend fun insert(libraryUpdateError: LibraryUpdateError) { - return libraryUpdateErrorRepository.insert(libraryUpdateError) + suspend fun insert(libraryUpdateError: LibraryUpdateError) = withNonCancellableContext { + try { + libraryUpdateErrorRepository.insert(libraryUpdateError) + Result.Success + } catch (e: Exception) { + logcat(LogPriority.ERROR, e) + return@withNonCancellableContext Result.InternalError(e) + } } - suspend fun insertAll(libraryUpdateErrors: List) { - return libraryUpdateErrorRepository.insertAll(libraryUpdateErrors) + suspend fun insertAll(libraryUpdateErrors: List) = withNonCancellableContext { + try { + libraryUpdateErrorRepository.insertAll(libraryUpdateErrors) + Result.Success + } catch (e: Exception) { + logcat(LogPriority.ERROR, e) + return@withNonCancellableContext Result.InternalError(e) + } } }