mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-21 21:46:27 +02:00
Contact page shows operator specific info
This commit is contained in:
parent
e436e83c1d
commit
a58c33f005
51 changed files with 948 additions and 221 deletions
|
@ -113,23 +113,13 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
/// <summary>
|
||||
/// Informs about need to log in before requesting an bike.
|
||||
/// </summary>
|
||||
public FormattedString LoginRequiredHintText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ActiveUser.IsLoggedIn)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
public string LoginRequiredHintText
|
||||
=> ActiveUser.IsLoggedIn
|
||||
? string.Empty
|
||||
: AppResources.MarkingLoginRequiredToRerserve;
|
||||
|
||||
var l_oHint = new FormattedString();
|
||||
l_oHint.Spans.Add(new Span { Text = "Bitte Anmelden um Fahrräder zu reservieren! " });
|
||||
l_oHint.Spans.Add(new Span { Text = "Hier", ForegroundColor = ViewModelHelper.LINK_COLOR });
|
||||
l_oHint.Spans.Add(new Span { Text = " tippen um auf Anmeldeseite zu wechseln."});
|
||||
|
||||
return l_oHint;
|
||||
}
|
||||
}
|
||||
public string ContactSupportHintText
|
||||
=> string.Format(AppResources.MarkingContactSupport, m_oStation?.OperatorData?.Name ?? "Operator");
|
||||
|
||||
/// <summary> Returns if info about the fact that user did not request or book any bikes is visible or not.<summary>
|
||||
/// Gets message that logged in user has not booked any bikes.
|
||||
|
@ -154,21 +144,22 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
}
|
||||
|
||||
/// <summary> Command object to bind login page redirect link to view model.</summary>
|
||||
public System.Windows.Input.ICommand LoginRequiredHintClickedCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
public System.Windows.Input.ICommand ContactSupportClickedCommand
|
||||
#if USEMASTERDETAIL || USEFLYOUT
|
||||
return new Xamarin.Forms.Command(() => OpenLoginPageAsync());
|
||||
=> new Xamarin.Forms.Command(() => OpenSupportPageAsync());
|
||||
#else
|
||||
return new Xamarin.Forms.Command(async () => await OpenLoginPageAsync());
|
||||
=> new Xamarin.Forms.Command(async () => await OpenLoginPageAsync());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens login page.
|
||||
/// </summary>
|
||||
/// <summary> Command object to bind login page redirect link to view model.</summary>
|
||||
public System.Windows.Input.ICommand LoginRequiredHintClickedCommand
|
||||
#if USEMASTERDETAIL || USEFLYOUT
|
||||
=> new Xamarin.Forms.Command(() => OpenLoginPageAsync());
|
||||
#else
|
||||
=> new Xamarin.Forms.Command(async () => await OpenLoginPageAsync());
|
||||
#endif
|
||||
|
||||
/// <summary> Opens login page. </summary>
|
||||
#if USEMASTERDETAIL || USEFLYOUT
|
||||
public void OpenLoginPageAsync()
|
||||
#else
|
||||
|
@ -192,6 +183,30 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary> Opens login page. </summary>
|
||||
#if USEMASTERDETAIL || USEFLYOUT
|
||||
public void OpenSupportPageAsync()
|
||||
#else
|
||||
public async Task OpenLoginPageAsync()
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
// Switch to map page
|
||||
|
||||
#if USEMASTERDETAIL || USEFLYOUT
|
||||
ViewService.ShowPage(ViewTypes.ContactPage, m_oStation?.OperatorData?.Name ?? AppResources.MarkingFeedbackAndContact);
|
||||
#else
|
||||
await ViewService.ShowPage("//LoginPage");
|
||||
#endif
|
||||
}
|
||||
catch (Exception p_oException)
|
||||
{
|
||||
Log.Error("Ein unerwarteter Fehler ist auf der Seite Kontakt aufgetreten. Kontext: Klick auf Hinweistext auf Station N- seite ohne Anmeldung. {@Exception}", p_oException);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when page is shown.
|
||||
/// Starts update process.
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using TINK.Model.Services.CopriApi.ServerUris;
|
||||
using TINK.Model.Station;
|
||||
using TINK.MultilingualResources;
|
||||
using TINK.View;
|
||||
using Xamarin.Essentials;
|
||||
|
@ -18,6 +19,9 @@ namespace TINK.ViewModel.Info
|
|||
/// <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;
|
||||
|
||||
Uri ActiveUri { get; }
|
||||
|
||||
/// <summary> Holds a reference to the external trigger service. </summary>
|
||||
|
@ -29,6 +33,7 @@ namespace TINK.ViewModel.Info
|
|||
/// <param name="openUrlInExternalBrowser">Action to open an external browser.</param>
|
||||
/// <param name="viewService">View service to notify user.</param>
|
||||
public ContactPageViewModel(
|
||||
IStation selectedStation,
|
||||
Uri activeUri,
|
||||
Func<string> createAttachment,
|
||||
Action openUrlInExternalBrowser,
|
||||
|
@ -45,6 +50,9 @@ namespace TINK.ViewModel.Info
|
|||
|
||||
OpenUrlInExternalBrowser = openUrlInExternalBrowser
|
||||
?? throw new ArgumentException("Can not instantiate contact page view model- object. No user external browse service available.");
|
||||
|
||||
// Station might be null-station, if no station info is avialable.
|
||||
SelectedStation = selectedStation;
|
||||
}
|
||||
|
||||
/// <summary> Command object to bind login button to view model. </summary>
|
||||
|
@ -65,45 +73,19 @@ namespace TINK.ViewModel.Info
|
|||
|
||||
/// <summary>Holds the mail address to mail to.</summary>
|
||||
public string MailAddressText
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (ActiveUri.AbsoluteUri)
|
||||
{
|
||||
case CopriServerUriList.TINK_DEVEL:
|
||||
case CopriServerUriList.TINK_LIVE:
|
||||
return "tink@fahrradspezialitaeten.com";
|
||||
|
||||
case CopriServerUriList.SHAREE_DEVEL:
|
||||
case CopriServerUriList.SHAREE_LIVE:
|
||||
return "hotline@sharee.bike";
|
||||
|
||||
default:
|
||||
return "post@sharee.bike";
|
||||
}
|
||||
}
|
||||
}
|
||||
=> SelectedStation?.OperatorData?.MailAddressText ?? string.Empty;
|
||||
|
||||
/// <summary>Holds the mail address to send mail to.</summary>
|
||||
public string PhoneNumberText
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (ActiveUri.AbsoluteUri)
|
||||
{
|
||||
case CopriServerUriList.TINK_DEVEL:
|
||||
case CopriServerUriList.TINK_LIVE:
|
||||
return "+49 7531 - 3694389";
|
||||
=> SelectedStation?.OperatorData?.PhoneNumberText ?? string.Empty;
|
||||
|
||||
case CopriServerUriList.SHAREE_DEVEL:
|
||||
case CopriServerUriList.SHAREE_LIVE:
|
||||
return "+49 761 - 45370097";
|
||||
/// <summary>Holds the mail address to send mail to.</summary>
|
||||
public string OfficeHoursText
|
||||
=> SelectedStation?.OperatorData?.Hours ?? string.Empty;
|
||||
|
||||
default:
|
||||
return "+49 761 5158912";
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary> Gets whether any operator support info is avaliable. </summary>
|
||||
public bool IsOperatorInfoAvaliable
|
||||
=> MailAddressText.Length > 0 || PhoneNumberText.Length > 0;
|
||||
|
||||
/// <summary> Request to do a phone call. </summary>
|
||||
public async Task DoSendMail()
|
||||
|
@ -256,7 +238,10 @@ namespace TINK.ViewModel.Info
|
|||
get
|
||||
{
|
||||
var l_oHint = new FormattedString();
|
||||
l_oHint.Spans.Add(new Span { Text = string.Format(AppResources.MessagePhoneMail, GetAppName(ActiveUri)) });
|
||||
l_oHint.Spans.Add(new Span
|
||||
{
|
||||
Text = string.Format(AppResources.MessagePhoneMail, GetAppName(ActiveUri)) + $"{(OfficeHoursText.Length > 0 ? $" {OfficeHoursText}" : string.Empty)}"
|
||||
});
|
||||
return l_oHint;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue