Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,20 @@ protected async Task<DialogTurnResult> RouteToFindFindParkingDialog(WaterfallSte
{
var pointOfInterest = pointOfInterestAddressList[0];
pointOfInterestList = await mapsService.GetPointOfInterestListByParkingCategoryAsync(pointOfInterest.Geolocation.Latitude, pointOfInterest.Geolocation.Longitude);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList, mapsService);
}
else
{
// Find parking lot near address
pointOfInterestList = await mapsService.GetPointOfInterestListByParkingCategoryAsync(state.CurrentCoordinates.Latitude, state.CurrentCoordinates.Longitude);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList, mapsService);
}
}
else
{
// No entities identified, find nearby parking lots
pointOfInterestList = await mapsService.GetPointOfInterestListByParkingCategoryAsync(state.CurrentCoordinates.Latitude, state.CurrentCoordinates.Longitude);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList, mapsService);
}

if (cards.Count == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected async Task<DialogTurnResult> ConfirmCurrentLocation(WaterfallStepConte
var service = ServiceManager.InitAddressMapsService(Settings);

var pointOfInterestList = await service.GetPointOfInterestListByAddressAsync(double.NaN, double.NaN, sc.Result.ToString());
var cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList);
var cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList, service);

if (cards.Count() == 0)
{
Expand Down Expand Up @@ -247,7 +247,7 @@ protected async Task<DialogTurnResult> ProcessCurrentLocationSelection(Waterfall
{
// No entities identified, find nearby locations
pointOfInterestList = await service.GetNearbyPointOfInterestListAsync(state.CurrentCoordinates.Latitude, state.CurrentCoordinates.Longitude);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList, service);
}
else if (!string.IsNullOrEmpty(state.Keyword) && !string.IsNullOrEmpty(state.Address))
{
Expand All @@ -258,26 +258,26 @@ protected async Task<DialogTurnResult> ProcessCurrentLocationSelection(Waterfall
{
var pointOfInterest = pointOfInterestAddressList[0];
pointOfInterestList = await service.GetPointOfInterestListByQueryAsync(pointOfInterest.Geolocation.Latitude, pointOfInterest.Geolocation.Longitude, state.Keyword);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList, service);
}
else
{
// No POIs found from address - search near current coordinates
pointOfInterestList = await service.GetPointOfInterestListByQueryAsync(state.CurrentCoordinates.Latitude, state.CurrentCoordinates.Longitude, state.Keyword);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList, service);
}
}
else if (!string.IsNullOrEmpty(state.Keyword))
{
// Fuzzy query search with keyword
pointOfInterestList = await service.GetPointOfInterestListByQueryAsync(state.CurrentCoordinates.Latitude, state.CurrentCoordinates.Longitude, state.Keyword);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList, service);
}
else if (!string.IsNullOrEmpty(state.Address))
{
// Fuzzy query search with address
pointOfInterestList = await service.GetPointOfInterestListByAddressAsync(state.CurrentCoordinates.Latitude, state.CurrentCoordinates.Longitude, state.Address);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList);
pointOfInterestList = await addressMapsService.GetPointOfInterestListByAddressAsync(state.CurrentCoordinates.Latitude, state.CurrentCoordinates.Longitude, state.Address);
cards = await GetPointOfInterestLocationCards(sc, pointOfInterestList, addressMapsService);
}

if (cards.Count() == 0)
Expand Down Expand Up @@ -457,25 +457,17 @@ protected async Task<List<PointOfInterestModel>> CurrentLocationValidator(Prompt
return await Task.FromResult(pointOfInterestList);
}

protected async Task<List<Card>> GetPointOfInterestLocationCards(DialogContext sc, List<PointOfInterestModel> pointOfInterestList)
// service: for details. the one generates pointOfInterestList
protected async Task<List<Card>> GetPointOfInterestLocationCards(DialogContext sc, List<PointOfInterestModel> pointOfInterestList, IGeoSpatialService service)
{
var state = await Accessor.GetAsync(sc.Context);
var service = ServiceManager.InitMapsService(Settings);
var addressService = ServiceManager.InitAddressMapsService(Settings);
var cards = new List<Card>();

if (pointOfInterestList != null && pointOfInterestList.Count > 0)
{
for (var i = 0; i < pointOfInterestList.Count; i++)
{
if (sc.ActiveDialog.Id.Equals(Actions.CheckForCurrentLocation))
{
pointOfInterestList[i] = await addressService.GetPointOfInterestDetailsAsync(pointOfInterestList[i]);
}
else
{
pointOfInterestList[i] = await service.GetPointOfInterestDetailsAsync(pointOfInterestList[i]);
}
pointOfInterestList[i] = await service.GetPointOfInterestDetailsAsync(pointOfInterestList[i]);

// Increase by one to avoid zero based options to the user which are confusing
pointOfInterestList[i].Index = i + 1;
Expand Down