Przeglądaj źródła

1.修改RA Image返回到根页面时检测并提示Photo是否需要上传。
2.修改RA Image只在Wifi条件下上传时,在非Wifi情况下也添加任务。
3.修改RA Image上传参数校验时,网络错误情况下添加上传任务。

Pen Li 8 lat temu
rodzic
commit
b6704ba79b

BIN
RA Image/RA Image.xcodeproj/project.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 25 - 1
RA Image/RA Image/BasicModeViewController.m

@@ -46,7 +46,30 @@
     }
     
     self.title = self.name;
+    
+    UIBarButtonItem *returnItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(returnItemClick:)];
+    self.navigationItem.backBarButtonItem = returnItem;
 }
+
+- (void)returnItemClick:(UIBarButtonItem *)sender {
+    if (self.photoCount > 0) {
+        
+        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Warning" message:@"There are some photos ready to upload,do you wan to discard them?" preferredStyle:UIAlertControllerStyleAlert];
+        __weak typeof(self) weakSelf = self;
+        UIAlertAction *yesAction = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+            [weakSelf.navigationController popViewControllerAnimated:YES];
+        }];
+        UIAlertAction *noAction = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+            
+        }];
+        [alert addAction:noAction];
+        [alert addAction:yesAction];
+        [self presentViewController:alert animated:YES completion:nil];
+    } else {
+        [self.navigationController popViewControllerAnimated:YES];
+    }
+}
+
 -(void) dealloc
 {
     AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
@@ -611,7 +634,8 @@
                     }
                     case RESULT_NET_ERROR:
                     {
-                        [RAUtils message_alert:@"Can not connect to server" title:title controller:weakself];
+                        [RAUtils message_alert:@"Can not connect to server,and the photos will upload when the network recover" title:title controller:weakself];
+                        [self addTasks];
                     }
                     default:
                         break;

+ 3 - 4
RA Image/RA Image/ModelModeViewController.m

@@ -98,8 +98,8 @@
 - (IBAction)uploadBtnClick:(id)sender {
     
     if (![self shouldUploadWithCurrentNerworkStatus]) {
-        [self.view makeToast:@"Current network is not WiFi" duration:3.0 position:CSToastPositionCenter];
-        return;
+        [self.view makeToast:@"Current network is not WiFi,we don't upload until wifi connected." duration:3.0 position:CSToastPositionCenter];
+//        return;
     }
     
     if(self.barcode.length ==0)
@@ -128,8 +128,7 @@
                                      @"mode":self.name,
                                      @"barcode":self.barcode,
                                      @"_operate":@"valid_upload",
-                                     @"platform":@"ios",
-
+                                     @"platform":@"ios"
                                      } mutableCopy];
     
     NSString *manufacturer = self.manufacturer;

+ 3 - 3
RA Image/RA Image/PopModeViewController.m

@@ -70,8 +70,8 @@
 - (IBAction)uploadBtnClick:(UIButton *)sender {
     
     if (![self shouldUploadWithCurrentNerworkStatus]) {
-        [self.view makeToast:@"Current network is not WiFi" duration:3.0 position:CSToastPositionCenter];
-        return;
+        [self.view makeToast:@"Current network is not WiFi,we don't upload until wifi connected." duration:3.0 position:CSToastPositionCenter];
+//        return;
     }
     
     // check piid, photo...
@@ -96,7 +96,7 @@
                              @"mode":self.name,
                              @"barcode":self.barcode,
                              @"_operate":@"valid_upload",
-                             @"platform":@"ios",
+                             @"platform":@"ios"
                              } mutableCopy];
     [self verify:params];