File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ @interface QNFormUpload ()
2626@property (nonatomic , strong ) QNUploadOption *option;
2727@property (nonatomic , strong ) QNUpCompletionHandler complete;
2828@property (nonatomic , strong ) QNConfiguration *config;
29+ @property (nonatomic ) float previousPercent;
2930
3031@end
3132
@@ -46,6 +47,7 @@ - (instancetype)initWithData:(NSData *)data
4647 _complete = block;
4748 _httpManager = http;
4849 _config = config;
50+ _previousPercent = 0 ;
4951 }
5052 return self;
5153}
@@ -72,6 +74,11 @@ - (void)put {
7274 if (percent > 0.95 ) {
7375 percent = 0.95 ;
7476 }
77+ if (percent > _previousPercent) {
78+ _previousPercent = percent;
79+ } else {
80+ percent = _previousPercent;
81+ }
7582 _option.progressHandler (_key, percent);
7683 };
7784
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ @interface QNResumeUpload ()
4242
4343@property (nonatomic , strong ) NSArray *fileAry;
4444
45+ @property (nonatomic ) float previousPercent;
46+
4547- (void )makeBlock : (NSString *)uphost
4648 offset : (UInt32)offset
4749 blockSize : (UInt32)blockSize
@@ -89,6 +91,7 @@ - (instancetype)initWithFile:(id<QNFileDelegate>)file
8991 _config = config;
9092
9193 _token = token;
94+ _previousPercent = 0 ;
9295 }
9396 return self;
9497}
@@ -197,6 +200,11 @@ - (void)nextTask:(UInt32)offset retriedTimes:(int)retried host:(NSString *)host
197200 if (percent > 0.95 ) {
198201 percent = 0.95 ;
199202 }
203+ if (percent > _previousPercent) {
204+ _previousPercent = percent;
205+ } else {
206+ percent = _previousPercent;
207+ }
200208 self.option .progressHandler (self.key , percent);
201209 };
202210
You can’t perform that action at this time.
0 commit comments