|
@@ -10,8 +10,8 @@
|
|
|
#import "RAUtils.h"
|
|
#import "RAUtils.h"
|
|
|
#import "AppDelegate.h"
|
|
#import "AppDelegate.h"
|
|
|
|
|
|
|
|
-#define AL_CACHE 1234
|
|
|
|
|
-#define AL_CLEAN 1235
|
|
|
|
|
|
|
+//#define AL_CACHE 1234
|
|
|
|
|
+//#define AL_CLEAN 1235
|
|
|
@interface CacheViewController ()
|
|
@interface CacheViewController ()
|
|
|
|
|
|
|
|
@end
|
|
@end
|
|
@@ -153,14 +153,58 @@
|
|
|
|
|
|
|
|
if(!sender.on)
|
|
if(!sender.on)
|
|
|
{
|
|
{
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Disable Cache Confirm", nil) message:NSLocalizedString(@"Disable cache will save some diskspace but cost more network traffic and also slower. Are you sure to Disable cache?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
|
|
|
|
|
|
|
+ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Disable Cache Confirm", nil) message:NSLocalizedString(@"Disable cache will save some diskspace but cost more network traffic and also slower. Are you sure to Disable cache?", nil) preferredStyle:UIAlertControllerStyleAlert];
|
|
|
|
|
|
|
|
|
|
|
|
|
- alert.tag = AL_CACHE;
|
|
|
|
|
|
|
+ UIAlertAction *action_0 = [UIAlertAction actionWithTitle:@"YES" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ [defaults setValue:@"false" forKey:@"enable_cache"];
|
|
|
|
|
+
|
|
|
|
|
+ [defaults synchronize];
|
|
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
+ appDelegate.bEnable_Cache = false;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 创建
|
|
|
|
|
+ NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(clear) object:nil];
|
|
|
|
|
+ // 启动
|
|
|
|
|
+ [thread start];
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ UIAlertAction *action_3 = [UIAlertAction actionWithTitle:@"NO" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
|
+ self.catchSwitch.on=YES;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+ [alertController addAction:action_0];
|
|
|
|
|
+
|
|
|
|
|
+ [alertController addAction:action_3];
|
|
|
|
|
+
|
|
|
|
|
|
|
|
- [alert show];
|
|
|
|
|
|
|
+ [self presentViewController:alertController animated:YES completion:nil];
|
|
|
|
|
+
|
|
|
|
|
+//
|
|
|
|
|
+// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Disable Cache Confirm", nil) message:NSLocalizedString(@"Disable cache will save some diskspace but cost more network traffic and also slower. Are you sure to Disable cache?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// alert.tag = AL_CACHE;
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// [alert show];
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -175,58 +219,89 @@
|
|
|
appDelegate.bEnable_Cache = true;
|
|
appDelegate.bEnable_Cache = true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-#pragma mark - UIAlertViewDelegate
|
|
|
|
|
-// Called when a button is clicked. The view will be automatically dismissed after this call returns
|
|
|
|
|
-- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
|
|
|
|
|
|
+//#pragma mark - UIAlertViewDelegate
|
|
|
|
|
+//// Called when a button is clicked. The view will be automatically dismissed after this call returns
|
|
|
|
|
+//- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
|
|
|
|
+//{
|
|
|
|
|
+// if(alertView.tag==AL_CACHE)
|
|
|
|
|
+// {
|
|
|
|
|
+// if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
|
|
+// {
|
|
|
|
|
+// NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// [defaults setValue:@"false" forKey:@"enable_cache"];
|
|
|
|
|
+//
|
|
|
|
|
+// [defaults synchronize];
|
|
|
|
|
+// AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
+// appDelegate.bEnable_Cache = false;
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// // 创建
|
|
|
|
|
+// NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(clear) object:nil];
|
|
|
|
|
+// // 启动
|
|
|
|
|
+// [thread start];
|
|
|
|
|
+// return;
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// self.catchSwitch.on=YES;
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+//// if(buttonIndex!=alertView.cancelButtonIndex&&alertView.tag==AL_CLEAN)
|
|
|
|
|
+//// {
|
|
|
|
|
+//// // 创建
|
|
|
|
|
+//// NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(clear) object:nil];
|
|
|
|
|
+//// // 启动
|
|
|
|
|
+//// [thread start];
|
|
|
|
|
+//// return;
|
|
|
|
|
+//// }
|
|
|
|
|
+//}
|
|
|
|
|
+#pragma mark - Table view delegate
|
|
|
|
|
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
{
|
|
{
|
|
|
- if(alertView.tag==AL_CACHE)
|
|
|
|
|
|
|
+ if(indexPath.row==2)
|
|
|
{
|
|
{
|
|
|
- if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
|
|
- {
|
|
|
|
|
- NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
- [defaults setValue:@"false" forKey:@"enable_cache"];
|
|
|
|
|
|
|
+ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Clear Cache Confirm", nil) message:NSLocalizedString(@"Clear cache will take some time, click YES to confirm clear.", nil) preferredStyle:UIAlertControllerStyleAlert];
|
|
|
|
|
|
|
|
- [defaults synchronize];
|
|
|
|
|
- AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
- appDelegate.bEnable_Cache = false;
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- // 创建
|
|
|
|
|
- NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(clear) object:nil];
|
|
|
|
|
- // 启动
|
|
|
|
|
- [thread start];
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- self.catchSwitch.on=YES;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(buttonIndex!=alertView.cancelButtonIndex&&alertView.tag==AL_CLEAN)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ UIAlertAction *action_0 = [UIAlertAction actionWithTitle:@"YES" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// 创建
|
|
// 创建
|
|
|
NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(clear) object:nil];
|
|
NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(clear) object:nil];
|
|
|
// 启动
|
|
// 启动
|
|
|
[thread start];
|
|
[thread start];
|
|
|
return;
|
|
return;
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-#pragma mark - Table view delegate
|
|
|
|
|
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
|
|
-{
|
|
|
|
|
- if(indexPath.row==2)
|
|
|
|
|
- {
|
|
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Clear Cache Confirm", nil) message:NSLocalizedString(@"Clear cache will take some time, click YES to confirm clear.", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ UIAlertAction *action_3 = [UIAlertAction actionWithTitle:@"NO" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+ [alertController addAction:action_0];
|
|
|
|
|
+ [alertController addAction:action_3];
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
+ [self presentViewController:alertController animated:YES completion:nil];
|
|
|
|
|
|
|
|
- alert.tag = AL_CLEAN;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- [alert show];
|
|
|
|
|
|
|
+// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Clear Cache Confirm", nil) message:NSLocalizedString(@"Clear cache will take some time, click YES to confirm clear.", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// alert.tag = AL_CLEAN;
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// [alert show];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|