فهرست منبع

160906
modify upload logic, add sync complete check

Ray Zhang 9 سال پیش
والد
کامیت
75d0c5895b

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 3 - 51
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -259,22 +259,6 @@
             landmarkType = "5">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "iSales-NPD/AppDelegate.m"
-            timestampString = "494838480.772555"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1048"
-            endingLineNumber = "1048"
-            landmarkName = "-check_offline:useInternalAddress:parentvc:"
-            landmarkType = "5">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
@@ -330,27 +314,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "iSales-NPD/AppDelegate.m"
-            timestampString = "494838480.772555"
+            timestampString = "494906718.503454"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1004"
-            endingLineNumber = "1004"
-            landmarkName = "-check_offline:useInternalAddress:parentvc:"
-            landmarkType = "5">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "iSales-NPD/AppDelegate.m"
-            timestampString = "494838480.772555"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "999"
-            endingLineNumber = "999"
+            startingLineNumber = "1001"
+            endingLineNumber = "1001"
             landmarkName = "-check_offline:useInternalAddress:parentvc:"
             landmarkType = "5">
          </BreakpointContent>
@@ -371,22 +339,6 @@
             landmarkType = "5">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "iSales-NPD/AppDelegate.m"
-            timestampString = "494838480.772555"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1007"
-            endingLineNumber = "1007"
-            landmarkName = "-check_offline:useInternalAddress:parentvc:"
-            landmarkType = "5">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent

+ 18 - 5
RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m

@@ -115,12 +115,25 @@
             if(haveofflineData)
             {
                 NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-                [defaults removeObjectForKey:@"EnableOfflineMode"];
-                [defaults setBool:self.checkOfflineMode.selected forKey:@"EnableOfflineMode"];
                 
-                [defaults synchronize];
-                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                appDelegate.offline_mode = self.checkOfflineMode.selected;
+                bool forcedownload = [defaults boolForKey:@"Forcedownload"];
+                
+                if(forcedownload)
+                {
+                    btn.selected = !btn.selected;
+                    
+                    [RAUtils alert_view:@"Detective incomplete sync, please finish sync first." title:@"Incomplete sync"];
+                }
+                else
+                {
+                    [defaults removeObjectForKey:@"EnableOfflineMode"];
+                    [defaults setBool:self.checkOfflineMode.selected forKey:@"EnableOfflineMode"];
+                    
+                    [defaults synchronize];
+                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+                    appDelegate.offline_mode = self.checkOfflineMode.selected;
+                }
+
             }
             else
             {

+ 42 - 32
RedAnt ERP Mobile/iSales-NPD/AppDelegate.m

@@ -860,7 +860,7 @@
                     
                     NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
                     [defaults removeObjectForKey:@"Forcedownload"];
-                    [defaults setValue:@"true" forKey:@"Forcedownload"];
+                    [defaults setBool:true forKey:@"Forcedownload"];
                     [defaults synchronize];
                     
                     [self download_offline:ver useInternalAddress:buseinternaladdress];
@@ -995,56 +995,66 @@
     
     
     
+    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+    bool forcedownload = [defaults boolForKey:@"Forcedownload"];
     
-    NSArray* arr_order=[OLDataProvider enumOfflineOrder];
-    if(arr_order.count>0)
+    if(forcedownload)
+        [self download_offline:ver useInternalAddress:buseinternaladdress];
+    else
     {
+        NSArray* arr_order=nil;
+        arr_order=[OLDataProvider enumOfflineOrder];
         
+        if(arr_order.count>0)
         {
-            SelectUploadOrderViewController * vc =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SelectUploadOrderViewController"];
-            vc.returnValue = ^(NSArray* SelectedOrder){
+            
+            {
+                SelectUploadOrderViewController * vc =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SelectUploadOrderViewController"];
+                vc.returnValue = ^(NSArray* SelectedOrder){
+                    
+                    [self upload_offline:ver useInternalAddress:buseinternaladdress orderid:SelectedOrder];
+                    SyncControlPanelViewController * syncVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SyncControlPanelViewController"];
+                    syncVC.action_string=@"Download";
+                    UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:syncVC] ;
+                    
+                    
+                    
+                    
+                    
+                    //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
+                    
+                    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+                    [parent presentViewController:navi animated:YES completion:^{
+                        
+                        //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
+                        
+                        NSLog(@"about present.........");
+                        
+                        //   self.btop = false;
+                        //  <#code#>
+                    }];
+                };
                 
-                [self upload_offline:ver useInternalAddress:buseinternaladdress orderid:SelectedOrder];
-                SyncControlPanelViewController * syncVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SyncControlPanelViewController"];
-                syncVC.action_string=@"Download";
-                UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:syncVC] ;
+                UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:vc] ;
                 
                 
                 
                 
                 
-                //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
                 
                 navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
                 [parent presentViewController:navi animated:YES completion:^{
                     
-                    //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
                     
-                    NSLog(@"about present.........");
-                    
-                    //   self.btop = false;
-                    //  <#code#>
                 }];
-            };
-            
-            UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:vc] ;
-            
-            
-            
-            
+            }
             
             
-            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
-            [parent presentViewController:navi animated:YES completion:^{
-                
-                
-            }];
         }
-        
+        else
+            [self upload_offline:ver useInternalAddress:buseinternaladdress orderid:nil];
         
     }
-    else
-        [self upload_offline:ver useInternalAddress:buseinternaladdress orderid:nil];
     
     
     
@@ -2372,8 +2382,8 @@
     
     //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     //    NSString* customer_email=    [appDelegate.customerInfo valueForKey:@"customer_email"];
-    //    
-    //    
+    //
+    //
     //    NSMutableArray* send_to = [[NSMutableArray alloc]init];
     //    if(customer_email.length>0)
     //    {

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

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15C50" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
     <dependencies>
         <deployment identifier="iOS"/>
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
@@ -89,7 +89,7 @@
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="jns-5C-X4w">
                                 <rect key="frame" x="616" y="115" width="132" height="30"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
-                                <state key="normal" title="Check update"/>
+                                <state key="normal" title="Sync"/>
                                 <connections>
                                     <action selector="OnCheckUpdate:" destination="FG7-WW-Z5X" eventType="touchUpInside" id="2zt-3T-WH7"/>
                                 </connections>
@@ -213,7 +213,7 @@
                                         <rect key="frame" x="0.0" y="28" width="768" height="44"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="XXr-fU-67o" id="Ohn-hG-mj9">
-                                            <rect key="frame" x="0.0" y="0.0" width="768" height="43"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="768" height="43.5"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="AIn-eK-sCn">