|
|
@@ -81,43 +81,56 @@
|
|
|
- (void)cleanDiskCache:(RASettingActionModel *)model {
|
|
|
model.active = YES;
|
|
|
|
|
|
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:@"are you sure to clean cached file" preferredStyle:UIAlertControllerStyleAlert];
|
|
|
- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
-
|
|
|
- model.active = NO;
|
|
|
- }];
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
|
- UIAlertAction *yesAction = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:@"are you sure to clean cached file" preferredStyle:UIAlertControllerStyleAlert];
|
|
|
+ UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+
|
|
|
+ model.active = NO;
|
|
|
+ }];
|
|
|
|
|
|
- dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
+ UIAlertAction *yesAction = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
|
|
- NSFileManager *defaultManager = [NSFileManager defaultManager];
|
|
|
- NSString *cacheDir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
|
|
|
- NSString *imageCacheDir = [cacheDir stringByAppendingPathComponent:@"ImageCache"];
|
|
|
- if ([defaultManager fileExistsAtPath:imageCacheDir]) {
|
|
|
- [defaultManager removeItemAtPath:imageCacheDir error:nil];
|
|
|
- }
|
|
|
- sleep(1.0);
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- model.active = NO;
|
|
|
-
|
|
|
- [self showAlert:@"Clean Success"];
|
|
|
+ dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
+
|
|
|
+ NSFileManager *defaultManager = [NSFileManager defaultManager];
|
|
|
+ NSString *cacheDir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
|
|
|
+ NSString *imageCacheDir = [cacheDir stringByAppendingPathComponent:@"ImageCache"];
|
|
|
+ if ([defaultManager fileExistsAtPath:imageCacheDir]) {
|
|
|
+ [defaultManager removeItemAtPath:imageCacheDir error:nil];
|
|
|
+ }
|
|
|
+// sleep(1.0);
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+// model.active = NO;
|
|
|
+//
|
|
|
+// [self showAlert:@"Clean Success"];
|
|
|
+// });
|
|
|
+
|
|
|
+ dispatch_after(dispatch_time(1 * NSEC_PER_SEC, DISPATCH_TIME_NOW), dispatch_get_main_queue(), ^{
|
|
|
+ model.active = NO;
|
|
|
+
|
|
|
+ [self showAlert:@"Clean Success"];
|
|
|
+ });
|
|
|
+
|
|
|
});
|
|
|
- });
|
|
|
+//
|
|
|
+ }];
|
|
|
|
|
|
- }];
|
|
|
-
|
|
|
-
|
|
|
- [alertVC addAction:cancelAction];
|
|
|
- [alertVC addAction:yesAction];
|
|
|
-
|
|
|
- [self presentViewController:alertVC animated:YES completion:nil];
|
|
|
+
|
|
|
+ [alertVC addAction:cancelAction];
|
|
|
+ [alertVC addAction:yesAction];
|
|
|
+
|
|
|
+ [self presentViewController:alertVC animated:YES completion:nil];
|
|
|
+
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- (void)changePassword:(RASettingActionModel *)model {
|
|
|
|
|
|
- RAChangePasswordViewController *vc = [RAChangePasswordViewController viewControllerFromStoryboard];
|
|
|
- [self presentViewController:vc animated:YES completion:nil];
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ RAChangePasswordViewController *vc = [RAChangePasswordViewController viewControllerFromStoryboard];
|
|
|
+ [self presentViewController:vc animated:YES completion:nil];
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
#pragma mark - Show Option
|
|
|
@@ -128,13 +141,15 @@
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- RAOptionViewController *optionVC = [RAOptionViewController optionViewControllerWith:model.options selectedIndex:model.selectedIndex];
|
|
|
- optionVC.optionTitle = model.title;
|
|
|
- optionVC.selectBlk = ^(NSInteger index) {
|
|
|
- [model setSelectedIndex:(int)index];
|
|
|
- };
|
|
|
-
|
|
|
- [self.navigationController pushViewController:optionVC animated:YES];
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ RAOptionViewController *optionVC = [RAOptionViewController optionViewControllerWith:model.options selectedIndex:model.selectedIndex];
|
|
|
+ optionVC.optionTitle = model.title;
|
|
|
+ optionVC.selectBlk = ^(NSInteger index) {
|
|
|
+ [model setSelectedIndex:(int)index];
|
|
|
+ };
|
|
|
+
|
|
|
+ [self.navigationController pushViewController:optionVC animated:YES];
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
@end
|