Version 3.0.353

This commit is contained in:
Anja 2022-12-07 16:54:52 +01:00
parent 5ea2e3b0ca
commit 85321580df
57 changed files with 1421 additions and 888 deletions

View file

@ -191,28 +191,32 @@ namespace TINK.ViewModel.Contact
}
//Add blue dot for showing current location of user
Location currentLocation = null;
try
var status = await PermissionsService.CheckStatusAsync();
if (status == Status.Granted)
{
currentLocation = await GeolocationService.GetAsync();
}
catch (Exception ex)
{
Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
}
if (currentLocation != null)
{
var currentLocationPin = new Pin()
Location currentLocation = null;
try
{
Position = new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude),
Label = "currentLocationPin",
Type = PinType.Place,
Tag = "NotClickable",
Icon = BitmapDescriptorFactory.FromBundle(currentLocationPinName)
};
currentLocation = await GeolocationService.GetAsync();
}
catch (Exception ex)
{
Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
}
Pins.Add(currentLocationPin);
if (currentLocation != null)
{
var currentLocationPin = new Pin()
{
Position = new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude),
Label = "currentLocationPin",
Type = PinType.Place,
Tag = "NotClickable",
Icon = BitmapDescriptorFactory.FromBundle(currentLocationPinName)
};
Pins.Add(currentLocationPin);
}
}
}
@ -313,17 +317,15 @@ namespace TINK.ViewModel.Contact
if (Pins.Count <= 0)
{
ActionText = AppResources.ActivityTextRequestingLocationPermissions;
// Check location permission
var status = await PermissionsService.CheckStatusAsync();
if (TinkApp.CenterMapToCurrentLocation
&& !GeolocationService.IsSimulation
&& status != Status.Granted)
// Move and scale before getting stations and bikes which takes some time.
if (TinkApp.CenterMapToCurrentLocation)
{
var permissionResult = await PermissionsService.RequestAsync();
ActionText = AppResources.ActivityTextRequestingLocationPermissions;
if (permissionResult != Status.Granted)
// Check location permission
var status = await PermissionsService.CheckStatusAsync();
if (!GeolocationService.IsSimulation
&& status != Status.Granted)
{
var dialogResult = await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
@ -341,23 +343,25 @@ namespace TINK.ViewModel.Contact
return;
}
}
}
if (status == Status.Granted)
{
ActionText = AppResources.ActivityTextCenterMap;
// Move and scale before getting stations and bikes which takes some time.
ActionText = AppResources.ActivityTextCenterMap;
Location currentLocation = null;
try
{
currentLocation = TinkApp.CenterMapToCurrentLocation
? await GeolocationService.GetAsync()
: null;
}
catch (Exception ex)
{
Log.ForContext<SelectStationPageViewModel>().Error("Getting location failed. {Exception}", ex);
}
Location currentLocation = null;
try
{
currentLocation = TinkApp.CenterMapToCurrentLocation
? await GeolocationService.GetAsync()
: null;
}
catch (Exception ex)
{
Log.ForContext<SelectStationPageViewModel>().Error("Getting location failed. {Exception}", ex);
}
MoveAndScale(m_oMoveToRegionDelegate, TinkApp.Uris.ActiveUri, currentLocation);
MoveAndScale(m_oMoveToRegionDelegate, TinkApp.Uris.ActiveUri, currentLocation);
}
}
}
ActionText = AppResources.ActivityTextMapLoadingStationsAndBikes;