mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-19 03:27:29 +02:00
Version 3.0.338
This commit is contained in:
parent
573fe77e12
commit
0468955d49
751 changed files with 62747 additions and 60672 deletions
|
@ -5,7 +5,6 @@ using System.Threading.Tasks;
|
|||
using System.Windows.Input;
|
||||
using Plugin.Messaging;
|
||||
using Serilog;
|
||||
using TINK.Model.Services.CopriApi.ServerUris;
|
||||
using TINK.Model.Station;
|
||||
using TINK.MultilingualResources;
|
||||
using TINK.View;
|
||||
|
@ -14,378 +13,347 @@ using Xamarin.Forms;
|
|||
|
||||
namespace TINK.ViewModel.Info
|
||||
{
|
||||
/// <summary> View model for contact page.</summary>
|
||||
public class ContactPageViewModel : INotifyPropertyChanged
|
||||
{
|
||||
/// <summary>
|
||||
/// Mail address for app related support.
|
||||
/// </summary>
|
||||
public const string APPSUPPORTMAILADDRESS = "hotline@sharee.bike";
|
||||
/// <summary> View model for contact page.</summary>
|
||||
public class ContactPageViewModel : INotifyPropertyChanged
|
||||
{
|
||||
/// <summary>
|
||||
/// Mail address for app related support.
|
||||
/// </summary>
|
||||
public const string APPSUPPORTMAILADDRESS = "hotline@sharee.bike";
|
||||
|
||||
/// <summary> Reference on view service to show modal notifications and to perform navigation. </summary>
|
||||
private IViewService ViewService { get; }
|
||||
/// <summary> Reference on view service to show modal notifications and to perform navigation. </summary>
|
||||
private IViewService ViewService { get; }
|
||||
|
||||
/// <summary> Station selected by user. </summary>
|
||||
private IStation SelectedStation { get; set; } = new NullStation();
|
||||
/// <summary> Station selected by user. </summary>
|
||||
private IStation SelectedStation { get; set; } = new NullStation();
|
||||
|
||||
Uri ActiveUri { get; }
|
||||
/// <summary> Holds the name of the app (sharee.bike, Mein konrad, ...)</summary>
|
||||
string AppFlavorName { get; }
|
||||
|
||||
/// <summary> Holds the name of the app (sharee.bike, Mein konrad, ...)</summary>
|
||||
string AppName { get; }
|
||||
/// <summary> Holds a reference to the external trigger service. </summary>
|
||||
private Action OpenUrlInExternalBrowser { get; }
|
||||
|
||||
/// <summary> Holds a reference to the external trigger service. </summary>
|
||||
private Action OpenUrlInExternalBrowser { get; }
|
||||
Func<string> CreateAttachment { get; }
|
||||
|
||||
Func<string> CreateAttachment { get; }
|
||||
/// <summary> Notifies view about changes. </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary> Notifies view about changes. </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
/// <summary> Constructs a contact page view model. </summary>
|
||||
/// <param name="appFlavorName">Holds the name of the app.</param>
|
||||
/// <param name="openUrlInExternalBrowser">Action to open an external browser.</param>
|
||||
/// <param name="viewService">View service to notify user.</param>
|
||||
public ContactPageViewModel(
|
||||
string appFlavorName,
|
||||
Func<string> createAttachment,
|
||||
Action openUrlInExternalBrowser,
|
||||
IViewService viewService)
|
||||
{
|
||||
AppFlavorName = !string.IsNullOrEmpty(appFlavorName)
|
||||
? appFlavorName
|
||||
: throw new ArgumentException("Can not instantiate contact page view model- object. No app name availalbe.");
|
||||
|
||||
/// <summary> Constructs a contact page view model. </summary>
|
||||
/// <param name="openUrlInExternalBrowser">Action to open an external browser.</param>
|
||||
/// <param name="viewService">View service to notify user.</param>
|
||||
public ContactPageViewModel(
|
||||
Uri activeUri,
|
||||
string appName,
|
||||
Func<string> createAttachment,
|
||||
Action openUrlInExternalBrowser,
|
||||
IViewService viewService)
|
||||
{
|
||||
ActiveUri = activeUri
|
||||
?? throw new ArgumentException("Can not instantiate contact page view model- object. No active uri available.");
|
||||
CreateAttachment = createAttachment
|
||||
?? throw new ArgumentException("Can not instantiate contact page view model- object. No create attachment provider available.");
|
||||
|
||||
AppName = !string.IsNullOrEmpty(appName)
|
||||
? appName
|
||||
: throw new ArgumentException("Can not instantiate contact page view model- object. No app name availalbe.");
|
||||
ViewService = viewService
|
||||
?? throw new ArgumentException("Can not instantiate contact page view model- object. No user view service available.");
|
||||
|
||||
CreateAttachment = createAttachment
|
||||
?? throw new ArgumentException("Can not instantiate contact page view model- object. No create attachment provider available.");
|
||||
OpenUrlInExternalBrowser = openUrlInExternalBrowser
|
||||
?? throw new ArgumentException("Can not instantiate contact page view model- object. No user external browse service available.");
|
||||
}
|
||||
|
||||
ViewService = viewService
|
||||
?? throw new ArgumentException("Can not instantiate contact page view model- object. No user view service available.");
|
||||
/// <summary> Is invoked when page is shown. </summary>
|
||||
public async Task OnAppearing(
|
||||
IStation selectedStation)
|
||||
{
|
||||
if (SelectedStation?.Id == selectedStation?.Id)
|
||||
{
|
||||
// Nothing to do because either both are null or of same id.
|
||||
return;
|
||||
}
|
||||
|
||||
OpenUrlInExternalBrowser = openUrlInExternalBrowser
|
||||
?? throw new ArgumentException("Can not instantiate contact page view model- object. No user external browse service available.");
|
||||
}
|
||||
SelectedStation = selectedStation;
|
||||
|
||||
/// <summary> Is invoked when page is shown. </summary>
|
||||
public async Task OnAppearing(
|
||||
IStation selectedStation)
|
||||
{
|
||||
if (SelectedStation?.Id == selectedStation?.Id)
|
||||
{
|
||||
// Nothing to do because either both are null or of same id.
|
||||
return;
|
||||
}
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MailAddressText)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OfficeHoursText)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PhoneNumberText)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ProviderNameText)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsOperatorInfoAvaliable)));
|
||||
|
||||
SelectedStation = selectedStation;
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MailAddressText)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OfficeHoursText)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PhoneNumberText)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ProviderNameText)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsOperatorInfoAvaliable)));
|
||||
/// <summary> Command object to bind mail button to view model. </summary>
|
||||
public ICommand OnMailToOperatorRequest
|
||||
=> new Command(
|
||||
async () => await DoSendMailToOperator(),
|
||||
() => IsSendMailAvailable);
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
/// <summary> Command object to bind mail app releated button to model. </summary>
|
||||
public ICommand OnMailAppRelatedRequest
|
||||
=> new Command(
|
||||
async () => await DoSendMailAppRelated(),
|
||||
() => IsSendMailAvailable);
|
||||
|
||||
/// <summary> Command object to bind mail button to view model. </summary>
|
||||
public ICommand OnMailRequest
|
||||
=> new Command(
|
||||
async () =>
|
||||
{
|
||||
if (await DoSendMailToOperator())
|
||||
{
|
||||
// Mail sent to operator or no mailer availble.
|
||||
return;
|
||||
}
|
||||
|
||||
await DoSendMailAppRelated(
|
||||
new List<string> { MailAddressText },
|
||||
MailAddressText.ToUpper() != APPSUPPORTMAILADDRESS.ToUpper()
|
||||
? new List<string> { APPSUPPORTMAILADDRESS }
|
||||
: new List<string>());
|
||||
},
|
||||
() => IsSendMailAvailable);
|
||||
|
||||
/// <summary> Command object to bind mail app releated button to model. </summary>
|
||||
public ICommand OnSendAppFeedbackMailRequest
|
||||
=> new Command(
|
||||
async () => await DoSendMailToOperator(),
|
||||
() => IsSendMailAvailable);
|
||||
|
||||
/// <summary> Command object to bind mail app releated button to model. </summary>
|
||||
public ICommand OnMailAppRelatedRequest
|
||||
=> new Command(
|
||||
async () => await DoSendMailAppRelated(new List<string> { APPSUPPORTMAILADDRESS }, new List<string>()),
|
||||
() => IsSendMailAvailable);
|
||||
|
||||
/// <summary>True if sending mail is possible.</summary>
|
||||
public bool IsSendMailAvailable =>
|
||||
CrossMessaging.Current.EmailMessenger.CanSendEmail;
|
||||
/// <summary>True if sending mail is possible.</summary>
|
||||
public bool IsSendMailAvailable =>
|
||||
CrossMessaging.Current.EmailMessenger.CanSendEmail;
|
||||
|
||||
|
||||
/// <summary>cTrue if doing a phone call is possible.</summary>
|
||||
public bool IsDoPhoncallAvailable
|
||||
=> CrossMessaging.Current.PhoneDialer.CanMakePhoneCall;
|
||||
/// <summary>cTrue if doing a phone call is possible.</summary>
|
||||
public bool IsDoPhoncallAvailable
|
||||
=> CrossMessaging.Current.PhoneDialer.CanMakePhoneCall;
|
||||
|
||||
/// <summary>Holds the mail address to mail to.</summary>
|
||||
public string MailAddressText
|
||||
=> SelectedStation?.OperatorData?.MailAddressText ?? string.Empty;
|
||||
/// <summary>Holds the mail address to mail to.</summary>
|
||||
public string MailAddressText
|
||||
=> SelectedStation?.OperatorData?.MailAddressText ?? string.Empty;
|
||||
|
||||
/// <summary>Holds the mail address to send mail to.</summary>
|
||||
public string PhoneNumberText
|
||||
=> SelectedStation?.OperatorData?.PhoneNumberText ?? string.Empty;
|
||||
/// <summary>Holds the mail address to send mail to.</summary>
|
||||
public string PhoneNumberText
|
||||
=> SelectedStation?.OperatorData?.PhoneNumberText ?? string.Empty;
|
||||
|
||||
/// <summary>Holds the mail address to send mail to.</summary>
|
||||
public string OfficeHoursText
|
||||
=> SelectedStation?.OperatorData?.Hours ?? string.Empty;
|
||||
/// <summary>Holds the mail address to send mail to.</summary>
|
||||
public string OfficeHoursText
|
||||
=> SelectedStation?.OperatorData?.Hours ?? string.Empty;
|
||||
|
||||
/// <summary> Gets whether any operator support info is avaliable. </summary>
|
||||
public bool IsOperatorInfoAvaliable
|
||||
=> MailAddressText.Length > 0 || PhoneNumberText.Length > 0;
|
||||
/// <summary> Gets whether any operator support info is avaliable. </summary>
|
||||
public bool IsOperatorInfoAvaliable
|
||||
=> MailAddressText.Length > 0 || PhoneNumberText.Length > 0;
|
||||
|
||||
/// <returns> Returns true if eithe mail was sent or if no mailer available.</returns>
|
||||
public async Task<bool> DoSendMailToOperator()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!IsSendMailAvailable)
|
||||
{
|
||||
// Nothing to do because email can not be sent.
|
||||
return true;
|
||||
}
|
||||
/// <returns> Returns true if eithe mail was sent or if no mailer available.</returns>
|
||||
public async Task DoSendMailToOperator()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!IsSendMailAvailable)
|
||||
{
|
||||
// Nothing to do because email can not be sent.
|
||||
return;
|
||||
}
|
||||
|
||||
// Ask whether mail is operator or app specific.
|
||||
var operatorRelatedMail = await ViewService.DisplayAlert(
|
||||
AppResources.QuestionTitle,
|
||||
string.Format(AppResources.QuestionSupportmailSubject, GetAppName(ActiveUri)),
|
||||
string.Format(AppResources.QuestionSupportmailAnswerOperator, GetAppName(ActiveUri)),
|
||||
string.Format(AppResources.QuestionSupportmailAnswerApp, GetAppName(ActiveUri)));
|
||||
// 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.
|
||||
await Email.ComposeAsync(new EmailMessage { To = new List<string> { MailAddressText }, Subject = $"{GetAppName(ActiveUri)} Anfrage" });
|
||||
return true;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
return false;
|
||||
// Send app-related related support mail to operator.
|
||||
await Email.ComposeAsync(new EmailMessage
|
||||
{
|
||||
To = new List<string> { MailAddressText },
|
||||
Cc = APPSUPPORTMAILADDRESS.ToUpper() != MailAddressText.ToUpper() ? new List<string> { APPSUPPORTMAILADDRESS } : new List<string>(),
|
||||
Subject = string.Format(AppResources.SupportmailSubjectAppmail, AppFlavorName)
|
||||
});
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Error("An unexpected error occurred sending mail to operator. {@Exception}", exception);
|
||||
await ViewService.DisplayAdvancedAlert(
|
||||
AppResources.MessageWaring,
|
||||
AppResources.ErrorSupportmailMailingFailed,
|
||||
exception.Message,
|
||||
AppResources.MessageAnswerOk);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Error("An unexpected error occurred sending mail to operator. {@Exception}", exception);
|
||||
await ViewService.DisplayAdvancedAlert(
|
||||
AppResources.MessageWaring,
|
||||
AppResources.ErrorSupportmailMailingFailed,
|
||||
exception.Message,
|
||||
AppResources.MessageAnswerOk);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Request to send a app related mail. </summary>
|
||||
public async Task DoSendMailAppRelated(List<string> to, List<string> cc)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Send app related mail
|
||||
var appendFile = false;
|
||||
appendFile = await ViewService.DisplayAlert(
|
||||
AppResources.QuestionTitle,
|
||||
AppResources.QuestionSupportmailAttachment,
|
||||
AppResources.QuestionAnswerYes,
|
||||
AppResources.QuestionAnswerNo);
|
||||
/// <summary> Request to send a app related mail. </summary>
|
||||
public async Task DoSendMailAppRelated()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Ask for permission to append diagnostics.
|
||||
var appendFile = false;
|
||||
appendFile = await ViewService.DisplayAlert(
|
||||
AppResources.QuestionSupportmailTitle,
|
||||
AppResources.QuestionSupportmailAttachment,
|
||||
AppResources.QuestionAnswerYes,
|
||||
AppResources.QuestionSupportmailAnswerNo);
|
||||
|
||||
var message = new EmailMessage
|
||||
{
|
||||
To = to,
|
||||
Cc = cc,
|
||||
Subject = $"{GetAppName(ActiveUri)}-App Anfrage"
|
||||
};
|
||||
var message = new EmailMessage
|
||||
{
|
||||
To = new List<string> { APPSUPPORTMAILADDRESS },
|
||||
Subject = string.Format(AppResources.SupportmailSubjectAppmail, AppFlavorName)
|
||||
};
|
||||
|
||||
if (appendFile == false)
|
||||
{
|
||||
// Send without attachment
|
||||
await Email.ComposeAsync(message);
|
||||
return;
|
||||
}
|
||||
if (appendFile == false)
|
||||
{
|
||||
// Send without attachment
|
||||
await Email.ComposeAsync(message);
|
||||
return;
|
||||
}
|
||||
|
||||
// Send with attachment.
|
||||
var logFileName = string.Empty;
|
||||
try
|
||||
{
|
||||
logFileName = CreateAttachment();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
await ViewService.DisplayAdvancedAlert(
|
||||
AppResources.MessageWaring,
|
||||
AppResources.ErrorSupportmailCreateAttachment,
|
||||
exception.Message,
|
||||
AppResources.MessageAnswerOk);
|
||||
Log.Error("An error occurred creating attachment. {@Exception)", exception);
|
||||
}
|
||||
// Send with attachment.
|
||||
var logFileName = string.Empty;
|
||||
try
|
||||
{
|
||||
logFileName = CreateAttachment();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
await ViewService.DisplayAdvancedAlert(
|
||||
AppResources.MessageWaring,
|
||||
AppResources.ErrorSupportmailCreateAttachment,
|
||||
exception.Message,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
if (!string.IsNullOrEmpty(logFileName))
|
||||
{
|
||||
message.Attachments.Add(new Xamarin.Essentials.EmailAttachment(logFileName));
|
||||
}
|
||||
Log.ForContext<ContactPageViewModel>().Error("An error occurred creating attachment for app mail. {@Exception)", exception);
|
||||
}
|
||||
|
||||
// Send a tink app related mail
|
||||
await Email.ComposeAsync(message);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Error("An unexpected error occurred sending mail. {@Exception}", exception);
|
||||
await ViewService.DisplayAdvancedAlert(
|
||||
AppResources.MessageWaring,
|
||||
AppResources.ErrorSupportmailMailingFailed,
|
||||
exception.Message,
|
||||
AppResources.MessageAnswerOk);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(logFileName))
|
||||
{
|
||||
message.Attachments.Add(new Xamarin.Essentials.EmailAttachment(logFileName));
|
||||
}
|
||||
|
||||
/// <summary> Command object to bind login button to view model. </summary>
|
||||
public ICommand OnSelectStationRequest
|
||||
// Send a tink app related mail
|
||||
await Email.ComposeAsync(message);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext<ContactPageViewModel>().Error("An unexpected error occurred sending mail. {@Exception}", exception);
|
||||
await ViewService.DisplayAdvancedAlert(
|
||||
AppResources.MessageWaring,
|
||||
AppResources.ErrorSupportmailMailingFailed,
|
||||
exception.Message,
|
||||
AppResources.MessageAnswerOk);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Command object to bind login button to view model. </summary>
|
||||
public ICommand OnSelectStationRequest
|
||||
#if USEFLYOUT
|
||||
=> new Xamarin.Forms.Command(() => OpenSelectStationPage());
|
||||
#else
|
||||
=> new Xamarin.Forms.Command(async () => await OpenSelectStationPageAsync());
|
||||
=> new Xamarin.Forms.Command(async () => await OpenSelectStationPageAsync());
|
||||
#endif
|
||||
|
||||
/// <summary> Opens login page. </summary>
|
||||
/// <summary> Opens login page. </summary>
|
||||
#if USEFLYOUT
|
||||
public void OpenSelectStationPage()
|
||||
#else
|
||||
public async Task OpenSelectStationPageAsync()
|
||||
public async Task OpenSelectStationPageAsync()
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
// Switch to map page
|
||||
{
|
||||
try
|
||||
{
|
||||
// Switch to map page
|
||||
|
||||
#if USEFLYOUT
|
||||
ViewService.PushAsync(ViewTypes.SelectStationPage);
|
||||
#else
|
||||
await ViewService.PushAsync(ViewTypes.SelectStationPage);
|
||||
await ViewService.PushAsync(ViewTypes.SelectStationPage);
|
||||
#endif
|
||||
}
|
||||
catch (Exception p_oException)
|
||||
{
|
||||
Log.Error("Ein unerwarteter Fehler ist in der Klasse ContactPageViewModel aufgetreten. Kontext: Klick auf Hinweistext auf Station N- seite ohne Anmeldung. {@Exception}", p_oException);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception p_oException)
|
||||
{
|
||||
Log.Error("Ein unerwarteter Fehler ist in der Klasse ContactPageViewModel aufgetreten. Kontext: Klick auf Hinweistext auf Station N- seite ohne Anmeldung. {@Exception}", p_oException);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Command object to bind phone call button. </summary>
|
||||
public ICommand OnPhoneRequest
|
||||
=> new Command(
|
||||
async () => await DoPhoneCall(),
|
||||
() => IsDoPhoncallAvailable);
|
||||
/// <summary> Command object to bind phone call button. </summary>
|
||||
public ICommand OnPhoneRequest
|
||||
=> new Command(
|
||||
async () => await DoPhoneCall(),
|
||||
() => IsDoPhoncallAvailable);
|
||||
|
||||
/// <summary> Request to do a phone call. </summary>
|
||||
public async Task DoPhoneCall()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make Phone Call
|
||||
if (IsDoPhoncallAvailable)
|
||||
{
|
||||
CrossMessaging.Current.PhoneDialer.MakePhoneCall(PhoneNumberText);
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Error("An unexpected error occurred doing a phone call. {@Exception}", exception);
|
||||
await ViewService.DisplayAdvancedAlert(
|
||||
AppResources.MessageWaring,
|
||||
AppResources.ErrorSupportmailPhoningFailed,
|
||||
exception.Message,
|
||||
AppResources.MessageAnswerOk);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/// <summary> Request to do a phone call. </summary>
|
||||
public async Task DoPhoneCall()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make Phone Call
|
||||
if (IsDoPhoncallAvailable)
|
||||
{
|
||||
CrossMessaging.Current.PhoneDialer.MakePhoneCall(PhoneNumberText);
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Error("An unexpected error occurred doing a phone call. {@Exception}", exception);
|
||||
await ViewService.DisplayAdvancedAlert(
|
||||
AppResources.MessageWaring,
|
||||
AppResources.ErrorSupportmailPhoningFailed,
|
||||
exception.Message,
|
||||
AppResources.MessageAnswerOk);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary> Text providing mail address and possilbe reasons to contact. </summary>
|
||||
public string ProviderNameText
|
||||
=> string.Format("Betreiber: {0}", SelectedStation?.OperatorData?.Name)
|
||||
/// <summary> Text providing mail address and possilbe reasons to contact. </summary>
|
||||
public string ProviderNameText
|
||||
=> string.Format("Betreiber: {0}", SelectedStation?.OperatorData?.Name)
|
||||
;
|
||||
/// <summary> Text providing mail address and possilbe reasons to contact. </summary>
|
||||
public FormattedString MailAddressAndMotivationsText
|
||||
{
|
||||
get
|
||||
{
|
||||
var hint = new FormattedString();
|
||||
hint.Spans.Add(new Span { Text = AppResources.MessageContactMail });
|
||||
return hint;
|
||||
}
|
||||
}
|
||||
/// <summary> Text providing mail address and possilbe reasons to contact. </summary>
|
||||
public FormattedString MailAddressAndMotivationsText
|
||||
{
|
||||
get
|
||||
{
|
||||
var hint = new FormattedString();
|
||||
hint.Spans.Add(new Span { Text = AppResources.MessageContactMail });
|
||||
return hint;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Invitation to rate app.</summary>
|
||||
public FormattedString LikeTinkApp
|
||||
{
|
||||
get
|
||||
{
|
||||
var l_oHint = new FormattedString();
|
||||
l_oHint.Spans.Add(new Span { Text = string.Format(AppResources.MessageRateMail, AppName) });
|
||||
return l_oHint;
|
||||
}
|
||||
}
|
||||
/// <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> 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> 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
|
||||
{
|
||||
get
|
||||
{
|
||||
var l_oHint = new FormattedString();
|
||||
l_oHint.Spans.Add(new Span
|
||||
{
|
||||
Text = string.Format(AppResources.MessagePhoneMail, GetAppName(ActiveUri)) + $"{(OfficeHoursText.Length > 0 ? $" {OfficeHoursText}" : string.Empty)}"
|
||||
});
|
||||
return l_oHint;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the application name.</summary>
|
||||
public static string GetAppName(Uri activeUri)
|
||||
{
|
||||
switch (activeUri.AbsoluteUri)
|
||||
{
|
||||
case CopriServerUriList.TINK_DEVEL:
|
||||
case CopriServerUriList.TINK_LIVE:
|
||||
return "TINK";
|
||||
|
||||
case CopriServerUriList.SHAREE_DEVEL:
|
||||
case CopriServerUriList.SHAREE_LIVE:
|
||||
return "sharee.bike";
|
||||
|
||||
default:
|
||||
return "Teilrad";
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary> Invitation to rate app.</summary>
|
||||
public FormattedString PhoneContactText
|
||||
{
|
||||
get
|
||||
{
|
||||
var l_oHint = new FormattedString();
|
||||
l_oHint.Spans.Add(new Span
|
||||
{
|
||||
Text = string.Format(AppResources.MessagePhoneMail, AppFlavorName) + $"{(OfficeHoursText.Length > 0 ? $" {OfficeHoursText}" : string.Empty)}"
|
||||
});
|
||||
return l_oHint;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue