mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-16 02:48:08 -04:00
Merge pull request #4279 from kiwix/Fixes#4278
Fixed: Application crashes on `FetchDownloadNotificationManager.getCancelNotification` method.
This commit is contained in:
commit
563e06e302
@ -73,6 +73,8 @@ class FetchDownloadNotificationManager @Inject constructor(
|
|||||||
val context: Context,
|
val context: Context,
|
||||||
private val downloadRoomDao: DownloadRoomDao
|
private val downloadRoomDao: DownloadRoomDao
|
||||||
) : DefaultFetchNotificationManager(context) {
|
) : DefaultFetchNotificationManager(context) {
|
||||||
|
private val notificationBuilderLock = Any()
|
||||||
|
|
||||||
private val downloadNotificationManager: NotificationManager by lazy {
|
private val downloadNotificationManager: NotificationManager by lazy {
|
||||||
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
}
|
}
|
||||||
@ -258,6 +260,7 @@ class FetchDownloadNotificationManager @Inject constructor(
|
|||||||
download: Download,
|
download: Download,
|
||||||
notificationBuilder: Builder
|
notificationBuilder: Builder
|
||||||
): Notification {
|
): Notification {
|
||||||
|
synchronized(notificationBuilderLock) {
|
||||||
val downloadTitle = getDownloadNotificationTitle(download)
|
val downloadTitle = getDownloadNotificationTitle(download)
|
||||||
val notificationTitle =
|
val notificationTitle =
|
||||||
runBlocking(Dispatchers.IO) {
|
runBlocking(Dispatchers.IO) {
|
||||||
@ -287,6 +290,7 @@ class FetchDownloadNotificationManager @Inject constructor(
|
|||||||
)
|
)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getActionPendingIntent(
|
private fun getActionPendingIntent(
|
||||||
fetch: Fetch,
|
fetch: Fetch,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user