mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-23 05:16:29 +02:00
Version 3.0.369
This commit is contained in:
parent
1a58bf58d3
commit
f5cf9bb22f
70 changed files with 1130 additions and 773 deletions
|
@ -75,6 +75,8 @@ namespace TINK.ViewModel.Info
|
|||
|
||||
SelectedStation = selectedStation;
|
||||
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectedStationId)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectedStationName)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MailAddressText)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OfficeHoursText)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PhoneNumberText)));
|
||||
|
@ -132,32 +134,14 @@ namespace TINK.ViewModel.Info
|
|||
return;
|
||||
}
|
||||
|
||||
// Ask whether mail is operator or app specific.
|
||||
var operatorRelatedMail = await ViewService.DisplayAlert(
|
||||
AppResources.QuestionTitle,
|
||||
string.Format(AppResources.QuestionSupportmailSubject, AppFlavorName),
|
||||
string.Format(AppResources.QuestionSupportmailAnswerOperator, AppFlavorName),
|
||||
string.Format(AppResources.QuestionSupportmailAnswerApp, AppFlavorName));
|
||||
|
||||
if (operatorRelatedMail)
|
||||
{
|
||||
// Send operator related support mail to operator.
|
||||
await Email.ComposeAsync(new EmailMessage
|
||||
{
|
||||
To = new List<string> { MailAddressText },
|
||||
Subject = string.Format(AppResources.SupportmailSubjectOperatormail, AppFlavorName)
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Send app-related support mail to operator.
|
||||
// Send operator related support mail to operator.
|
||||
await Email.ComposeAsync(new EmailMessage
|
||||
{
|
||||
To = new List<string> { MailAddressText },
|
||||
Cc = APPSUPPORTMAILADDRESS.ToUpper() != MailAddressText.ToUpper() // do not sent copy if same mail address
|
||||
&& MailAddressText != "konrad@sharee.bike" // do not sent copy if Mein konrad
|
||||
? new List<string> { APPSUPPORTMAILADDRESS } : new List<string>(),
|
||||
Subject = string.Format(AppResources.SupportmailSubjectAppmail, AppFlavorName)
|
||||
&& MailAddressText != "konrad@sharee.bike" // do not sent copy if Mein konrad
|
||||
? new List<string> { APPSUPPORTMAILADDRESS } : new List<string>(),
|
||||
Subject = string.Format(AppResources.SupportmailSubjectOperatormail, AppFlavorName, SelectedStation?.Id)
|
||||
});
|
||||
|
||||
return;
|
||||
|
@ -180,12 +164,10 @@ namespace TINK.ViewModel.Info
|
|||
try
|
||||
{
|
||||
// Ask for permission to append diagnostics.
|
||||
var appendFile = false;
|
||||
appendFile = await ViewService.DisplayAlert(
|
||||
await ViewService.DisplayAlert(
|
||||
AppResources.QuestionSupportmailTitle,
|
||||
AppResources.QuestionSupportmailAttachment,
|
||||
AppResources.QuestionAnswerYes,
|
||||
AppResources.QuestionSupportmailAnswerNo);
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
var message = new EmailMessage
|
||||
{
|
||||
|
@ -193,13 +175,6 @@ namespace TINK.ViewModel.Info
|
|||
Subject = string.Format(AppResources.SupportmailSubjectAppmail, AppFlavorName)
|
||||
};
|
||||
|
||||
if (appendFile == false)
|
||||
{
|
||||
// Send without attachment
|
||||
await Email.ComposeAsync(message);
|
||||
return;
|
||||
}
|
||||
|
||||
// Send with attachment.
|
||||
var logFileName = string.Empty;
|
||||
try
|
||||
|
@ -299,13 +274,18 @@ namespace TINK.ViewModel.Info
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary> Text providing the id of the selected station.</summary>
|
||||
public string SelectedStationId
|
||||
=> SelectedStation?.Id;
|
||||
|
||||
public string SelectedStationName
|
||||
=> SelectedStation?.StationName;
|
||||
|
||||
/// <summary> Text providing mail address and possilbe reasons to contact. </summary>
|
||||
/// <summary> Text providing the name of the operator of the selected station </summary>
|
||||
public string ProviderNameText
|
||||
=> string.Format("Betreiber: {0}", SelectedStation?.OperatorData?.Name)
|
||||
;
|
||||
/// <summary> Text providing mail address and possilbe reasons to contact. </summary>
|
||||
=> SelectedStation?.OperatorData?.Name;
|
||||
|
||||
/// <summary> Text providing mail address and possible reasons to contact. </summary>
|
||||
public FormattedString MailAddressAndMotivationsText
|
||||
{
|
||||
get
|
||||
|
@ -316,35 +296,6 @@ namespace TINK.ViewModel.Info
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary> Invitation to rate app.</summary>
|
||||
public FormattedString LikeTinkApp
|
||||
{
|
||||
get
|
||||
{
|
||||
var hint = new FormattedString();
|
||||
hint.Spans.Add(new Span { Text = string.Format(AppResources.MessageRateMail, AppFlavorName) });
|
||||
return hint;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> User clicks rate button.</summary>
|
||||
public ICommand OnRateRequest
|
||||
=> new Command(() => RegisterRequest());
|
||||
|
||||
/// <summary> Opens login page.</summary>
|
||||
public void RegisterRequest()
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenUrlInExternalBrowser();
|
||||
}
|
||||
catch (Exception p_oException)
|
||||
{
|
||||
Log.Error("Ein unerwarteter Fehler ist auf der Login Seite beim Öffnen eines Browsers, Seite {url}, aufgetreten. {@Exception}", p_oException);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Invitation to rate app.</summary>
|
||||
public FormattedString PhoneContactText
|
||||
{
|
||||
|
|
|
@ -22,6 +22,9 @@ using TINK.MultilingualResources;
|
|||
using TINK.Repository;
|
||||
using TINK.Services.Geolocation;
|
||||
using TINK.Model.State;
|
||||
using TINK.ViewModel.Map;
|
||||
using TINK.Model.Stations.StationNS;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BC;
|
||||
|
||||
namespace TINK.ViewModel.Contact
|
||||
{
|
||||
|
@ -395,6 +398,7 @@ namespace TINK.ViewModel.Contact
|
|||
|
||||
var colors = GetStationColors(
|
||||
Pins.Select(x => x.Tag.ToString()).ToList(),
|
||||
resultStationsAndBikes.Response.StationsAll,
|
||||
resultStationsAndBikes.Response.BikesOccupied);
|
||||
|
||||
// Update pins color form count of bikes located at station.
|
||||
|
@ -491,10 +495,13 @@ namespace TINK.ViewModel.Contact
|
|||
/// Gets the list of station color for all stations.
|
||||
/// </summary>
|
||||
/// <param name="stationsId">Station id list to get color for.</param>
|
||||
/// <param name="stations">Station object dictionary to get count of available bike from for each station.</param>
|
||||
/// <param name="bikesReserved">Bike collection to get count of reserved/ rented bikes from for each station.</param>
|
||||
/// <returns></returns>
|
||||
private static IList<Color> GetStationColors(
|
||||
IEnumerable<string> stationsId,
|
||||
BikeCollection bikesAll)
|
||||
internal static IList<Color> GetStationColors(
|
||||
IEnumerable<string> stationsId,
|
||||
IEnumerable<IStation> stations,
|
||||
IEnumerable<BikeInfo> bikesReserved)
|
||||
{
|
||||
if (stationsId == null)
|
||||
{
|
||||
|
@ -502,11 +509,14 @@ namespace TINK.ViewModel.Contact
|
|||
return new List<Color>();
|
||||
}
|
||||
|
||||
if (bikesAll == null)
|
||||
if (stations == null)
|
||||
{
|
||||
// If object is null an error occurred querying bikes centered or bikes occupied which results in an unknown state.
|
||||
Log.ForContext<SelectStationPageViewModel>().Error("No bikes available to determine pins color.");
|
||||
return new List<Color>(stationsId.Select(x => Color.Blue));
|
||||
Log.ForContext<SelectStationPageViewModel>().Error("No stations info available to get count of bikes available to determine whether a pin is green or not.");
|
||||
}
|
||||
|
||||
if (bikesReserved == null)
|
||||
{
|
||||
Log.ForContext<SelectStationPageViewModel>().Error("No bikes info available to determine whether a pins is light blue or not.");
|
||||
}
|
||||
|
||||
// Get state for each station.
|
||||
|
@ -514,15 +524,14 @@ namespace TINK.ViewModel.Contact
|
|||
foreach (var stationId in stationsId)
|
||||
{
|
||||
// Get color of given station.
|
||||
var bikesAtStation = bikesAll.Where(x => x.StationId == stationId).ToList();
|
||||
if (bikesAtStation.FirstOrDefault(x => x.State.Value.IsOccupied()) != null)
|
||||
if (bikesReserved?.Where(x => x.StationId == stationId).Count() > 0)
|
||||
{
|
||||
// There is at least one requested or booked bike
|
||||
colors.Add(Color.LightBlue);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bikesAtStation.ToList().Count > 0)
|
||||
if (stations?.FirstOrDefault(x => x.Id == stationId)?.AvailableBikesCount > 0)
|
||||
{
|
||||
// There is at least one bike available
|
||||
colors.Add(Color.Green);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue