Version 3.0.354

This commit is contained in:
Anja 2022-12-13 10:53:08 +01:00
parent 85321580df
commit 8b460bfebf
51 changed files with 363 additions and 570 deletions

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
@ -153,7 +153,9 @@ namespace TINK.ViewModel.Info
await Email.ComposeAsync(new EmailMessage
{
To = new List<string> { MailAddressText },
Cc = APPSUPPORTMAILADDRESS.ToUpper() != MailAddressText.ToUpper() ? new List<string> { APPSUPPORTMAILADDRESS } : new List<string>(),
Cc = APPSUPPORTMAILADDRESS.ToUpper() != MailAddressText.ToUpper() // do not sent copy if same mail adress
&& MailAddressText != "konrad@sharee.bike" // do not sent copy if Meinkonrad
? new List<string> { APPSUPPORTMAILADDRESS } : new List<string>(),
Subject = string.Format(AppResources.SupportmailSubjectAppmail, AppFlavorName)
});

View file

@ -189,39 +189,8 @@ namespace TINK.ViewModel.Contact
Pins.Add(l_oPin);
}
//Add blue dot for showing current location of user
var status = await PermissionsService.CheckStatusAsync();
if (status == Status.Granted)
{
Location currentLocation = null;
try
{
currentLocation = await GeolocationService.GetAsync();
}
catch (Exception ex)
{
Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
}
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);
}
}
}
public string currentLocationPinName = $"Location_Pin{(DeviceInfo.Platform == DevicePlatform.Android ? ".png" : string.Empty)}";
/// <summary> Update all stations from TINK. </summary>
/// <param name="stationsColorList">List of colors to apply.</param>
private void UpdatePinsColor(IList<Color> stationsColorList)
@ -231,12 +200,6 @@ namespace TINK.ViewModel.Contact
// Update colors of pins.
for (int pinIndex = 0; pinIndex < stationsColorList.Count; pinIndex++)
{
if (Pins[pinIndex].Tag.ToString() == "NotClickable")
{
Pins[pinIndex].Icon = BitmapDescriptorFactory.FromBundle(currentLocationPinName);
}
else
{
var indexPartPrefix = int.TryParse(Pins[pinIndex].Tag.ToString(), out int stationId)
&& stationId <= CUSTOM_ICONS_COUNT
? $"{stationId}" // there is a station marker with index letter for given station id
@ -255,7 +218,6 @@ namespace TINK.ViewModel.Contact
Pins[pinIndex].Label = stationId.ToString();
Pins[pinIndex].Icon = BitmapDescriptorFactory.DefaultMarker(stationsColorList[pinIndex]);
}
}
Pins[pinIndex].IsVisible = true;
}
@ -487,9 +449,6 @@ namespace TINK.ViewModel.Contact
/// <param name="selectedStationId">Id of station user clicked on.</param>
public async void OnStationClicked(string selectedStationId)
{
//Make shure currentLocationPin can not be clicked
if (selectedStationId != "NotClickable")
{
try
{
Log.ForContext<SelectStationPageViewModel>().Information($"User taped station {selectedStationId}.");
@ -527,11 +486,6 @@ namespace TINK.ViewModel.Contact
"OK");
}
#endif
}
else
{
return;
}
}
/// <summary>
@ -560,26 +514,23 @@ namespace TINK.ViewModel.Contact
var colors = new List<Color>();
foreach (var stationId in stationsId)
{
if (stationId != "NotClickable")
// Get color of given station.
var bikesAtStation = bikesAll.Where(x => x.StationId == stationId).ToList();
if (bikesAtStation.FirstOrDefault(x => x.State.Value.IsOccupied()) != null)
{
// Get color of given station.
var bikesAtStation = bikesAll.Where(x => x.StationId == stationId).ToList();
if (bikesAtStation.FirstOrDefault(x => x.State.Value.IsOccupied()) != null)
{
// There is at least one requested or booked bike
colors.Add(Color.LightBlue);
continue;
}
if (bikesAtStation.ToList().Count > 0)
{
// There is at least one bike available
colors.Add(Color.Green);
continue;
}
colors.Add(Color.Red);
// There is at least one requested or booked bike
colors.Add(Color.LightBlue);
continue;
}
if (bikesAtStation.ToList().Count > 0)
{
// There is at least one bike available
colors.Add(Color.Green);
continue;
}
colors.Add(Color.Red);
}
return colors;