mirror of
https://github.com/home-assistant/android
synced 2024-07-22 10:54:12 +00:00
Don't notify about cancellations in WebsocketManager (#2831)
Don't notify about cancellations in WebSocketManager
This commit is contained in:
parent
0148c65284
commit
e30390533d
|
@ -33,6 +33,7 @@ import io.homeassistant.companion.android.database.settings.WebsocketSetting
|
|||
import io.homeassistant.companion.android.notifications.MessagingManager
|
||||
import io.homeassistant.companion.android.settings.SettingsActivity
|
||||
import io.homeassistant.companion.android.webview.WebViewActivity
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
|
@ -226,6 +227,8 @@ class WebsocketManager(
|
|||
setForeground(ForegroundInfo(NOTIFICATION_ID, notification))
|
||||
true
|
||||
} catch (e: IllegalStateException) {
|
||||
if (e is CancellationException) return false
|
||||
|
||||
Log.e(TAG, "Unable to setForeground due to restrictions", e)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
if (notificationManager.getNotificationChannel(websocketIssuesChannel) == null) {
|
||||
|
|
Loading…
Reference in a new issue