mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-22 05:47:28 +02:00
Version 3.0.337
This commit is contained in:
parent
fd0e63cf10
commit
573fe77e12
2336 changed files with 33688 additions and 86082 deletions
|
@ -45,7 +45,7 @@ namespace TINK.ViewModel.Info.BikeInfo
|
|||
{
|
||||
var l_oCount = PagesCountProvider();
|
||||
|
||||
return l_oCount > 0 ? (double)CurrentPageIndex / l_oCount : 0;
|
||||
return l_oCount > 0 ? (double)CurrentPageIndex / l_oCount : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ namespace TINK.ViewModel.Info.BikeInfo
|
|||
}
|
||||
|
||||
/// <summary> Returns one based index of the current page. </summary>
|
||||
private int CurrentPageIndex { get; }
|
||||
private int CurrentPageIndex { get; }
|
||||
|
||||
/// <summary> Gets the count of carousel pages. </summary>
|
||||
private Func<int> PagesCountProvider { get; }
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Threading.Tasks;
|
||||
using Serilog;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Services.CopriApi.ServerUris;
|
||||
using Xamarin.Essentials;
|
||||
using Xamarin.Forms;
|
||||
|
||||
|
@ -26,8 +26,17 @@ namespace TINK.ViewModel.Info
|
|||
|
||||
private string ImpressResourcePath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the current ui two letter ISO language name.
|
||||
/// </summary>
|
||||
private string UiIsoLanguageName { get; }
|
||||
|
||||
/// <summary> Constructs Info view model</summary>
|
||||
/// <param name="isSiteCachingOn">Holds value wether site caching is on or off.</param>
|
||||
/// <param name="agbResourcePath"> Agb resouce path received from backend.</param>
|
||||
/// <param name="privacyResourcePath"> Privacy resouce path received from backend.</param>
|
||||
/// <param name="impressResourcePath"> Impress resouce path received from backend.</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>
|
||||
public InfoPageViewModel(
|
||||
string hostName,
|
||||
|
@ -35,13 +44,15 @@ namespace TINK.ViewModel.Info
|
|||
string privacyResourcePath,
|
||||
string impressResourcePath,
|
||||
bool isSiteCachingOn,
|
||||
string uiIsoLangugageName,
|
||||
Func<string, string> resourceProvider)
|
||||
{
|
||||
HostName = hostName;
|
||||
AgbResourcePath = agbResourcePath;
|
||||
PrivacyResourcePath = privacyResourcePath;
|
||||
ImpressResourcePath = impressResourcePath;
|
||||
PrivacyResourcePath = privacyResourcePath;
|
||||
ImpressResourcePath = impressResourcePath;
|
||||
IsSiteCachingOn = isSiteCachingOn;
|
||||
UiIsoLanguageName = uiIsoLangugageName;
|
||||
|
||||
InfoAgb = new HtmlWebViewSource { Html = "<html>Loading...</html>" };
|
||||
|
||||
|
@ -52,25 +63,61 @@ namespace TINK.ViewModel.Info
|
|||
/// <summary> Called when page is shown. </summary>
|
||||
public async void OnAppearing()
|
||||
{
|
||||
InfoAgb = await GetAgb(HostName, AgbResourcePath, IsSiteCachingOn);
|
||||
|
||||
InfoPrivacy = new HtmlWebViewSource
|
||||
// Gets privacy info from server.
|
||||
async Task<HtmlWebViewSource> GetInfoPrivacy()
|
||||
{
|
||||
Html = !string.IsNullOrEmpty(PrivacyResourcePath)
|
||||
? await ViewModelHelper.GetSource(
|
||||
$"https://{HostName}/{PrivacyResourcePath}", // "site/privacy.html"
|
||||
IsSiteCachingOn)
|
||||
: await Task.FromResult(ViewModelHelper.FromBody("No privacy resource available. Resource path is null or empty."))
|
||||
};
|
||||
string GetUriText()
|
||||
=> $"https://{HostName}/{PrivacyResourcePath}";
|
||||
|
||||
InfoImpressum = new HtmlWebViewSource
|
||||
if (string.IsNullOrEmpty(PrivacyResourcePath))
|
||||
{
|
||||
// Information to access ressource is missing
|
||||
return new HtmlWebViewSource
|
||||
{
|
||||
Html = await Task.FromResult(ViewModelHelper.FromBody("No privacy resource available. Resource path is null or empty."))
|
||||
};
|
||||
}
|
||||
|
||||
Log.Debug($"Request to open url {GetUriText()} to get privacy info.");
|
||||
|
||||
return new HtmlWebViewSource
|
||||
{
|
||||
Html = await ViewModelHelper.GetSource(
|
||||
GetUriText(), // "site/privacy.html"
|
||||
IsSiteCachingOn)
|
||||
};
|
||||
}
|
||||
|
||||
// Gets impress info from server.
|
||||
async Task<HtmlWebViewSource> GetImpressum()
|
||||
{
|
||||
Html = !string.IsNullOrEmpty(ImpressResourcePath)
|
||||
? await ViewModelHelper.GetSource(
|
||||
$"https://{HostName}/{ImpressResourcePath}", // "site/impress.html"
|
||||
IsSiteCachingOn)
|
||||
: await Task.FromResult(ViewModelHelper.FromBody("No impress resource available. Resource path is null or empty."))
|
||||
};
|
||||
string GetUriText()
|
||||
=> $"https://{HostName}/{ImpressResourcePath}";
|
||||
|
||||
if (string.IsNullOrEmpty(ImpressResourcePath))
|
||||
{
|
||||
// Information to access ressource is missing
|
||||
return new HtmlWebViewSource
|
||||
{
|
||||
Html = await Task.FromResult(ViewModelHelper.FromBody("No impress resource available. Resource path is null or empty."))
|
||||
};
|
||||
}
|
||||
|
||||
Log.Debug($"Request to open url {GetUriText()} to get impress info.");
|
||||
|
||||
return new HtmlWebViewSource
|
||||
{
|
||||
Html = await ViewModelHelper.GetSource(
|
||||
GetUriText(), // "site/privacy.html"
|
||||
IsSiteCachingOn)
|
||||
};
|
||||
}
|
||||
|
||||
InfoAgb = await GetAgb(HostName, AgbResourcePath, IsSiteCachingOn, UiIsoLanguageName);
|
||||
|
||||
InfoPrivacy = await GetInfoPrivacy();
|
||||
|
||||
InfoImpressum = await GetImpressum();
|
||||
}
|
||||
|
||||
/// <summary> Gets the AGBs</summary>
|
||||
|
@ -79,15 +126,27 @@ namespace TINK.ViewModel.Info
|
|||
public static async Task<HtmlWebViewSource> GetAgb(
|
||||
string hostName,
|
||||
string agbResourcePath,
|
||||
bool isSiteCachingOn)
|
||||
bool isSiteCachingOn,
|
||||
string uiIsoLangugageName)
|
||||
{
|
||||
string GetUriText()
|
||||
=> $"https://{hostName}/{agbResourcePath}";
|
||||
|
||||
if (string.IsNullOrEmpty(agbResourcePath))
|
||||
{
|
||||
return new HtmlWebViewSource
|
||||
{
|
||||
Html = await Task.FromResult(ViewModelHelper.FromBody("No terms resource available. Resource path is null or empty."))
|
||||
};
|
||||
}
|
||||
|
||||
Log.Debug($"Request to open url {GetUriText()} to get AGB infos.");
|
||||
|
||||
return new HtmlWebViewSource
|
||||
{
|
||||
Html = !string.IsNullOrEmpty(agbResourcePath)
|
||||
? await ViewModelHelper.GetSource(
|
||||
$"https://{hostName}/{agbResourcePath}", // "agb.html"
|
||||
Html = await ViewModelHelper.GetSource(
|
||||
GetUriText(), // "agb.html"
|
||||
isSiteCachingOn)
|
||||
: await Task.FromResult(ViewModelHelper.FromBody("No terms resource available. Resource path is null or empty."))
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -100,12 +159,13 @@ namespace TINK.ViewModel.Info
|
|||
Html = ResourceProvider("HtmlResouces.V02.InfoLicenses.html")
|
||||
.Replace("CURRENT_VERSION_TINKAPP", DependencyService.Get<IAppInfo>().Version.ToString())
|
||||
.Replace("ACTIVE_APPNAME", AppInfo.Name)
|
||||
.Replace("APPSUPPORTMAILADDRESS", ContactPageViewModel.APPSUPPORTMAILADDRESS)
|
||||
};
|
||||
|
||||
/// <summary> Privacy text.</summary>
|
||||
private HtmlWebViewSource infoImpress;
|
||||
/// <summary> Gets the privacy related information. </summary>
|
||||
public HtmlWebViewSource InfoImpressum
|
||||
public HtmlWebViewSource InfoImpressum
|
||||
{
|
||||
get => infoImpress;
|
||||
set
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue