Commit 969a1dc7 authored by kinarob's avatar kinarob

optimize request operation

parent c78fbae1
...@@ -26,26 +26,24 @@ ...@@ -26,26 +26,24 @@
- (void)start { - (void)start {
self.executing = YES; self.executing = YES;
dispatch_async(dispatch_get_global_queue(0, 0), ^{ [[TZImageManager manager] getPhotoWithAsset:self.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
[[TZImageManager manager] getPhotoWithAsset:self.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { dispatch_async(dispatch_get_main_queue(), ^{
dispatch_async(dispatch_get_main_queue(), ^{ if (!isDegraded) {
if (!isDegraded) { if (self.completedBlock) {
if (self.completedBlock) { self.completedBlock(photo, info, isDegraded);
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];
});
} }
}); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
} progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) { [self done];
dispatch_async(dispatch_get_main_queue(), ^{ });
if (self.progressBlock) { }
self.progressBlock(progress, error, stop, info); });
} } progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
}); dispatch_async(dispatch_get_main_queue(), ^{
} networkAccessAllowed:YES]; if (self.progressBlock) {
}); self.progressBlock(progress, error, stop, info);
}
});
} networkAccessAllowed:YES];
} }
- (void)done { - (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