Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary fix for notification permission checker #1325

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ open class PlaybackManager @Inject constructor(
const val ENABLED_KEY = "enabled"
}

private lateinit var notificationPermissionChecker: NotificationPermissionChecker
private var notificationPermissionChecker: NotificationPermissionChecker? = null

override val coroutineContext: CoroutineContext
get() = Dispatchers.Default
Expand Down Expand Up @@ -1719,12 +1719,14 @@ open class PlaybackManager @Inject constructor(
notification.sound = sound
}

notificationPermissionChecker.checkNotificationPermission {
manager.notify(
notificationTag,
NotificationBroadcastReceiver.NOTIFICATION_ID,
notification
)
try {
notificationPermissionChecker?.checkNotificationPermission {
manager.notify(notificationTag, NotificationBroadcastReceiver.NOTIFICATION_ID, notification)
} ?: manager.notify(notificationTag, NotificationBroadcastReceiver.NOTIFICATION_ID, notification)
} catch (e: Exception) {
val message = "Could not post notification ${e.message}"
LogBuffer.e(LogBuffer.TAG_PLAYBACK, message)
SentryHelper.recordException(message, e)
Comment on lines +1736 to +1737
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the extra logging you've added here. 👍

}
}

Expand Down