|
|
|
@ -106,7 +106,7 @@ class AppSettings {
|
|
|
|
|
static String loginUrl = host + 'sendSms';
|
|
|
|
|
static String deliveryboyloginUrl = host + 'deliveryboylogin';
|
|
|
|
|
static String deliveryboybookingsUrl = host + 'getdeliveryboybookings';
|
|
|
|
|
|
|
|
|
|
static String deliveryboyStartAndStopUrl = host + 'deliveryboystartandstop';
|
|
|
|
|
|
|
|
|
|
static String verifyPhnUrl = host + 'phone';
|
|
|
|
|
static String updateProfileUrl = host + 'update/currentUser';
|
|
|
|
@ -315,7 +315,30 @@ class AppSettings {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static Future<String> startAndStop(var bookingId,payload) async {
|
|
|
|
|
//var uri = Uri.parse(deliveryboyStartAndStopUrl);
|
|
|
|
|
var uri = Uri.parse(deliveryboyStartAndStopUrl + '/' + bookingId);
|
|
|
|
|
var response = await http.put(uri,
|
|
|
|
|
body: json.encode(payload), headers: await buildRequestHeaders());
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
|
return response.body;
|
|
|
|
|
} else if (response.statusCode == 401) {
|
|
|
|
|
bool status = await AppSettings.resetToken();
|
|
|
|
|
if (status) {
|
|
|
|
|
response = await http.put(uri,
|
|
|
|
|
body: json.encode(payload), headers: await buildRequestHeaders());
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
|
return response.body;
|
|
|
|
|
} else {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static Future<bool> resetToken() async {
|
|
|
|
|