Skip to content

How to track upload progress? #366

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

Closed
jaweii opened this issue Apr 29, 2020 · 24 comments
Closed

How to track upload progress? #366

jaweii opened this issue Apr 29, 2020 · 24 comments
Labels
type:feature New feature or improvement of existing feature

Comments

@jaweii
Copy link

jaweii commented Apr 29, 2020

No description provided.

@pastordee
Copy link
Contributor

This would be nice, any word on this.

@fischerscode
Copy link
Contributor

Currently the http package is used for server communication and as far as I know, there is now way to track the uploading progress using this library.

In order to track the upload of files, we might have to switch to dio.

@phillwiggins Do you think we should do this? As the whole SDK uses the ParseHTTPClient (I think), this might actually be possible without to much changes.

@phillwiggins
Copy link
Member

It does sound like a large change, however, I think you might be right. Except for websockets, I think the entire project depends on ParseHTTPClient which could be swapped out? It's definitely worth a try if you think that's the best option?

fischerscode added a commit to fischerscode/Parse-SDK-Flutter that referenced this issue Aug 11, 2020
@fischerscode
Copy link
Contributor

I have created a branch that uses dio, currently it seems to work, but I will do further testing.

@fischerscode
Copy link
Contributor

When using it with a heavy app, web freezes sometimes. I think it is related to this.

@facuparedes
Copy link
Contributor

I have created a branch that uses dio, currently it seems to work, but I will do further testing.

Hi!
Any plans to do a PR with dio package? It may be so useful in android/ios.
Greetings!

@fischerscode
Copy link
Contributor

The problem is, that at least my test app freezes, using the branch above.
@phillwiggins Do you think It would be an idea to leave everything as it is and just add dio for uploading a file (provinging an additional funktion like uploadWithProgress that uses the dio package)?
An other idea would be to create a parse_server_sdk_extension package, that adds some extra functionality, only some users need. (Personaly I am already using kind of such an approach for my application.)

@fischerscode
Copy link
Contributor

fischerscode commented Aug 26, 2020

I have created a branch that adds the option of getting the upload progress of a file.

This is only tested on Android. Further testing is appreciated.
Example:

file.upload(progressCallback: (int count, int total) => print("$count of $total"));

I am still not sure if I will create a PR with this change, as I think, using two network libraries is not ideal.

@fischerscode
Copy link
Contributor

When using it with a heavy app, web freezes sometimes. I think it is related to this.

I tried to reproduce this freezes and where not able to do so.
Maybe it has been a bug in flutters beta channel.

fischerscode added a commit to fischerscode/Parse-SDK-Flutter that referenced this issue Aug 27, 2020
@fischerscode
Copy link
Contributor

I have added the progressCallback to the dio branch.
Testing is highly appreciated. Pleas notify me, if you encounter any ui freezes or other problems.

If we would change the whole SDK to use dio (PR this branch) we could even add send and receive progress indications to the ParseObject().save() and QueryBuilder().query(). In normal use cases, this might not be used that often, but it might be handy, if many objects are fetched in a single query.

fischerscode added a commit to fischerscode/Parse-SDK-Flutter that referenced this issue Aug 27, 2020
fischerscode added a commit to fischerscode/Parse-SDK-Flutter that referenced this issue Aug 27, 2020
@facuparedes
Copy link
Contributor

I have added the progressCallback to the dio branch.
Testing is highly appreciated. Pleas notify me, if you encounter any ui freezes or other problems.

If we would change the whole SDK to use dio (PR this branch) we could even add send and receive progress indications to the ParseObject().save() and QueryBuilder().query(). In normal use cases, this might not be used that often, but it might be handy, if many objects are fetched in a single query.

Thanks u!! I'm going to try it on my app.
Greetings!

@fischerscode
Copy link
Contributor

@FNPCMDs
Are you still using this branch?
Did it work fine?

I am considering to create a similar branch based on 1.0.28.

@facuparedes
Copy link
Contributor

@FNPCMDs
Are you still using this branch?
Did it work fine?

I am considering to create a similar branch based on 1.0.28.

Right now I don't have any issues with that branch. I'm using it to develop my android app and everything works like a charm. I think it could be a nice feature in 1.0.28

@fischerscode
Copy link
Contributor

@phillwiggins
What do you think about switching to dio?

@phillwiggins
Copy link
Member

Risky, but could work quite well. It's a very powerful networking library that could offer some great benefits. I doubt very much that people are using the http library directly, and as it's abstracted by the library we have wrote, there probably wouldn't be many breaking changes?

@fischerscode
Copy link
Contributor

Changing http to dio was possible with not to many changes.
As far as I know, there are no breaking changes. Maybe if you provide your own ParseHTTPClient but this should be a pretty uncommon case.

I suggest that I will create a branch based on 1.0.28, change everything to dio, implement features like progress callbacks and then test this in my current project. (Maybe @FNPCMDs can test it, too.)
Then we can consider merging it into 1.0.28.

@fischerscode
Copy link
Contributor

I have created a branch based on 1.0.28 that uses dio.
I had no time testing it, yet.
Migration guide

@facuparedes
Copy link
Contributor

facuparedes commented Sep 18, 2020

Changing http to dio was possible with not to many changes.
As far as I know, there are no breaking changes. Maybe if you provide your own ParseHTTPClient but this should be a pretty uncommon case.

I suggest that I will create a branch based on 1.0.28, change everything to dio, implement features like progress callbacks and then test this in my current project. (Maybe @FNPCMDs can test it, too.)
Then we can consider merging it into 1.0.28.

Sorry!! I'm not getting notifications about this issue. I'm going to test your new branch in the following days. If I find any issues I will let you know. I will gladly help in this SDK.

Greetings!

@fischerscode
Copy link
Contributor

No problem :-)
I am currently testing using this branch. It uses dio and is up to date with 1.0.28. I think dio-1.0.28 is already some commits from 1.0.28 behind. (For example #446)

@fischerscode
Copy link
Contributor

@FNPCMDs
I have just discovered a problem with uploading files. I will try to fix it as soon as possible.

@fischerscode
Copy link
Contributor

@FNPCMDs
I have just discovered a problem with uploading files. I will try to fix it as soon as possible.

I think it is solved now.

@facuparedes
Copy link
Contributor

@FNPCMDs
I have just discovered a problem with uploading files. I will try to fix it as soon as possible.

I think it is solved now.

Wow that was so fast

@fischerscode
Copy link
Contributor

fischerscode commented Sep 18, 2020

Well... including a break it took 4 hours ;-)

@fischerscode
Copy link
Contributor

I am closing this now, as this feature was merged with #459.

@mtrezza mtrezza added type:feature New feature or improvement of existing feature and removed type:improvement labels Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

6 participants