Skip to content

Commit

Permalink
Added Dispatchers.Main coroutine context when invoking listener.onDow…
Browse files Browse the repository at this point in the history
…nloadStart() (#134)
  • Loading branch information
nishant-sbnri authored Jan 18, 2025
1 parent b413053 commit d1271dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pdfViewer/src/main/java/com/rajat/pdfviewer/PdfDownloader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ class PdfDownloader(
withContext(Dispatchers.IO) {
var tempFile: File? = null
try {
listener.onDownloadStart()
withContext(Dispatchers.Main) {
listener.onDownloadStart()
}
val cacheDir = listener.getContext().cacheDir
tempFile = File.createTempFile("download_", ".tmp", cacheDir)
val urlConnection = URL(downloadUrl).openConnection().apply {
Expand Down

0 comments on commit d1271dd

Please sign in to comment.