Просмотр исходного кода

Optimize ERP Mobile build warring

Ray Zhang 2 лет назад
Родитель
Сommit
b32cdc413d
27 измененных файлов с 793 добавлено и 403 удалено
  1. BIN
      RA TradeFiling/RA TradeFiling.xcodeproj/project.xcworkspace/xcuserdata/ruizhang.xcuserdatad/UserInterfaceState.xcuserstate
  2. 47 47
      RedAnt ERP Mobile/HMLG Scan Order/MainViewController.m
  3. 8 1
      RedAnt ERP Mobile/common/AppDelegateBase.h
  4. 513 4
      RedAnt ERP Mobile/common/AppDelegateBase.m
  5. 2 1
      RedAnt ERP Mobile/common/Functions/cart/CartViewController.m
  6. 7 2
      RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m
  7. 6 2
      RedAnt ERP Mobile/common/Functions/offline/OfflineSettingViewController.m
  8. 9 4
      RedAnt ERP Mobile/common/Functions/offline/SyncControlPanelViewController.m
  9. 1 1
      RedAnt ERP Mobile/common/Functions/order/CreateOrderViewController.m
  10. 1 1
      RedAnt ERP Mobile/common/Functions/signature/SViewController.m
  11. 26 26
      RedAnt ERP Mobile/common/categoryMenu_RATree/RATreeView+TableViewDelegate.m
  12. 10 10
      RedAnt ERP Mobile/common/categoryMenu_RATree/RATreeView+UIScrollView.m
  13. 4 4
      RedAnt ERP Mobile/common/categoryMenu_RATree/RATreeView.h
  14. 14 9
      RedAnt ERP Mobile/common/customUI/NIDropDown.m
  15. 42 34
      RedAnt ERP Mobile/common/customUI/SimpleGrid.m
  16. 6 3
      RedAnt ERP Mobile/common/data_provider/RANetwork.m
  17. 1 1
      RedAnt ERP Mobile/common/zip/minizip/unzip.c
  18. 1 1
      RedAnt ERP Mobile/common/zip/minizip/zip.c
  19. 0 19
      RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/xcuserdata/ray.xcuserdatad/xcschemes/xcschememanagement.plist
  20. 1 6
      RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist
  21. 8 0
      RedAnt ERP Mobile/iSales-NPD.xcodeproj/project.pbxproj
  22. 33 74
      RedAnt ERP Mobile/iSales-NPD/Base.lproj/OLM.storyboard
  23. 3 125
      common/NetworkUtils.m
  24. 2 2
      common/RAConvertor.h
  25. 14 5
      common/RAConvertor.m
  26. 33 20
      common/Youtube/RAYTPlayer.m
  27. 1 1
      common/customUI/commoneditor/SRMonthPicker.m

BIN
RA TradeFiling/RA TradeFiling.xcodeproj/project.xcworkspace/xcuserdata/ruizhang.xcuserdatad/UserInterfaceState.xcuserstate


+ 47 - 47
RedAnt ERP Mobile/HMLG Scan Order/MainViewController.m

@@ -88,54 +88,54 @@
     
     
 }
 }
 
 
-- (IBAction)onSelectSales:(id)sender {
-    
-
-    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
- 
-    
-    
-    ScanUserListViewController * userVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"ScanUserListViewController"];
-   userVC.returnValue=^(NSString* user)
-    {
-//        self.btnContact.hidden = false;
-        appDelegate.user = user;
-        [self.buttonUser setTitle:user forState:UIControlStateNormal];
-        
-        [self refreshContactDisplay];
+//- (IBAction)onSelectSales:(id)sender {
+//    
 //
 //
-    };
-    //    loginvc.delegate = self;
-    //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
-//       appDelegate.active_controller = gunVC;
-//        gunVC.onDismissVC = ^(){
-//            appDelegate.active_controller = active_vc;
-//        };
-    UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:userVC] ;
-    
-    
-    
-    
-    
-    //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
-    
-    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
-    [self presentViewController:navi animated:YES completion:^{
-        
-        //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
-        
-        DebugLog(@"about present.........");
-        
-        //   self.btop = false;
-        //  <#code#>
-    }];
-    
-    
-    
-    
-    [appDelegate update_count_mark];
-//    appDelegate.bLogin = true;
-}
+//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+// 
+//    
+//    
+//    ScanUserListViewController * userVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"ScanUserListViewController"];
+//   userVC.returnValue=^(NSString* user)
+//    {
+////        self.btnContact.hidden = false;
+//        appDelegate.user = user;
+//        [self.buttonUser setTitle:user forState:UIControlStateNormal];
+//        
+//        [self refreshContactDisplay];
+////
+//    };
+//    //    loginvc.delegate = self;
+//    //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
+////       appDelegate.active_controller = gunVC;
+////        gunVC.onDismissVC = ^(){
+////            appDelegate.active_controller = active_vc;
+////        };
+//    UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:userVC] ;
+//    
+//    
+//    
+//    
+//    
+//    //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
+//    
+//    navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
+//    [self presentViewController:navi animated:YES completion:^{
+//        
+//        //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
+//        
+//        DebugLog(@"about present.........");
+//        
+//        //   self.btop = false;
+//        //  <#code#>
+//    }];
+//    
+//    
+//    
+//    
+//    [appDelegate update_count_mark];
+////    appDelegate.bLogin = true;
+//}
 #ifndef RA_NOTIFICATION
 #ifndef RA_NOTIFICATION
 -(void) reloadCategory:(BOOL) update_data immediately:(bool)immediately
 -(void) reloadCategory:(BOOL) update_data immediately:(bool)immediately
 {
 {

+ 8 - 1
RedAnt ERP Mobile/common/AppDelegateBase.h

@@ -33,7 +33,7 @@ typedef enum {
 } CustomerType;
 } CustomerType;
 #ifdef USE_BLE_SCANNER
 #ifdef USE_BLE_SCANNER
 @interface AppDelegateBase : UIResponder<UIApplicationDelegate , NSURLConnectionDataDelegate
 @interface AppDelegateBase : UIResponder<UIApplicationDelegate , NSURLConnectionDataDelegate
-,ScanApiHelperDelegate,CBCentralManagerDelegate, CBPeripheralDelegate>
+,ScanApiHelperDelegate,CBCentralManagerDelegate, CBPeripheralDelegate,NSURLSessionDataDelegate>
 #else
 #else
 @interface AppDelegateBase : UIResponder<UIApplicationDelegate , NSURLConnectionDataDelegate
 @interface AppDelegateBase : UIResponder<UIApplicationDelegate , NSURLConnectionDataDelegate
 ,ScanApiHelperDelegate>
 ,ScanApiHelperDelegate>
@@ -170,6 +170,7 @@ typedef enum {
 //@property (nonatomic, assign) long long fileLength; //>>文件长度
 //@property (nonatomic, assign) long long fileLength; //>>文件长度
 //@property (nonatomic, strong) NSString *fileName;   //>>文件名
 //@property (nonatomic, strong) NSString *fileName;   //>>文件名
 @property (nonatomic, strong) NSURLConnection *connection;
 @property (nonatomic, strong) NSURLConnection *connection;
+
 @property double file_progress;
 @property double file_progress;
 @property double overall_progress;
 @property double overall_progress;
 @property (strong, nonatomic) NSString* downloadlog;
 @property (strong, nonatomic) NSString* downloadlog;
@@ -252,4 +253,10 @@ typedef enum {
 
 
 -(void) enableBLE:(bool) bEnable;
 -(void) enableBLE:(bool) bEnable;
 #endif
 #endif
+
+
+#pragma mark newdownload
+@property (strong,nonatomic) NSURLSession *session;
+@property (strong,nonatomic) NSURLSessionDataTask* curr_task;
+-(void)handle_download1:(NSString *)url start:(bool) start type:(NSString*) type taskid:(int)taskidx;
 @end
 @end

+ 513 - 4
RedAnt ERP Mobile/common/AppDelegateBase.m

@@ -1813,6 +1813,9 @@ void UncaughtExceptionHandler(NSException *exception) {
 }
 }
 -(void) download_offline:(bool) start checkdiskspace:(bool) checkdiskspace
 -(void) download_offline:(bool) start checkdiskspace:(bool) checkdiskspace
 {
 {
+
+    
+    
     [ERPUtils googleAnalyticsSendRequestString:nil WithScreen:ScreenCodeOfflineSync Action:nil Extra:nil];
     [ERPUtils googleAnalyticsSendRequestString:nil WithScreen:ScreenCodeOfflineSync Action:nil Extra:nil];
     if(start)
     if(start)
     {
     {
@@ -1940,7 +1943,8 @@ void UncaughtExceptionHandler(NSException *exception) {
                 
                 
                 if([itemjson[@"retry"] intValue]<DOWNLOAD_RETRY_TIMES)
                 if([itemjson[@"retry"] intValue]<DOWNLOAD_RETRY_TIMES)
                 {
                 {
-                    [self handle_download:url start:start  type:type taskid:i];
+//                    [self handle_download:url start:start  type:type taskid:i];
+                    [self handle_download1:url start:start  type:type taskid:i];
                     alldone=false;
                     alldone=false;
                     break;
                     break;
                 }
                 }
@@ -2142,8 +2146,8 @@ void UncaughtExceptionHandler(NSException *exception) {
                 
                 
                 if([itemjson[@"retry"] intValue]<DOWNLOAD_RETRY_TIMES)
                 if([itemjson[@"retry"] intValue]<DOWNLOAD_RETRY_TIMES)
                 {
                 {
-                    [self handle_download:url start:start  type:type taskid:i];
-                    
+//                    [self handle_download:url start:start  type:type taskid:i];
+                    [self handle_download1:url start:start  type:type taskid:i];
                     break;
                     break;
                 }
                 }
                 
                 
@@ -2750,7 +2754,7 @@ void UncaughtExceptionHandler(NSException *exception) {
 }
 }
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 {
 {
-    
+
     NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
     NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
     // 蓝牙扫描枪
     // 蓝牙扫描枪
 #ifdef USE_BLE_SCANNER
 #ifdef USE_BLE_SCANNER
@@ -4219,6 +4223,511 @@ void UncaughtExceptionHandler(NSException *exception) {
 
 
 
 
 
 
+#pragma mark new_download
+- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler{
+    if([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]){
+        if(/*[challenge.protectionSpace.host isEqualToString:@"96.75.188.41"]*/ true){
+            NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
+            completionHandler(NSURLSessionAuthChallengeUseCredential,credential);
+        }
+    }
+}
+-(void)handle_download1:(NSString *)url start:(bool) start type:(NSString*) type taskid:(int)taskidx
+{
+    //操作有两种,start stop;
+    //结果有四种, wait , downloading, pause, finish
+    
+    dispatch_async(dispatch_get_main_queue(), ^{
+        // debug;
+//        NSString* file_name=[url lastPathComponent];
+        //暂停<->开始转换
+        
+        //   bool isdownloading = [self isdownloading:file_name];
+        if (start)
+        {//开始下载
+            
+            
+            
+            
+            
+            
+            DebugLog(@"%d start",taskidx);
+            
+            self.current_task=taskidx;
+            
+            
+            
+//            NSURL* _url = [NSURL URLWithString:url];//@"http://localhost/test.zip"];
+//
+//            //        _url = [NSURL URLWithString:@"https://rate.apexshipping.com/temp/apache-tomcat-8.0.22.zip"];
+//            //
+//            //
+//            //        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:_url];
+//            //
+//            //        //设置请求头(GET)
+//            //        NSString *range = [NSString stringWithFormat:@"bytes=%lld-", [self getcurrentLength:taskidx]];
+//            //        [request setValue:range forHTTPHeaderField:@"Range"];
+//            //
+//            //        self.connection = [NSURLConnection connectionWithRequest:request delegate:self];
+//
+//
+//            NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:_url];
+//
+//            //设置请求头(GET)
+//            NSString *range = [NSString stringWithFormat:@"bytes=%lld-",  [self getcurrentLength:taskidx]];
+//            [request setValue:range forHTTPHeaderField:@"Range"];
+//
+            
+            
+//            RANetworkTaskDelegate *delegate = [RANetworkTaskDelegate sharedInstance];
+            
+            
+            NSURLSession *session = nil;
+            
+            NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
+            config.timeoutIntervalForRequest = JSON_TIMEOUT;
+            
+            NSOperationQueue *queue = [[NSOperationQueue alloc] init];
+            
+            session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:queue];
+
+            
+            
+
+         
+            
+            NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
+            
+            req.HTTPMethod = @"GET";
+//            long offset = [self getcurrentLength:taskidx];
+//            if (offset > 0) {
+//                [req addValue:[NSString stringWithFormat:@"bytes=%ld-",(unsigned long)offset] forHTTPHeaderField:@"Range"];
+//            }
+            
+          
+                        NSString *range = [NSString stringWithFormat:@"bytes=%lld-",  [self getcurrentLength:taskidx]];
+                        [req setValue:range forHTTPHeaderField:@"Range"];
+            
+            
+            NSURLSessionDataTask *downloadTask = [session dataTaskWithRequest:req];
+            
+            [downloadTask resume];
+            self.session =session;
+            self.curr_task = downloadTask;
+            
+        }else{ //暂停
+            DebugLog(@"%d pause",taskidx);
+            
+            
+            [self.curr_task cancel];
+            
+            self.curr_task = nil;
+//            [self.connection cancel];
+//            self.connection = nil;
+        }
+    });
+}
+- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler {
+    
+    NSHTTPURLResponse* httpresponse = (NSHTTPURLResponse *)response;
+    
+    if (httpresponse.statusCode == 206) {//!!!断点续传的状态码为206
+        
+        
+        DebugLog(@"%d begin",self.current_task);
+        
+        long long position=[self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]][@"position"] longLongValue];
+        
+        
+        //获取下载文件大小
+        //        self.fileLength = response.expectedContentLength;
+        NSMutableDictionary* currenttask=[self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]] mutableCopy];
+        
+        
+        //获取文件名
+        //self.fileName = response.suggestedFilename;
+        
+        currenttask[@"fileName"] = response.suggestedFilename;
+        currenttask[@"response"] = @"true";
+        [self add_downloadlog:[NSString stringWithFormat:@"Begin download file %@.",currenttask[@"fileName"]]];
+        
+        self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]]=currenttask;
+        
+        //文件路径
+        NSString *temp = NSTemporaryDirectory();//[NSSearchPathForDirectoriesInDomains(NSTemporaryDirectory(), NSUserDomainMask, YES) lastObject];
+        
+        NSString * ver = self.download_task[@"ver"];
+        NSString* location=[NSString stringWithFormat:@"%@/%@",ver,response.suggestedFilename];
+        NSString *filePath = [temp stringByAppendingPathComponent:location];
+        DebugLog(@"save to: %@",filePath);
+        
+        if (position>0) {
+            //不需要创建文件;
+            //创建一个用来写数据的文件句柄
+            self.fileHandle = [NSFileHandle fileHandleForWritingAtPath:filePath];
+            return;
+        }
+        // 第一次获取的才是文件正确大小
+        currenttask[@"fileLength"] = [NSNumber numberWithLongLong:response.expectedContentLength];
+        //创建一个空的文件到沙盒
+        NSFileManager *fileManager = [NSFileManager defaultManager];
+        [fileManager createFileAtPath:filePath contents:nil attributes:nil];
+        
+        //创建一个用来写数据的文件句柄
+        self.fileHandle = [NSFileHandle fileHandleForWritingAtPath:filePath];
+    }else{
+        
+        //debug 这里缺少文件的情况还没处理
+        
+        [self.connection cancel];
+        self.connection = nil;
+        DebugLog(@"该文件不存在");
+        NSString* str_status=[NSString stringWithFormat:@"Server return %d.",(int)httpresponse.statusCode];
+        
+        [self add_downloadlog:@"Offline file does not exist,please contact your administrator."];
+        [self add_downloadlog:str_status];
+    }
+    completionHandler(NSURLSessionResponseAllow);
+}
+- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data {
+    
+    
+    //移动到文件末尾
+    [self.fileHandle seekToEndOfFile];
+    
+    //写入数据到文件
+    [self.fileHandle writeData:data];
+    
+    NSMutableDictionary* currenttask=[self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]] mutableCopy];
+    
+    long long position=[self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]][@"position"] longLongValue];
+    position += data.length;
+    currenttask[@"position"] = [NSNumber numberWithLongLong:position];
+    
+    
+    self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]]=currenttask;
+    
+    //更新画面中的进度
+    int fileLength=[self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]][@"fileLength"] intValue];
+    
+    
+    
+    
+    
+    double progress = (double)position/fileLength;
+    
+    self.file_progress = progress;
+    [self.settingUI onProgressUpdate];
+}
+
+
+- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didSendBodyData:(int64_t)bytesSent totalBytesSent:(int64_t)totalBytesSent totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend {
+    
+//    double progress = (double)totalBytesSent / totalBytesExpectedToSend;
+
+}
+
+- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {
+    
+//    if (self.decryptHandler) {
+//
+//        self.result.decryptHandler = self.decryptHandler;
+//
+//    }
+//
+//    if (error) {
+//
+//        self.result.error = error;
+//
+//        DebugLog(@"Delegate recv Error: %@",error.localizedDescription);
+//
+//    }
+//
+//    self.result.data = self.recvData;
+//
+//    DebugLog(@"Delegate recv data %@",self.recvData);
+//
+//
+//
+    
+
+        
+        
+        
+        if (error) {
+            DebugLog(@"%d error message:%@",self.current_task,error);
+            
+            
+            NSMutableDictionary* currenttask=[self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]] mutableCopy];
+            
+            
+            
+            
+            
+            
+            
+            
+            //    self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]][@"position"] = [NSNumber numberWithLongLong:0];
+            currenttask[@"status"] = @"pause";
+            int retry=[self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]][@"retry"] intValue];
+            currenttask[@"retry"]= [NSNumber numberWithInt:retry+1];
+            self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]]=currenttask;
+            
+            //    self.currentLength = 0;
+            //    self.fileLength = 0;
+            [self.fileHandle closeFile];
+            self.fileHandle = nil;
+            [self.connection cancel];
+            self.connection = nil;
+            
+            [self download_offline:true checkdiskspace:false];
+            
+        } else {
+            NSMutableDictionary* currenttask=[self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]] mutableCopy];
+            
+            
+            
+            
+            [self add_downloadlog:[NSString stringWithFormat:@"Finish download file %@.",currenttask[@"fileName"]]];
+            
+            DebugLog(@"%d finish",self.current_task);
+            currenttask[@"position"] = [NSNumber numberWithLongLong:0];
+            
+            self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]]=currenttask;
+            //    self.currentLength = 0;
+            //    self.fileLength = 0;
+            [self.fileHandle closeFile];
+            self.fileHandle = nil;
+            int result=[self unpack];
+            NSString* temp = NSTemporaryDirectory();
+            
+            NSString* filename = self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]][@"fileName"];
+            
+            
+            
+            NSString * ver = self.download_task[@"ver"];
+            
+            NSString* unziplocation=[NSString stringWithFormat:@"%@/%@",ver,[filename stringByDeletingPathExtension]];
+            
+            NSString *unZipTo = [temp stringByAppendingPathComponent:unziplocation];
+            
+            switch (result) {
+                case UNZIP_FILE_DAMAGE:
+                {
+                    NSMutableDictionary* currenttask=[self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]] mutableCopy];
+                    currenttask[@"status"] = @"pause";
+                    int retry=[self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]][@"retry"] intValue];
+                    currenttask[@"retry"]= [NSNumber numberWithInt:retry+1];
+                    self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]]=currenttask;
+                    
+                    //    self.currentLength = 0;
+                    //    self.fileLength = 0;
+                    [self.fileHandle closeFile];
+                    self.fileHandle = nil;
+                    [self.connection cancel];
+                    self.connection = nil;
+                    break;
+                }
+                case UNZIP_SUCCESS:
+                {
+                    NSString* type = self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]][@"type"];
+                    
+                    if([type isEqualToString:@"img"])
+                    {
+                        
+                        NSString* parent_path = self.download_task[@"path"];
+                        if(parent_path.length==0)
+                            parent_path=@"";
+                        parent_path = [parent_path stringByReplacingOccurrencesOfString:@"http://" withString:@""];
+                        parent_path = [parent_path stringByReplacingOccurrencesOfString:@"https://" withString:@""];
+                        NSString* cachefolder=[NSString stringWithFormat:@"%@/image_cache/%@",ver,parent_path];
+                        
+                        
+                        
+                        NSString *imagecache = [temp stringByAppendingPathComponent:cachefolder];
+                        
+                        BOOL bdir=YES;
+                        NSError *error = nil;
+                        if(!  [[NSFileManager defaultManager] fileExistsAtPath:imagecache isDirectory:&bdir])
+                        {
+                            
+                            bool bsuccess=[[NSFileManager defaultManager] createDirectoryAtPath:imagecache withIntermediateDirectories:YES attributes:nil error:&error];
+                            
+                            if(!bsuccess)
+                                DebugLog(@"Create temp folder failed");
+                        }
+                        
+                        error=nil;
+                        //                NSString* backupfolder=[NSString stringWithFormat:@"%@/test.xml",ver];
+                        //                NSString* backup=[temp stringByAppendingPathComponent:backupfolder];
+                        
+                        //                NSError *error = nil;
+                        //                NSURL* uf=[NSURL fileURLWithPath:imagecache];
+                        //               if( [[NSFileManager defaultManager] replaceItemAtURL:[NSURL fileURLWithPath:imagecache]
+                        //                               withItemAtURL:[NSURL fileURLWithPath:unZipTo]
+                        //                              backupItemName:backup
+                        //                                     options:NSFileManagerItemReplacementWithoutDeletingBackupItem
+                        //                            resultingItemURL:nil error:&error])
+                        if(![RAUtils mergeContentsOfPath:unZipTo intoPath:imagecache error:&error])
+                            //   if([[NSFileManager defaultManager] moveItemAtPath:unZipTo toPath:imagecache error:&error]!=YES)// prePath 为原路径、     cenPath 为目标路径
+                        {
+                            DebugLog(@"move image folder failed");
+                        }
+                        else
+                        {
+                            currenttask[@"status"] = @"finish";
+                            DebugLog(@"move image folder successful");
+                        }
+                        
+                    }
+                    else if([type isEqualToString:@"sql"])
+                    {
+                      //  AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+                        NSString * ver = self.download_task[@"ver"];
+                        NSString* tempdb=[NSString stringWithFormat:@"%@/%@",ver,DBNAME];
+                        tempdb=[temp stringByAppendingPathComponent:tempdb];
+                        sqlite3* tdb=[iSalesDB get_db_at:tempdb];
+                        
+                        
+                        [self add_downloadlog:@"updating local database..."];
+                        
+                        
+                        @try {
+                            char *errmsg=NULL;
+        //                    [iSalesDB disable_trigger]
+                            [iSalesDB disable_trigger];
+                            
+                            if (sqlite3_exec(tdb, "begin", NULL, NULL, &errmsg)==SQLITE_OK)
+                            {
+                                
+                                sqlite3_exec(tdb, "drop trigger if exists wishlist_insert;drop trigger if exists wishlist_update;drop trigger if exists wishlist_delete;drop trigger if exists offline_portfolio_insert;drop trigger if exists offline_portfolio_update;drop trigger if exists offline_portfolio_delete;drop trigger if exists offline_pdf_insert;drop trigger if exists offline_pdf_update;drop trigger if exists offline_pdf_delete;drop trigger if exists offline_pdf;", NULL, NULL, &errmsg);
+                                
+                                sqlite3_free(errmsg);
+                                DebugLog(@"开启事务");
+                                NSString* jsonpath =[NSString stringWithFormat:@"%@/offLineSql/%@",unZipTo,@"SqlJson.txt"];
+                                
+                                NSDictionary* orderjson=[RAUtils dictfromfile:jsonpath];
+                                int count = [orderjson[@"count"] intValue];
+                                for(int i=0;i<count;i++)
+                                {
+                                    NSString* sqlfile=orderjson[[NSString stringWithFormat:@"item_%d",i]];
+                                    NSString* sqlpath =[NSString stringWithFormat:@"%@/offLineSql/%@",unZipTo,sqlfile];
+                                    NSError *error = nil;
+                                    NSString* sql = [NSString stringWithContentsOfFile:sqlpath encoding:NSUTF8StringEncoding error:&error];
+                                    //DebugLog(@"NSString类方法读取的内容是:\n%@",content);
+                                    
+                                    
+                                    
+                                    
+                                    if(sqlite3_exec(tdb, [sql UTF8String], NULL, NULL, &errmsg)!=SQLITE_OK)
+                                    {
+                                        //throw exception;
+                                        if(errmsg==nil)
+                                            errmsg="Unknown error.";
+                                        NSString *nsmsg = [[NSString alloc]initWithUTF8String:errmsg];
+                                        [NSException raise:@"offline update sql error" format:@"FILE:%@  MSG:%@",sqlfile,nsmsg];
+                                    }
+                                    
+                                    sqlite3_free(errmsg);
+                                }
+                                
+                                
+                                sqlite3_exec(tdb, "CREATE TRIGGER  if not exists wishlist_insert after insert on wishlist BEGIN select offline_dirty();  UPDATE wishlist SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;END;CREATE TRIGGER  if not exists wishlist_update after update on wishlist BEGIN select offline_dirty();  UPDATE wishlist SET modify_time= datetime('now', 'localtime'), is_dirty = 1 WHERE _id=new._id; END;CREATE TRIGGER if not exists wishlist_delete after DELETE ON wishlist BEGIN select offline_dirty(); END;CREATE TRIGGER  if not exists offline_pdf_insert after insert on offline_pdf BEGIN select offline_dirty();  UPDATE offline_pdf SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;END;CREATE TRIGGER  if not exists offline_pdf_update after update on offline_pdf BEGIN select offline_dirty();  UPDATE offline_pdf SET modify_time= datetime('now', 'localtime'), is_dirty = 1 WHERE _id=new._id; END;CREATE TRIGGER if not exists offline_pdf_delete after DELETE ON offline_pdf BEGIN select offline_dirty(); END;CREATE TRIGGER  if not exists offline_portfolio_insert after insert on offline_portfolio BEGIN select offline_dirty();  UPDATE offline_portfolio SET modify_time= datetime('now', 'localtime') WHERE _id=new._id;END;CREATE TRIGGER  if not exists offline_portfolio_update after update on offline_portfolio BEGIN select offline_dirty();  UPDATE offline_portfolio SET modify_time= datetime('now', 'localtime'), is_dirty = 1 WHERE _id=new._id; END;CREATE TRIGGER if not exists offline_portfolio_delete after DELETE ON offline_portfolio BEGIN select offline_dirty(); END;", NULL, NULL, &errmsg);
+                            }
+                            //提交事务
+                            if (sqlite3_exec(tdb, "commit", NULL, NULL, &errmsg)==SQLITE_OK) {
+                                
+                                DebugLog(@"提交事务");
+                                
+                                sqlite3_free(errmsg);
+                            }
+                            
+                            [self add_downloadlog:@"updating local database successful"];
+                            currenttask[@"status"] = @"finish";
+                            
+                        }
+                        
+                        
+                        @catch (NSException *exception) {
+                            char *errmsg=NULL;
+                            [self add_downloadlog:[NSString stringWithFormat:@"updating local database error, %@",exception.description]];
+                            [self add_downloadlog:@"updating local database failed rollback..."];
+                            if (sqlite3_exec(tdb, "rollback", NULL, NULL, &errmsg)==SQLITE_OK) {
+                                DebugLog(@"回滚事务");
+                                
+                                
+                                
+                                
+                                
+                                
+                            }
+                            else
+                            {
+                                [self add_downloadlog:@"rollback failed."];
+                            }
+                            
+                            
+                            NSMutableDictionary* currenttask=[self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]] mutableCopy];
+                            currenttask[@"status"] = @"pause";
+                            //int retry=[self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]][@"retry"] intValue];
+                            currenttask[@"retry"]= [NSNumber numberWithInt:DOWNLOAD_RETRY_TIMES];
+                            self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]]=currenttask;
+                            
+                            //    self.currentLength = 0;
+                            //    self.fileLength = 0;
+                            [self.fileHandle closeFile];
+                            self.fileHandle = nil;
+                            [self.connection cancel];
+                            self.connection = nil;
+                            //break;
+                        }
+                        @finally {
+                            
+        //                    [iSalesDB enable_trigger]
+                            [iSalesDB enable_trigger];
+                            sqlite3_close(tdb);
+                            // [iSalesDB close_db:tdb];
+                            //  [self SelectData];
+                        }
+                        
+                    }
+                    else if([type isEqualToString:@"script"])
+                    {
+                        currenttask[@"status"] = @"finish";
+                    }
+                    else if([type isEqualToString:@"resource"])
+                    {
+                        currenttask[@"status"] = @"finish";
+                    }
+                    // debug
+        //            int c=self.current_task+1;
+        //            double t=[ self.download_task[@"count"] doubleValue];
+                    double oprogress=(self.current_task+1) / [ self.download_task[@"count"] doubleValue];
+                    self.overall_progress = oprogress;
+                    [self.settingUI onProgressUpdate];
+                    break;
+                }
+                case UNZIP_NO_SPACE:
+                {
+                    [self add_downloadlog:@"Disk space not enough."];
+                    
+                    break;
+                }
+                case UNZIP_OPEN_FAILED:
+                {
+                    [self add_downloadlog:[NSString stringWithFormat:@"Unpack file %@ failed, error: cannot unpack zip.",filename]];
+                    break;
+                }
+                default:
+                    break;
+            }
+            [self download_offline:true checkdiskspace:false];
+        }
 
 
 
 
+    printf("net work complete\n");
+    
+//
+    [session invalidateAndCancel];
+}
 @end
 @end

+ 2 - 1
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -3276,9 +3276,10 @@
     int count =[[item_json valueForKey:@"count"] intValue];
     int count =[[item_json valueForKey:@"count"] intValue];
     
     
     int stockUom =[[item_json valueForKey:@"stockUom"] intValue];
     int stockUom =[[item_json valueForKey:@"stockUom"] intValue];
-    int mpack =[[item_json valueForKey:@"mpack"] intValue];
+   
     
     
 #ifdef BUILD_CONTRAST
 #ifdef BUILD_CONTRAST
+    int mpack =[[item_json valueForKey:@"mpack"] intValue];
     cell.labelMpack.text =[NSString stringWithFormat:@"Master Pack:%d", mpack];
     cell.labelMpack.text =[NSString stringWithFormat:@"Master Pack:%d", mpack];
 #endif
 #endif
     
     

+ 7 - 2
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -837,8 +837,11 @@
             float lift_gate_value = sqlite3_column_double(statement, 29);
             float lift_gate_value = sqlite3_column_double(statement, 29);
             float handling_fee_value = sqlite3_column_double(statement, 30);
             float handling_fee_value = sqlite3_column_double(statement, 30);
             
             
+            
+#ifdef BUILD_CONTRAST
             float order_discount=sqlite3_column_double(statement, 35);
             float order_discount=sqlite3_column_double(statement, 35);
             
             
+#endif
             
             
             data[@"company"]=sender_name;
             data[@"company"]=sender_name;
             data[@"shipfrom_addr"]=sender_ext;
             data[@"shipfrom_addr"]=sender_ext;
@@ -11130,7 +11133,9 @@ if(stockUom==0)
         int mustCall = sqlite3_column_int(stmt, 1);
         int mustCall = sqlite3_column_int(stmt, 1);
         //        NSString *internalNotes = [self textAtColumn:2 statement:stmt];
         //        NSString *internalNotes = [self textAtColumn:2 statement:stmt];
         NSString *generalNotes = [self textAtColumn:3 statement:stmt];
         NSString *generalNotes = [self textAtColumn:3 statement:stmt];
+#ifdef BUILD_CONTRAST
         NSString *schedule_date = [self textAtColumn:4 statement:stmt];
         NSString *schedule_date = [self textAtColumn:4 statement:stmt];
+#endif
         
         
         NSDictionary *po_dic = @{
         NSDictionary *po_dic = @{
             @"aname" : @"PO#",
             @"aname" : @"PO#",
@@ -11546,9 +11551,9 @@ if(stockUom==0)
     //    NSString * code = [iSalesDB jk_queryText:Sql];
     //    NSString * code = [iSalesDB jk_queryText:Sql];
     
     
 //    [self offline_getCarrierCode:offline_getCarrierCode];
 //    [self offline_getCarrierCode:offline_getCarrierCode];
-    
+#ifdef BUILD_CONTRAST
     NSDictionary *carrierDic = [self offline_OrderCarrier:params[@"orderCode"] db:db];
     NSDictionary *carrierDic = [self offline_OrderCarrier:params[@"orderCode"] db:db];
-    
+#endif
     NSDictionary *val_1 = @{
     NSDictionary *val_1 = @{
         @"check" : [NSNumber numberWithInteger:common_carrier_check],
         @"check" : [NSNumber numberWithInteger:common_carrier_check],
         @"sub_item" : @{
         @"sub_item" : @{

+ 6 - 2
RedAnt ERP Mobile/common/Functions/offline/OfflineSettingViewController.m

@@ -131,11 +131,15 @@
 
 
 - (IBAction)OnCheckUpdate:(id)sender {
 - (IBAction)OnCheckUpdate:(id)sender {
     
     
-    
+
     UIApplication * app = [UIApplication sharedApplication];
     UIApplication * app = [UIApplication sharedApplication];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     
     
-    
+//    if(true)
+//    {
+//        [appDelegate handle_download1:@"https:/redant.contrast-inc.com:443/zipDatas/1b13b704-b663-4806-b8e8-823e64cca953/pictureZip/PicturesZip4.zip" start:true type:@"img" taskid:0];
+//        return;
+//    }
     if(appDelegate.bLogin==false)
     if(appDelegate.bLogin==false)
     {
     {
         
         

+ 9 - 4
RedAnt ERP Mobile/common/Functions/offline/SyncControlPanelViewController.m

@@ -52,11 +52,16 @@
 -(void) onProgressUpdate
 -(void) onProgressUpdate
 {
 {
     
     
-    UIApplication * app = [UIApplication sharedApplication];
-    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     
     
-    self.progress_overall.progress= appDelegate.overall_progress;
-    self.progress_current.progress= appDelegate.file_progress;
+    
+    dispatch_async(dispatch_get_main_queue(), ^{
+        UIApplication * app = [UIApplication sharedApplication];
+        AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+        
+        self.progress_overall.progress= appDelegate.overall_progress;
+        self.progress_current.progress= appDelegate.file_progress;
+    });
+
     
     
     
     
 }
 }

+ 1 - 1
RedAnt ERP Mobile/common/Functions/order/CreateOrderViewController.m

@@ -2364,7 +2364,7 @@
 }
 }
 
 
 - (void)start_urgency_timer {
 - (void)start_urgency_timer {
-    return;
+//    return;
     if (!self.editable) {
     if (!self.editable) {
         return;
         return;
     }
     }

+ 1 - 1
RedAnt ERP Mobile/common/Functions/signature/SViewController.m

@@ -63,7 +63,7 @@
     
     
     
     
     
     
-    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
+    if (/*UI_USER_INTERFACE_IDIOM()*/[[UIDevice currentDevice] userInterfaceIdiom]   == UIUserInterfaceIdiomPhone) {
         self.navigationItem.rightBarButtonItems=[NSArray arrayWithObjects:doneBtn,clearBtn , nil];
         self.navigationItem.rightBarButtonItems=[NSArray arrayWithObjects:doneBtn,clearBtn , nil];
     } else {
     } else {
         self.navigationItem.rightBarButtonItems=[NSArray arrayWithObjects:doneBtn,clearBtn,settingBtn , nil];
         self.navigationItem.rightBarButtonItems=[NSArray arrayWithObjects:doneBtn,clearBtn,settingBtn , nil];

+ 26 - 26
RedAnt ERP Mobile/common/categoryMenu_RATree/RATreeView+TableViewDelegate.m

@@ -195,32 +195,32 @@
 }
 }
 
 
 #pragma mark Copying and Pasting Row Content
 #pragma mark Copying and Pasting Row Content
-
-- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath
-{
-  if ([self.delegate respondsToSelector:@selector(treeView:shouldShowMenuForRowForItem:treeNodeInfo:)]) {
-    RATreeNode *treeNode = [self treeNodeForIndex:indexPath.row];
-    return [self.delegate treeView:self shouldShowMenuForRowForItem:treeNode.item treeNodeInfo:[treeNode treeNodeInfo]];
-  }
-  return NO;
-}
-
-- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender
-{
-  if ([self.delegate respondsToSelector:@selector(treeView:canPerformAction:forRowForItem:treeNodeInfo:withSender:)]) {
-    RATreeNode *treeNode = [self treeNodeForIndex:indexPath.row];
-    return [self.delegate treeView:self canPerformAction:action forRowForItem:treeNode.item treeNodeInfo:[treeNode treeNodeInfo] withSender:sender];
-  }
-  return NO;
-}
-
-- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender
-{
-  if ([self.delegate respondsToSelector:@selector(treeView:performAction:forRowForItem:treeNodeInfo:withSender:)]) {
-    RATreeNode *treeNode = [self treeNodeForIndex:indexPath.row];
-    return [self.delegate treeView:self performAction:action forRowForItem:treeNode.item treeNodeInfo:[treeNode treeNodeInfo] withSender:sender];
-  }
-}
+//
+//- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath
+//{
+//  if ([self.delegate respondsToSelector:@selector(treeView:shouldShowMenuForRowForItem:treeNodeInfo:)]) {
+//    RATreeNode *treeNode = [self treeNodeForIndex:indexPath.row];
+//    return [self.delegate treeView:self shouldShowMenuForRowForItem:treeNode.item treeNodeInfo:[treeNode treeNodeInfo]];
+//  }
+//  return NO;
+//}
+//
+//- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender
+//{
+//  if ([self.delegate respondsToSelector:@selector(treeView:canPerformAction:forRowForItem:treeNodeInfo:withSender:)]) {
+//    RATreeNode *treeNode = [self treeNodeForIndex:indexPath.row];
+//    return [self.delegate treeView:self canPerformAction:action forRowForItem:treeNode.item treeNodeInfo:[treeNode treeNodeInfo] withSender:sender];
+//  }
+//  return NO;
+//}
+//
+//- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender
+//{
+//  if ([self.delegate respondsToSelector:@selector(treeView:performAction:forRowForItem:treeNodeInfo:withSender:)]) {
+//    RATreeNode *treeNode = [self treeNodeForIndex:indexPath.row];
+//    return [self.delegate treeView:self performAction:action forRowForItem:treeNode.item treeNodeInfo:[treeNode treeNodeInfo] withSender:sender];
+//  }
+//}
 
 
 #pragma mark Managing Table View Highlighting
 #pragma mark Managing Table View Highlighting
 
 

+ 10 - 10
RedAnt ERP Mobile/common/categoryMenu_RATree/RATreeView+UIScrollView.m

@@ -201,16 +201,16 @@
   return self.tableView.indicatorStyle;
   return self.tableView.indicatorStyle;
 }
 }
 
 
-
-- (void)setScrollIndicatorInsets:(UIEdgeInsets)scrollIndicatorInsets
-{
-  self.tableView.scrollIndicatorInsets = scrollIndicatorInsets;
-}
-
-- (UIEdgeInsets)scrollIndicatorInsets
-{
-  return self.tableView.scrollIndicatorInsets;
-}
+//
+//- (void)setScrollIndicatorInsets:(UIEdgeInsets)scrollIndicatorInsets
+//{
+//  self.tableView.scrollIndicatorInsets = scrollIndicatorInsets;
+//}
+//
+//- (UIEdgeInsets)scrollIndicatorInsets
+//{
+//  return self.tableView.scrollIndicatorInsets;
+//}
 
 
 
 
 - (void)setShowsHorizontalScrollIndicator:(BOOL)showsHorizontalScrollIndicator
 - (void)setShowsHorizontalScrollIndicator:(BOOL)showsHorizontalScrollIndicator

+ 4 - 4
RedAnt ERP Mobile/common/categoryMenu_RATree/RATreeView.h

@@ -111,10 +111,10 @@ typedef enum RATreeViewRowAnimation {
 //Tracking the Removal of Views
 //Tracking the Removal of Views
 - (void)treeView:(RATreeView *)treeView didEndDisplayingCell:(RATreeViewCell *)cell forItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo;
 - (void)treeView:(RATreeView *)treeView didEndDisplayingCell:(RATreeViewCell *)cell forItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo;
 
 
-//Copying and Pasting Row Content
-- (BOOL)treeView:(RATreeView *)treeView shouldShowMenuForRowForItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo;
-- (BOOL)treeView:(RATreeView *)treeView canPerformAction:(SEL)action forRowForItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo withSender:(id)sender;
-- (void)treeView:(RATreeView *)treeView performAction:(SEL)action forRowForItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo withSender:(id)sender;
+////Copying and Pasting Row Content
+//- (BOOL)treeView:(RATreeView *)treeView shouldShowMenuForRowForItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo;
+//- (BOOL)treeView:(RATreeView *)treeView canPerformAction:(SEL)action forRowForItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo withSender:(id)sender;
+//- (void)treeView:(RATreeView *)treeView performAction:(SEL)action forRowForItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo withSender:(id)sender;
 
 
 //Managing Table View Highlighting
 //Managing Table View Highlighting
 - (BOOL)treeView:(RATreeView *)treeView shouldHighlightRowForItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo;
 - (BOOL)treeView:(RATreeView *)treeView shouldHighlightRowForItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo;

+ 14 - 9
RedAnt ERP Mobile/common/customUI/NIDropDown.m

@@ -107,15 +107,20 @@
         }
         }
         table.separatorColor = [UIColor grayColor];
         table.separatorColor = [UIColor grayColor];
         
         
-        [UIView beginAnimations:nil context:nil];
-        [UIView setAnimationDuration:0.3];
-        if ([direction isEqualToString:@"up"]) {
-            self.frame = CGRectMake(btn.origin.x, btn.origin.y-height, btn.size.width, height);
-        } else if([direction isEqualToString:@"down"]) {
-            self.frame = CGRectMake(btn.origin.x, btn.origin.y+btn.size.height, btn.size.width, height);
-        }
-        table.frame = CGRectMake(0, 0, btn.size.width, height);
-        [UIView commitAnimations];
+        __weak typeof(table) weaktable = table;
+        [UIView animateWithDuration:0.3 animations:^{
+            if ([direction isEqualToString:@"up"]) {
+                self.frame = CGRectMake(btn.origin.x, btn.origin.y-height, btn.size.width, height);
+            } else if([direction isEqualToString:@"down"]) {
+                self.frame = CGRectMake(btn.origin.x, btn.origin.y+btn.size.height, btn.size.width, height);
+            }
+            weaktable.frame = CGRectMake(0, 0, btn.size.width, height);
+        }];
+        
+        
+//        [UIView beginAnimations:nil context:nil];
+//        [UIView setAnimationDuration:0.3];
+//        [UIView commitAnimations];
         self.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
         self.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
         [container addSubview:self];
         [container addSubview:self];
         [self addSubview:table];
         [self addSubview:table];

+ 42 - 34
RedAnt ERP Mobile/common/customUI/SimpleGrid.m

@@ -320,27 +320,31 @@
         //            rect.origin.y= gestureRecognizer.view.superview.frame.origin.y+self.left_line;
         //            rect.origin.y= gestureRecognizer.view.superview.frame.origin.y+self.left_line;
         //        }
         //        }
         //int idx = [t locationInView:self].y / d.cellHeight;
         //int idx = [t locationInView:self].y / d.cellHeight;
-		[UIView beginAnimations:nil context:nil];
-		[UIView setAnimationDuration:0.65];
+//		[UIView beginAnimations:nil context:nil];
+//		[UIView setAnimationDuration:0.65];
         long row = gestureRecognizer.view.tag/self.column_count;
         long row = gestureRecognizer.view.tag/self.column_count;
         long column = gestureRecognizer.view.tag%self.column_count;
         long column = gestureRecognizer.view.tag%self.column_count;
-        if(self.fullrowselect)
-        {
-            
-            for(int i=0;i<self.column_count;i++)
+        [UIView animateWithDuration:0.65 animations:^{
+  
+            if(self.fullrowselect)
             {
             {
-                [self viewWithTag:(row*self.column_count+i)].alpha = 0.5;
+                
+                for(int i=0;i<self.column_count;i++)
+                {
+                    [self viewWithTag:(row*self.column_count+i)].alpha = 0.5;
+                }
+                for(int i=0;i<self.column_count;i++)
+                {
+                    [self viewWithTag:(row*self.column_count+i)].alpha = 1.0;
+                }
             }
             }
-            for(int i=0;i<self.column_count;i++)
+            else
             {
             {
-                [self viewWithTag:(row*self.column_count+i)].alpha = 1.0;
+                gestureRecognizer.view.alpha=0.5;
+                gestureRecognizer.view.alpha=1;
             }
             }
-        }
-        else
-        {
-            gestureRecognizer.view.alpha=0.5;
-            gestureRecognizer.view.alpha=1;
-        }
+        }];
+    
         //		for(int i=0;i<[d.dataSource.titles count];i++){
         //		for(int i=0;i<[d.dataSource.titles count];i++){
         //			UILabel *l = (UILabel*)[dataGridComponent viewWithTag:idx * d.cellHeight + i + 1000];
         //			UILabel *l = (UILabel*)[dataGridComponent viewWithTag:idx * d.cellHeight + i + 1000];
         //			l.alpha = .5;
         //			l.alpha = .5;
@@ -349,7 +353,7 @@
         //			UILabel *l = (UILabel*)[dataGridComponent viewWithTag:idx * d.cellHeight + i + 1000];
         //			UILabel *l = (UILabel*)[dataGridComponent viewWithTag:idx * d.cellHeight + i + 1000];
         //			l.alpha = 1.0;
         //			l.alpha = 1.0;
         //		}
         //		}
-		[UIView commitAnimations];
+//		[UIView commitAnimations];
         
         
         if(self.fullrowselect)
         if(self.fullrowselect)
         {
         {
@@ -373,30 +377,34 @@
     //    if(gestureRecognizer.view.tag - self.basetag < MAX_COLUMN) //header
     //    if(gestureRecognizer.view.tag - self.basetag < MAX_COLUMN) //header
     //        return;
     //        return;
     
     
-    [UIView beginAnimations:nil context:nil];
-    [UIView setAnimationDuration:0.65];
+//    [UIView beginAnimations:nil context:nil];
+//    [UIView setAnimationDuration:0.65];
     long row = gestureRecognizer.view.tag/self.column_count;
     long row = gestureRecognizer.view.tag/self.column_count;
     long column = gestureRecognizer.view.tag%self.column_count;
     long column = gestureRecognizer.view.tag%self.column_count;
-    if(self.fullrowselect)
-    {
-        
-        for(int i=0;i<self.column_count;i++)
+    [UIView animateWithDuration:0.65 animations:^{
+
+        if(self.fullrowselect)
         {
         {
-            [self viewWithTag:(row*self.column_count+i)].alpha = 0.5;
+            
+            for(int i=0;i<self.column_count;i++)
+            {
+                [self viewWithTag:(row*self.column_count+i)].alpha = 0.5;
+            }
+            for(int i=0;i<self.column_count;i++)
+            {
+                [self viewWithTag:(row*self.column_count+i)].alpha = 1.0;
+            }
+            
         }
         }
-        for(int i=0;i<self.column_count;i++)
+        else
         {
         {
-            [self viewWithTag:(row*self.column_count+i)].alpha = 1.0;
+            gestureRecognizer.view.alpha=0.5;
+            gestureRecognizer.view.alpha=1;
+            
         }
         }
-        
-    }
-    else
-    {
-        gestureRecognizer.view.alpha=0.5;
-        gestureRecognizer.view.alpha=1;
-        
-    }
-    [UIView commitAnimations];
+    }];
+   
+//    [UIView commitAnimations];
     
     
     
     
     if(self.fullrowselect)
     if(self.fullrowselect)

+ 6 - 3
RedAnt ERP Mobile/common/data_provider/RANetwork.m

@@ -1636,7 +1636,7 @@ NSString *const ScreenCodeOfflineSync = @"Offline Sync Screen";
 +(NSDictionary*)err_log:(NSString*) up_params result:(NSString*)result module:(NSString*) module code:(int) code//device:(NSString*) device
 +(NSDictionary*)err_log:(NSString*) up_params result:(NSString*)result module:(NSString*) module code:(int) code//device:(NSString*) device
 {
 {
     
     
-    return nil;
+#ifdef ERR_LOG
     NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
     NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
     __block AppDelegate *appDelegate = nil;
     __block AppDelegate *appDelegate = nil;
     
     
@@ -1674,6 +1674,9 @@ NSString *const ScreenCodeOfflineSync = @"Offline Sync Screen";
     NSError *error=nil;
     NSError *error=nil;
     NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
     NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
     return jsobj;
     return jsobj;
+#else
+    return nil;
+#endif
 }
 }
 
 
 
 
@@ -10646,10 +10649,10 @@ NSMutableDictionary* section = [RASingleton.sharedInstance.scan_cart[@"section_0
 
 
 +(void) request_complete_offline_ticket:(NSString* )vid completionHandler:(resultHandler)result
 +(void) request_complete_offline_ticket:(NSString* )vid completionHandler:(resultHandler)result
 {
 {
-    AppDelegate *appDelegate = nil;
+//    AppDelegate *appDelegate = nil;
     
     
     
     
-    appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
     NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
     NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
     
     
     [params setObject:ScreenCodeOfflineSetting forKey:kScreenName];
     [params setObject:ScreenCodeOfflineSetting forKey:kScreenName];

+ 1 - 1
RedAnt ERP Mobile/common/zip/minizip/unzip.c

@@ -1162,7 +1162,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
         pfile_info->internal_fa = file_info64.internal_fa;
         pfile_info->internal_fa = file_info64.internal_fa;
         pfile_info->external_fa = file_info64.external_fa;
         pfile_info->external_fa = file_info64.external_fa;
 
 
-        pfile_info->tmu_date = file_info64.tmu_date,
+        pfile_info->tmu_date = file_info64.tmu_date;
 
 
 
 
         pfile_info->compressed_size = (uLong)file_info64.compressed_size;
         pfile_info->compressed_size = (uLong)file_info64.compressed_size;

+ 1 - 1
RedAnt ERP Mobile/common/zip/minizip/zip.c

@@ -186,7 +186,7 @@ typedef struct
 #include "crypt.h"
 #include "crypt.h"
 #endif
 #endif
 
 
-local linkedlist_datablock_internal* allocate_new_datablock()
+local linkedlist_datablock_internal* allocate_new_datablock(void)
 {
 {
     linkedlist_datablock_internal* ldi;
     linkedlist_datablock_internal* ldi;
     ldi = (linkedlist_datablock_internal*)
     ldi = (linkedlist_datablock_internal*)

+ 0 - 19
RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/xcuserdata/ray.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>SchemeUserState</key>
-	<dict>
-		<key>iSales-USAI.xcscheme</key>
-		<dict>
-			<key>orderHint</key>
-			<integer>6</integer>
-		</dict>
-		<key>iSales-USAI.xcscheme_^#shared#^_</key>
-		<dict>
-			<key>orderHint</key>
-			<integer>7</integer>
-		</dict>
-	</dict>
-</dict>
-</plist>

+ 1 - 6
RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,12 +7,7 @@
 		<key>iSales-CONTRAST.xcscheme_^#shared#^_</key>
 		<key>iSales-CONTRAST.xcscheme_^#shared#^_</key>
 		<dict>
 		<dict>
 			<key>orderHint</key>
 			<key>orderHint</key>
-			<integer>5</integer>
-		</dict>
-		<key>iSales-USAI.xcscheme_^#shared#^_</key>
-		<dict>
-			<key>orderHint</key>
-			<integer>6</integer>
+			<integer>1</integer>
 		</dict>
 		</dict>
 	</dict>
 	</dict>
 </dict>
 </dict>

+ 8 - 0
RedAnt ERP Mobile/iSales-NPD.xcodeproj/project.pbxproj

@@ -2352,6 +2352,10 @@
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.apex.iSales-NPD";
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.apex.iSales-NPD";
 				PRODUCT_NAME = "NPD Mobile";
 				PRODUCT_NAME = "NPD Mobile";
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE = "";
+				SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
+				SUPPORTS_MACCATALYST = NO;
+				SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
+				TARGETED_DEVICE_FAMILY = 2;
 				WRAPPER_EXTENSION = app;
 				WRAPPER_EXTENSION = app;
 			};
 			};
 			name = Debug;
 			name = Debug;
@@ -2396,6 +2400,10 @@
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.apex.iSales-NPD";
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.apex.iSales-NPD";
 				PRODUCT_NAME = "NPD Mobile";
 				PRODUCT_NAME = "NPD Mobile";
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE = "";
+				SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
+				SUPPORTS_MACCATALYST = NO;
+				SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
+				TARGETED_DEVICE_FAMILY = 2;
 				WRAPPER_EXTENSION = app;
 				WRAPPER_EXTENSION = app;
 			};
 			};
 			name = Release;
 			name = Release;

+ 33 - 74
RedAnt ERP Mobile/iSales-NPD/Base.lproj/OLM.storyboard

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
     <device id="ipad9_7" orientation="portrait" layout="fullscreen" appearance="light"/>
     <device id="ipad9_7" orientation="portrait" layout="fullscreen" appearance="light"/>
     <dependencies>
     <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     </dependencies>
@@ -300,7 +300,7 @@
                                                     <rect key="frame" x="10" y="32" width="21" height="21"/>
                                                     <rect key="frame" x="10" y="32" width="21" height="21"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                                     <state key="normal" image="button:hrK-DY-RbO:image"/>
                                                     <state key="normal" image="button:hrK-DY-RbO:image"/>
-                                                    <state key="selected" image="4D9BDF16-516E-45D5-BD53-324B3B5C6B8E"/>
+                                                    <state key="selected" image="24A753FE-9743-4BAD-BFDE-8CCD81F08A8A"/>
                                                     <connections>
                                                     <connections>
                                                         <action selector="checkButtonClick:" destination="XXr-fU-67o" eventType="touchUpInside" id="KeU-ld-H4J"/>
                                                         <action selector="checkButtonClick:" destination="XXr-fU-67o" eventType="touchUpInside" id="KeU-ld-H4J"/>
                                                     </connections>
                                                     </connections>
@@ -354,10 +354,10 @@
             </objects>
             </objects>
             <point key="canvasLocation" x="2397.65625" y="348.6328125"/>
             <point key="canvasLocation" x="2397.65625" y="348.6328125"/>
         </scene>
         </scene>
-        <!--Sign_in-->
+        <!--Unlock offline-->
         <scene sceneID="Iag-oy-jaN">
         <scene sceneID="Iag-oy-jaN">
             <objects>
             <objects>
-                <viewController storyboardIdentifier="OfflineUnlockViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="38J-Bm-huX" userLabel="Sign_in" customClass="OfflineUnlockViewController" sceneMemberID="viewController">
+                <viewController storyboardIdentifier="OfflineUnlockViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="38J-Bm-huX" userLabel="Unlock offline" customClass="OfflineUnlockViewController" sceneMemberID="viewController">
                     <layoutGuides>
                     <layoutGuides>
                         <viewControllerLayoutGuide type="top" id="gur-LG-w64"/>
                         <viewControllerLayoutGuide type="top" id="gur-LG-w64"/>
                         <viewControllerLayoutGuide type="bottom" id="DTK-XA-Cl4"/>
                         <viewControllerLayoutGuide type="bottom" id="DTK-XA-Cl4"/>
@@ -366,9 +366,8 @@
                         <rect key="frame" x="0.0" y="0.0" width="480" height="320"/>
                         <rect key="frame" x="0.0" y="0.0" width="480" height="320"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <subviews>
                         <subviews>
-                            <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="User" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="OGq-ht-S8t">
-                                <rect key="frame" x="58" y="103" width="361" height="30"/>
-                                <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+                            <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="User" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="OGq-ht-S8t">
+                                <rect key="frame" x="60" y="103" width="360" height="34"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <textInputTraits key="textInputTraits" autocorrectionType="no"/>
                                 <textInputTraits key="textInputTraits" autocorrectionType="no"/>
@@ -376,51 +375,20 @@
                                     <outlet property="delegate" destination="38J-Bm-huX" id="WID-8R-2yL"/>
                                     <outlet property="delegate" destination="38J-Bm-huX" id="WID-8R-2yL"/>
                                 </connections>
                                 </connections>
                             </textField>
                             </textField>
-                            <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Password" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="l8b-7U-g6s">
-                                <rect key="frame" x="58" y="142" width="361" height="30"/>
-                                <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+                            <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Password" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="l8b-7U-g6s">
+                                <rect key="frame" x="60" y="147" width="360" height="34"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <textInputTraits key="textInputTraits" secureTextEntry="YES"/>
                                 <textInputTraits key="textInputTraits" secureTextEntry="YES"/>
                             </textField>
                             </textField>
-                            <button hidden="YES" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rMJ-4V-e3C">
-                                <rect key="frame" x="60" y="196" width="154" height="22"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                <inset key="contentEdgeInsets" minX="4" minY="0.0" maxX="0.0" maxY="0.0"/>
-                                <inset key="imageEdgeInsets" minX="-4" minY="0.0" maxX="0.0" maxY="0.0"/>
-                                <state key="normal" title="Save password" image="checkbox">
-                                    <color key="titleColor" red="0.59999999999999998" green="0.40000000000000002" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                    <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                </state>
-                            </button>
-                            <button hidden="YES" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6lu-Dw-7uZ">
-                                <rect key="frame" x="295" y="196" width="125" height="22"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                <inset key="contentEdgeInsets" minX="4" minY="0.0" maxX="0.0" maxY="0.0"/>
-                                <inset key="imageEdgeInsets" minX="-4" minY="0.0" maxX="0.0" maxY="0.0"/>
-                                <state key="normal" title="Offline mode" image="checkbox">
-                                    <color key="titleColor" red="0.59999999999999998" green="0.40000000000000002" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                    <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                </state>
-                            </button>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Unlock offline" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DWa-JA-ah5">
-                                <rect key="frame" x="60" y="67" width="124" height="26"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Unlock offline" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DWa-JA-ah5">
+                                <rect key="frame" x="60" y="67" width="120.5" height="24"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="20"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="20"/>
                                 <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             </label>
-                            <button hidden="YES" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="snZ-xL-t2m">
-                                <rect key="frame" x="247" y="65" width="172" height="30"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
-                                <state key="normal" title="Retrieve password">
-                                    <color key="titleColor" red="0.59999999999999998" green="0.40000000000000002" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                    <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                </state>
-                            </button>
-                            <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="06f-pS-V71">
-                                <rect key="frame" x="358" y="267" width="100" height="36"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="06f-pS-V71">
+                                <rect key="frame" x="378" y="267" width="62" height="36"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="20"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="20"/>
                                 <state key="normal" title="Unlock">
                                 <state key="normal" title="Unlock">
                                     <color key="titleColor" red="0.59999999999999998" green="0.40000000000000002" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
                                     <color key="titleColor" red="0.59999999999999998" green="0.40000000000000002" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
@@ -435,35 +403,23 @@
                                     <action selector="OnUnlockClicked:" destination="38J-Bm-huX" eventType="touchUpInside" id="Gwz-83-oAU"/>
                                     <action selector="OnUnlockClicked:" destination="38J-Bm-huX" eventType="touchUpInside" id="Gwz-83-oAU"/>
                                 </connections>
                                 </connections>
                             </button>
                             </button>
-                            <tableView hidden="YES" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="wA2-4c-W2N">
-                                <rect key="frame" x="60" y="133" width="360" height="129"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                <prototypes>
-                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="LoginListCell" textLabel="hql-hH-AXh" style="IBUITableViewCellStyleDefault" id="0HM-qr-ZyP">
-                                        <rect key="frame" x="0.0" y="50" width="360" height="44"/>
-                                        <autoresizingMask key="autoresizingMask"/>
-                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="0HM-qr-ZyP" id="qg6-aD-3QW">
-                                            <rect key="frame" x="0.0" y="0.0" width="360" height="44"/>
-                                            <autoresizingMask key="autoresizingMask"/>
-                                            <subviews>
-                                                <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="hql-hH-AXh">
-                                                    <rect key="frame" x="16" y="0.0" width="328" height="44"/>
-                                                    <autoresizingMask key="autoresizingMask"/>
-                                                    <fontDescription key="fontDescription" type="system" pointSize="16"/>
-                                                    <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                                    <nil key="highlightedColor"/>
-                                                </label>
-                                            </subviews>
-                                        </tableViewCellContentView>
-                                    </tableViewCell>
-                                </prototypes>
-                            </tableView>
                         </subviews>
                         </subviews>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <constraints>
+                            <constraint firstItem="l8b-7U-g6s" firstAttribute="top" secondItem="OGq-ht-S8t" secondAttribute="bottom" constant="10" id="7ga-5U-cOL"/>
+                            <constraint firstItem="DTK-XA-Cl4" firstAttribute="top" secondItem="06f-pS-V71" secondAttribute="bottom" constant="17" id="9jU-wp-9Ni"/>
+                            <constraint firstAttribute="trailing" secondItem="OGq-ht-S8t" secondAttribute="trailing" constant="60" id="Blc-ti-3Dj"/>
+                            <constraint firstItem="DWa-JA-ah5" firstAttribute="top" secondItem="gur-LG-w64" secondAttribute="bottom" constant="47" id="ERJ-vA-lyj"/>
+                            <constraint firstItem="OGq-ht-S8t" firstAttribute="leading" secondItem="gyO-SO-Q7G" secondAttribute="leading" constant="60" id="GHo-4f-apZ"/>
+                            <constraint firstAttribute="trailing" secondItem="l8b-7U-g6s" secondAttribute="trailing" constant="60" id="GmQ-TV-ISv"/>
+                            <constraint firstAttribute="trailing" secondItem="06f-pS-V71" secondAttribute="trailing" constant="40" id="Ms4-Wq-8ZN"/>
+                            <constraint firstItem="DWa-JA-ah5" firstAttribute="leading" secondItem="gyO-SO-Q7G" secondAttribute="leading" constant="60" id="aSB-G7-Hwz"/>
+                            <constraint firstItem="l8b-7U-g6s" firstAttribute="leading" secondItem="gyO-SO-Q7G" secondAttribute="leading" constant="60" id="d4D-tG-YnZ"/>
+                            <constraint firstItem="OGq-ht-S8t" firstAttribute="top" secondItem="DWa-JA-ah5" secondAttribute="bottom" constant="12" id="oXL-5K-6bd"/>
+                        </constraints>
                     </view>
                     </view>
                     <navigationItem key="navigationItem" title="Unlock Offline" id="ANt-1h-Ffe">
                     <navigationItem key="navigationItem" title="Unlock Offline" id="ANt-1h-Ffe">
-                        <barButtonItem key="rightBarButtonItem" image="close" style="plain" id="i0p-qZ-6mR">
+                        <barButtonItem key="rightBarButtonItem" image="close" id="i0p-qZ-6mR">
                             <connections>
                             <connections>
                                 <action selector="CloseClick:" destination="38J-Bm-huX" id="RRH-EO-4ga"/>
                                 <action selector="CloseClick:" destination="38J-Bm-huX" id="RRH-EO-4ga"/>
                             </connections>
                             </connections>
@@ -523,6 +479,7 @@
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Z2w-2n-SST">
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Z2w-2n-SST">
                                 <rect key="frame" x="296" y="220" width="124" height="22"/>
                                 <rect key="frame" x="296" y="220" width="124" height="22"/>
                                 <constraints>
                                 <constraints>
+                                    <constraint firstAttribute="width" constant="124" id="LKL-kP-Bug"/>
                                     <constraint firstAttribute="height" constant="22" id="x3I-Ae-w2r"/>
                                     <constraint firstAttribute="height" constant="22" id="x3I-Ae-w2r"/>
                                 </constraints>
                                 </constraints>
                                 <inset key="contentEdgeInsets" minX="4" minY="0.0" maxX="0.0" maxY="0.0"/>
                                 <inset key="contentEdgeInsets" minX="4" minY="0.0" maxX="0.0" maxY="0.0"/>
@@ -533,8 +490,9 @@
                                 </state>
                                 </state>
                             </button>
                             </button>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sign in" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="knf-cd-xPX">
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sign in" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="knf-cd-xPX">
-                                <rect key="frame" x="60" y="87" width="59" height="26"/>
+                                <rect key="frame" x="60" y="87" width="60" height="26"/>
                                 <constraints>
                                 <constraints>
+                                    <constraint firstAttribute="width" constant="60" id="7Xc-eA-JbQ"/>
                                     <constraint firstAttribute="height" constant="26" id="qI6-Ph-C1i"/>
                                     <constraint firstAttribute="height" constant="26" id="qI6-Ph-C1i"/>
                                 </constraints>
                                 </constraints>
                                 <fontDescription key="fontDescription" type="system" pointSize="20"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="20"/>
@@ -544,6 +502,7 @@
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vs9-qY-X1G">
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vs9-qY-X1G">
                                 <rect key="frame" x="294" y="85.5" width="126" height="30"/>
                                 <rect key="frame" x="294" y="85.5" width="126" height="30"/>
                                 <constraints>
                                 <constraints>
+                                    <constraint firstAttribute="width" constant="126" id="C2c-Wg-Ei7"/>
                                     <constraint firstAttribute="height" constant="30" id="W9d-yI-RqE"/>
                                     <constraint firstAttribute="height" constant="30" id="W9d-yI-RqE"/>
                                 </constraints>
                                 </constraints>
                                 <state key="normal" title="Retrieve password">
                                 <state key="normal" title="Retrieve password">
@@ -645,7 +604,7 @@
                         </constraints>
                         </constraints>
                     </view>
                     </view>
                     <navigationItem key="navigationItem" title="NPD" id="ziz-8O-kl9">
                     <navigationItem key="navigationItem" title="NPD" id="ziz-8O-kl9">
-                        <barButtonItem key="rightBarButtonItem" image="close" style="plain" id="9Vc-xr-KiD">
+                        <barButtonItem key="rightBarButtonItem" image="close" id="9Vc-xr-KiD">
                             <connections>
                             <connections>
                                 <action selector="CloseClick:" destination="9zU-md-xm6" id="odn-1c-HwF"/>
                                 <action selector="CloseClick:" destination="9zU-md-xm6" id="odn-1c-HwF"/>
                             </connections>
                             </connections>
@@ -1074,7 +1033,7 @@
                                 <rect key="frame" x="36" y="36" width="696" height="972"/>
                                 <rect key="frame" x="36" y="36" width="696" height="972"/>
                                 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                                 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                                 <prototypes>
                                 <prototypes>
-                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="If9-Ed-Mke" style="IBUITableViewCellStyleDefault" id="XFZ-pE-gLa">
+                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="cell" textLabel="If9-Ed-Mke" style="IBUITableViewCellStyleDefault" id="XFZ-pE-gLa">
                                         <rect key="frame" x="0.0" y="50" width="696" height="43.5"/>
                                         <rect key="frame" x="0.0" y="50" width="696" height="43.5"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="XFZ-pE-gLa" id="bSi-0h-mDn">
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="XFZ-pE-gLa" id="bSi-0h-mDn">
@@ -1116,7 +1075,7 @@
         </scene>
         </scene>
     </scenes>
     </scenes>
     <resources>
     <resources>
-        <image name="4D9BDF16-516E-45D5-BD53-324B3B5C6B8E" width="24" height="24">
+        <image name="24A753FE-9743-4BAD-BFDE-8CCD81F08A8A" width="24" height="24">
             <mutableData key="keyedArchiveRepresentation">
             <mutableData key="keyedArchiveRepresentation">
 YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05T
 YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05T
 S2V5ZWRBcmNoaXZlctEICVRyb290gAGuCwwZGh8UJCkqMTQ3PUBVJG51bGzWDQ4PEBESExQVFhcYVk5T
 S2V5ZWRBcmNoaXZlctEICVRyb290gAGuCwwZGh8UJCkqMTQ3PUBVJG51bGzWDQ4PEBESExQVFhcYVk5T

+ 3 - 125
common/NetworkUtils.m

@@ -410,92 +410,7 @@ repeat:
         NSData *file_data = [NSData dataWithContentsOfFile:filePath];
         NSData *file_data = [NSData dataWithContentsOfFile:filePath];
     
     
     return [self upload:file_data FileName:fileName Params:params ToHost:urlString Result:r Progress:p DecryptHandler:decrypt];
     return [self upload:file_data FileName:fileName Params:params ToHost:urlString Result:r Progress:p DecryptHandler:decrypt];
-//
-//    NSMutableData *dataM = [NSMutableData data];
-//
-//    NSMutableString *stringM = [NSMutableString string];
-//
-//
-//    DebugLog(@"================parms==================");
-//
-//
-//
-//    for (NSString *key in params) {
-//
-//        [stringM appendString:[NSString stringWithFormat:@"--%@\r\n",BOUNDARY]];
-//        [stringM appendFormat:@"Content-Type: text/plain; charset=UTF-8\r\n"];
-//        [stringM appendFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n",key];
-//        [stringM appendFormat:@"%@\r\n",[params objectForKey:key]];
-//
-//
-//        DebugLog(@"parameter: key=%@   value=%@",key,[params objectForKey:key]);
-//    }
-//    DebugLog(@"================parms==================");
-//    [stringM appendString:[NSString stringWithFormat:@"--%@\r\n",BOUNDARY]];
-//
-//    [stringM appendFormat:@"Content-Disposition: form-data; name=\"upfile\"; filename=%@\r\n",fileName];
-//    [stringM appendString:@"Content-Type: application/mac-binary\r\n"];
-//    [stringM appendString:@"\r\n"];
-//
-//    NSData *stringM_data = [stringM dataUsingEncoding:NSUTF8StringEncoding];
-//    [dataM appendData:stringM_data];
-//
-//    NSData *file_data = [NSData dataWithContentsOfFile:filePath];
-//    [dataM appendData:file_data];
-//
-//    NSString *end = [NSString stringWithFormat:@"\r\n--%@--",BOUNDARY];
-//    [dataM appendData:[end dataUsingEncoding:NSUTF8StringEncoding]];
-//
-//    // Data
-//    NSData *data = dataM;
-//
-//
-//    // 可变请求
-//    NSURL *url = [NSURL URLWithString:urlString];
-//    NSMutableURLRequest *requestM = [NSMutableURLRequest requestWithURL:url
-//                                                            cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:JSON_TIMEOUT];
-//    // line note
-//    requestM.HTTPMethod = @"POST";
-//
-//    // request header
-//    [requestM addValue:@"close" forHTTPHeaderField:@"Connection"];
-//
-//    [requestM addValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@",BOUNDARY] forHTTPHeaderField:@"Content-Type"];
-//
-//    [requestM addValue:[NSString stringWithFormat:@"%lu", (unsigned long)[data length]] forHTTPHeaderField:@"Content-Length"];
-//
-//    // request body
-//    requestM.HTTPBody = data;
-//
-//
-//
-//    NSURLSession *urlSession = [self standSession];
-//
-//    if (urlSession.delegate) {
-//        if ([urlSession.delegate isKindOfClass:[RANetworkTaskDelegate class]]) {
-//
-//            RANetworkTaskDelegate *delegate = (RANetworkTaskDelegate *)urlSession.delegate;
-//
-//            if (p) {
-//                delegate.p = p;
-//            }
-//
-//            if (r) {
-//                delegate.r = r;
-//            }
-//
-//            if (decrypt) {
-//                delegate.decryptHandler = decrypt;
-//            }
-//
-//        }
-//    }
-//
-//    NSURLSessionDataTask *dataTask = [urlSession uploadTaskWithRequest:requestM fromData:data];
-//
-//    [dataTask resume];
-//
-//    return dataTask;
+
 }
 }
 
 
 
 
@@ -905,17 +820,7 @@ repeat:
     params = [self prepare_additional_params:params];
     params = [self prepare_additional_params:params];
 
 
     NSURLSession *urlSession = [self standSession];
     NSURLSession *urlSession = [self standSession];
-    
-//    RANetworkTaskDelegate *delegate = (RANetworkTaskDelegate *)urlSession.delegate;
-//    delegate.downloadTask = YES;
-//    delegate.fileCachePath = path;
-//    if (progressHandler) {
-//        delegate.p = progressHandler;
-//    }
-//
-//    if (result) {
-//        delegate.r = result;
-//    }
+
     
     
     NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
     NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
     
     
@@ -1020,7 +925,7 @@ repeat:
 +(void)request_upload_fast :(NSData *)filedata   FileName:(NSString*) filename server:(NSString*) urlString parameters:(NSMutableDictionary *) params completionHandler:(resultHandler)result
 +(void)request_upload_fast :(NSData *)filedata   FileName:(NSString*) filename server:(NSString*) urlString parameters:(NSMutableDictionary *) params completionHandler:(resultHandler)result
 {
 {
     //    NSString *fileName = [filePath lastPathComponent];
     //    NSString *fileName = [filePath lastPathComponent];
-    DebugLog(urlString);
+    DebugLog(@"%@",urlString);
     NSMutableData *dataM = [NSMutableData data];
     NSMutableData *dataM = [NSMutableData data];
     
     
     NSMutableString *stringM = [NSMutableString string];
     NSMutableString *stringM = [NSMutableString string];
@@ -1094,33 +999,6 @@ repeat:
     
     
     NSURLSession *urlSession = [self standSession];
     NSURLSession *urlSession = [self standSession];
     
     
-//    if (urlSession.delegate) {
-//        if ([urlSession.delegate isKindOfClass:[RANetworkTaskDelegate class]]) {
-//
-//            RANetworkTaskDelegate *delegate = (RANetworkTaskDelegate *)urlSession.delegate;
-//
-//            if (p) {
-//                delegate.p = p;
-//            }
-//
-//            if (r) {
-//                delegate.r = r;
-//            }
-//
-//            if (decrypt) {
-//                delegate.decryptHandler = decrypt;
-//            }
-//
-//        }
-//    }
-    
-//    NSURLSessionDataTask *dataTask = [urlSession uploadTaskWithRequest:requestM fromData:data];
-  
-//    [urlSession uploadTaskWithRequest:<#(nonnull NSURLRequest *)#> fromData:<#(nullable NSData *)#> completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
-//        <#code#>
-//    }];
-//    [urlSession uploadTaskWithRequest:<#(nonnull NSURLRequest *)#> fromFile:<#(nonnull NSURL *)#> completionHandler:<#^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error)completionHandler#>]
-    
     NSURLSessionUploadTask *uploadTask =  [urlSession uploadTaskWithRequest:requestM fromData:data completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
     NSURLSessionUploadTask *uploadTask =  [urlSession uploadTaskWithRequest:requestM fromData:data completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
         
         
         NSData *responseData =data;
         NSData *responseData =data;

+ 2 - 2
common/RAConvertor.h

@@ -19,8 +19,8 @@
 +(NSData*) arr2data:(NSArray*) arr;
 +(NSData*) arr2data:(NSArray*) arr;
 +(NSArray*) data2arr:(NSData*) data;
 +(NSArray*) data2arr:(NSData*) data;
 
 
-+(NSData*) dict2data:(NSDictionary*) dict;
-+(NSDictionary*) data2dict:(NSData*) data;
++(NSData*) dict2data:(id) dict;
++(id) data2dict:(NSData*) data;
 +(id) string2dict:(NSString*) str;
 +(id) string2dict:(NSString*) str;
 +(NSString*) dict2string:(id) dict;
 +(NSString*) dict2string:(id) dict;
 +(NSString*) currencyNumber:(double) num;
 +(NSString*) currencyNumber:(double) num;

+ 14 - 5
common/RAConvertor.m

@@ -25,7 +25,7 @@
     }
     }
     return jsonString;
     return jsonString;
 }
 }
-+(NSDictionary*) data2dict:(NSData*) data
++(id) data2dict:(NSData*) data
 {
 {
     return [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
     return [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
 }
 }
@@ -107,7 +107,14 @@ begin:
 {
 {
     if(arr==nil)
     if(arr==nil)
         return nil;
         return nil;
-    NSData *data = [NSKeyedArchiver archivedDataWithRootObject:arr];
+    
+    
+//    [self dict2data:arr];
+//    NSData *data = [NSKeyedArchiver archivedDataWithRootObject:arr];
+    
+    
+    NSData *data =[NSKeyedArchiver archivedDataWithRootObject:arr requiringSecureCoding:false error:nil];
+    
     return data;
     return data;
 }
 }
 
 
@@ -115,8 +122,10 @@ begin:
 {
 {
     if(data == nil)
     if(data == nil)
         return nil;
         return nil;
-    
-    NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:data];
+    NSError* err;
+    NSArray *array =[NSKeyedUnarchiver unarchivedObjectOfClasses:[NSSet setWithObjects:NSDictionary.class,NSArray.class,nil] fromData:data error:&err];
+     
+//    NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:data];
     return array;
     return array;
 }
 }
 +(NSString*) separateNumber:(double) num
 +(NSString*) separateNumber:(double) num
@@ -156,7 +165,7 @@ begin:
     
     
 
 
 }
 }
-+(NSData*) dict2data:(NSDictionary*) dict
++(NSData*) dict2data:(id) dict
 {
 {
     if(dict==nil)
     if(dict==nil)
         return nil;
         return nil;

+ 33 - 20
common/Youtube/RAYTPlayer.m

@@ -190,38 +190,51 @@
     
     
     //1)获取trust object
     //1)获取trust object
     SecTrustRef trust = challenge.protectionSpace.serverTrust;
     SecTrustRef trust = challenge.protectionSpace.serverTrust;
-    SecTrustResultType result;
+//    SecTrustResultType result;
     
     
     //2)SecTrustEvaluate对trust进行验证
     //2)SecTrustEvaluate对trust进行验证
-    OSStatus status = SecTrustEvaluate(trust, &result);
+    
+    
+//    OSStatus status = SecTrustEvaluate(trust, &result);
     
     
     //    CFArrayRef defaultPolicies = NULL;
     //    CFArrayRef defaultPolicies = NULL;
     //    SecTrustCopyPolicies(trust, &defaultPolicies);
     //    SecTrustCopyPolicies(trust, &defaultPolicies);
     //    DebugLog(@"default policies: %@",(__bridge id)defaultPolicies);
     //    DebugLog(@"default policies: %@",(__bridge id)defaultPolicies);
     
     
-    NSMutableArray *policies = [NSMutableArray array];
-    [policies addObject:(__bridge_transfer id)SecPolicyCreateBasicX509()];
-    SecTrustSetPolicies(trust, (__bridge CFArrayRef)policies);
+
     
     
-    if (status == errSecSuccess && (result == kSecTrustResultProceed || result == kSecTrustResultUnspecified)) {
-        
-        //3)验证成功,生成NSURLCredential凭证cred,告知challenge的sender使用这个凭证来继续连接
-        NSURLCredential *cred = [NSURLCredential credentialForTrust:trust];
-        [challenge.sender useCredential:cred forAuthenticationChallenge:challenge];
-        if (completionHandler) {
-            completionHandler(NSURLSessionAuthChallengeUseCredential,cred); // 使用证书
-        }
-        
-    } else {
+    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+        CFErrorRef cfError = nil;
+        bool btrust = SecTrustEvaluateWithError(trust, &cfError);
         
         
-        [challenge.sender cancelAuthenticationChallenge:challenge];
+        NSMutableArray *policies = [NSMutableArray array];
+        [policies addObject:(__bridge_transfer id)SecPolicyCreateBasicX509()];
+        SecTrustSetPolicies(trust, (__bridge CFArrayRef)policies);
         
         
-        //4)验证失败,取消这次验证流程
-        if (completionHandler) {
-            completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge,nil); // 忽略证书
+    //    if (status == errSecSuccess && (result == kSecTrustResultProceed || result == kSecTrustResultUnspecified))
+        if(btrust&&cfError == nil)
+        {
+            
+            //3)验证成功,生成NSURLCredential凭证cred,告知challenge的sender使用这个凭证来继续连接
+            NSURLCredential *cred = [NSURLCredential credentialForTrust:trust];
+            [challenge.sender useCredential:cred forAuthenticationChallenge:challenge];
+            if (completionHandler) {
+                completionHandler(NSURLSessionAuthChallengeUseCredential,cred); // 使用证书
+            }
+            
+        } else {
+            
+            [challenge.sender cancelAuthenticationChallenge:challenge];
+            
+            //4)验证失败,取消这次验证流程
+            if (completionHandler) {
+                completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge,nil); // 忽略证书
+            }
+            
         }
         }
         
         
-    }
+
+    });
 
 
 }
 }
 
 

+ 1 - 1
common/customUI/commoneditor/SRMonthPicker.m

@@ -60,7 +60,7 @@ static const NSCalendarUnit SRDateComponentFlags = NSCalendarUnitMonth | NSCalen
         _calendar = calendar;
         _calendar = calendar;
         [self p_prepare];
         [self p_prepare];
         [self setDate:date];
         [self setDate:date];
-        self.showsSelectionIndicator = YES;
+//        self.showsSelectionIndicator = YES;
     }
     }
     
     
     return self;
     return self;