Albirew/tachiyomi
Archivé
1
0
Bifurcation 0

Avoid crashing when notification channels can't be created/deleted

For example, the application may be launched from a service, where channels cannot be deleted.
Cette révision appartient à :
arkon 2021-11-07 09:11:41 -05:00
Parent 7ce0110158
révision d4aeeadb26

Voir le fichier

@ -32,6 +32,7 @@ import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil
import eu.kanade.tachiyomi.util.system.animatorDurationScale
import eu.kanade.tachiyomi.util.system.logcat
import eu.kanade.tachiyomi.util.system.notification
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
@ -158,7 +159,11 @@ open class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
}
protected open fun setupNotificationChannels() {
Notifications.createChannels(this)
try {
Notifications.createChannels(this)
} catch (e: Exception) {
logcat(LogPriority.ERROR, e) { "Failed to modify notification channels" }
}
}
private inner class DisableIncognitoReceiver : BroadcastReceiver() {