Open kelson42 opened 1 month ago
@kelson42 Can you please provide some addtional information so that the problem can be narrowed down?
Android 13, only one download at a time. It disappear I believe after a while if I don't use the device and never reapoear... but downloads continues (I see it in the library).
@kelson42 I have tested this issue with different large zim files, and left the phone until the files were not downloading, and monitored the behavior but the notification was visible all the time. The notification only disappeared when I killed the application(closed from the background list), and again visible when I reopened the application. Apart from this, the notification is triggering from the fetch lib with the downloadProgress
see the below method of fetch lib.
override fun progress(download: Download, etaInMilliSeconds: Long, downloadedBytesPerSecond: Long) {
synchronized(lock) {
fetchNotificationHandler.post {
synchronized(lock) {
for (fetchNotificationManager in fetchNotificationManagerList) {
if (fetchNotificationManager.postDownloadUpdate(download)) break
}
}
}
fetchListenerMap.values.forEach {
val iterator = it.iterator()
while (iterator.hasNext()) {
val fetchListener = iterator.next().get()
if (fetchListener == null) {
iterator.remove()
} else {
uiHandler.post {
fetchListener.onProgress(download, etaInMilliSeconds, downloadedBytesPerSecond)
}
}
}
}
if (fetchGroupListenerMap.isNotEmpty()) {
val groupId = download.group
val fetchGroup = groupInfoProvider.getGroupReplace(groupId, download, Reason.DOWNLOAD_PROGRESS_CHANGED)
fetchGroupListenerMap.values.forEach {
val iterator = it.iterator()
while (iterator.hasNext()) {
val fetchListener = iterator.next().get()
if (fetchListener == null) {
iterator.remove()
} else {
fetchListener.onProgress(groupId, download, etaInMilliSeconds, downloadedBytesPerSecond, fetchGroup)
}
}
}
} else {
groupInfoProvider.postGroupReplace(download.group, download, Reason.DOWNLOAD_PROGRESS_CHANGED)
}
val downloadObserverSet = downloadsObserverMap[download.id]
downloadObserverSet?.forEach {
val observer = it.get()
if (observer != null) {
uiHandler.post {
observer.onChanged(download, Reason.DOWNLOAD_PROGRESS_CHANGED)
}
}
}
}
}
In the above code, notification
and downloadProgress
are triggering via this method.
This code triggers the notification
for (fetchNotificationManager in fetchNotificationManagerList) {
if (fetchNotificationManager.postDownloadUpdate(download)) break
}
As you mentioned downloads continue so this method is running as it is publishing the download progress via below method, and we are handling this progress and showing it in LocalLibrary
.
fetchListener.onProgress(download, etaInMilliSeconds, downloadedBytesPerSecond)
So the postDownloadUpdate
method is not calling which updates the notification, somehow the fetchNotificationManager
listener was removed. The removal and adding of the fetchNotificationManager
listener is internal to fetch. The notification disappears after 10 seconds if it is not updated(To handle the app killing scenarios).
I will retest once #3940 is merged
I have no clear reproduction steps, but downloading large files at some point make the download notification disappearing.