Adjusted method call order in the MapPageViewModel

This commit is contained in:
Tobias Reski 2021-11-15 11:55:26 +01:00
parent 6181f3aec1
commit 950c50f218

View file

@ -314,6 +314,7 @@ namespace TINK.ViewModel.Map
ActiveFilterMap = TinkApp.GroupFilterMapPage; ActiveFilterMap = TinkApp.GroupFilterMapPage;
ActionText = AppResources.ActivityTextRequestingLocationPermissions; ActionText = AppResources.ActivityTextRequestingLocationPermissions;
Status status = await RequestLocationPermission();
ActionText = AppResources.ActivityTextMapLoadingStationsAndBikes; ActionText = AppResources.ActivityTextMapLoadingStationsAndBikes;
IsConnected = TinkApp.GetIsConnected(); IsConnected = TinkApp.GetIsConnected();
@ -338,9 +339,10 @@ namespace TINK.ViewModel.Map
Log.ForContext<MapPageViewModel>().Verbose("Update pins color done."); Log.ForContext<MapPageViewModel>().Verbose("Update pins color done.");
// Move and scale before getting stations and bikes which takes some time. // Move and scale before getting stations and bikes which takes some time.
ActionText = AppResources.ActivityTextCenterMap; ActionText = AppResources.ActivityTextCenterMap;
await MoveMapToCurrentPositionOfUser(status);
m_oViewUpdateManager = CreateUpdateTask(); m_oViewUpdateManager = CreateUpdateTask();
try try
@ -357,8 +359,6 @@ namespace TINK.ViewModel.Map
ActionText = ""; ActionText = "";
IsRunning = false; IsRunning = false;
IsMapPageEnabled = true; IsMapPageEnabled = true;
await MoveMapToCurrentPositionOfUser();
} }
catch (Exception l_oException) catch (Exception l_oException)
{ {
@ -450,10 +450,8 @@ namespace TINK.ViewModel.Map
/// Moves the map to the current position of the user. /// Moves the map to the current position of the user.
/// If location permission hasn't been granted, the position is not adjusted. /// If location permission hasn't been granted, the position is not adjusted.
/// </summary> /// </summary>
private async Task MoveMapToCurrentPositionOfUser() private async Task MoveMapToCurrentPositionOfUser(Status status)
{ {
Status status = await RequestLocationPermission();
if (status == Status.Granted) if (status == Status.Granted)
{ {
ActionText = AppResources.ActivityTextCenterMap; ActionText = AppResources.ActivityTextCenterMap;