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

@ -6,70 +6,70 @@ using TINK.Model.Connector.Filter;
namespace TINK.ViewModel.Settings
{
public class GroupFilterSettings : IGroupFilterSettings
{
public class GroupFilterSettings : IGroupFilterSettings
{
public GroupFilterSettings(IDictionary<string, FilterState> filterDictionary = null)
{
FilterDictionary = filterDictionary ?? new Dictionary<string, FilterState>();
public GroupFilterSettings(IDictionary<string, FilterState> filterDictionary = null)
{
FilterDictionary = filterDictionary ?? new Dictionary<string, FilterState>();
Filter = filterDictionary != null
? (IGroupFilter)new IntersectGroupFilter(FilterDictionary.Where(x => x.Value == FilterState.On).Select(x => x.Key))
: new NullGroupFilter();
}
Filter = filterDictionary != null
? (IGroupFilter)new IntersectGroupFilter(FilterDictionary.Where(x => x.Value == FilterState.On).Select(x => x.Key))
: new NullGroupFilter();
}
private IDictionary<string, FilterState> FilterDictionary { get; set; }
private IDictionary<string, FilterState> FilterDictionary { get; set; }
private IGroupFilter Filter { get; }
private IGroupFilter Filter { get; }
/// <summary> Performs filtering on response -group. </summary>
public IEnumerable<string> DoFilter(IEnumerable<string> filter = null) => Filter.DoFilter(filter);
/// <summary> Performs filtering on response -group. </summary>
public IEnumerable<string> DoFilter(IEnumerable<string> filter = null) => Filter.DoFilter(filter);
public FilterState this[string key] { get => FilterDictionary[key]; set => FilterDictionary[key] = value; }
public FilterState this[string key] { get => FilterDictionary[key]; set => FilterDictionary[key] = value; }
public ICollection<string> Keys => FilterDictionary.Keys;
public ICollection<string> Keys => FilterDictionary.Keys;
public ICollection<FilterState> Values => FilterDictionary.Values;
public ICollection<FilterState> Values => FilterDictionary.Values;
public int Count => FilterDictionary.Count;
public int Count => FilterDictionary.Count;
public bool IsReadOnly => true;
public bool IsReadOnly => true;
public void Add(string key, FilterState value)
{
throw new System.NotImplementedException();
}
public void Add(string key, FilterState value)
{
throw new System.NotImplementedException();
}
public void Add(KeyValuePair<string, FilterState> item)
{
throw new System.NotImplementedException();
}
public void Add(KeyValuePair<string, FilterState> item)
{
throw new System.NotImplementedException();
}
public void Clear()
{
throw new System.NotImplementedException();
}
public void Clear()
{
throw new System.NotImplementedException();
}
public bool Contains(KeyValuePair<string, FilterState> item) => FilterDictionary.Contains(item);
public bool Contains(KeyValuePair<string, FilterState> item) => FilterDictionary.Contains(item);
public bool ContainsKey(string key) => FilterDictionary.ContainsKey(key);
public bool ContainsKey(string key) => FilterDictionary.ContainsKey(key);
public void CopyTo(KeyValuePair<string, FilterState>[] array, int arrayIndex) => FilterDictionary.CopyTo(array, arrayIndex);
public void CopyTo(KeyValuePair<string, FilterState>[] array, int arrayIndex) => FilterDictionary.CopyTo(array, arrayIndex);
public IEnumerator<KeyValuePair<string, FilterState>> GetEnumerator() => FilterDictionary.GetEnumerator();
public IEnumerator<KeyValuePair<string, FilterState>> GetEnumerator() => FilterDictionary.GetEnumerator();
public bool Remove(string key)
{
throw new System.NotImplementedException();
}
public bool Remove(string key)
{
throw new System.NotImplementedException();
}
public bool Remove(KeyValuePair<string, FilterState> item)
{
throw new System.NotImplementedException();
}
public bool Remove(KeyValuePair<string, FilterState> item)
{
throw new System.NotImplementedException();
}
public bool TryGetValue(string key, out FilterState value) => FilterDictionary.TryGetValue(key, out value);
public bool TryGetValue(string key, out FilterState value) => FilterDictionary.TryGetValue(key, out value);
IEnumerator IEnumerable.GetEnumerator() => FilterDictionary.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator() => FilterDictionary.GetEnumerator();
}
}

View file

@ -3,9 +3,9 @@ using TINK.Model;
namespace TINK.ViewModel.Settings
{
public interface IGroupFilterSettings : IDictionary<string, FilterState>
{
/// <summary> Performs filtering on response-group. </summary>
IEnumerable<string> DoFilter(IEnumerable<string> filter = null);
}
public interface IGroupFilterSettings : IDictionary<string, FilterState>
{
/// <summary> Performs filtering on response-group. </summary>
IEnumerable<string> DoFilter(IEnumerable<string> filter = null);
}
}

File diff suppressed because it is too large Load diff

View file

@ -2,99 +2,99 @@
namespace TINK.Settings
{
/// <summary> Holds polling parameters.</summary>
public sealed class PollingParameters : IEquatable<PollingParameters>
{
/// <summary> Holds default polling parameters. </summary>
public static PollingParameters Default { get; } = new PollingParameters(
new TimeSpan(0, 0, 0, 10 /*secs*/, 0),// Default polling interval.
true);
/// <summary> Holds polling parameters.</summary>
public sealed class PollingParameters : IEquatable<PollingParameters>
{
/// <summary> Holds default polling parameters. </summary>
public static PollingParameters Default { get; } = new PollingParameters(
new TimeSpan(0, 0, 0, 10 /*secs*/, 0),// Default polling interval.
true);
/// <summary> Holds polling parameters which represent polling off (empty polling object). </summary>
public static PollingParameters NoPolling { get; } = new PollingParameters(
TimeSpan.MaxValue,// Very long intervall which should never be used because polling IsActivated property is set to false.
false);
/// <summary> Holds polling parameters which represent polling off (empty polling object). </summary>
public static PollingParameters NoPolling { get; } = new PollingParameters(
TimeSpan.MaxValue,// Very long intervall which should never be used because polling IsActivated property is set to false.
false);
/// <summary> Constructs a polling parameter object. </summary>
/// <param name="p_oPeriode">Polling periode.</param>
/// <param name="p_bIsActivated">True if polling is activated.</param>
public PollingParameters(TimeSpan p_oPeriode, bool p_bIsActivated)
{
Periode = p_oPeriode; // Can not be null because is a struct.
IsActivated = p_bIsActivated;
}
/// <summary> Constructs a polling parameter object. </summary>
/// <param name="p_oPeriode">Polling periode.</param>
/// <param name="p_bIsActivated">True if polling is activated.</param>
public PollingParameters(TimeSpan p_oPeriode, bool p_bIsActivated)
{
Periode = p_oPeriode; // Can not be null because is a struct.
IsActivated = p_bIsActivated;
}
/// <summary>Holds the polling periode.</summary>
public TimeSpan Periode { get; }
/// <summary>Holds the polling periode.</summary>
public TimeSpan Periode { get; }
/// <summary> Holds value whether polling is activated or not.</summary>
public bool IsActivated { get; }
/// <summary> Holds value whether polling is activated or not.</summary>
public bool IsActivated { get; }
/// <summary> Checks equallity.</summary>
/// <param name="other">Object to compare with.</param>
/// <returns>True if objects are equal.</returns>
public bool Equals(PollingParameters other)
{
return this == other;
}
/// <summary> Checks equallity.</summary>
/// <param name="other">Object to compare with.</param>
/// <returns>True if objects are equal.</returns>
public bool Equals(PollingParameters other)
{
return this == other;
}
/// <summary> Checks equallity.</summary>
/// <param name="obj">Object to compare with.</param>
/// <returns>True if objects are equal.</returns>
public override bool Equals(object obj)
{
var l_oParameters = obj as PollingParameters;
if (l_oParameters == null)
{
return false;
}
/// <summary> Checks equallity.</summary>
/// <param name="obj">Object to compare with.</param>
/// <returns>True if objects are equal.</returns>
public override bool Equals(object obj)
{
var l_oParameters = obj as PollingParameters;
if (l_oParameters == null)
{
return false;
}
return this == l_oParameters;
}
return this == l_oParameters;
}
/// <summary> Gets the has code of object.</summary>
/// <returns></returns>
public override int GetHashCode()
{
return Periode.GetHashCode() ^ IsActivated.GetHashCode();
}
/// <summary> Gets the has code of object.</summary>
/// <returns></returns>
public override int GetHashCode()
{
return Periode.GetHashCode() ^ IsActivated.GetHashCode();
}
/// <summary> Gets the string representation of the object.</summary>
/// <returns></returns>
public override string ToString()
{
return $"Polling is on={IsActivated}, polling interval={Periode.TotalSeconds}[sec].";
}
/// <summary> Gets the string representation of the object.</summary>
/// <returns></returns>
public override string ToString()
{
return $"Polling is on={IsActivated}, polling interval={Periode.TotalSeconds}[sec].";
}
/// <summary>Defines equality of thwo polling parameter objects.</summary>
/// <param name="p_oSource">First object to compare.</param>
/// <param name="p_oTarget">Second object to compare.</param>
/// <returns>True if objects are equal</returns>
public static bool operator ==(PollingParameters p_oSource, PollingParameters p_oTarget)
{
if (p_oSource is null && p_oTarget is null)
{
// Both object are null
return true;
}
/// <summary>Defines equality of thwo polling parameter objects.</summary>
/// <param name="p_oSource">First object to compare.</param>
/// <param name="p_oTarget">Second object to compare.</param>
/// <returns>True if objects are equal</returns>
public static bool operator ==(PollingParameters p_oSource, PollingParameters p_oTarget)
{
if (p_oSource is null && p_oTarget is null)
{
// Both object are null
return true;
}
if (p_oSource is null ^ p_oTarget is null)
{
// Only one object is null.
return false;
}
if (p_oSource is null ^ p_oTarget is null)
{
// Only one object is null.
return false;
}
return p_oSource.Periode == p_oTarget.Periode
&& p_oSource.IsActivated == p_oTarget.IsActivated;
}
return p_oSource.Periode == p_oTarget.Periode
&& p_oSource.IsActivated == p_oTarget.IsActivated;
}
/// <summary>Defines equality of thwo polling parameter objects.</summary>
/// <param name="p_oSource">First object to compare.</param>
/// <param name="p_oTarget">Second object to compare.</param>
/// <returns>True if objects are equal</returns>
public static bool operator !=(PollingParameters p_oSource, PollingParameters p_oTarget)
{
return (p_oSource == p_oTarget) == false;
}
}
/// <summary>Defines equality of thwo polling parameter objects.</summary>
/// <param name="p_oSource">First object to compare.</param>
/// <param name="p_oTarget">Second object to compare.</param>
/// <returns>True if objects are equal</returns>
public static bool operator !=(PollingParameters p_oSource, PollingParameters p_oTarget)
{
return (p_oSource == p_oTarget) == false;
}
}
}

View file

@ -10,113 +10,113 @@ using TINK.ViewModel.Settings;
namespace TINK.Model.Settings
{
/// <summary> Holds settings which are persisted.</summary>
public class Settings
{
public const LogEventLevel DEFAULTLOGGINLEVEL = LogEventLevel.Error;
/// <summary> Holds settings which are persisted.</summary>
public class Settings
{
public const LogEventLevel DEFAULTLOGGINLEVEL = LogEventLevel.Error;
public const bool DEFAULTREPOTLEVEL = false;
public const bool DEFAULTREPOTLEVEL = false;
/// <summary> Gets the type of the default geolocation service. </summary>
/// <remarks> Swtiched from GeolocationService (GeolocationAccuracyMediumService) to GeolocationAccuracyHighService in app version 3.0.290.</remarks>
public static Type DefaultLocationService => typeof(GeolocationAccuracyHighService);
/// <summary> Gets the type of the default geolocation service. </summary>
/// <remarks> Swtiched from GeolocationService (GeolocationAccuracyMediumService) to GeolocationAccuracyHighService in app version 3.0.290.</remarks>
public static Type DefaultLocationService => typeof(GeolocationAccuracyHighService);
// Default value of the expires after entry. Controls the expiration time of the cache values.
private TimeSpan DEFAULTEXPIRESAFTER = TimeSpan.FromSeconds(1);
// Default value of the expires after entry. Controls the expiration time of the cache values.
private TimeSpan DEFAULTEXPIRESAFTER = TimeSpan.FromSeconds(1);
/// <summary> Constructs settings object. </summary>
/// <param name="groupFilterMapPage">filter which is applied on the map view. Either TINK or Konrad stations are displayed.</param>
/// <param name="groupFilterSettings"></param>
/// <param name="activeUri"></param>
/// <param name="pollingParameters"></param>
/// <param name="minimumLogEventLevel">Minimum logging level to be applied.</param>
/// <param name="isReportLevelVerbose">True if logging level is verbose.</param>
/// <param name="expiresAfter">Holds the expires after value.</param>
/// <param name="activeLockService">Gets the name of the lock service to use.</param>
/// <param name="connectTimeout">Timeout to apply when connecting to bluetooth lock</param>
/// <param name="activeTheme">Full class name of active app theme.</param>
public Settings(
IGroupFilterMapPage groupFilterMapPage = null,
IGroupFilterSettings groupFilterSettings = null,
Uri activeUri = null,
PollingParameters pollingParameters = null,
LogEventLevel? minimumLogEventLevel = null,
bool? isReportLevelVerbose = null,
TimeSpan? expiresAfter = null,
string activeLockService = null,
TimeSpan? connectTimeout = null,
string activeGeolocationService = null,
bool? centerMapToCurrentLocation = null,
Xamarin.Forms.GoogleMaps.MapSpan mapSpan = null,
bool? logToExternalFolder = null,
bool? isSiteCachingOn = null,
string activeTheme = null)
{
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;
IsReportLevelVerbose = isReportLevelVerbose ?? DEFAULTREPOTLEVEL;
ExpiresAfter = expiresAfter ?? DEFAULTEXPIRESAFTER;
ActiveLockService = activeLockService ?? LocksServicesContainerMutable.DefaultLocksservice;
ConnectTimeout = connectTimeout ?? new TimeSpan(0, 0, TimeOutProvider.DEFAULT_BLUETOOTHCONNECT_TIMEOUTSECONDS); // Try one sec. to connect.
ActiveGeolocationService = activeGeolocationService ?? DefaultLocationService.Name;
CenterMapToCurrentLocation = centerMapToCurrentLocation ?? GetCenterMapToCurrentLocation(activeUri);
MapSpan = mapSpan;
LogToExternalFolder = logToExternalFolder ?? false;
IsSiteCachingOn = isSiteCachingOn ?? true;
ActiveTheme = activeTheme ?? typeof(Themes.ShareeBike).Name;
}
/// <summary> Constructs settings object. </summary>
/// <param name="groupFilterMapPage">filter which is applied on the map view. Either TINK or Konrad stations are displayed.</param>
/// <param name="groupFilterSettings"></param>
/// <param name="activeUri"></param>
/// <param name="pollingParameters"></param>
/// <param name="minimumLogEventLevel">Minimum logging level to be applied.</param>
/// <param name="isReportLevelVerbose">True if logging level is verbose.</param>
/// <param name="expiresAfter">Holds the expires after value.</param>
/// <param name="activeLockService">Gets the name of the lock service to use.</param>
/// <param name="connectTimeout">Timeout to apply when connecting to bluetooth lock</param>
/// <param name="activeTheme">Full class name of active app theme.</param>
public Settings(
IGroupFilterMapPage groupFilterMapPage = null,
IGroupFilterSettings groupFilterSettings = null,
Uri activeUri = null,
PollingParameters pollingParameters = null,
LogEventLevel? minimumLogEventLevel = null,
bool? isReportLevelVerbose = null,
TimeSpan? expiresAfter = null,
string activeLockService = null,
TimeSpan? connectTimeout = null,
string activeGeolocationService = null,
bool? centerMapToCurrentLocation = null,
Xamarin.Forms.GoogleMaps.MapSpan mapSpan = null,
bool? logToExternalFolder = null,
bool? isSiteCachingOn = null,
string activeTheme = null)
{
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;
IsReportLevelVerbose = isReportLevelVerbose ?? DEFAULTREPOTLEVEL;
ExpiresAfter = expiresAfter ?? DEFAULTEXPIRESAFTER;
ActiveLockService = activeLockService ?? LocksServicesContainerMutable.DefaultLocksservice;
ConnectTimeout = connectTimeout ?? new TimeSpan(0, 0, TimeOutProvider.DEFAULT_BLUETOOTHCONNECT_TIMEOUTSECONDS); // Try one sec. to connect.
ActiveGeolocationService = activeGeolocationService ?? DefaultLocationService.Name;
CenterMapToCurrentLocation = centerMapToCurrentLocation ?? GetCenterMapToCurrentLocation(activeUri);
MapSpan = mapSpan;
LogToExternalFolder = logToExternalFolder ?? false;
IsSiteCachingOn = isSiteCachingOn ?? true;
ActiveTheme = activeTheme ?? typeof(Themes.ShareeBike).Name;
}
/// <summary> Holds the filter which is applied on the map view. Either TINK or Konrad stations are displayed. </summary>
public IGroupFilterMapPage GroupFilterMapPage { get; }
/// <summary> Holds the filter which is applied on the map view. Either TINK or Konrad stations are displayed. </summary>
public IGroupFilterMapPage GroupFilterMapPage { get; }
/// <summary> Holds the filters loaded from settings. </summary>
public IGroupFilterSettings GroupFilterSettings { get; }
/// <summary> Holds the filters loaded from settings. </summary>
public IGroupFilterSettings GroupFilterSettings { get; }
/// <summary> Holds the uri to connect to. </summary>
public Uri ActiveUri { get; }
/// <summary> Holds the uri to connect to. </summary>
public Uri ActiveUri { get; }
/// <summary> Holds the polling parameters. </summary>
public PollingParameters PollingParameters { get; }
/// <summary> Holds the polling parameters. </summary>
public PollingParameters PollingParameters { get; }
/// <summary> Gets the minimum logging level. </summary>
public LogEventLevel MinimumLogEventLevel { get; }
/// <summary> Gets the minimum logging level. </summary>
public LogEventLevel MinimumLogEventLevel { get; }
/// <summary> Gets the expires after value.</summary>
public TimeSpan ExpiresAfter { get; }
/// <summary> Gets the expires after value.</summary>
public TimeSpan ExpiresAfter { get; }
/// <summary> Gets the lock service to use.</summary>
public string ActiveLockService { get; private set; }
/// <summary> Gets the lock service to use.</summary>
public string ActiveLockService { get; private set; }
/// <summary> Timeout to apply when connecting to bluetooth lock.</summary>
public TimeSpan ConnectTimeout { get; }
/// <summary> Timeout to apply when connecting to bluetooth lock.</summary>
public TimeSpan ConnectTimeout { get; }
/// <summary> Gets the geolocation service to use.</summary>
public string ActiveGeolocationService { get; }
/// <summary> Gets the geolocation service to use.</summary>
public string ActiveGeolocationService { get; }
/// <summary> True if map is centered to current positon, false if not to center map.</summary>
public bool CenterMapToCurrentLocation { get; }
/// <summary> True if map is centered to current positon, false if not to center map.</summary>
public bool CenterMapToCurrentLocation { get; }
/// <summary> Holds the map area to display. </summary>
public Xamarin.Forms.GoogleMaps.MapSpan MapSpan { get; }
/// <summary> Holds the map area to display. </summary>
public Xamarin.Forms.GoogleMaps.MapSpan MapSpan { get; }
public bool LogToExternalFolder { get; }
public bool LogToExternalFolder { get; }
public bool IsSiteCachingOn { get; }
public bool IsSiteCachingOn { get; }
public string ActiveTheme { get; }
public string ActiveTheme { get; }
/// <summary> Gets a value indicating whether reporting level is verbose or not.</summary>
public bool IsReportLevelVerbose { get; }
/// <summary> Gets a value indicating whether reporting level is verbose or not.</summary>
public bool IsReportLevelVerbose { get; }
public static Uri GetActiveUri(Uri activeUri) => activeUri ?? Services.CopriApi.ServerUris.CopriServerUriList.DefaultActiveUri;
public static Uri GetActiveUri(Uri activeUri) => activeUri ?? Services.CopriApi.ServerUris.CopriServerUriList.DefaultActiveUri;
public static bool GetCenterMapToCurrentLocation(Uri activeUri)
{
// TINK does not require acess to current location. Deactivate center map to current location for this reason.
return !GetActiveUri(activeUri).Host.GetIsCopri();
}
}
public static bool GetCenterMapToCurrentLocation(Uri activeUri)
{
// TINK does not require acess to current location. Deactivate center map to current location for this reason.
return !GetActiveUri(activeUri).Host.GetIsCopri();
}
}
}