-
Notifications
You must be signed in to change notification settings - Fork 19
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
Implement MVP Share UI as designed #6
Conversation
that shows number of items, total file size and Clear All button
app/src/main/java/org/onionshare/android/server/WebserverManager.kt
Outdated
Show resolved
Hide resolved
} | ||
return FilesAdded(existingFiles + files) | ||
} | ||
|
||
fun zipFiles(state: FilesAdded): FilesReadyForDownload { | ||
fun zipFiles(files: List<SendFile>, ensureActive: () -> Unit): FilesReadyForDownload { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than passing a lambda that wraps the coroutine scope's ensureActive() method, I wonder if it might be clearer to pass the coroutine scope and call its ensureActive() method explicitly? I think that would make it more obvious that the lambda is expected to throw CancellationException to break the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is actually how it was before. I had changed it, because I found it a bit strange to hand over coroutine contexts in a function, but maybe that's fine.
What might be better and seems to be possible is using currentCoroutineContext().ensureActive()
which can be done when we make this a suspend function.
No description provided.