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

Add dlprogress callbacks #74

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

JorySchossau
Copy link

@JorySchossau JorySchossau commented May 30, 2022

Summary:

  • Adds download progress callbacks. Comment, reject, help? :)
  • osx delegate-wrapping has me stumped. Anyone have experience or can point me in the right direction?

I really need minimal x-platform download progress for a project. To my knowledge no nim lib exists that allows this, but puppy is the closest. It would be ideal to also implement upload progress, but I figure one thing at a time. Also, download progress is far more common of a need than upload progress -- so a phased development doesn't seem horrible.

What's working in this PR:

  • linux libcurl download progress callback
  • windows WinHTTP download progress callback

What's broken:
Instead of including my attempt for macOS, I've left it untouched. This means it will not compile right now due to breaking signature changes elsewhere.

Features:

  • very simple download progress callbacks (total, current: int; an optional user pointer) trying to keep with puppy's minimalism
  • could be extended to support upload callbacks later in the same way

Assumptions:

  • The user is responsible for caring about concurrency, if it's important to them. But this is easy enough.

What needs help or guidance:

  • how can the objc code in this repo be used to create a delegate for the NSURLConnectionDelegate type?
    It looks like everything necessary is there to make this relatively easy. I have some guesses about how to use the templates, but there's a complex dance of declarations and registrations that needs to happen, and I'm at a loss. So far I've been looking into other delegate wrappers for understanding, like in the older nim objc project by jangko, and rust's objc wrapper.
  • Maybe there's a better/shorter name for the type than ProgressCallback? I don't like how long it is, but it is at least descriptive.
  • I'll work on adding tests

@guzba
Copy link
Collaborator

guzba commented Jun 18, 2022

Thanks for working on this. We'll take a look.

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

Successfully merging this pull request may close these issues.

2 participants