Add loading spinner on restore
This commit is contained in:
parent
e3d88f7122
commit
47e20ddb99
2 changed files with 31 additions and 0 deletions
|
@ -8,6 +8,12 @@
|
|||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIAlertController (Private)
|
||||
|
||||
@property (nonatomic, retain) UIViewController *contentViewController;
|
||||
|
||||
@end
|
||||
|
||||
@interface UIAlertAction (Common)
|
||||
+ (UIAlertAction *)okAction;
|
||||
+ (UIAlertAction *)okActionWithHandler:(void (^)(UIAlertAction *action))handler;
|
||||
|
|
|
@ -114,6 +114,31 @@ NSString *backupNameSelected;
|
|||
alertControllerWithTitle:@"Restoring from backup"
|
||||
message:@"Your device will respring when the process is completed."
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
UIActivityIndicatorViewStyle indicatorStyle = UIActivityIndicatorViewStyleGray;
|
||||
if (@available(iOS 13, *)) {
|
||||
indicatorStyle = UIActivityIndicatorViewStyleMedium;
|
||||
}
|
||||
UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:indicatorStyle];
|
||||
activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[activityIndicator startAnimating];
|
||||
|
||||
finishedRestoreAlert.contentViewController = [[UIViewController alloc] init];
|
||||
[finishedRestoreAlert.contentViewController.view addSubview:activityIndicator];
|
||||
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[activityIndicator]|"
|
||||
options:kNilOptions
|
||||
metrics:nil
|
||||
views:@{
|
||||
@"activityIndicator": activityIndicator
|
||||
}]];
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[activityIndicator]|"
|
||||
options:kNilOptions
|
||||
metrics:nil
|
||||
views:@{
|
||||
@"activityIndicator": activityIndicator
|
||||
}]];
|
||||
|
||||
[self presentViewController:finishedRestoreAlert animated:YES completion:nil];
|
||||
|
||||
//RUN RESTORE SCRIPT
|
||||
|
|
Reference in a new issue