Version 3.0.260

This commit is contained in:
Oliver Hauff 2021-11-07 21:28:13 +01:00
parent 5a26bf273b
commit 4df8aa98aa
134 changed files with 8098 additions and 567 deletions

View file

@ -70,6 +70,13 @@ namespace TINK.Model.Bikes.Bike
/// Max. costs per day in euro.
/// </summary>
public double MaxFeeEuroPerDay { get; set; }
/// <summary> Info about operator agb as HTML (i.g. text and hyperlink). </summary>
public string OperatorAgb { get; set; }
/// <summary> Text which informs users about GPS tracking if tracking is on. </summary>
public string TrackingInfo { get; set; }
}
#endif
}

View file

@ -13,8 +13,8 @@ namespace TINK.Model.Connector.Filter
/// <summary> Applies filtering. </summary>
/// <param name="filter">Enumeration of filter values to filter with or null if no filtering has to be applied.</param>
/// <returns></returns>
public IEnumerable<string> DoFilter(IEnumerable<string> filter) => filter != null
? Group.Intersect(filter)
: Group;
public IEnumerable<string> DoFilter(IEnumerable<string> filter) => filter != null
? Group.IntersectByGoupId(filter)
: Group;
}
}

View file

@ -0,0 +1,43 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace TINK.Model.Connector.Filter
{
public static class IntersectGroupFilterHelper
{
/// <summary>
/// Transforms a group (each element consists of an operator prefix and a numeric bike category) to bike category enumeration (numeric elements).
/// </summary>
/// <param name="group">Group to transform.</param>
/// <returns>Enumeration of numeric bike categories.</returns>
public static IEnumerable<string> ToBikeCategory(this IEnumerable<string> group)
=> group?.Select(x => x.GetBikeCategory())?.Where(x => !string.IsNullOrEmpty(x))
?? new List<string>();
/// <summary>
/// Extracts bike group category umber from a group string.
/// </summary>
/// <param name="group">Group to transform. Example KN_300101 (Stadtrad located in Konstanz), FR_300102 (Lastenrad located in Freiburg).</param>
/// <returns>Enumeration of numeric bike categories.</returns>
public static string GetBikeCategory(this string group)
=> Regex.Match(group, "[0-9]+")?.Value ?? string.Empty;
/// <summary>
/// Intersects two goups only taking into accout the numeric bike group category part.
/// </summary>
/// <param name="group">Group to filter.</param>
/// <param name="filter">Filter to apply</param>
public static IEnumerable<string> IntersectByGoupId(this IEnumerable<string> group, IEnumerable<string> filter)
=> group.Where(x => filter.ContainsGroupId(x));
/// <summary>
/// Gets if group contains a filter element.
/// </summary>
/// <param name="group"></param>
/// <param name="filterElement"></param>
/// <returns></returns>
public static bool ContainsGroupId(this IEnumerable<string> group, string filterElement)
=> group.ToBikeCategory().Contains(filterElement.GetBikeCategory());
}
}

View file

@ -3,9 +3,17 @@
public static class FilterHelper
{
/// <summary> Holds the Konrad group (city bikes).</summary>
public const string FILTERKONRAD = "Konrad";
/// <remarks>
/// Was "Konrad" up to version 3.0.258.
/// Specified first: "KN300001" (RG).
/// </remarks>
public const string FILTERKONRAD = "300101";
/// <summary> Holds the tink group (Lastenräder).</summary>
public const string FILTERTINKGENERAL = "TINK";
/// <remarks>
/// Was "TINK" up to version 3.0.258.
/// Specified first: "KN300029" (RG).
/// </remarks>
public const string FILTERTINKGENERAL = "300102";
}
}

View file

@ -86,16 +86,6 @@ namespace TINK.Model.Connector
}
}
/// <summary>
/// Gets the position from StationInfo object.
/// </summary>
/// <param name="p_oBikeInfo">Object to get information from.</param>
/// <returns>Position information.</returns>
public static Station.Position GetPosition(this BikeInfoAvailable p_oBikeInfo)
{
return GetPosition(p_oBikeInfo.gps);
}
/// <summary>
/// Gets the position from StationInfo object.
/// </summary>

View file

@ -507,6 +507,8 @@ namespace TINK.Model.Connector
FeeEuroPerHour = double.TryParse(tariffDesciption?.eur_per_hour, NumberStyles.Any, CultureInfo.InvariantCulture, out double euroPerHour) ? euroPerHour : double.NaN,
AboEuroPerMonth = double.TryParse(tariffDesciption?.abo_eur_per_month, NumberStyles.Any, CultureInfo.InvariantCulture, out double aboEuroPerMonth) ? aboEuroPerMonth : double.NaN,
MaxFeeEuroPerDay = double.TryParse(tariffDesciption?.max_eur_per_day, NumberStyles.Any, CultureInfo.InvariantCulture, out double maxEuroPerDay) ? maxEuroPerDay : double.NaN,
OperatorAgb = tariffDesciption?.operator_agb,
TrackingInfo = tariffDesciption?.track_info
};
}

View file

@ -26,7 +26,7 @@ namespace TINK.Model
{
get
{
return new ViewModel.Map.GroupFilterMapPage(new Dictionary<string, FilterState> {
return new GroupFilterMapPage(new Dictionary<string, FilterState> {
{ FilterHelper.FILTERTINKGENERAL, FilterState.On },
{FilterHelper.FILTERKONRAD, FilterState.Off }
});

View file

@ -149,11 +149,6 @@ namespace TINK.Model.Settings
return null;
}
if (uriText.ToUpper().ToUpper().Contains("copri-bike.de".ToUpper()))
return new Uri(CopriServerUriList.SHAREE_DEVEL);
if (uriText.ToUpper().ToUpper().Contains("copri.eu".ToUpper()))
return new Uri(CopriServerUriList.SHAREE_LIVE);
return JsonConvert.DeserializeObject<Uri>(uriText);
}

View file

@ -50,8 +50,8 @@ namespace TINK.Model.Settings
bool? isSiteCachingOn = null,
string activeTheme = null)
{
GroupFilterMapPage = groupFilterMapPage ?? GroupFilterHelper.GetMapPageFilterDefaults;
GroupFilterSettings = groupFilterSettings ?? GroupFilterHelper.GetSettingsFilterDefaults;
GroupFilterMapPage = groupFilterMapPage ?? new GroupFilterMapPage(); // Default behaviour: No filtering.
GroupFilterSettings = groupFilterSettings ?? new GroupFilterSettings(); // Default behaviour: No filtering.
ActiveUri = GetActiveUri(activeUri);
PollingParameters = pollingParameters ?? PollingParameters.Default;
MinimumLogEventLevel = minimumLogEventLevel ?? DEFAULTLOGGINLEVEL;

View file

@ -203,16 +203,8 @@ namespace TINK.Model
GeolocationServices = geolocationServicesContainer
?? throw new ArgumentException($"Can not instantiate {nameof(TinkApp)}- object. No geolocation services container object available.");
if (settings.ActiveUri == new Uri(CopriServerUriList.TINK_LIVE) ||
settings.ActiveUri == new Uri(CopriServerUriList.TINK_DEVEL))
{
FilterGroupSetting = settings.GroupFilterSettings;
GroupFilterMapPage = settings.GroupFilterMapPage;
} else
{
FilterGroupSetting = new GroupFilterSettings();
GroupFilterMapPage = new GroupFilterMapPage();
}
FilterGroupSetting = settings.GroupFilterSettings;
GroupFilterMapPage = settings.GroupFilterMapPage;
CenterMapToCurrentLocation = settings.CenterMapToCurrentLocation;

View file

@ -455,7 +455,7 @@ namespace TINK.Model
AppResources.ChangeLog3_0_250 // Third-party components updated.
},
{
new Version(3, 0, 254),
new Version(3, 0, 260),
// Same info as for version 3.0.251 and 3.0.252
AppResources.ChangeLog3_0_231 // Minor improvements.
}