silkimen / cordova-plugin-advanced-http

Cordova / Phonegap plugin for communicating with HTTP servers. Allows for SSL pinning!
MIT License
391 stars 313 forks source link

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

Open MaximBelov opened 1 year ago

MaximBelov commented 1 year ago

source: https://github.com/silkimen/cordova-plugin-advanced-http/pull/466

Demo: https://github.com/MaximBelov/cordova-plugin-advanced-http-lab

PR to Awesome Cordova Plugins: https://github.com/danielsogl/awesome-cordova-plugins/pull/4512

Blasterdude commented 12 months ago

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 commented 12 months ago

@Blasterdude I dont see your fork of this plugin

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

Blasterdude commented 12 months ago

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 commented 12 months ago

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 commented 11 months ago

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 commented 11 months ago

Hi @silkimen You are right

I removed new functions

I added progress callback for uploadFile and downloadLoad methods

MaximBelov commented 11 months ago

@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 commented 5 months ago

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