Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions QiniuSDK/Storage/QNFormUpload.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ @interface QNFormUpload ()
@property (nonatomic, strong) QNUploadOption *option;
@property (nonatomic, strong) QNUpCompletionHandler complete;
@property (nonatomic, strong) QNConfiguration *config;
@property (nonatomic) float previousPercent;

@end

Expand All @@ -46,6 +47,7 @@ - (instancetype)initWithData:(NSData *)data
_complete = block;
_httpManager = http;
_config = config;
_previousPercent = 0;
}
return self;
}
Expand All @@ -72,6 +74,11 @@ - (void)put {
if (percent > 0.95) {
percent = 0.95;
}
if (percent > _previousPercent) {
_previousPercent = percent;
} else {
percent = _previousPercent;
}
_option.progressHandler(_key, percent);
};

Expand Down
8 changes: 8 additions & 0 deletions QiniuSDK/Storage/QNResumeUpload.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ @interface QNResumeUpload ()

@property (nonatomic, strong) NSArray *fileAry;

@property (nonatomic) float previousPercent;

- (void)makeBlock:(NSString *)uphost
offset:(UInt32)offset
blockSize:(UInt32)blockSize
Expand Down Expand Up @@ -89,6 +91,7 @@ - (instancetype)initWithFile:(id<QNFileDelegate>)file
_config = config;

_token = token;
_previousPercent = 0;
}
return self;
}
Expand Down Expand Up @@ -197,6 +200,11 @@ - (void)nextTask:(UInt32)offset retriedTimes:(int)retried host:(NSString *)host
if (percent > 0.95) {
percent = 0.95;
}
if (percent > _previousPercent) {
_previousPercent = percent;
} else {
percent = _previousPercent;
}
self.option.progressHandler(self.key, percent);
};

Expand Down