mirror of
https://github.com/mihonapp/mihon.git
synced 2025-01-30 11:54:54 +01:00
catch exception & fix notification intent
This commit is contained in:
parent
5d95c72e03
commit
dd29305979
@ -629,7 +629,12 @@ class NotificationReceiver : BroadcastReceiver() {
|
|||||||
action = Constants.SHORTCUT_LIBRARY_UPDATE_ERRORS
|
action = Constants.SHORTCUT_LIBRARY_UPDATE_ERRORS
|
||||||
flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
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,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,20 +1,42 @@
|
|||||||
package tachiyomi.domain.libraryUpdateError.interactor
|
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.model.LibraryUpdateError
|
||||||
import tachiyomi.domain.libraryUpdateError.repository.LibraryUpdateErrorRepository
|
import tachiyomi.domain.libraryUpdateError.repository.LibraryUpdateErrorRepository
|
||||||
|
|
||||||
class InsertLibraryUpdateErrors(
|
class InsertLibraryUpdateErrors(
|
||||||
private val libraryUpdateErrorRepository: LibraryUpdateErrorRepository,
|
private val libraryUpdateErrorRepository: LibraryUpdateErrorRepository,
|
||||||
) {
|
) {
|
||||||
suspend fun upsert(libraryUpdateError: LibraryUpdateError) {
|
suspend fun upsert(libraryUpdateError: LibraryUpdateError) = withNonCancellableContext {
|
||||||
return libraryUpdateErrorRepository.upsert(libraryUpdateError)
|
try {
|
||||||
|
libraryUpdateErrorRepository.upsert(libraryUpdateError)
|
||||||
|
Result.Success
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logcat(LogPriority.ERROR, e)
|
||||||
|
return@withNonCancellableContext Result.InternalError(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun insert(libraryUpdateError: LibraryUpdateError) {
|
suspend fun insert(libraryUpdateError: LibraryUpdateError) = withNonCancellableContext {
|
||||||
return libraryUpdateErrorRepository.insert(libraryUpdateError)
|
try {
|
||||||
|
libraryUpdateErrorRepository.insert(libraryUpdateError)
|
||||||
|
Result.Success
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logcat(LogPriority.ERROR, e)
|
||||||
|
return@withNonCancellableContext Result.InternalError(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun insertAll(libraryUpdateErrors: List<LibraryUpdateError>) {
|
suspend fun insertAll(libraryUpdateErrors: List<LibraryUpdateError>) = withNonCancellableContext {
|
||||||
return libraryUpdateErrorRepository.insertAll(libraryUpdateErrors)
|
try {
|
||||||
|
libraryUpdateErrorRepository.insertAll(libraryUpdateErrors)
|
||||||
|
Result.Success
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logcat(LogPriority.ERROR, e)
|
||||||
|
return@withNonCancellableContext Result.InternalError(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user