Kaynağa Gözat

修复ERP Mobile 工程的部分警告错误

Ray Zhang 6 yıl önce
ebeveyn
işleme
ac13909595

+ 117 - 42
RedAnt ERP Mobile/common/Functions/sidemenu/CacheViewController.m

@@ -10,8 +10,8 @@
 #import "RAUtils.h"
 #import "AppDelegate.h"
 
-#define AL_CACHE 1234
-#define AL_CLEAN 1235
+//#define AL_CACHE 1234
+//#define AL_CLEAN 1235
 @interface CacheViewController ()
 
 @end
@@ -153,14 +153,58 @@
     
     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
     {
@@ -175,58 +219,89 @@
         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];
             // 启动
             [thread start];
             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];
     }
 
 }

+ 12 - 6
RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m

@@ -134,7 +134,9 @@
                 {
                     btn.selected = !btn.selected;
                     
-                    [RAUtils alert_view:@"Detected incomplete sync, please finish sync first." title:@"Incomplete sync"];
+                    [RAUtils message_alert:@"Detected incomplete sync, please finish sync first." title:@"Incomplete sync" controller:self];
+
+//                    [RAUtils alert_view:@"Detected incomplete sync, please finish sync first." title:@"Incomplete sync"];
                 }
                 else
                 {
@@ -154,7 +156,8 @@
             {
                 btn.selected = !btn.selected;
                 
-                [RAUtils alert_view:@"Offline data not found, you must login online and download offline data first." title:@"Offline data not found"];
+                [RAUtils message_alert:@"Offline data not found, you must login online and download offline data first." title:@"Offline data not found" controller:self];
+//                [RAUtils alert_view:@"Offline data not found, you must login online and download offline data first." title:@"Offline data not found"];
             }
         }
         else
@@ -222,7 +225,9 @@
     {
         self.checkOfflineMode.selected = !self.checkOfflineMode.selected;
         
-        [RAUtils alert_view:@"Detected incomplete sync, please finish sync first." title:@"Incomplete sync"];
+        [RAUtils message_alert:@"Detected incomplete sync, please finish sync first." title:@"Incomplete sync" controller:self];
+        
+//        [RAUtils alert_view:@"Detected incomplete sync, please finish sync first." title:@"Incomplete sync"];
         return;
     }
     
@@ -235,8 +240,8 @@
         //        //[[UILabel appearanceWhenContainedIn:UIAlertView.class, nil] setAppearanceFont:[UIFont boldSystemFontOfSize:10]];
         //        [alert show];
         
-        
-        [RAUtils alert_view:@"Username or Password cannot be blank." title:@"Cannot sign-in"];
+        [RAUtils message_alert:@"Username or Password cannot be blank." title:@"Cannot sign-in" controller:self];
+//        [RAUtils alert_view:@"Username or Password cannot be blank." title:@"Cannot sign-in"];
         return;
     }
     DebugLog(@"Login...   user= %@ ; password= %@",user,password);
@@ -440,7 +445,8 @@
                     break;
             }
             
-            [RAUtils alert_view:msg title:@"Cannot sign-in"];
+            [RAUtils message_alert:msg title:@"Cannot sign-in" controller:self];
+//            [RAUtils alert_view:msg title:@"Cannot sign-in"];
             
             
             

+ 2 - 2
RedAnt ERP Mobile/common/Functions/sidemenu/RetrievePassViewController.m

@@ -38,8 +38,8 @@
 //        //[[UILabel appearanceWhenContainedIn:UIAlertView.class, nil] setAppearanceFont:[UIFont boldSystemFontOfSize:10]];
 //        [alert show];
         
-        
-        [RAUtils alert_view:@"User or email cannot be empty." title:@"Input Error!"];
+        [RAUtils message_alert:@"User or email cannot be empty." title:@"Input Error!" controller:self];
+//        [RAUtils alert_view:title:];
         return;
     }