firebase / firebase/firebase-ios-sdk
FR: Storage - use NSProgress objects properly when reporting progress, not re-initting them every time
- Dominant language
- C++
- Stars
- 6.7k
- Forks
- 1.8k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 72
Description
### [READ] Guidelines
### Feature proposal
* Firebase Component: Storage
In `FIRStorageTask.m` there's this code for reporting progress:
```
- (FIRStorageTaskSnapshot *)snapshot {
@synchronized(self) {
NSProgress *progress = [NSProgress progressWithTotalUnitCount:self.progress.totalUnitCount];
```
A new NSProgress object is created every time there's a snapshot. This makes it impossible to use NSProgress objects how they are often used: they get added as a child of another NSProgress object, via `NSProgress.addChild(...)`. That's because often one has lots of download tasks and wants to report overall/aggregate progress to the user -- and rather than having to calculate this every time something changes, one just observes a parent NSProgress object.
Ask: instead of making a new NSProgress object every time, please reuse one NSProgress object per task, specifically so we can add it as a child of a "parent" NSProgress object.
Bonus ask, worth 10,000 points: also support NSProgress' pause/unpause/cancel functionality, so we can easily tie in pausing multiple tasks at once
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.