Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
POI returns no route for not covered areas (#1960) (#1993)
Browse files Browse the repository at this point in the history
  • Loading branch information
xieofxie authored and ryanisgrig committed Aug 1, 2019
1 parent 66277aa commit 6dae291
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public async Task<DialogTurnResult> RouteToFindPointOfInterestBeforeRouteDialog(

if (cards.Count() == 0)
{
var replyMessage = ResponseManager.GetResponse(POISharedResponses.NoLocationsFound);
var replyMessage = ResponseManager.GetResponse(POISharedResponses.NoRouteFound);
await sc.Context.SendActivityAsync(replyMessage);
}
else if (cards.Count() == 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class POISharedResponses : IResponseIdCollection
public const string NoLocationsFound = "NoLocationsFound";
public const string MultipleRoutesFound = "MultipleRoutesFound";
public const string SingleRouteFound = "SingleRouteFound";
public const string NoRouteFound = "NoRouteFound";
public const string PointOfInterestSelection = "PointOfInterestSelection";
public const string CurrentLocationMultipleSelection = "CurrentLocationMultipleSelection";
public const string CurrentLocationSingleSelection = "CurrentLocationSingleSelection";
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,15 @@
],
"inputHint": "expectingInput"
},
"NoRouteFound": {
"replies": [
{
"text": "Sorry, I didn't find any route.",
"speak": "Sorry, I didn't find any route."
}
],
"inputHint": "acceptingInput"
},
"PointOfInterestSelection": {
"replies": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,15 @@
],
"inputHint": "expectingInput"
},
"NoRouteFound": {
"inputHint": "acceptingInput",
"replies": [
{
"text": "对不起,我找不到任何路线。",
"speak": "对不起,我找不到任何路线。"
}
]
},
"CurrentLocationSingleSelection": {
"replies": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,16 @@ void AddPoint(double longitude, double latitude)
/// <returns>RouteDirections.</returns>
private async Task<RouteDirections> GetRouteDirectionsAsync(string url)
{
var response = await httpClient.GetStringAsync(url);
var response = await httpClient.GetAsync(url);

var apiResponse = new RouteDirections();

var apiResponse = JsonConvert.DeserializeObject<RouteDirections>(response);
// TODO when it returns 400 for uncovered areas, we return no route instead. For other unsuccessful codes, exception is thrown as usual
if (response.StatusCode != System.Net.HttpStatusCode.BadRequest)
{
response = response.EnsureSuccessStatusCode();
apiResponse = JsonConvert.DeserializeObject<RouteDirections>(await response.Content.ReadAsStringAsync());
}

apiResponse.Provider = PointOfInterestModel.AzureMaps;

Expand Down

0 comments on commit 6dae291

Please sign in to comment.