Jelajahi Sumber

1.修改iOS Apex & Drivers相机初始化失败的情况下卡顿。
2.完成iOS Apex & Drivers Update Order文件上传。

Pen Li 8 tahun lalu
induk
melakukan
ba0a0ef8da
29 mengubah file dengan 973 tambahan dan 259 penghapusan
  1. 54 0
      Redant Drivers/Apex And Drivers.xcodeproj/project.pbxproj
  2. 2 0
      Redant Drivers/Apex And Drivers/AppDelegate.h
  3. 52 6
      Redant Drivers/Apex And Drivers/AppDelegate.m
  4. 14 8
      Redant Drivers/Apex And Drivers/Camera/Camera.storyboard
  5. 25 2
      Redant Drivers/Apex And Drivers/Camera/RACameraViewController.m
  6. 6 193
      Redant Drivers/Apex And Drivers/Camera/RATakePhotoPreviewController.m
  7. 1 1
      Redant Drivers/Apex And Drivers/Detail/Model/Collection/RADetailActionModel.h
  8. 1 0
      Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController+TableViewDataSource.m
  9. 4 0
      Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController.m
  10. 45 0
      Redant Drivers/Apex And Drivers/FakeData/fake_order_edit.json
  11. 20 2
      Redant Drivers/Apex And Drivers/Home/RAHomeViewController.m
  12. 15 18
      Redant Drivers/Apex And Drivers/Info.plist
  13. 1 3
      Redant Drivers/Apex And Drivers/Login/Login.storyboard
  14. 2 0
      Redant Drivers/Apex And Drivers/PrefixHeader.pch
  15. 14 4
      Redant Drivers/Apex And Drivers/QRCode/RAQRCodeScannerViewController.m
  16. 6 0
      Redant Drivers/Apex And Drivers/RAProgressHUD.h
  17. 69 16
      Redant Drivers/Apex And Drivers/RAProgressHUD.m
  18. 18 0
      Redant Drivers/Apex And Drivers/RASingleton.h
  19. 24 0
      Redant Drivers/Apex And Drivers/RASingleton.m
  20. 1 0
      Redant Drivers/Apex And Drivers/Update/Model/RAEditBaseModel.h
  21. 1 1
      Redant Drivers/Apex And Drivers/Update/Model/RAEditPhotoModel.h
  22. 2 5
      Redant Drivers/Apex And Drivers/Update/Model/RAEditPhotoModel.m
  23. 1 0
      Redant Drivers/Apex And Drivers/Update/RAOrderEditViewController.h
  24. 164 0
      Redant Drivers/Apex And Drivers/Update/RAOrderEditViewController.m
  25. 22 0
      Redant Drivers/Apex And Drivers/Upload/ApexDriverUploadCell.h
  26. 98 0
      Redant Drivers/Apex And Drivers/Upload/ApexDriverUploadCell.m
  27. 15 0
      Redant Drivers/Apex And Drivers/Upload/ApexDriverUploadListVC.h
  28. 144 0
      Redant Drivers/Apex And Drivers/Upload/ApexDriverUploadListVC.m
  29. 152 0
      Redant Drivers/Apex And Drivers/Upload/Upload.storyboard

+ 54 - 0
Redant Drivers/Apex And Drivers.xcodeproj/project.pbxproj

@@ -61,6 +61,14 @@
 		4255EC9C20C5286D00E5DA24 /* RAEditMultInputModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4255EC9B20C5286D00E5DA24 /* RAEditMultInputModel.m */; };
 		4255EC9F20C5287D00E5DA24 /* RAEditPhotoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4255EC9E20C5287D00E5DA24 /* RAEditPhotoModel.m */; };
 		4255ECA120C5400400E5DA24 /* Barcode_h.png in Resources */ = {isa = PBXBuildFile; fileRef = 4255ECA020C5400300E5DA24 /* Barcode_h.png */; };
+		425B97CB20C7895F00B35713 /* RASingleton.m in Sources */ = {isa = PBXBuildFile; fileRef = 425B97CA20C7895F00B35713 /* RASingleton.m */; };
+		425B97D020C78ABE00B35713 /* RAUploadManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 425B97CE20C78ABE00B35713 /* RAUploadManager.m */; };
+		425B97D120C78ABE00B35713 /* RAUploadOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 425B97CF20C78ABE00B35713 /* RAUploadOperation.m */; };
+		425B97E220C7BC4A00B35713 /* RAUploadListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 425B97E120C7BC4A00B35713 /* RAUploadListViewController.m */; };
+		425B97E520C7BD3800B35713 /* UIView+Toast.m in Sources */ = {isa = PBXBuildFile; fileRef = 425B97E320C7BD3800B35713 /* UIView+Toast.m */; };
+		425B97E820C7BF4000B35713 /* ApexDriverUploadListVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 425B97E720C7BF4000B35713 /* ApexDriverUploadListVC.m */; };
+		425B97EA20C7BF4E00B35713 /* Upload.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 425B97E920C7BF4E00B35713 /* Upload.storyboard */; };
+		425B97ED20C7C35C00B35713 /* ApexDriverUploadCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 425B97EC20C7C35C00B35713 /* ApexDriverUploadCell.m */; };
 		4280034120C0F146004D4F50 /* AESCrypt.m in Sources */ = {isa = PBXBuildFile; fileRef = 4280033920C0F145004D4F50 /* AESCrypt.m */; };
 		4280034220C0F146004D4F50 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 4280033A20C0F145004D4F50 /* LICENSE */; };
 		4280034320C0F146004D4F50 /* NSData+Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 4280033C20C0F145004D4F50 /* NSData+Base64.m */; };
@@ -195,6 +203,21 @@
 		4255EC9D20C5287D00E5DA24 /* RAEditPhotoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RAEditPhotoModel.h; sourceTree = "<group>"; };
 		4255EC9E20C5287D00E5DA24 /* RAEditPhotoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RAEditPhotoModel.m; sourceTree = "<group>"; };
 		4255ECA020C5400300E5DA24 /* Barcode_h.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Barcode_h.png; sourceTree = "<group>"; };
+		425B97C920C7895F00B35713 /* RASingleton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RASingleton.h; sourceTree = "<group>"; };
+		425B97CA20C7895F00B35713 /* RASingleton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RASingleton.m; sourceTree = "<group>"; };
+		425B97CC20C78ABD00B35713 /* RAUploadOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAUploadOperation.h; path = ../../common/upload/RAUploadOperation.h; sourceTree = "<group>"; };
+		425B97CD20C78ABE00B35713 /* RAUploadManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAUploadManager.h; path = ../../common/upload/RAUploadManager.h; sourceTree = "<group>"; };
+		425B97CE20C78ABE00B35713 /* RAUploadManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAUploadManager.m; path = ../../common/upload/RAUploadManager.m; sourceTree = "<group>"; };
+		425B97CF20C78ABE00B35713 /* RAUploadOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAUploadOperation.m; path = ../../common/upload/RAUploadOperation.m; sourceTree = "<group>"; };
+		425B97E020C7BC4A00B35713 /* RAUploadListViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RAUploadListViewController.h; path = ../../../common/upload/RAUploadListViewController.h; sourceTree = "<group>"; };
+		425B97E120C7BC4A00B35713 /* RAUploadListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = RAUploadListViewController.m; path = ../../../common/upload/RAUploadListViewController.m; sourceTree = "<group>"; };
+		425B97E320C7BD3800B35713 /* UIView+Toast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIView+Toast.m"; path = "../../common/customUI/UIView+Toast.m"; sourceTree = "<group>"; };
+		425B97E420C7BD3800B35713 /* UIView+Toast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIView+Toast.h"; path = "../../common/customUI/UIView+Toast.h"; sourceTree = "<group>"; };
+		425B97E620C7BF4000B35713 /* ApexDriverUploadListVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApexDriverUploadListVC.h; sourceTree = "<group>"; };
+		425B97E720C7BF4000B35713 /* ApexDriverUploadListVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ApexDriverUploadListVC.m; sourceTree = "<group>"; };
+		425B97E920C7BF4E00B35713 /* Upload.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Upload.storyboard; sourceTree = "<group>"; };
+		425B97EB20C7C35C00B35713 /* ApexDriverUploadCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApexDriverUploadCell.h; sourceTree = "<group>"; };
+		425B97EC20C7C35C00B35713 /* ApexDriverUploadCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ApexDriverUploadCell.m; sourceTree = "<group>"; };
 		4280033520C0EE1E004D4F50 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = "<group>"; };
 		4280033620C0F0C6004D4F50 /* config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
 		4280033820C0F145004D4F50 /* AESCrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AESCrypt.h; sourceTree = "<group>"; };
@@ -366,6 +389,10 @@
 		42529D1E20C0E8C4000C0F4D /* Network */ = {
 			isa = PBXGroup;
 			children = (
+				425B97CD20C78ABE00B35713 /* RAUploadManager.h */,
+				425B97CE20C78ABE00B35713 /* RAUploadManager.m */,
+				425B97CC20C78ABD00B35713 /* RAUploadOperation.h */,
+				425B97CF20C78ABE00B35713 /* RAUploadOperation.m */,
 				42529D4120C0EB01000C0F4D /* RANetworkTaskDelegate.h */,
 				42529D4220C0EB01000C0F4D /* RANetworkTaskDelegate.m */,
 				42529D3E20C0EA59000C0F4D /* Reachability.h */,
@@ -408,6 +435,8 @@
 				424204F220C68E02005AEED9 /* RAProgressHUD.m */,
 				424204E820C6698A005AEED9 /* UIImage+fixOrientation.h */,
 				424204E920C6698A005AEED9 /* UIImage+fixOrientation.m */,
+				425B97E420C7BD3800B35713 /* UIView+Toast.h */,
+				425B97E320C7BD3800B35713 /* UIView+Toast.m */,
 			);
 			name = Utils;
 			sourceTree = "<group>";
@@ -488,6 +517,20 @@
 			path = Model;
 			sourceTree = "<group>";
 		};
+		425B97D220C7B7E100B35713 /* Upload */ = {
+			isa = PBXGroup;
+			children = (
+				425B97E020C7BC4A00B35713 /* RAUploadListViewController.h */,
+				425B97E120C7BC4A00B35713 /* RAUploadListViewController.m */,
+				425B97E620C7BF4000B35713 /* ApexDriverUploadListVC.h */,
+				425B97E720C7BF4000B35713 /* ApexDriverUploadListVC.m */,
+				425B97E920C7BF4E00B35713 /* Upload.storyboard */,
+				425B97EB20C7C35C00B35713 /* ApexDriverUploadCell.h */,
+				425B97EC20C7C35C00B35713 /* ApexDriverUploadCell.m */,
+			);
+			path = Upload;
+			sourceTree = "<group>";
+		};
 		4280033720C0F145004D4F50 /* AES */ = {
 			isa = PBXGroup;
 			children = (
@@ -642,6 +685,9 @@
 				424204D920C6150A005AEED9 /* QRCode */,
 				424204DF20C657EE005AEED9 /* Camera */,
 				424204EB20C66CFE005AEED9 /* PhotoPreView */,
+				425B97D220C7B7E100B35713 /* Upload */,
+				425B97C920C7895F00B35713 /* RASingleton.h */,
+				425B97CA20C7895F00B35713 /* RASingleton.m */,
 				71EAA33120B9571B002F003C /* AppDelegate.h */,
 				71EAA33220B9571B002F003C /* AppDelegate.m */,
 				4205FD5D20C134B400DB42B4 /* Other */,
@@ -726,6 +772,7 @@
 				424204DE20C6156E005AEED9 /* QRCode.storyboard in Resources */,
 				424204F020C66D2D005AEED9 /* PhotoPreview.storyboard in Resources */,
 				4280034220C0F146004D4F50 /* LICENSE in Resources */,
+				425B97EA20C7BF4E00B35713 /* Upload.storyboard in Resources */,
 				4255EC7620C5097200E5DA24 /* Edit.storyboard in Resources */,
 				4205FD6320C136F900DB42B4 /* Home.storyboard in Resources */,
 				4205FD4420C0F2C000DB42B4 /* Login.storyboard in Resources */,
@@ -749,8 +796,10 @@
 				42529D3B20C0EA3F000C0F4D /* unzip.c in Sources */,
 				4205FD4B20C0F4C400DB42B4 /* RetrievePasswordViewController.m in Sources */,
 				42529D4320C0EB01000C0F4D /* RANetworkTaskDelegate.m in Sources */,
+				425B97D120C78ABE00B35713 /* RAUploadOperation.m in Sources */,
 				4255EC7120C4E2EC00E5DA24 /* RADetailActionSelectionModel.m in Sources */,
 				42D8B8DE20C279BA001C125F /* RAOrderDetailViewController+TableViewDelegate.m in Sources */,
+				425B97E520C7BD3800B35713 /* UIView+Toast.m in Sources */,
 				42529D2B20C0EA0A000C0F4D /* RAUtils.m in Sources */,
 				4205FD6620C13BF400DB42B4 /* RAOrderCell.m in Sources */,
 				42529D2120C0E8EC000C0F4D /* NetworkUtils.m in Sources */,
@@ -777,9 +826,11 @@
 				4255EC6B20C4E28400E5DA24 /* RADetailActionSelectionViewController+TableDelegate.m in Sources */,
 				42529D3C20C0EA3F000C0F4D /* zip.c in Sources */,
 				42D8B8D220C267C7001C125F /* RADetailActionsLayout.m in Sources */,
+				425B97D020C78ABE00B35713 /* RAUploadManager.m in Sources */,
 				42D8B8B420C2463D001C125F /* RADetailLocationCell.m in Sources */,
 				42529D3A20C0EA3F000C0F4D /* mztools.c in Sources */,
 				4205FD5C20C1316200DB42B4 /* RABaseViewController.m in Sources */,
+				425B97E220C7BC4A00B35713 /* RAUploadListViewController.m in Sources */,
 				42D8B8B120C2462D001C125F /* RADetailMultLineCell.m in Sources */,
 				4280034120C0F146004D4F50 /* AESCrypt.m in Sources */,
 				42529D2520C0E97E000C0F4D /* RADataProvider.m in Sources */,
@@ -791,9 +842,11 @@
 				4205FD5420C0F50C00DB42B4 /* JLCustomerNavigationAlertController.m in Sources */,
 				42D8B8A820C23DD9001C125F /* RAOrderDetailViewController.m in Sources */,
 				42D8B8AE20C245D5001C125F /* RADetailSingleLineCell.m in Sources */,
+				425B97E820C7BF4000B35713 /* ApexDriverUploadListVC.m in Sources */,
 				4255EC6520C4E24500E5DA24 /* RADetailActionSelectionViewController.m in Sources */,
 				4255EC8A20C5211700E5DA24 /* RAEditMultInputCell.m in Sources */,
 				4255EC9620C5284C00E5DA24 /* RAEditLabelModel.m in Sources */,
+				425B97ED20C7C35C00B35713 /* ApexDriverUploadCell.m in Sources */,
 				42D8B8C220C24AA6001C125F /* RADetailMultLineModel.m in Sources */,
 				4255EC9920C5285C00E5DA24 /* RAEditInputModel.m in Sources */,
 				71EAA34120B95720002F003C /* main.m in Sources */,
@@ -808,6 +861,7 @@
 				4255EC9320C526FE00E5DA24 /* RAEditBaseModel.m in Sources */,
 				42529D3920C0EA3F000C0F4D /* ioapi.c in Sources */,
 				42D8B8B720C24656001C125F /* RADetailActionsCell.m in Sources */,
+				425B97CB20C7895F00B35713 /* RASingleton.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

+ 2 - 0
Redant Drivers/Apex And Drivers/AppDelegate.h

@@ -7,11 +7,13 @@
 //
 
 #import <UIKit/UIKit.h>
+#import "RAUploadManager.h"
 
 @interface AppDelegate : UIResponder <UIApplicationDelegate>
 
 @property (strong, nonatomic) UIWindow *window;
 
+@property (strong, nonatomic) RAUploadManager *uploadManager;
 
 @end
 

+ 52 - 6
Redant Drivers/Apex And Drivers/AppDelegate.m

@@ -18,6 +18,27 @@
 
 @implementation AppDelegate
 
+#pragma mark - Private
+
+- (void)showHomeVC {
+    
+    RAHomeViewController *homeVC = [RAHomeViewController viewControllerFromStoryboard];
+    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:homeVC];
+    self.window.rootViewController = nav;
+}
+
+- (void)saveUploadTasks {
+    
+    if(self.uploadManager.arr_queue!=nil)
+    {
+        
+        [self.uploadManager stopAllTasks];
+        [self.uploadManager saveTasks];
+    }
+}
+
+#pragma mark - AppDelegate
+
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     // Override point for customization after application launch.
     
@@ -54,13 +75,20 @@
     return YES;
 }
 
-- (void)showHomeVC {
+- (void)applicationDidBecomeActive:(UIApplication *)application {
     
-    RAHomeViewController *homeVC = [RAHomeViewController viewControllerFromStoryboard];
-    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:homeVC];
-    self.window.rootViewController = nav;
+    if (!self.uploadManager) {
+        self.uploadManager=[[RAUploadManager alloc] init];
+    }
 }
 
+- (void)applicationWillTerminate:(UIApplication *)application {
+    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+    [self saveUploadTasks];
+}
+
+#pragma mark - Notification
+
 //完成注册后收到devicetoken
 - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
     //上传deviceToken给后台服务器
@@ -69,18 +97,36 @@
     NSString *deviceTokenStr = [[[[deviceToken description] stringByReplacingOccurrencesOfString:@"<" withString:@""] stringByReplacingOccurrencesOfString:@">" withString:@""] stringByReplacingOccurrencesOfString:@" " withString:@""];
     NSLog(@"deviceTokenStr:\n%@",deviceTokenStr);
 }
+
 - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
     NSLog(@"注册推送失败:%@",error);
 }
+
 //处理通知
 - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
     
+    UNNotificationRequest *request = notification.request;
+    NSDictionary *userInfo = request.content.userInfo;
+    
+    if ([request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
+        NSLog(@"收到了一个远程推送:%@",userInfo);
+    }
+    else{
+        NSLog(@"收到了一个本地推送:%@",userInfo);
+    }
+    
+    completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
 }
+
 - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
     NSLog(@"接收到推送内容==%@", response.notification.request.content.userInfo);
+    
+    completionHandler();
 }
-- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
 
-    NSLog(@"收到静默推送");
+- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
+
+    NSLog(@"收到静默推送: %@",userInfo);
+    completionHandler(UIBackgroundFetchResultNewData);
 }
 @end

+ 14 - 8
Redant Drivers/Apex And Drivers/Camera/Camera.storyboard

@@ -76,13 +76,23 @@
                         <subviews>
                             <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" maximumZoomScale="4" translatesAutoresizingMaskIntoConstraints="NO" id="w4v-z1-b7B">
                                 <rect key="frame" x="0.0" y="20" width="375" height="647"/>
+                                <subviews>
+                                    <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Z0q-fB-hKK">
+                                        <rect key="frame" x="0.0" y="0.0" width="375" height="647"/>
+                                    </imageView>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstAttribute="trailing" secondItem="Z0q-fB-hKK" secondAttribute="trailing" id="1DV-S9-kNZ"/>
+                                    <constraint firstItem="Z0q-fB-hKK" firstAttribute="leading" secondItem="w4v-z1-b7B" secondAttribute="leading" id="3vl-RG-C7S"/>
+                                    <constraint firstItem="Z0q-fB-hKK" firstAttribute="top" secondItem="w4v-z1-b7B" secondAttribute="top" id="U6T-ty-Pya"/>
+                                    <constraint firstItem="Z0q-fB-hKK" firstAttribute="height" secondItem="w4v-z1-b7B" secondAttribute="height" id="Vy1-Qy-KOG"/>
+                                    <constraint firstAttribute="bottom" secondItem="Z0q-fB-hKK" secondAttribute="bottom" id="iA1-6c-bee"/>
+                                    <constraint firstItem="Z0q-fB-hKK" firstAttribute="width" secondItem="w4v-z1-b7B" secondAttribute="width" id="mYI-88-f5w"/>
+                                </constraints>
                                 <connections>
                                     <outlet property="delegate" destination="hfm-f2-DNT" id="0Kg-98-liP"/>
                                 </connections>
                             </scrollView>
-                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Xpx-fL-Mis">
-                                <rect key="frame" x="1" y="110" width="373" height="395"/>
-                            </view>
                             <view alpha="0.44999998807907104" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WfP-Fk-mo9">
                                 <rect key="frame" x="0.0" y="605" width="375" height="62"/>
                                 <subviews>
@@ -117,12 +127,8 @@
                         <constraints>
                             <constraint firstItem="1aO-Vd-AQh" firstAttribute="top" secondItem="WfP-Fk-mo9" secondAttribute="bottom" id="18i-Al-Ypd"/>
                             <constraint firstItem="WfP-Fk-mo9" firstAttribute="leading" secondItem="khP-jm-wId" secondAttribute="leading" id="MSv-jh-Kws"/>
-                            <constraint firstItem="Xpx-fL-Mis" firstAttribute="leading" secondItem="khP-jm-wId" secondAttribute="leading" constant="1" id="PGU-Bl-cae"/>
                             <constraint firstItem="1aO-Vd-AQh" firstAttribute="top" secondItem="w4v-z1-b7B" secondAttribute="bottom" id="ZV0-ao-dGH"/>
-                            <constraint firstItem="Xpx-fL-Mis" firstAttribute="top" secondItem="JtE-cJ-OW0" secondAttribute="bottom" constant="90" id="a6t-MS-egk"/>
-                            <constraint firstAttribute="trailing" secondItem="Xpx-fL-Mis" secondAttribute="trailing" constant="1" id="an8-dn-WXn"/>
                             <constraint firstItem="w4v-z1-b7B" firstAttribute="leading" secondItem="khP-jm-wId" secondAttribute="leading" id="eWS-j0-eyB"/>
-                            <constraint firstItem="WfP-Fk-mo9" firstAttribute="top" secondItem="Xpx-fL-Mis" secondAttribute="bottom" constant="100" id="oIh-uh-DBC"/>
                             <constraint firstAttribute="trailing" secondItem="w4v-z1-b7B" secondAttribute="trailing" id="qYR-pg-xfY"/>
                             <constraint firstItem="w4v-z1-b7B" firstAttribute="top" secondItem="JtE-cJ-OW0" secondAttribute="bottom" id="vBb-3e-ld9"/>
                             <constraint firstAttribute="trailing" secondItem="WfP-Fk-mo9" secondAttribute="trailing" id="wKB-RK-2W0"/>
@@ -133,7 +139,7 @@
                     <nil key="simulatedTopBarMetrics"/>
                     <nil key="simulatedBottomBarMetrics"/>
                     <connections>
-                        <outlet property="editContainer" destination="Xpx-fL-Mis" id="el8-Dl-ZdA"/>
+                        <outlet property="previewPhotoView" destination="Z0q-fB-hKK" id="CuC-M7-vFP"/>
                         <outlet property="previewScroll" destination="w4v-z1-b7B" id="mvQ-nK-wZW"/>
                         <outlet property="retakeBtn" destination="XlI-8n-qRu" id="Og5-TY-dJU"/>
                         <outlet property="toolBarView" destination="WfP-Fk-mo9" id="sdI-yW-TCC"/>

+ 25 - 2
Redant Drivers/Apex And Drivers/Camera/RACameraViewController.m

@@ -23,6 +23,8 @@
 @property (nonatomic,strong) AVCaptureStillImageOutput *captureOutput;
 @property (nonatomic,strong) AVCaptureVideoPreviewLayer *previewLayer;
 
+@property (nonatomic,assign) BOOL cameraInitial;
+
 @end
 
 @implementation RACameraViewController
@@ -48,7 +50,9 @@
 - (void)viewWillAppear:(BOOL)animated {
     [super viewWillAppear:animated];
     
-    [self.captureSession startRunning];
+    if (self.cameraInitial) {
+        [self.captureSession startRunning];
+    }
 }
 
 - (void)viewWillDisappear:(BOOL)animated {
@@ -69,16 +73,24 @@
 
 - (void)initCapture {
     
+    self.cameraInitial = NO;
+    
     self.captureSession = [[AVCaptureSession alloc] init];
     
     self.captureDevice = [self videoDevicePosition:AVCaptureDevicePositionBack];
     if (!self.captureDevice) {
+        NSLog(@"there is no capture device while init camera");
         return;
     }
     
     NSError *error;
     self.captureInput = [[AVCaptureDeviceInput alloc] initWithDevice:self.captureDevice error:&error];
     
+    if (error) {
+        NSLog(@"init camera error: %@",error);
+        return;
+    }
+    
     [self.captureSession beginConfiguration];
     
     if ([_captureSession canSetSessionPreset:AVCaptureSessionPresetHigh]) {
@@ -98,6 +110,9 @@
 //            }
 //        }
         
+    } else {
+        NSLog(@"init camera can't add input");
+        return;
     }
     
     [self.captureSession commitConfiguration];
@@ -105,10 +120,14 @@
     self.previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:self.captureSession];
     self.previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
     [self.previewContainer.layer addSublayer:self.previewLayer];
+    
+    self.cameraInitial = YES;
 }
 
 - (void)initTakePicture {
-    
+    if (!self.cameraInitial) {
+        return;
+    }
     self.captureOutput = [[AVCaptureStillImageOutput alloc] init];
     AVCaptureConnection *connection = [self.captureOutput connectionWithMediaType:AVMediaTypeVideo];
     if (connection.supportsVideoOrientation) {
@@ -169,6 +188,10 @@
 
 - (IBAction)takePictureBtnClick:(UIButton *)sender {
     
+    if (!self.cameraInitial) {
+        return;
+    }
+    
     AVCaptureConnection *connection = [self.captureOutput connectionWithMediaType:AVMediaTypeVideo];
     [self.captureOutput captureStillImageAsynchronouslyFromConnection:connection completionHandler:^(CMSampleBufferRef  _Nullable imageDataSampleBuffer, NSError * _Nullable error) {
         

+ 6 - 193
Redant Drivers/Apex And Drivers/Camera/RATakePhotoPreviewController.m

@@ -13,13 +13,11 @@
 @interface RATakePhotoPreviewController ()<UIScrollViewDelegate>
 
 @property (strong, nonatomic) IBOutlet UIScrollView *previewScroll;
-@property (strong, nonatomic) IBOutlet UIView *editContainer;
+@property (strong, nonatomic) IBOutlet UIImageView *previewPhotoView;
 @property (strong, nonatomic) IBOutlet UIButton *retakeBtn;
 @property (strong, nonatomic) IBOutlet UIButton *usePhotoBtn;
 @property (strong, nonatomic) IBOutlet UIView *toolBarView;
 
-@property (nonatomic,strong) UIImageView *imgView;
-
 @end
 
 @implementation RATakePhotoPreviewController
@@ -32,32 +30,13 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
-    [self.view insertSubview:[UIView new] atIndex:0];
-    
-    self.editContainer.layer.borderColor = [UIColor lightGrayColor].CGColor;
-    self.editContainer.layer.borderWidth = 0.5f;
-    self.editContainer.userInteractionEnabled = NO;
-//    UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(imageViewPinch:)];
-//    [self.editContainer addGestureRecognizer:pinch];
     
-    
-    [self.previewScroll addSubview:self.imgView];
+    [self.view insertSubview:[UIView new] atIndex:0];
+    self.previewPhotoView.image = self.preImage;
 }
+
 - (void)setPreImage:(UIImage *)preImage {
     _preImage = [preImage fixOrientation];
-    //    self.nameLabel.text = name;
-}
-- (void)viewDidLayoutSubviews {
-    [super viewDidLayoutSubviews];
-    
-    CGSize size = [self imgViewOriginSize];
-    
-    CGRect frame = CGRectMake(0, 70, size.width, size.height); // 水平居中
-    
-    if (frame.size.height < CGRectGetHeight(self.editContainer.frame)) { // 横屏拍照时,照片在编辑框垂直居中
-        frame.origin.y = CGRectGetMinY(self.editContainer.frame) + (CGRectGetHeight(self.editContainer.frame) - CGRectGetHeight(frame)) * 0.5;
-    }
-    self.imgView.frame = frame;
 }
 
 - (BOOL)prefersStatusBarHidden {
@@ -69,60 +48,6 @@
     // Dispose of any resources that can be recreated.
 }
 
-- (CGSize)imgViewOriginSize {
-    CGFloat width = CGRectGetWidth(self.previewScroll.bounds);
-    CGFloat height = CGRectGetHeight(self.previewScroll.bounds);
-    CGFloat w = self.preImage.size.width;
-    CGFloat h = self.preImage.size.height;
-    // 根据图片大小和ScrollView大小等比缩放,使ScrollView容得下图片
-    float factor = MAX(w / width, h / height);
-    factor = 1 / factor;
-    
-    CGSize size = CGSizeMake(w * factor, h * factor);
-    return size;
-}
-
-- (UIImageView *)imgView {
-    if (!_imgView) {
-        _imgView = [[UIImageView alloc] initWithImage:self.preImage];
-        _imgView.userInteractionEnabled = YES;
-        
-    }
-    return _imgView;
-}
-
-- (UIImage *)captureImageInView:(UIView *)view {
-    UIImage *img = nil;
-    
-//    UIGraphicsBeginImageContext(view.frame.size);
-    UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, 0.0);
-    if ([view respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) {
-        [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
-    } else {
-        [view.layer renderInContext:UIGraphicsGetCurrentContext()];
-    }
-    img = UIGraphicsGetImageFromCurrentImageContext();
-    UIGraphicsEndImageContext();
-    
-    return img;
-}
-
-- (UIImage *)captureImageWithImage:(UIImage *)image inRect:(CGRect)rect {
-    
-    CGFloat scale = image.scale;
-    rect.origin.x *= scale;
-    rect.origin.y *= scale;
-    rect.size.height *= scale;
-    rect.size.width *= scale;
-    CGImageRef imgRef = CGImageCreateWithImageInRect(image.CGImage, rect);
-    UIImage *img = [UIImage imageWithCGImage:imgRef scale:0 orientation:image.imageOrientation];
-    CGImageRelease(imgRef);
-    return img;
-    
-    
-    
-}
-
 - (IBAction)retakeBtnClick:(UIButton *)sender {
     if (self.photoHandler) {
         self.photoHandler(nil);
@@ -133,22 +58,7 @@
 - (IBAction)usePhotoClick:(UIButton *)sender {
     
     if (self.photoHandler) {
-        
-        CGRect imgRect = self.imgView.frame;
-        CGRect editRect = self.editContainer.frame;
-        CGPoint contentOffset = self.previewScroll.contentOffset;
-        CGRect clipRect = CGRectMake(editRect.origin.x + 1 + contentOffset.x, editRect.origin.y + 1 + contentOffset.y - imgRect.origin.y, editRect.size.width - 2, editRect.size.height -2);
-        
-        CGFloat xp = clipRect.origin.x / imgRect.size.width;
-        CGFloat yp = clipRect.origin.y / imgRect.size.height;
-        CGFloat wp = clipRect.size.width / imgRect.size.width;
-        CGFloat hp = clipRect.size.height / imgRect.size.height;
-        
-        CGSize size = self.preImage.size;
-        CGRect clipImgRect = CGRectMake(size.width * xp, size.height * yp, size.width * wp, size.height * hp);
-        
-        UIImage *img = [self captureImageWithImage:self.preImage inRect:clipImgRect];
-        self.photoHandler(img);
+        self.photoHandler(self.preImage);
     }
     if (self.popTo) {
         [self.navigationController popToViewController:self.popTo animated:YES];
@@ -158,110 +68,13 @@
     
 }
 
-//-(void) testimg
-//{
-//    UIImageOrientation o =self.preImage.imageOrientation;
-//    
-//    CGRect imgviewRect = self.imgView.frame;
-//    CGRect editRect = self.editContainer.frame;
-//    CGPoint offset= self.previewScroll.contentOffset;
-//    
-//    double sscale=self.previewScroll.zoomScale;
-//    CGSize contentsize=self.previewScroll.contentSize;
-//    
-//    CGRect imgScreenRect = CGRectMake(imgviewRect.origin.x-offset.x, imgviewRect.origin.y-offset.y, imgviewRect.size.width, imgviewRect.size.height);
-//    
-//    double scale = imgScreenRect.size.width/self.preImage.size.width;//1;//self.previewScroll.zoomScale*(imgviewRect.size.width/self.preImage.size.width);
-//    CGRect rectimg = CGRectMake((editRect.origin.x-imgScreenRect.origin.x)/scale, (editRect.origin.y-imgScreenRect.origin.y)/scale, editRect.size.width/scale, editRect.size.height/scale);
-////    UIImage * newimg=[UIImage imageWithCGImage:self.preImage.CGImage scale:1 orientation:UIImageOrientationUp];
-//    UIImage * img= [self captureImageWithImage:self.preImage inRect:rectimg];//
-//    UIImage* img1 =[self getSubImage:rectimg img:self.preImage];
-//    return;
-//}
-//
-//
-//-(UIImage*)getSubImage:(CGRect)rect img:(UIImage*)img
-//{
-//    
-//    //将UIImage转换成CGImageRef
-//    CGImageRef sourceImageRef = [img CGImage];
-//    
-//    //按照给定的矩形区域进行剪裁
-//    CGImageRef newImageRef = CGImageCreateWithImageInRect(sourceImageRef, rect);
-//    
-//    //将CGImageRef转换成UIImage
-//    UIImage *newImage = [UIImage imageWithCGImage:newImageRef];
-//    
-//    //返回剪裁后的图片
-//    return newImage;
-//    
-//    
-//    CGImageRef subImageRef = CGImageCreateWithImageInRect(img.CGImage, rect);
-//    UIImage* debugimg = [UIImage imageWithCGImage:subImageRef];
-//    CGRect smallBounds = CGRectMake(0, 0, CGImageGetWidth(subImageRef), CGImageGetHeight(subImageRef));
-//    
-//    UIGraphicsBeginImageContext(smallBounds.size);
-//    CGContextRef context = UIGraphicsGetCurrentContext();
-//    CGContextDrawImage(context, smallBounds, subImageRef);
-//    UIImage* smallImage = [UIImage imageWithCGImage:subImageRef];
-//    UIGraphicsEndImageContext();
-//    
-//    return smallImage;
-//}
 #pragma mark - UIScrollViewDelegate
 
 - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
-    return self.imgView;
+    return self.previewPhotoView;
 }
 
-- (void)scrollViewDidZoom:(UIScrollView *)scrollView {
-    
-    CGRect imgRect = self.imgView.frame;
-    CGSize contentSize = scrollView.contentSize;
-    contentSize.height += imgRect.origin.y;
-    scrollView.contentSize = contentSize;
-}
 
-//#pragma mark - pinch
-//
-//- (void)imageViewPinch:(UIPinchGestureRecognizer *)pinch{
-//    
-//    UIScrollView *scroll = self.previewScroll;
-//    UIImageView *imgv = [scroll.subviews firstObject];
-//    
-//    CGFloat width = scroll.frame.size.width;
-//    CGFloat height = scroll.frame.size.height;
-//    
-//    imgv.transform = CGAffineTransformScale(imgv.transform, pinch.scale, pinch.scale);
-//    CGSize size = scroll.contentSize;
-//    //    size.width = size.width * pinch.scale;
-//    //    size.height = size.height * pinch.scale;
-//    size = imgv.frame.size;// bounds 和 frame 不一致
-//    CGSize itemSize = self.editContainer.frame.size;
-//    DebugLog(@"size %@",[NSValue valueWithCGSize:size]);
-//    if (size.height < itemSize.height || size.width < itemSize.width) { // 禁止缩小得比原图小
-//        imgv.transform = CGAffineTransformIdentity;
-//        size = imgv.frame.size;
-//    }
-//    
-//    
-////    if (size.width < width) {
-////        size.width = width;
-////    }
-////    if (size.height < height) {
-////        size.height = height;
-////    }
-//    
-//    scroll.contentSize = size;
-//    scroll.contentOffset = CGPointMake((size.width - width) * 0.5, (size.height - height) * 0.5);
-//    // 保持在屏幕中心
-//    CGPoint offset = scroll.contentOffset;
-//    CGFloat x = offset.x + width * 0.5;
-//    CGFloat y = offset.y + height * 0.5;
-//    imgv.center = CGPointMake(x, y);
-//    
-//    pinch.scale = 1;
-//}
 
 
 

+ 1 - 1
Redant Drivers/Apex And Drivers/Detail/Model/Collection/RADetailActionModel.h

@@ -24,6 +24,6 @@ typedef enum {
 @property (nonatomic,assign) RADetailActionSubType actionSubType;
 @property (nonatomic,copy) NSString *actionTitle;
 
-@property (nonatomic,strong,readonly) NSArray <RADetailActionSelectionModel *> *enums;
+@property (nonatomic,strong,readonly) NSArray <RADetailActionSelectionModel *> *enums;///< actionSubType == RADetailActionSubTypeEnum
 
 @end

+ 1 - 0
Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController+TableViewDataSource.m

@@ -188,6 +188,7 @@
     vc.title = model.detailActionTitle;
     vc.orderID = self.orderID;
     vc.actionID = model.actionID;
+    vc.actionTitle = model.actionTitle;
     [self.navigationController pushViewController:vc animated:YES];
 
 }

+ 4 - 0
Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController.m

@@ -13,6 +13,8 @@
 #import "RADetailLocationModel.h"
 #import "RADetailActionCollectionModel.h"
 
+#import "RAProgressHUD.h"
+
 @interface RAOrderDetailSectionModel : NSObject
 
 @property (nonatomic,strong) NSArray <RADetailBaseModel *> *values;
@@ -129,6 +131,7 @@
 - (void)loadData {
     
     // show progress
+    RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
     
     __weak typeof(self) weakSelf = self;
     
@@ -139,6 +142,7 @@
         dispatch_async(dispatch_get_main_queue(), ^{
             
             // dismiss progress
+            [hud dismiss];
             
             if (weakSelf) {
                 __strong typeof(weakSelf) strongSelf = weakSelf;

+ 45 - 0
Redant Drivers/Apex And Drivers/FakeData/fake_order_edit.json

@@ -22,22 +22,67 @@
                            {
                            "type": 1,
                            "title": "File No.",
+                           "key": "file_no_0",
                            "value": "AFS20180530001200",
                            "scannable": true
                            },
                            {
                            "type": 1,
                            "title": "File No.",
+                           "key": "file_no_1",
                            "value": "AFS20180530001200",
                            "scannable": false
                            },
                            {
                            "type": 2,
+                           "key": "instruction_0",
                            "title": "Instruction",
                            "value": "不同于一般的 bug,性能问题因为并没有统一的标准,而且与用户的机器环境相关性较大,所以往往是在产品上线后才被发现,也导致解决问题的周期很长。微信读书 1.3.0 版本之前,性能问题基本都来自于用户反馈(包括测试人员),受限于测试时间和用户反馈的积极性,性能问题往往到了比较严重的程度,开发人员才真正发现问题。\n\n但是,移动应用要保证良好的用户体验,产品在性能方面的表现极其重要。为了尽可能早、尽可能全面地收集产品的性能问题,就避免不了对产品做性能监控。我们主要从两个维度进行了监控"
                            },
                            {
                            "type": 3,
+                           "key": "container_photo_0",
+                           "title": "Container Photo",
+                           "path": "photoPath"
+                           },
+                           {
+                           "type": 0,
+                           "title": "Order ID",
+                           "value": "AFS20180530001200"
+                           },
+                           {
+                           "type": 0,
+                           "title": "Dispatcher",
+                           "value": "Jack Li"
+                           },
+                           {
+                           "type": 0,
+                           "title": "Current Action",
+                           "value": "Delivered"
+                           },
+                           {
+                           "type": 1,
+                           "title": "File No.",
+                           "key": "file_no_2",
+                           "value": "AFS20180530001200",
+                           "scannable": true
+                           },
+                           {
+                           "type": 1,
+                           "title": "File No.",
+                           "key": "file_no_3",
+                           "value": "AFS20180530001200",
+                           "scannable": false
+                           },
+                           {
+                           "type": 2,
+                           "title": "Instruction",
+                           "key": "instruction_1",
+                           "value": "不同于一般的 bug,性能问题因为并没有统一的标准,而且与用户的机器环境相关性较大,所以往往是在产品上线后才被发现,也导致解决问题的周期很长。微信读书 1.3.0 版本之前,性能问题基本都来自于用户反馈(包括测试人员),受限于测试时间和用户反馈的积极性,性能问题往往到了比较严重的程度,开发人员才真正发现问题。\n\n但是,移动应用要保证良好的用户体验,产品在性能方面的表现极其重要。为了尽可能早、尽可能全面地收集产品的性能问题,就避免不了对产品做性能监控。我们主要从两个维度进行了监控"
+                           },
+                           {
+                           "type": 3,
+                           "key": "container_photo_1",
                            "title": "Container Photo",
                            "path": "photoPath"
                            }

+ 20 - 2
Redant Drivers/Apex And Drivers/Home/RAHomeViewController.m

@@ -10,6 +10,7 @@
 #import "RAHomeOrderModel.h"
 #import "RAOrderDetailViewController.h"
 #import "RAProgressHUD.h"
+#import "ApexDriverUploadListVC.h"
 
 @interface RAHomeSectionModel : NSObject
 
@@ -62,6 +63,7 @@
     [super viewDidLoad];
     // Do any additional setup after loading the view.
     
+    [self configureNavigationBar];
     [self configureTable];
     [self loadData];
 }
@@ -71,13 +73,28 @@
     // Dispose of any resources that can be recreated.
 }
 
+#pragma mark - Configure
+
 - (void)configureTable {
     
     self.homeOrderTableView.tableFooterView = [UIView new];
     self.homeOrderTableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
 }
 
-#pragma mark Getter
+- (void)configureNavigationBar {
+    UIBarButtonItem *uploadListItem = [[UIBarButtonItem alloc] initWithTitle:@"Upload List" style:UIBarButtonItemStylePlain target:self action:@selector(uploadListItemClick:)];
+    self.navigationItem.rightBarButtonItem = uploadListItem;
+}
+
+#pragma mark - Action
+
+- (void)uploadListItemClick:(UIBarButtonItem *)sender {
+    
+    ApexDriverUploadListVC *vc = [ApexDriverUploadListVC viewControllerFromStoryboard];
+    [self.navigationController pushViewController:vc animated:YES];
+}
+
+#pragma mark - Getter
 
 - (NSMutableArray *)sectionArray {
     if (!_sectionArray) {
@@ -111,7 +128,7 @@
 - (void)loadData {
     
     // show progress
-//    RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
+    RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
     
     __weak typeof(self) weakSelf = self;
     dispatch_async(dispatch_get_global_queue(0, 0), ^{
@@ -121,6 +138,7 @@
         dispatch_async(dispatch_get_main_queue(), ^{
             
             // dismiss progress
+            [hud dismiss];
             
             if (weakSelf) {
                 __strong typeof(weakSelf) strongSelf = weakSelf;

+ 15 - 18
Redant Drivers/Apex And Drivers/Info.plist

@@ -18,10 +18,25 @@
 	<string>1.0</string>
 	<key>CFBundleVersion</key>
 	<string>1</string>
+	<key>LSApplicationQueriesSchemes</key>
+	<array>
+		<string>comgooglemaps</string>
+	</array>
 	<key>LSRequiresIPhoneOS</key>
 	<true/>
+	<key>NSCameraUsageDescription</key>
+	<string>need use camera</string>
+	<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
+	<string>tracking deliver status</string>
+	<key>NSLocationAlwaysUsageDescription</key>
+	<string>tracking deliver status</string>
+	<key>NSLocationUsageDescription</key>
+	<string>show loaction on map </string>
+	<key>NSLocationWhenInUseUsageDescription</key>
+	<string>tracking deliver status</string>
 	<key>UIBackgroundModes</key>
 	<array>
+		<string>location</string>
 		<string>remote-notification</string>
 	</array>
 	<key>UILaunchStoryboardName</key>
@@ -41,23 +56,5 @@
 		<string>UIInterfaceOrientationLandscapeLeft</string>
 		<string>UIInterfaceOrientationLandscapeRight</string>
 	</array>
-	<key>LSApplicationQueriesSchemes</key>
-	<array>
-		<string>comgooglemaps</string>
-	</array>
-	<key>NSCameraUsageDescription</key>
-	<string>need use camera</string>
-    <key>NSLocationWhenInUseUsageDescription</key>
-    <string>tracking deliver status</string>
-    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
-    <string>tracking deliver status</string>
-    <key>NSLocationAlwaysUsageDescription</key>
-    <string>tracking deliver status</string>
-    <key>NSLocationUsageDescription</key>
-    <string>show loaction on map </string>
-    <key>UIBackgroundModes</key>
-    <array>
-        <string>location</string>
-    </array>
 </dict>
 </plist>

+ 1 - 3
Redant Drivers/Apex And Drivers/Login/Login.storyboard

@@ -121,10 +121,9 @@
                         </constraints>
                         <viewLayoutGuide key="safeArea" id="eN5-fH-f6F"/>
                     </view>
-                    <tabBarItem key="tabBarItem" title="Login" image="tab_login" id="7cB-CR-vqD"/>
                     <simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
                     <nil key="simulatedTopBarMetrics"/>
-                    <simulatedTabBarMetrics key="simulatedBottomBarMetrics"/>
+                    <nil key="simulatedBottomBarMetrics"/>
                     <connections>
                         <outlet property="btnRetrievePassword" destination="4nB-rd-0CZ" id="W8b-Z2-ap1"/>
                         <outlet property="checkSavePassword" destination="vy2-V9-9ML" id="TPX-Vp-7eD"/>
@@ -236,7 +235,6 @@
     </scenes>
     <resources>
         <image name="apexlogo-1" width="16" height="16"/>
-        <image name="tab_login" width="16" height="16"/>
         <image name="unchecked_32" width="16" height="16"/>
     </resources>
 </document>

+ 2 - 0
Redant Drivers/Apex And Drivers/PrefixHeader.pch

@@ -18,6 +18,8 @@
 #import "config.h"
 #import "AESCrypt.h"
 #import "RADataProvider.h"
+#import "RASingleton.h"
+#import "RAUtils.h"
 
 
 #endif

+ 14 - 4
Redant Drivers/Apex And Drivers/QRCode/RAQRCodeScannerViewController.m

@@ -21,6 +21,8 @@
 @property (nonatomic,strong) AVCaptureVideoPreviewLayer *previewLayer;
 
 @property (nonatomic,assign) BOOL scannerEnable;
+@property (nonatomic,assign) BOOL scannerInitial;
+
 @property (nonatomic,strong) CAGradientLayer *scanLineLayer;
 
 @end
@@ -68,13 +70,17 @@
 - (void)viewDidAppear:(BOOL)animated {
     [super viewDidAppear:animated];
     
-    [self.session startRunning];
+    if (self.scannerInitial) {
+        [self.session startRunning];
+    }
 }
 
 - (void)viewWillDisappear:(BOOL)animated {
     [super viewWillDisappear:animated];
     
-    [self.session stopRunning];
+    if ([self.session isRunning]) {
+        [self.session stopRunning];
+    }
 }
 
 - (void)didReceiveMemoryWarning {
@@ -101,14 +107,15 @@
 #pragma mark - Init
 
 - (void)initCapture {
-        
+    
+    self.scannerInitial = NO;
     self.device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
     
     NSError *inputError;
     self.input = [AVCaptureDeviceInput deviceInputWithDevice:self.device error:&inputError];
     
     if (inputError) {
-     
+        NSLog(@"init scanner input error: %@",inputError);
         return;
     }
     
@@ -117,6 +124,7 @@
     if ([self.session canAddInput:self.input]) {
         [self.session addInput:self.input];
     } else {
+        NSLog(@"init scanner can't add input");
         return;
     }
     
@@ -126,6 +134,7 @@
     if ([self.session canAddOutput:self.output]) {
         [self.session addOutput:self.output];
     } else {
+        NSLog(@"init scanner can't add output");
         return;
     }
     self.output.metadataObjectTypes = @[
@@ -144,6 +153,7 @@
     self.previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
     [self.previewContainer.layer addSublayer:self.previewLayer];
     
+    self.scannerInitial = YES;
 }
 
 #pragma mark - AVCaptureMetadataOutputObjectsDelegate

+ 6 - 0
Redant Drivers/Apex And Drivers/RAProgressHUD.h

@@ -10,8 +10,14 @@
 
 @interface RAProgressHUD : UIView
 
+@property (nonatomic,copy) NSString *title;
+
 + (instancetype)showHUDOnView:(UIView *)view;
 
++ (instancetype)showHUDOnView:(UIView *)view withTitle:(NSString *)title;
+
 - (void)dismiss;
 
+- (void)dismiss:(void(^)(void))completion;
+
 @end

+ 69 - 16
Redant Drivers/Apex And Drivers/RAProgressHUD.m

@@ -8,21 +8,33 @@
 
 #import "RAProgressHUD.h"
 
+static const CGFloat HUDSIZE = 100.0f;
+
+@interface RAProgressHUD ()
+
+@property (nonatomic,strong) CAGradientLayer *gradientLayer;
+@property (nonatomic,strong) CAShapeLayer *progressLayer;
+
+@property (nonatomic,strong) UIActivityIndicatorView *activityIndicator;
+@property (nonatomic,strong) UILabel *indicatorLabel;
+
+@end
+
 @implementation RAProgressHUD
 
 + (instancetype)showHUDOnView:(UIView *)view {
     
+    return [self showHUDOnView:view withTitle:@"loading..."];
+}
+
++ (instancetype)showHUDOnView:(UIView *)view withTitle:(NSString *)title {
+    
     if (!view) {
         return nil;
     }
     
     RAProgressHUD *hud = [[RAProgressHUD alloc] init];
-    CGFloat viewWidth = CGRectGetWidth(view.bounds);
-    CGFloat viewHeight = CGRectGetHeight(view.bounds);
-    
-//    CGRect frame = CGRectMake((viewWidth - 100) * 0.5, (viewHeight - 100) * 0.5, 100, 100);
-//    hud.frame = frame;
-    hud.backgroundColor = [UIColor lightGrayColor];
+    hud.backgroundColor = [UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.8];
     hud.layer.cornerRadius = 5.0f;
     hud.layer.masksToBounds = YES;
     [view addSubview:hud];
@@ -45,26 +57,67 @@
                                                                multiplier:1
                                                                  constant:0];
     NSLayoutConstraint *width = [NSLayoutConstraint constraintWithItem:hud
-                                                                attribute:NSLayoutAttributeWidth
-                                                                relatedBy:NSLayoutRelationEqual
-                                                                   toItem:nil
-                                                                attribute:NSLayoutAttributeNotAnAttribute
-                                                               multiplier:0
-                                                                 constant:100];
-    NSLayoutConstraint *height = [NSLayoutConstraint constraintWithItem:hud
-                                                             attribute:NSLayoutAttributeHeight
+                                                             attribute:NSLayoutAttributeWidth
                                                              relatedBy:NSLayoutRelationEqual
                                                                 toItem:nil
                                                              attribute:NSLayoutAttributeNotAnAttribute
                                                             multiplier:0
-                                                              constant:100];
+                                                              constant:HUDSIZE];
+    NSLayoutConstraint *height = [NSLayoutConstraint constraintWithItem:hud
+                                                              attribute:NSLayoutAttributeHeight
+                                                              relatedBy:NSLayoutRelationEqual
+                                                                 toItem:nil
+                                                              attribute:NSLayoutAttributeNotAnAttribute
+                                                             multiplier:0
+                                                               constant:HUDSIZE];
     [view addConstraints:@[h_center,v_center,width,height]];
     
+    hud.indicatorLabel.frame = CGRectMake(0, 70, HUDSIZE, 20);
+    [hud addSubview:hud.indicatorLabel];
+    
+    hud.activityIndicator.frame = CGRectMake(20, 5, 60, 60);
+    [hud addSubview:hud.activityIndicator];
+    
     return hud;
 }
 
+- (UIActivityIndicatorView *)activityIndicator {
+    if (!_activityIndicator) {
+        _activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
+        [_activityIndicator startAnimating];
+    }
+    return _activityIndicator;
+}
+
+- (UILabel *)indicatorLabel {
+    if (!_indicatorLabel) {
+        _indicatorLabel = [[UILabel alloc] init];
+        _indicatorLabel.textColor = [UIColor whiteColor];
+        _indicatorLabel.textAlignment = NSTextAlignmentCenter;
+        _indicatorLabel.font = [UIFont systemFontOfSize:14.0f];
+    }
+    return _indicatorLabel;
+}
+
 - (void)dismiss {
-    [self removeFromSuperview];
+    [self dismiss:nil];
+}
+
+- (void)dismiss:(void(^)(void))completion {
+    
+    [UIView animateWithDuration:0.25 animations:^{
+        self.alpha = 0.3;
+    } completion:^(BOOL finished) {
+        [self removeFromSuperview];
+        if (completion) {
+            completion();
+        }
+    }];
+}
+
+- (void)setTitle:(NSString *)title {
+    _title = title;
+    self.indicatorLabel.text = title;
 }
 
 @end

+ 18 - 0
Redant Drivers/Apex And Drivers/RASingleton.h

@@ -0,0 +1,18 @@
+//
+//  RASingleton.h
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/6/6.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface RASingleton : NSObject
+
++ (instancetype)sharedInstance;
+
+@property (nonatomic,copy) NSString *user;
+@property (nonatomic,copy) NSString *password;
+
+@end

+ 24 - 0
Redant Drivers/Apex And Drivers/RASingleton.m

@@ -0,0 +1,24 @@
+//
+//  RASingleton.m
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/6/6.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import "RASingleton.h"
+
+static RASingleton *singleton;
+
+@implementation RASingleton
+
++ (instancetype)sharedInstance {
+    
+    static dispatch_once_t tocken;
+    dispatch_once(&tocken, ^{
+        singleton = [[RASingleton alloc] init];
+    });
+    return singleton;
+}
+
+@end

+ 1 - 0
Redant Drivers/Apex And Drivers/Update/Model/RAEditBaseModel.h

@@ -26,6 +26,7 @@ typedef enum {
 @interface RAEditBaseModel : NSObject
 
 @property (nonatomic,assign) RAEditType type;
+@property (nonatomic,copy) NSString *key;
 @property (nonatomic,copy) NSString *title;
 @property (nonatomic,assign) CGFloat height;
 

+ 1 - 1
Redant Drivers/Apex And Drivers/Update/Model/RAEditPhotoModel.h

@@ -10,7 +10,7 @@
 
 @interface RAEditPhotoModel : RAEditBaseModel
 
-@property (nonatomic,copy) NSString *path;
 @property (nonatomic,strong) UIImage *photo;
+@property (nonatomic,copy,readonly) NSString *photoName;
 
 @end

+ 2 - 5
Redant Drivers/Apex And Drivers/Update/Model/RAEditPhotoModel.m

@@ -14,11 +14,8 @@
     return 100.0f;
 }
 
-- (void)setPath:(NSString *)path {
-    _path = path;
-    if (self.delegate && [self.delegate respondsToSelector:@selector(refresh)]) {
-        [self.delegate refresh];
-    }
+- (NSString *)photoName {
+    return [NSString stringWithFormat:@"%@.jpg",self.key];
 }
 
 - (void)setPhoto:(UIImage *)photo {

+ 1 - 0
Redant Drivers/Apex And Drivers/Update/RAOrderEditViewController.h

@@ -13,6 +13,7 @@
 
 @property (nonatomic,copy) NSString *orderID;
 @property (nonatomic,assign) NSInteger actionID;
+@property (nonatomic,copy) NSString *actionTitle;
 
 @property (nonatomic,strong) NSIndexPath *editingIndexPath;
 

+ 164 - 0
Redant Drivers/Apex And Drivers/Update/RAOrderEditViewController.m

@@ -13,6 +13,10 @@
 #import "RAEditLabelModel.h"
 #import "RAEditPhotoModel.h"
 
+#import "RAProgressHUD.h"
+#import "ZipArchive.h"
+#import "AppDelegate.h"
+
 #import <MapKit/MapKit.h>
 
 @interface RAEditSectionModel : NSObject
@@ -201,6 +205,7 @@
 - (void)loadData {
     
     // show progress
+    RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
     
     NSString *orderID = self.orderID;
     NSInteger actionID = self.actionID;
@@ -212,6 +217,7 @@
         dispatch_async(dispatch_get_main_queue(), ^{
             
             // dismiss progress
+            [hud dismiss];
             
             if (weakSelf) {
                 __strong typeof(weakSelf) strongSelf = weakSelf;
@@ -250,6 +256,30 @@
 
 - (void)updateBtnClick:(UIBarButtonItem *)sender {
     
+    RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
+    
+    NSMutableDictionary *task = [self preparePackage];
+    
+    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+    [appDelegate.uploadManager addTask:task];
+    
+    __weak typeof(self) weakSelf = self;
+    [hud dismiss:^{
+        
+        UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Message" message:@"you can find the update progress in upload list" preferredStyle:UIAlertControllerStyleAlert];
+        
+        UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+            
+            [weakSelf.navigationController popToRootViewControllerAnimated:YES];
+        }];
+        
+        [alertVC addAction:okAction];
+        
+        [weakSelf presentViewController:alertVC animated:YES completion:nil];
+    }];
+    
+    
+    
 }
 
 #pragma mark - Keyboard Listener
@@ -299,4 +329,138 @@
     }
 }
 
+#pragma mark - Package Update Data
+
+- (NSString *)createPhotoDir {
+    
+    NSString *cacheDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
+    NSString *photoDir = [cacheDir stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_%ld_%@",self.orderID,self.actionID,[NSUUID UUID].UUIDString]];
+    
+    NSError *error;
+//    BOOL dirExist = YES;
+//    for (int i = 0; i < INT_MAX; i++) {
+//        if (i != 0) {
+//            photoDir = [photoDir stringByAppendingString:[NSString stringWithFormat:@"(%d)",i]];
+//        }
+//        if (![[NSFileManager defaultManager] fileExistsAtPath:photoDir]) {
+//            dirExist = NO;
+//            break;
+//        }
+//    }
+
+    [[NSFileManager defaultManager] createDirectoryAtPath:photoDir withIntermediateDirectories:YES attributes:nil error:&error];
+    if (error) {
+        NSLog(@"create dir %@ failed %@",photoDir,error.localizedDescription);
+        return nil;
+    }
+    
+    return photoDir;
+}
+
+- (NSMutableDictionary *)preparePackage {
+    
+    NSMutableDictionary *params = [NSMutableDictionary dictionary];
+    NSString *photoDir = [self createPhotoDir];
+    
+    [params setObject:self.orderID forKey:@"orderID"];
+    [params setObject:@(self.actionID) forKey:@"actionID"];
+    
+    NSString* encryptu=[AESCrypt AES128Encrypt:[RASingleton sharedInstance].user key:@"usai"];
+    NSString* encryptp=[AESCrypt AES128Encrypt:[RASingleton sharedInstance].password key:@"usai"];
+    [params setObject:encryptu forKey:@"user"];
+    [params setObject:encryptp forKey:@"password"];
+    [params setObject:@"iOS" forKey:@"platform"];
+    
+    if (self.currentLocation) {
+        [params setObject:[NSString stringWithFormat:@"%f,%f",self.currentLocation.coordinate.latitude,self.currentLocation.coordinate.longitude] forKey:@"location"];
+    }
+    
+    NSInteger photoCount = 0;
+    for (RAEditSectionModel *section in self.sectionArray) {
+        for (int i = 0; i < [section itemCount]; i++) {
+            RAEditBaseModel *model = [section itemModelForIndex:i];
+            switch (model.type) {
+                case RAEditTypeLabel: {
+                    
+                }
+                    break;
+                case RAEditTypeInput: {
+                    
+                    RAEditInputModel *inputModel = (RAEditInputModel *)model;
+                    if (inputModel.key && inputModel.value.length > 0) {
+                        [params setObject:inputModel.value forKey:inputModel.key];
+                    }
+                }
+                    break;
+                case RAEditTypeMultInput: {
+                    
+                    RAEditMultInputModel *multInputModel = (RAEditMultInputModel *)model;
+                    if (multInputModel.key && multInputModel.value.length > 0) {
+                        [params setObject:multInputModel.value forKey:multInputModel.key];
+                    }
+                }
+                    break;
+                case RAEditTypePhoto: {
+                    if (photoDir) {
+                        RAEditPhotoModel *photoModel = (RAEditPhotoModel *)model;
+                        if (photoModel.photo) {
+                            NSString *photoPath = [photoDir stringByAppendingPathComponent:photoModel.photoName];
+                            NSData *imgData = UIImageJPEGRepresentation(photoModel.photo, 1.0f);
+                            if (imgData) {
+                                [imgData writeToFile:photoPath atomically:NO];
+                                [params setObject:photoModel.photoName forKey:photoModel.key];
+                                photoCount++;
+                            }
+                        }
+                        
+                    }
+                    
+                    
+                }
+                    break;
+                    
+                default:
+                    break;
+            }
+        }
+    }
+    
+    NSMutableDictionary *task = [@{
+                                   @"order" : self.orderID,
+                                   @"action" : self.actionTitle,
+                                   @"url" : URL_HOST,
+                                   @"noFile" : @(YES)
+                                  } mutableCopy];
+    
+    if (photoCount > 0) {
+        
+        // 压缩文件
+        NSString *zipPath = [photoDir stringByAppendingPathExtension:@".zip"];
+        ZipArchive *zip = [[ZipArchive alloc] init];
+        [zip CreateZipFile2:zipPath];
+        NSArray *subPaths = [[NSFileManager defaultManager] subpathsAtPath:photoDir];
+        for (NSString *subPath in subPaths) {
+            NSString *fullPath = [photoDir stringByAppendingPathComponent:subPath];
+            BOOL isDir;
+            if([[NSFileManager defaultManager] fileExistsAtPath:fullPath isDirectory:&isDir]) {
+                if (!isDir) {
+                    [zip addFileToZip:fullPath newname:subPath];
+                }
+            }
+        }
+        [zip CloseZipFile2];
+        
+        [[NSFileManager defaultManager] removeItemAtPath:photoDir error:nil];
+
+        NSString *md5 = [RAUtils md5WithFile:zipPath];
+        
+        [params setObject:md5 forKey:@"md5"];
+        [task setObject:@"file" forKey:zipPath.lastPathComponent];
+    }
+    
+    [task setObject:params forKey:@"params"];
+    
+    return task;
+}
+
 @end

+ 22 - 0
Redant Drivers/Apex And Drivers/Upload/ApexDriverUploadCell.h

@@ -0,0 +1,22 @@
+//
+//  ApexDriverUploadCell.h
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/6/6.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface ApexDriverUploadCell : UITableViewCell
+
+@property (nonatomic,copy) NSString *orderID;
+@property (nonatomic,copy) NSString *action;
+@property (nonatomic,copy) NSString *datetime;
+@property (nonatomic,copy) NSString *status;
+@property (nonatomic,copy) NSString *errMsg;
+@property (nonatomic,assign) float progress;
+
+- (void)reset;
+
+@end

+ 98 - 0
Redant Drivers/Apex And Drivers/Upload/ApexDriverUploadCell.m

@@ -0,0 +1,98 @@
+//
+//  ApexDriverUploadCell.m
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/6/6.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import "ApexDriverUploadCell.h"
+
+@interface ApexDriverUploadCell ()
+
+@property (strong, nonatomic) IBOutlet UILabel *orderNoLabel;
+@property (strong, nonatomic) IBOutlet UILabel *actionLabel;
+@property (strong, nonatomic) IBOutlet UILabel *dateLabel;
+@property (strong, nonatomic) IBOutlet UILabel *statusLabel;
+@property (strong, nonatomic) IBOutlet UILabel *progressLabel;
+@property (strong, nonatomic) IBOutlet UILabel *tipsLabel;
+@property (strong, nonatomic) IBOutlet UIProgressView *progressView;
+
+
+@end
+
+@implementation ApexDriverUploadCell
+
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    // Initialization code
+    
+    [self reset];
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
+    [super setSelected:selected animated:animated];
+
+    // Configure the view for the selected state
+}
+
+- (void)prepareForReuse {
+    [super prepareForReuse];
+    
+    [self reset];
+}
+
+- (void)reset {
+    self.orderID = nil;
+    self.action = nil;
+    self.datetime = nil;
+    self.progress = 0;
+    self.status = nil;
+    self.errMsg = nil;
+}
+
+- (void)setProgress:(float)progress {
+    if (progress < 0) {
+        progress = 0.0f;
+    }
+    if (progress > 1) {
+        progress = 1.0f;
+    }
+    _progress = progress;
+    self.progressView.progress = progress;
+    progress = progress * 100;
+    self.progressLabel.text = [NSString stringWithFormat:@"%.1f%%",progress];
+}
+
+- (void)setStatus:(NSString *)status {
+    _status = status;
+    self.statusLabel.text = _status;
+}
+
+- (void)setErrMsg:(NSString *)errMsg {
+    _errMsg = errMsg;
+    if (errMsg.length) {
+        self.tipsLabel.hidden = NO;
+        self.tipsLabel.text = errMsg;
+    } else {
+        self.tipsLabel.hidden = YES;
+        self.tipsLabel.text = nil;
+    }
+}
+
+- (void)setOrderID:(NSString *)orderID {
+    _orderID = orderID;
+    self.orderNoLabel.text = orderID;
+}
+
+- (void)setAction:(NSString *)action {
+    _action = action;
+    self.actionLabel.text = action;
+}
+
+- (void)setDatetime:(NSString *)datetime {
+    _datetime = datetime;
+    self.dateLabel.text = datetime;
+}
+
+@end

+ 15 - 0
Redant Drivers/Apex And Drivers/Upload/ApexDriverUploadListVC.h

@@ -0,0 +1,15 @@
+//
+//  ApexDriverUploadListVC.h
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/6/6.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import "RAUploadListViewController.h"
+
+@interface ApexDriverUploadListVC : RAUploadListViewController
+
++ (instancetype)viewControllerFromStoryboard;
+
+@end

+ 144 - 0
Redant Drivers/Apex And Drivers/Upload/ApexDriverUploadListVC.m

@@ -0,0 +1,144 @@
+//
+//  ApexDriverUploadListVC.m
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/6/6.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import "ApexDriverUploadListVC.h"
+#import "ApexDriverUploadCell.h"
+#import "AppDelegate.h"
+
+@interface ApexDriverUploadListVC ()
+
+@property (strong, nonatomic) IBOutlet UITableView *tableView;
+
+@end
+
+@implementation ApexDriverUploadListVC
+
++ (NSString *)storyboardID {
+    return NSStringFromClass([self class]);
+}
+
++ (instancetype)viewControllerFromStoryboard {
+    ApexDriverUploadListVC *uploadVC = [[UIStoryboard storyboardWithName:@"Upload" bundle:nil] instantiateViewControllerWithIdentifier:[self storyboardID]];
+    return uploadVC;
+}
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.    
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+- (UITableView *)uploadTableView {
+    return self.tableView;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    ApexDriverUploadCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ApexDriverUploadCell" forIndexPath:indexPath];
+    
+    AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+    NSDictionary * item_json = appdelegate.uploadManager.arr_queue[indexPath.row];
+
+    
+    RAUploadOperation* op = item_json[@"operation"];
+    
+    
+    
+    NSString* status =nil;
+    switch ([item_json[@"status"] intValue]) {
+        case TaskStatusStart:
+            status=@"uploading";
+            break;
+        case TaskStatusStop:
+            status=@"stop";
+            break;
+        case TaskStatusError:
+            status=@"warning";
+            break;
+        case TaskStatusWait:
+            status=@"waiting";
+            break;
+        case TaskStatusFinish:
+            status=@"finish";
+            break;
+            
+        default:
+            status=@"warning";
+            break;
+    }
+    
+    double progress =[item_json[@"progress"] doubleValue];
+    cell.progress = progress;
+    cell.orderID = item_json[@"order"];
+    cell.action = item_json[@"action"];
+    cell.status = status;
+    cell.errMsg = item_json[@"msg"];
+
+    
+    op.updateUI=^(){
+        
+        NSString* status =nil;
+        switch ([item_json[@"status"] intValue]) {
+            case TaskStatusStart:
+                status=@"uploading";
+                break;
+            case TaskStatusStop:
+                status=@"stop";
+                break;
+            case TaskStatusError:
+                status=@"warning";
+                break;
+            case TaskStatusWait:
+                status=@"waiting";
+                break;
+            case TaskStatusFinish:
+                status=@"finish";
+                break;
+                
+            default:
+                status=@"warning";
+                break;
+        }
+        double progress =[item_json[@"progress"] doubleValue];
+        cell.progress = progress;
+        cell.orderID = item_json[@"order"];
+        cell.action = item_json[@"action"];
+        cell.status = status;
+        cell.errMsg = item_json[@"msg"];
+        
+    };
+    
+    return cell;
+}
+
+- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    ApexDriverUploadCell *upCell = (ApexDriverUploadCell *)cell;
+    
+    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+    NSUInteger row = indexPath.row;
+    NSUInteger count = Appdelegate.uploadManager.arr_queue.count;
+    if (count > row) {
+        NSDictionary * item_json = Appdelegate.uploadManager.arr_queue[indexPath.row];
+        RAUploadOperation* operation = item_json[@"operation"];
+        ApexDriverUploadCell *newCell = (ApexDriverUploadCell *)[tableView cellForRowAtIndexPath:indexPath];
+        if (newCell != upCell) {
+            // reload row
+        } else {
+            operation.updateUI = nil; // restart 会调用就会导致cell不会刷新
+        }
+    }
+
+    [upCell reset];
+}
+
+@end

+ 152 - 0
Redant Drivers/Apex And Drivers/Upload/Upload.storyboard

@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <scenes>
+        <!--Apex Driver Upload ListVC-->
+        <scene sceneID="hIX-ac-0Es">
+            <objects>
+                <viewController storyboardIdentifier="ApexDriverUploadListVC" useStoryboardIdentifierAsRestorationIdentifier="YES" id="bfA-h6-yQM" customClass="ApexDriverUploadListVC" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="zKj-H2-OQK">
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="koe-ry-qPp">
+                                <rect key="frame" x="0.0" y="20" width="375" height="647"/>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <prototypes>
+                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="ApexDriverUploadCell" rowHeight="125" id="huU-zg-npZ" customClass="ApexDriverUploadCell">
+                                        <rect key="frame" x="0.0" y="28" width="375" height="125"/>
+                                        <autoresizingMask key="autoresizingMask"/>
+                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="huU-zg-npZ" id="dZU-sw-5VP">
+                                            <rect key="frame" x="0.0" y="0.0" width="375" height="124.5"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                            <subviews>
+                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="AFS20180530001200" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WTo-cm-rdo">
+                                                    <rect key="frame" x="5" y="5" width="365" height="21"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="21" id="bQX-N5-lYJ"/>
+                                                        <constraint firstAttribute="height" constant="21" id="udo-28-Jah"/>
+                                                    </constraints>
+                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                    <nil key="textColor"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
+                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Delivered" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="y9Q-F5-1QB">
+                                                    <rect key="frame" x="5" y="31" width="240" height="21"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="21" id="nLb-nk-rmK"/>
+                                                    </constraints>
+                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                    <nil key="textColor"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
+                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Waiting" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rUp-S4-lOb">
+                                                    <rect key="frame" x="5" y="72" width="310" height="21"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="21" id="fbR-9t-WUj"/>
+                                                    </constraints>
+                                                    <fontDescription key="fontDescription" type="system" pointSize="15"/>
+                                                    <nil key="textColor"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
+                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="100.0%" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2cy-8a-tLI">
+                                                    <rect key="frame" x="320" y="74" width="50" height="17"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="50" id="Ax5-Vz-Htq"/>
+                                                        <constraint firstAttribute="height" constant="17" id="djs-9H-M2g"/>
+                                                    </constraints>
+                                                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                                    <nil key="textColor"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
+                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Error:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UZL-gw-YiG">
+                                                    <rect key="frame" x="5" y="98" width="365" height="21"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="21" id="SPE-qn-CPk"/>
+                                                    </constraints>
+                                                    <fontDescription key="fontDescription" type="system" pointSize="15"/>
+                                                    <nil key="textColor"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
+                                                <progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="W75-Zx-6bA">
+                                                    <rect key="frame" x="5" y="62" width="365" height="2"/>
+                                                </progressView>
+                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="12/31/2018 24:05" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1qM-zg-EJJ">
+                                                    <rect key="frame" x="250" y="33" width="120" height="17"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="120" id="Lxf-4m-vXf"/>
+                                                        <constraint firstAttribute="height" constant="17" id="yIa-Y2-aBE"/>
+                                                    </constraints>
+                                                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                                    <nil key="textColor"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
+                                            </subviews>
+                                            <color key="backgroundColor" red="0.76483958467461133" green="0.62864267894700021" blue="0.1775369151630608" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                            <constraints>
+                                                <constraint firstItem="y9Q-F5-1QB" firstAttribute="top" secondItem="WTo-cm-rdo" secondAttribute="bottom" constant="5" id="0Fl-oe-y0X"/>
+                                                <constraint firstItem="W75-Zx-6bA" firstAttribute="top" secondItem="y9Q-F5-1QB" secondAttribute="bottom" constant="10" id="0Xf-UV-Nwz"/>
+                                                <constraint firstItem="1qM-zg-EJJ" firstAttribute="leading" secondItem="y9Q-F5-1QB" secondAttribute="trailing" constant="5" id="2eC-yA-7xv"/>
+                                                <constraint firstItem="UZL-gw-YiG" firstAttribute="top" secondItem="rUp-S4-lOb" secondAttribute="bottom" constant="5" id="Etm-UB-ilT"/>
+                                                <constraint firstItem="UZL-gw-YiG" firstAttribute="trailing" secondItem="2cy-8a-tLI" secondAttribute="trailing" id="JX0-IN-bS8"/>
+                                                <constraint firstItem="UZL-gw-YiG" firstAttribute="leading" secondItem="rUp-S4-lOb" secondAttribute="leading" id="OUW-J1-UlK"/>
+                                                <constraint firstItem="2cy-8a-tLI" firstAttribute="trailing" secondItem="W75-Zx-6bA" secondAttribute="trailing" id="TSq-PW-gIh"/>
+                                                <constraint firstItem="1qM-zg-EJJ" firstAttribute="trailing" secondItem="WTo-cm-rdo" secondAttribute="trailing" id="UC0-mb-OfH"/>
+                                                <constraint firstItem="2cy-8a-tLI" firstAttribute="leading" secondItem="rUp-S4-lOb" secondAttribute="trailing" constant="5" id="UQd-Yn-9tm"/>
+                                                <constraint firstItem="WTo-cm-rdo" firstAttribute="leading" secondItem="dZU-sw-5VP" secondAttribute="leading" constant="5" id="Xla-Fa-DfY"/>
+                                                <constraint firstItem="W75-Zx-6bA" firstAttribute="leading" secondItem="WTo-cm-rdo" secondAttribute="leading" id="ada-W8-fhY"/>
+                                                <constraint firstAttribute="bottom" secondItem="UZL-gw-YiG" secondAttribute="bottom" constant="5" id="cpg-bF-x6S"/>
+                                                <constraint firstAttribute="trailing" secondItem="WTo-cm-rdo" secondAttribute="trailing" constant="5" id="dpK-kz-h0C"/>
+                                                <constraint firstItem="2cy-8a-tLI" firstAttribute="centerY" secondItem="rUp-S4-lOb" secondAttribute="centerY" id="enp-D1-wmU"/>
+                                                <constraint firstItem="W75-Zx-6bA" firstAttribute="trailing" secondItem="WTo-cm-rdo" secondAttribute="trailing" id="fJh-Wr-WW6"/>
+                                                <constraint firstItem="y9Q-F5-1QB" firstAttribute="leading" secondItem="WTo-cm-rdo" secondAttribute="leading" id="gR7-jL-F0U"/>
+                                                <constraint firstItem="1qM-zg-EJJ" firstAttribute="centerY" secondItem="y9Q-F5-1QB" secondAttribute="centerY" id="oNc-nP-bfg"/>
+                                                <constraint firstItem="rUp-S4-lOb" firstAttribute="top" secondItem="W75-Zx-6bA" secondAttribute="bottom" constant="8" id="pJQ-pK-hLR"/>
+                                                <constraint firstItem="WTo-cm-rdo" firstAttribute="top" secondItem="dZU-sw-5VP" secondAttribute="top" constant="5" id="qxf-XV-bs7"/>
+                                                <constraint firstItem="rUp-S4-lOb" firstAttribute="leading" secondItem="W75-Zx-6bA" secondAttribute="leading" id="uva-SO-LsR"/>
+                                            </constraints>
+                                        </tableViewCellContentView>
+                                        <connections>
+                                            <outlet property="actionLabel" destination="y9Q-F5-1QB" id="iio-G5-JhR"/>
+                                            <outlet property="dateLabel" destination="1qM-zg-EJJ" id="Vlr-GZ-l6Q"/>
+                                            <outlet property="orderNoLabel" destination="WTo-cm-rdo" id="H2g-gN-czi"/>
+                                            <outlet property="progressLabel" destination="2cy-8a-tLI" id="R4m-gM-Kw6"/>
+                                            <outlet property="progressView" destination="W75-Zx-6bA" id="cVF-cl-2Jh"/>
+                                            <outlet property="statusLabel" destination="rUp-S4-lOb" id="OOb-Js-CBk"/>
+                                            <outlet property="tipsLabel" destination="UZL-gw-YiG" id="3IX-Ue-RKI"/>
+                                        </connections>
+                                    </tableViewCell>
+                                </prototypes>
+                                <connections>
+                                    <outlet property="dataSource" destination="bfA-h6-yQM" id="his-Tj-ZX2"/>
+                                    <outlet property="delegate" destination="bfA-h6-yQM" id="tDN-fN-TOB"/>
+                                </connections>
+                            </tableView>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                        <constraints>
+                            <constraint firstItem="koe-ry-qPp" firstAttribute="top" secondItem="YkL-J8-lPm" secondAttribute="top" id="5O3-dj-d80"/>
+                            <constraint firstItem="koe-ry-qPp" firstAttribute="leading" secondItem="YkL-J8-lPm" secondAttribute="leading" id="EgD-EN-ki4"/>
+                            <constraint firstItem="YkL-J8-lPm" firstAttribute="bottom" secondItem="koe-ry-qPp" secondAttribute="bottom" id="UEn-qk-QXi"/>
+                            <constraint firstItem="YkL-J8-lPm" firstAttribute="trailing" secondItem="koe-ry-qPp" secondAttribute="trailing" id="gqq-dc-zL3"/>
+                        </constraints>
+                        <viewLayoutGuide key="safeArea" id="YkL-J8-lPm"/>
+                    </view>
+                    <connections>
+                        <outlet property="tableView" destination="koe-ry-qPp" id="CTK-gu-hcs"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="AyC-bF-MNJ" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="61.600000000000001" y="147.97601199400302"/>
+        </scene>
+    </scenes>
+</document>