|
@@ -429,6 +429,8 @@
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ UIAlertController *alertVC = [self showIndicatorAlert];
|
|
|
|
|
+
|
|
|
__weak typeof(self) weakSelf = self;
|
|
__weak typeof(self) weakSelf = self;
|
|
|
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
|
|
|
|
@@ -439,11 +441,15 @@
|
|
|
weakSelf.download_query = path;
|
|
weakSelf.download_query = path;
|
|
|
weakSelf.documentPath = path;
|
|
weakSelf.documentPath = path;
|
|
|
|
|
|
|
|
- if (path) {
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
- [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
+ [alertVC dismissViewControllerAnimated:YES completion:^{
|
|
|
|
|
+
|
|
|
|
|
+ if (path) {
|
|
|
|
|
+ [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -474,4 +480,51 @@
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#pragma mark - UI
|
|
|
|
|
+
|
|
|
|
|
+- (UIAlertController *)showIndicatorAlert {
|
|
|
|
|
+
|
|
|
|
|
+ // show alert
|
|
|
|
|
+ UIAlertController *alertController = [UIAlertController alertControllerWithTitle: nil
|
|
|
|
|
+ message: @"loading..."
|
|
|
|
|
+ preferredStyle: UIAlertControllerStyleAlert];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ UIViewController *customVC = [[UIViewController alloc] init];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ UIActivityIndicatorView* spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
|
|
|
|
|
+ spinner.color = [UIColor darkGrayColor];
|
|
|
|
|
+ [spinner startAnimating];
|
|
|
|
|
+ [customVC.view addSubview:spinner];
|
|
|
|
|
+
|
|
|
|
|
+ [customVC.view addConstraint:[NSLayoutConstraint
|
|
|
|
|
+ constraintWithItem: spinner
|
|
|
|
|
+ attribute:NSLayoutAttributeCenterX
|
|
|
|
|
+ relatedBy:NSLayoutRelationEqual
|
|
|
|
|
+ toItem:customVC.view
|
|
|
|
|
+ attribute:NSLayoutAttributeCenterX
|
|
|
|
|
+ multiplier:1.0f
|
|
|
|
|
+ constant:0.0f]];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ [customVC.view addConstraint:[NSLayoutConstraint
|
|
|
|
|
+ constraintWithItem: spinner
|
|
|
|
|
+ attribute:NSLayoutAttributeCenterY
|
|
|
|
|
+ relatedBy:NSLayoutRelationEqual
|
|
|
|
|
+ toItem:customVC.view
|
|
|
|
|
+ attribute:NSLayoutAttributeCenterY
|
|
|
|
|
+ multiplier:1.0f
|
|
|
|
|
+ constant:0.0f]];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ [alertController setValue:customVC forKey:@"contentViewController"];
|
|
|
|
|
+
|
|
|
|
|
+ [self presentViewController: alertController animated: YES completion: nil];
|
|
|
|
|
+
|
|
|
|
|
+ return alertController;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
@end
|
|
@end
|