Open
Conversation
…ed `NotificationHelper` to support general-purpose notification creation. - **In-App Updater**: Added download progress tracking (BPS, ETA) and integrated with `NotificationHelper` to show update status. - **NotificationHelper**: Refactored `createNotification` to be more modular, allowing its use for both book downloads and app updates. - **BookDownloader2**: Improved error handling with additional `try-catch` blocks and simplified notification logic. - **General**: Added a volatile check to prevent multiple concurrent update downloads.
LagradOst
requested changes
Apr 14, 2026
Owner
LagradOst
left a comment
There was a problem hiding this comment.
Good change, but it has some bugs that should be fixed before merging.
| runBlocking { | ||
| NotificationHelper.createNotification( | ||
| context = this@downloadUpdate, | ||
| source = url, |
Owner
There was a problem hiding this comment.
Source is meant to be in app actions, and should be null. You need to change the signature of createNotification for that.
| } | ||
| } finally { | ||
| } | ||
| catch(t: Throwable){ |
| val extraText = if (stateProgressState.total > 1) { | ||
| val unit = if (progressInBytes) "Kb" else "" | ||
| val div = if (progressInBytes) 1024 else 1 | ||
| "${stateProgressState.progress / div} $unit / ${stateProgressState.total / div} $unit" |
| val unit = if (progressInBytes) "Kb" else "" | ||
| val div = if (progressInBytes) 1024 else 1 | ||
| "${stateProgressState.progress / div} $unit / ${stateProgressState.total / div} $unit" | ||
| } else "" |
Owner
There was a problem hiding this comment.
No download progress for full files.
| } | ||
|
|
||
| logError(t) | ||
| changeDownload(id) { state = DownloadState.IsFailed } |
Owner
There was a problem hiding this comment.
This should be moved to before setSuffixData
| } | ||
| } | ||
|
|
||
| } catch(t: Throwable){ |
Owner
There was a problem hiding this comment.
How can this even throw something to catch?
| output.flush() | ||
| output.close() | ||
| input.close() | ||
| runBlocking { |
Owner
There was a problem hiding this comment.
if you have showNotification = false then nothing will be shown?
…efined progress text formatting and removed redundant error catching.
…nload state is updated before setting suffix data.
Contributor
Author
|
Done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added in-app update notifications with progress tracking and refactored
NotificationHelperto support general-purpose notification creation.NotificationHelperto show update status.createNotificationto be more modular, allowing its use for both book downloads and app updates.try-catchblocks and simplified notification logic.