mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-21 20:46:28 +02:00
Version 3.0.261
This commit is contained in:
parent
8aa3089f32
commit
4bccfe740b
80 changed files with 2672 additions and 458 deletions
|
@ -158,9 +158,7 @@ namespace TINK.ViewModel.Account
|
|||
return AppResources.MarkingLoggedInStateInfoNotLoggedIn;
|
||||
}
|
||||
|
||||
return TinkApp.ActiveUser.Group.Intersect(new List<string> { FilterHelper.FILTERTINKGENERAL, FilterHelper.FILTERKONRAD }).Any()
|
||||
? string.Format(AppResources.MarkingLoggedInStateInfoLoggedInGroup, TinkApp.ActiveUser.Mail, TinkApp.ActiveUser.GetUserGroupDisplayName())
|
||||
: string.Format(AppResources.MarkingLoggedInStateInfoLoggedIn, TinkApp.ActiveUser.Mail);
|
||||
return string.Format(AppResources.MarkingLoggedInStateInfoLoggedIn, TinkApp.ActiveUser.Mail);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ using Xamarin.Essentials;
|
|||
using System.Threading;
|
||||
using TINK.MultilingualResources;
|
||||
using TINK.Services.BluetoothLock;
|
||||
using TINK.Model.Services.CopriApi.ServerUris;
|
||||
using TINK.ViewModel.Info;
|
||||
using TINK.Repository;
|
||||
using TINK.Model.Services.Geolocation;
|
||||
|
@ -420,19 +419,26 @@ namespace TINK.ViewModel.Map
|
|||
|
||||
// Move and scale before getting stations and bikes which takes some time.
|
||||
ActionText = AppResources.ActivityTextCenterMap;
|
||||
Location currentLocation = null;
|
||||
try
|
||||
if (TinkApp.CenterMapToCurrentLocation)
|
||||
{
|
||||
currentLocation = TinkApp.CenterMapToCurrentLocation
|
||||
? await GeolocationService.GetAsync()
|
||||
: null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
|
||||
Location currentLocation = null;
|
||||
try
|
||||
{
|
||||
currentLocation = await GeolocationService.GetAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
|
||||
}
|
||||
|
||||
TinkApp.MapSpan = MapSpan.FromCenterAndRadius(
|
||||
new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude),
|
||||
TinkApp.MapSpan.Radius);
|
||||
|
||||
TinkApp.Save();
|
||||
}
|
||||
|
||||
MoveAndScale(m_oMoveToRegionDelegate, TinkApp.Uris.ActiveUri, ActiveFilterMap, currentLocation);
|
||||
MoveAndScale(m_oMoveToRegionDelegate, TinkApp.MapSpan);
|
||||
|
||||
m_oViewUpdateManager = CreateUpdateTask();
|
||||
|
||||
|
@ -471,44 +477,14 @@ namespace TINK.ViewModel.Map
|
|||
/// <summary> Moves map and scales visible region depending on active filter. </summary>
|
||||
public static void MoveAndScale(
|
||||
Action<MapSpan> moveToRegionDelegate,
|
||||
Uri activeUri,
|
||||
IGroupFilterMapPage groupFilterMapPage,
|
||||
Location currentLocation = null)
|
||||
MapSpan currentMapSpan = null)
|
||||
{
|
||||
if (currentLocation != null)
|
||||
if (currentMapSpan != null)
|
||||
{
|
||||
// Move to current location.
|
||||
moveToRegionDelegate(MapSpan.FromCenterAndRadius(
|
||||
new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude),
|
||||
Distance.FromKilometers(1.0)));
|
||||
moveToRegionDelegate(currentMapSpan);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeUri.AbsoluteUri == CopriServerUriList.SHAREE_LIVE ||
|
||||
activeUri.AbsoluteUri == CopriServerUriList.SHAREE_DEVEL)
|
||||
{
|
||||
// Center map to Freiburg
|
||||
moveToRegionDelegate(MapSpan.FromCenterAndRadius(
|
||||
new Xamarin.Forms.GoogleMaps.Position(47.995865, 7.815086),
|
||||
Distance.FromKilometers(2.9)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Depending on whether TINK or Conrad is active set center of map and scale.
|
||||
if (groupFilterMapPage.GetGroup().Contains(FilterHelper.FILTERKONRAD))
|
||||
{
|
||||
// Konrad is activated,
|
||||
moveToRegionDelegate(MapSpan.FromCenterAndRadius(
|
||||
new Xamarin.Forms.GoogleMaps.Position(47.680, 9.180),
|
||||
Distance.FromKilometers(2.9)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// TINK
|
||||
moveToRegionDelegate(MapSpan.FromCenterAndRadius(
|
||||
new Xamarin.Forms.GoogleMaps.Position(47.667, 9.172),
|
||||
Distance.FromKilometers(0.9)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Creates a update task object. </summary>
|
||||
|
@ -894,21 +870,27 @@ namespace TINK.ViewModel.Map
|
|||
}
|
||||
|
||||
// Move and scale before getting stations and bikes which takes some time.
|
||||
Location currentLocation = null;
|
||||
try
|
||||
if (TinkApp.CenterMapToCurrentLocation)
|
||||
{
|
||||
currentLocation = TinkApp.CenterMapToCurrentLocation
|
||||
? await GeolocationService.GetAsync()
|
||||
: null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
|
||||
Location currentLocation = null;
|
||||
try
|
||||
{
|
||||
currentLocation = await GeolocationService.GetAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
|
||||
}
|
||||
|
||||
TinkApp.MapSpan = MapSpan.FromCenterAndRadius(
|
||||
new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude),
|
||||
TinkApp.MapSpan.Radius);
|
||||
|
||||
TinkApp.Save();
|
||||
}
|
||||
|
||||
// Update stations
|
||||
// Depending on whether TINK or Conrad is active set center of map and scale.
|
||||
MoveAndScale(m_oMoveToRegionDelegate, TinkApp.Uris.ActiveUri, ActiveFilterMap, currentLocation);
|
||||
MoveAndScale(m_oMoveToRegionDelegate, TinkApp.MapSpan);
|
||||
|
||||
IsConnected = TinkApp.GetIsConnected();
|
||||
var resultStationsAndBikes = await TinkApp.GetConnector(IsConnected).Query.GetBikesAndStationsAsync();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue