Unverified Commit 1de0c0f9 authored by 谭真's avatar 谭真 Committed by GitHub

Merge pull request #1238 from kinarobin/optimize_request_operation

[Enhancements] Optimize request operation
parents c78fbae1 969a1dc7
......@@ -26,26 +26,24 @@
- (void)start {
self.executing = YES;
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[[TZImageManager manager] getPhotoWithAsset:self.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
dispatch_async(dispatch_get_main_queue(), ^{
if (!isDegraded) {
if (self.completedBlock) {
self.completedBlock(photo, info, isDegraded);
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self done];
});
[[TZImageManager manager] getPhotoWithAsset:self.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
dispatch_async(dispatch_get_main_queue(), ^{
if (!isDegraded) {
if (self.completedBlock) {
self.completedBlock(photo, info, isDegraded);
}
});
} progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
dispatch_async(dispatch_get_main_queue(), ^{
if (self.progressBlock) {
self.progressBlock(progress, error, stop, info);
}
});
} networkAccessAllowed:YES];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self done];
});
}
});
} progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
dispatch_async(dispatch_get_main_queue(), ^{
if (self.progressBlock) {
self.progressBlock(progress, error, stop, info);
}
});
} networkAccessAllowed:YES];
}
- (void)done {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment