Version 3.0.338

This commit is contained in:
Anja Müller-Meißner 2022-09-06 16:08:19 +02:00 committed by Anja
parent 573fe77e12
commit 0468955d49
751 changed files with 62747 additions and 60672 deletions

View file

@ -8,78 +8,78 @@ using Xamarin.Forms;
namespace TINK.ViewModel.WhatsNew.Agb
{
public class AgbViewModel : INotifyPropertyChanged
{
/// <summary> Fired whenever a property changed.</summary>
public event PropertyChangedEventHandler PropertyChanged;
public class AgbViewModel : INotifyPropertyChanged
{
/// <summary> Fired whenever a property changed.</summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary> Holds the name of the host.</summary>
private string HostName { get; }
/// <summary> Holds the name of the host.</summary>
private string HostName { get; }
/// <summary> Holds value wether site caching is on or off.</summary>
bool IsSiteCachingOn { get; }
/// <summary> Holds value wether site caching is on or off.</summary>
bool IsSiteCachingOn { get; }
/// <summary>
/// Holds the current ui two letter ISO language name.
/// </summary>
private string UiIsoLanguageName { get; }
/// <summary>
/// Holds the current ui two letter ISO language name.
/// </summary>
private string UiIsoLanguageName { get; }
/// <summary> Constructs AGB view model</summary>
/// <param name="isSiteCachingOn">Holds value wether site caching is on or off.</param>
/// <param name="uiIsoLangugageName">Two letter ISO language name.</param>
/// <param name="resourceProvider">Delegate to get an an embedded html ressource. Used as fallback if download from web page does not work and cache is empty.</param>
/// <param name="viewService">View service to close page.</param>
public AgbViewModel(
string hostName,
bool isSiteCachingOn,
string uiIsoLangugageName,
Func<string, string> resourceProvider,
IViewService viewService)
{
HostName = hostName;
IsSiteCachingOn = isSiteCachingOn;
UiIsoLanguageName = uiIsoLangugageName;
/// <summary> Constructs AGB view model</summary>
/// <param name="isSiteCachingOn">Holds value wether site caching is on or off.</param>
/// <param name="uiIsoLangugageName">Two letter ISO language name.</param>
/// <param name="resourceProvider">Delegate to get an an embedded html ressource. Used as fallback if download from web page does not work and cache is empty.</param>
/// <param name="viewService">View service to close page.</param>
public AgbViewModel(
string hostName,
bool isSiteCachingOn,
string uiIsoLangugageName,
Func<string, string> resourceProvider,
IViewService viewService)
{
HostName = hostName;
IsSiteCachingOn = isSiteCachingOn;
UiIsoLanguageName = uiIsoLangugageName;
ViewService = viewService
?? throw new ArgumentException($"Can not instantiate {typeof(WhatsNewViewModel)}-object. No view available.");
ViewService = viewService
?? throw new ArgumentException($"Can not instantiate {typeof(WhatsNewViewModel)}-object. No view available.");
ResourceProvider = resourceProvider
?? throw new ArgumentException($"Can not instantiate {typeof(WhatsNewViewModel)}-object. No ressource provider availalbe.");
}
ResourceProvider = resourceProvider
?? throw new ArgumentException($"Can not instantiate {typeof(WhatsNewViewModel)}-object. No ressource provider availalbe.");
}
/// <summary> Gets the platfrom specific prefix. </summary>
private Func<string, string> ResourceProvider { get; set; }
/// <summary> Gets the platfrom specific prefix. </summary>
private Func<string, string> ResourceProvider { get; set; }
/// <summary> Agb information text.</summary>
private HtmlWebViewSource infoAgb;
/// <summary> Agb information text.</summary>
private HtmlWebViewSource infoAgb;
/// <summary> Agb information text.</summary>
public HtmlWebViewSource InfoAgb
{
get => infoAgb;
set
{
infoAgb = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(InfoAgb)));
}
}
/// <summary> Agb information text.</summary>
public HtmlWebViewSource InfoAgb
{
get => infoAgb;
set
{
infoAgb = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(InfoAgb)));
}
}
/// <summary> Called when page is shown. </summary>
public async Task OnAppearing()
{
InfoAgb = await InfoPageViewModel.GetAgb(HostName, "agbResourcePath", IsSiteCachingOn, UiIsoLanguageName);
}
/// <summary> Called when page is shown. </summary>
public async Task OnAppearing()
{
InfoAgb = await InfoPageViewModel.GetAgb(HostName, "agbResourcePath", IsSiteCachingOn, UiIsoLanguageName);
}
/// <summary> User clicks OK button.</summary>
public ICommand OnOk
{
get
{
return new Command(async () => await ViewService.PopModalAsync());
}
}
/// <summary> User clicks OK button.</summary>
public ICommand OnOk
{
get
{
return new Command(async () => await ViewService.PopModalAsync());
}
}
/// <summary> Reference to view service object.</summary>
private IViewService ViewService;
}
/// <summary> Reference to view service object.</summary>
private IViewService ViewService;
}
}

View file

@ -7,101 +7,101 @@ using Xamarin.Forms;
namespace TINK.ViewModel.WhatsNew
{
public class WhatsNewViewModel
{
/// <summary> Constructs view model. </summary>
/// <param name="currentVersion"></param>
/// <param name="whatsNewText"></param>
/// <param name="isShowAgbRequired"></param>
/// <param name="showMasterDetail">Delegate to invoke master detail.</param>
/// <param name="p_oViewService">View service to show agb- page.</param>
public WhatsNewViewModel(
Version currentVersion,
IDictionary<Version, string> whatsNewText,
bool isShowAgbRequired,
Action showMasterDetail,
IViewService p_oViewService)
{
ViewService = p_oViewService
?? throw new ArgumentException($"Can not instantiate {typeof(WhatsNewViewModel)}-object. No view available.");
public class WhatsNewViewModel
{
/// <summary> Constructs view model. </summary>
/// <param name="currentVersion"></param>
/// <param name="whatsNewText"></param>
/// <param name="isShowAgbRequired"></param>
/// <param name="showMasterDetail">Delegate to invoke master detail.</param>
/// <param name="p_oViewService">View service to show agb- page.</param>
public WhatsNewViewModel(
Version currentVersion,
IDictionary<Version, string> whatsNewText,
bool isShowAgbRequired,
Action showMasterDetail,
IViewService p_oViewService)
{
ViewService = p_oViewService
?? throw new ArgumentException($"Can not instantiate {typeof(WhatsNewViewModel)}-object. No view available.");
ShowMasterDetail = showMasterDetail
?? throw new ArgumentException($"Can not instantiate {typeof(WhatsNewViewModel)}-object. No delegate to activated maste detail page avilable.");
ShowMasterDetail = showMasterDetail
?? throw new ArgumentException($"Can not instantiate {typeof(WhatsNewViewModel)}-object. No delegate to activated maste detail page avilable.");
CurrentVersion = currentVersion;
WhatsNewText = new FormattedString();
WhatsNewText.Spans.Add(new Span { Text = GetWhatNextHtmlText(whatsNewText) });
IsAgbChangedVisible = isShowAgbRequired;
}
CurrentVersion = currentVersion;
WhatsNewText = new FormattedString();
WhatsNewText.Spans.Add(new Span { Text = GetWhatNextHtmlText(whatsNewText) });
IsAgbChangedVisible = isShowAgbRequired;
}
public Version CurrentVersion { get; }
public Version CurrentVersion { get; }
public FormattedString WhatsNewText { get; }
public FormattedString WhatsNewText { get; }
/// <summary>
/// Title of the WhatsNewPage.
/// </summary>
public string WhatsNewTitle
{
get
{
// Get version info.
return $"Neu in Version {CurrentVersion}";
}
}
/// <summary>
/// Title of the WhatsNewPage.
/// </summary>
public string WhatsNewTitle
{
get
{
// Get version info.
return $"Neu in Version {CurrentVersion}";
}
}
/// <summary> Text saying that AGBs were modified.</summary>
public FormattedString AgbChangedText
{
get
{
var l_oHint = new FormattedString();
l_oHint.Spans.Add(new Span { Text = "AGBs ", ForegroundColor = ViewModelHelper.LINK_COLOR });
l_oHint.Spans.Add(new Span { Text = "überarbeitet.\r\n" });
/// <summary> Text saying that AGBs were modified.</summary>
public FormattedString AgbChangedText
{
get
{
var l_oHint = new FormattedString();
l_oHint.Spans.Add(new Span { Text = "AGBs ", ForegroundColor = ViewModelHelper.LINK_COLOR });
l_oHint.Spans.Add(new Span { Text = "überarbeitet.\r\n" });
return l_oHint;
}
}
return l_oHint;
}
}
public bool IsAgbChangedVisible { get; }
public bool IsAgbChangedVisible { get; }
/// <summary> Command object to bind agb link to view model.</summary>
public ICommand OnShowAgbTapped
{
get
{
return new Command(async () => await ViewService.PushModalAsync(ViewTypes.AgbPage));
}
}
/// <summary> Command object to bind agb link to view model.</summary>
public ICommand OnShowAgbTapped
{
get
{
return new Command(async () => await ViewService.PushModalAsync(ViewTypes.AgbPage));
}
}
/// <summary> Called when dialog is disappearing.</summary>
/// <param name="setWhatsNewWasShown"></param>
public void OnDisappearing(Action setWhatsNewWasShown)
{
setWhatsNewWasShown();
}
/// <summary> Called when dialog is disappearing.</summary>
/// <param name="setWhatsNewWasShown"></param>
public void OnDisappearing(Action setWhatsNewWasShown)
{
setWhatsNewWasShown();
}
#if !SHOWFEEDBACK
public bool IsFeedbackVisible => false;
public bool IsFeedbackVisible => false;
#else
public bool IsFeedbackVisible => true;
#endif
/// <summary> User clicks rate button.</summary>
public ICommand OnOk
{
get
{
return new Command(() => ShowMasterDetail());
}
}
/// <summary> User clicks rate button.</summary>
public ICommand OnOk
{
get
{
return new Command(() => ShowMasterDetail());
}
}
/// <summary>Reference to view service object.</summary>
private readonly IViewService ViewService;
/// <summary>Reference to view service object.</summary>
private readonly IViewService ViewService;
/// <summary>Reference to view service object.</summary>
private Action ShowMasterDetail { get; }
/// <summary>Reference to view service object.</summary>
private Action ShowMasterDetail { get; }
public static string GetWhatNextHtmlText(IDictionary<Version, string> whatsNew)
=> string.Join("", whatsNew.Select(element => $"<p><b>{element.Key}</b><br/>{element.Value}</p>").ToArray());
}
public static string GetWhatNextHtmlText(IDictionary<Version, string> whatsNew)
=> string.Join("", whatsNew.Select(element => $"<p><b>{element.Key}</b><br/>{element.Value}</p>").ToArray());
}
}