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

Download notification disappearing #3882

Closed
kelson42 opened this issue Jun 15, 2024 · 5 comments
Closed

Download notification disappearing #3882

kelson42 opened this issue Jun 15, 2024 · 5 comments
Assignees
Milestone

Comments

@kelson42
Copy link
Collaborator

I have no clear reproduction steps, but downloading large files at some point make the download notification disappearing.

@MohitMaliFtechiz
Copy link
Collaborator

@kelson42 Can you please provide some addtional information so that the problem can be narrowed down?

  • Which version of Android were you testing this scenario on?
  • How much large file you were downloading? I am testing this with 6.4GB, and 9GB files.
  • Did the notification disappear when the application was running or in the background or did disappear when the application was closed?
  • Did the notification permanently disappear?

@kelson42
Copy link
Collaborator Author

kelson42 commented Jun 21, 2024

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).

@MohitMaliFtechiz
Copy link
Collaborator

@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.

https://github.com/tonyofrancis/Fetch/blob/c450f681035ed47d2bd6e5e2b7cf4b921665e669/fetch2/src/main/java/com/tonyodev/fetch2/fetch/ListenerCoordinator.kt#L413

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).

@kelson42 kelson42 modified the milestones: 3.11.1, 3.12.0, 3.11.2 Jun 23, 2024
@kelson42 kelson42 modified the milestones: 3.11.2, 3.11.3 Jul 2, 2024
@kelson42 kelson42 modified the milestones: 3.11.3, 3.12.0 Jul 15, 2024
@kelson42
Copy link
Collaborator Author

I will retest once #3940 is merged

@MohitMaliFtechiz
Copy link
Collaborator

@kelson42 This issue is fixed by the #3935, you can retest this issue on your end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants