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

feat: Add onProgress callback to download and upload methods #505

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

Conversation

MaximBelov
Copy link

@MaximBelov MaximBelov commented May 6, 2023

@Blasterdude
Copy link

Hey, I'd like to make a PR to fix this bug but I keep getting 403s when I try to push the feature branch. Any idea what's wrong / if this repo is even active? I'm curious how you were able to publish no problem.

@MaximBelov
Copy link
Author

@Blasterdude
I dont see your fork of this plugin

1 Make fork
2 Create branch and push commits
3 Create PR

@Blasterdude
Copy link

Ah okay thanks, not used to having to fork the repo to make a PR but makes sense. Is this repo even maintained currently? The last commit appears to be from last year.

@MaximBelov
Copy link
Author

I really hope that someone will merge my changes

You can use your forked version like this
https://github.com/MaximBelov/cordova-plugin-advanced-http-lab/blob/8a8caba1070babae54f10eafd034e73dadb30e93/package.json#L54

@silkimen
Copy link
Owner

Hi @MaximBelov, would you please explain why you created those two new functions? Asking, because uploadFile and downloadFile are short-hand functions for sendRequest (see https://github.com/silkimen/cordova-plugin-advanced-http#sendrequest) which is basically doing the same. Except it doesn't support progress callback yet, but this is implemented in #466. Did I miss something in your PR?

@MaximBelov MaximBelov changed the title feat: Add uploadFileWithOptions and downloadFileWithOptions methods feat: Add onProgress callback May 25, 2023
@MaximBelov MaximBelov changed the title feat: Add onProgress callback feat: Add onProgress callback to download and upload files May 25, 2023
@MaximBelov MaximBelov changed the title feat: Add onProgress callback to download and upload files feat: Add onProgress callback to download and upload methods May 25, 2023
@MaximBelov
Copy link
Author

Hi @silkimen
You are right

I removed new functions

I added progress callback for uploadFile and downloadLoad methods

@MaximBelov
Copy link
Author

MaximBelov commented May 25, 2023

@silkimen

Examples:

download file
https://github.com/MaximBelov/cordova-plugin-advanced-http-lab/blob/main/src/app/home/home.page.ts#L67

upload file
https://github.com/MaximBelov/cordova-plugin-advanced-http-lab/blob/main/src/app/home/home.page.ts#L78

We can simply implementation without providing a callback
cordova.fireDocumentEvent('onProgress', {transferred: 100 , total: 1000});

What did you think?

@Gargamil
Copy link

What about abort? Is there a possibility to abort the download?

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.

4 participants