|
|
@@ -559,13 +559,13 @@ public class ApexDriverApplication extends Application {
|
|
|
this.backgroundReportType = reportType;
|
|
|
}
|
|
|
|
|
|
- public void reportLocationForOrder(@Nullable final String location, final String orderId) {
|
|
|
+ public void reportLocationForOrder(@Nullable final Location location, final String orderId, final String locationId) {
|
|
|
|
|
|
getNetworkQueue().addOperationTask(new OperationQueue.OperationBackgroundCallBack() {
|
|
|
@Override
|
|
|
public Object operationDoInBackground() {
|
|
|
|
|
|
- Network.reportLocation(location,orderId);
|
|
|
+ Network.reportLocation(location,orderId,locationId);
|
|
|
|
|
|
return null;
|
|
|
}
|
|
|
@@ -573,13 +573,13 @@ public class ApexDriverApplication extends Application {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public void rejectReportLocation(final String reason, final String orderId) {
|
|
|
+ public void rejectReportLocation(final String reason, final String orderId, final String locationId) {
|
|
|
|
|
|
getNetworkQueue().addOperationTask(new OperationQueue.OperationBackgroundCallBack() {
|
|
|
@Override
|
|
|
public Object operationDoInBackground() {
|
|
|
|
|
|
- Network.rejectReportLocation(reason,orderId);
|
|
|
+ Network.rejectReportLocation(reason,orderId, locationId);
|
|
|
|
|
|
return null;
|
|
|
}
|
|
|
@@ -587,7 +587,7 @@ public class ApexDriverApplication extends Application {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public void reportLocationForOrder(final String orderId) {
|
|
|
+ public void handlLocationRequestForOrder(final String orderId, final String locationId) {
|
|
|
|
|
|
switch (backgroundReportType) {
|
|
|
case BackgroundReportTypeNone: {
|
|
|
@@ -597,7 +597,7 @@ public class ApexDriverApplication extends Application {
|
|
|
case BackgroundReportTypeReject: {
|
|
|
|
|
|
String reason = "Driver " + user +" rejected to report location";
|
|
|
- rejectReportLocation(reason,orderId);
|
|
|
+ rejectReportLocation(reason,orderId,locationId);
|
|
|
}
|
|
|
break;
|
|
|
case BackgroundReportTypeAlways: {
|
|
|
@@ -610,8 +610,8 @@ public class ApexDriverApplication extends Application {
|
|
|
@Override
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
|
- String location = null;
|
|
|
- reportLocationForOrder(location,orderId);
|
|
|
+ Location location = getCurrentLocation();
|
|
|
+ reportLocationForOrder(location,orderId,locationId);
|
|
|
}
|
|
|
})
|
|
|
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
|
|
@@ -619,7 +619,7 @@ public class ApexDriverApplication extends Application {
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
|
String reason = "Driver " + user +" cancel to report location";
|
|
|
- rejectReportLocation(reason,orderId);
|
|
|
+ rejectReportLocation(reason,orderId,locationId);
|
|
|
}
|
|
|
})
|
|
|
.show();
|
|
|
@@ -630,11 +630,8 @@ public class ApexDriverApplication extends Application {
|
|
|
case BackgroundReportTypeAllow: {
|
|
|
|
|
|
Location location = getCurrentLocation();
|
|
|
- String latlon = "-999,-999";
|
|
|
- if (location != null) {
|
|
|
- latlon = location.getLatitude() + "," + location.getLongitude();
|
|
|
- }
|
|
|
- reportLocationForOrder(latlon,orderId);
|
|
|
+
|
|
|
+ reportLocationForOrder(location,orderId,locationId);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
@@ -658,6 +655,7 @@ public class ApexDriverApplication extends Application {
|
|
|
|
|
|
int report_location = aps.optInt("report-location",0);
|
|
|
final String orderID = aps.optString("order-id");
|
|
|
+ final String locationId = aps.optString("location-id");
|
|
|
|
|
|
if (report_location != 0) {
|
|
|
|
|
|
@@ -667,22 +665,18 @@ public class ApexDriverApplication extends Application {
|
|
|
if (backgroundReportType == BackgroundReportTypeAllow) {
|
|
|
|
|
|
Location location = getCurrentLocation();
|
|
|
- String latlon = "-999,-999";
|
|
|
- if (location != null) {
|
|
|
- latlon = location.getLatitude() + "," + location.getLongitude();
|
|
|
- }
|
|
|
- reportLocationForOrder(latlon,orderID);
|
|
|
+ reportLocationForOrder(location,orderID, locationId);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
String reason = "Driver " + user +" rejected to report location";
|
|
|
- rejectReportLocation(reason,orderID);
|
|
|
+ rejectReportLocation(reason,orderID, locationId);
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- reportLocationForOrder(orderID);
|
|
|
+ handlLocationRequestForOrder(orderID,locationId);
|
|
|
|
|
|
} else {
|
|
|
|