Răsfoiți Sursa

1.修改iOS Apex Drivers报告位置,拒绝或取消时上传原因。

Pen Li 7 ani în urmă
părinte
comite
92a8454e42

+ 11 - 0
Redant Drivers/Apex And Drivers/AppDelegate.m

@@ -259,6 +259,9 @@
             } else if (RASingleton.sharedInstance.backgroundReportType == RABackgroundReportTypeAlways) {
                 
                 [self reportLocationWithOrder:orderID];
+            } else if (RASingleton.sharedInstance.backgroundReportType == RABackgroundReportTypeReject) {
+                
+                [self rejectReportLocationWithReason:[NSString stringWithFormat:@"Driver %@ rejected to report location",RASingleton.sharedInstance.user] forOrder:orderID];
             }
             completionHandler(UIBackgroundFetchResultNewData);
         } else {
@@ -315,6 +318,12 @@
 
 #pragma mark - Report Location
 
+- (void)rejectReportLocationWithReason:(NSString *)reason forOrder:(NSString *)orderID {
+    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+        [RADataProvider reportLocationWithUserReason:reason forOrder:orderID];
+    });
+}
+
 - (void)reportLocation:(CLLocation *)location forOrder:(NSString *)orderID {
     
     if (location) {
@@ -338,6 +347,8 @@
         UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:[NSString stringWithFormat:@"Report Location For Order:%@",orderID] preferredStyle:UIAlertControllerStyleAlert];
         UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
             
+            [self rejectReportLocationWithReason:[NSString stringWithFormat:@"Driver %@ cancel to report location",RASingleton.sharedInstance.user] forOrder:orderID];
+            
         }];
         
         __weak typeof(self) weakSelf = self;

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

@@ -30,6 +30,8 @@
 
 + (NSDictionary *)reportCurrentLocation:(NSString *)location forOrderID:(NSString *)orderID;
 
++ (NSDictionary *)reportLocationWithUserReason:(NSString *)option forOrder:(NSString *)orderID;
+
 + (NSDictionary *)bindNitificationToken:(NSString *)token;
 
 + (NSDictionary *)logout;

+ 19 - 0
Redant Drivers/Apex And Drivers/RADataProvider.m

@@ -270,6 +270,25 @@
         [params setObject:orderID forKey:@"orderID"];
     }
     
+    [params setObject:@(0) forKey:@"userOption"]; // 0 表示同意发送位置
+    
+    NSData* json=[self get_json:URL_REPORT_LOCATION parameters:params  file:nil];
+    
+    return [self handleJsonData:json];
+}
+
++ (NSDictionary *)reportLocationWithUserReason:(NSString *)reason forOrder:(NSString *)orderID {
+    
+    NSMutableDictionary *params = [NSMutableDictionary dictionary];
+    if (reason) {
+        [params setObject:reason forKey:@"reason"];
+    }
+    if (orderID) {
+        [params setObject:orderID forKey:@"orderID"];
+    }
+    
+    [params setObject:@(1) forKey:@"userOption"]; // 1 表示不同意发送位置
+    
     NSData* json=[self get_json:URL_REPORT_LOCATION parameters:params  file:nil];
     
     return [self handleJsonData:json];