Version 3.0.339

This commit is contained in:
Anja 2022-09-16 11:19:46 +02:00
parent 0468955d49
commit 52c9f6f1d9
43 changed files with 993 additions and 614 deletions

View file

@ -0,0 +1,9 @@
using Xamarin.Essentials;
namespace TINK.Model
{
public static class CurrentAppInfos
{
public static string CurrentAppVersion => VersionTracking.CurrentVersion;
}
}

View file

@ -1,4 +1,4 @@
using Xamarin.Essentials;
using Xamarin.Essentials;
namespace TINK.Model.Device
{
@ -14,6 +14,7 @@ namespace TINK.Model.Device
/// <summary> Device Model (SMG-950U, iPhone10,6). </summary>
string Model { get; }
/// <summary> Operation system. </summary>
DevicePlatform Platform { get; }
/// <summary> Operating System Version Number (7.0) as text</summary>

View file

@ -0,0 +1,16 @@
using System;
using Serilog;
using TINK.Model.Device;
namespace TINK.Model.Logging
{
public class AppAndEnvironmentInfo
{
public void LogHeader(ISmartDevice device, AppFlavor appFlavor, Version appVersion)
{
Log.ForContext<AppAndEnvironmentInfo>().Information($"App: {appFlavor.GetDisplayName()}, version {appVersion}");
Log.ForContext<AppAndEnvironmentInfo>().Information($"OS: {device.Platform}, version: {device.VersionText}");
Log.ForContext<AppAndEnvironmentInfo>().Information($"Device: {device.Model}, manufacturer: {device.Manufacturer}");
}
}
}

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Threading;
@ -190,6 +190,9 @@ namespace TINK.Model
Flavor = flavor;
// Log application and environment information.
new AppAndEnvironmentInfo().LogHeader(device, flavor, currentVersion);
var locksServices = locksService != null
? new HashSet<ILocksService> { locksService }
: new HashSet<ILocksService> {
@ -440,15 +443,50 @@ namespace TINK.Model
LoggingLevelSwitch levelSwitch,
string logFilePath)
{
bool LogToFileFilter(LogEvent e)
{
if (e.Level >= levelSwitch.MinimumLevel)
{
// If level is above global logging level do log.
return true;
}
if (!e.Properties.ContainsKey(Constants.SourceContextPropertyName))
{
// Do not log if source context is not available.
return false;
}
var sourceContex = e.Properties[Constants.SourceContextPropertyName].ToString();
if ((e.Level == LogEventLevel.Information) &&
(sourceContex.Contains(typeof(AppAndEnvironmentInfo).Namespace) /* Log App and enviroment info. */
|| sourceContex.Contains(typeof(ViewModel.Bikes.Bike.BluetoothLock.RequestHandler.Base).Namespace /* Log info-level messages to provide context for bluetooth log. */ )))
{
return true;
}
if (e.Level >= LogEventLevel.Debug
&& sourceContex.Contains(typeof(LockItBase).Namespace /*Scanning, connect and management functionality */))
{
return true;
}
return false;
}
Log.Logger = new LoggerConfiguration()
.MinimumLevel.ControlledBy(levelSwitch)
.MinimumLevel.Override("TINK.Services.BluetoothLock.BLE", LogEventLevel.Debug) /* Scanning, connect and management functionality */
.MinimumLevel.Override("TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler", LogEventLevel.Information) /* Provides use case context */
.WriteTo.Debug()
.WriteTo.File(logFilePath, Logging.RollingInterval.Session)
.WriteTo.Logger(lg => lg
.MinimumLevel.ControlledBy(new LoggingLevelSwitch(LogEventLevel.Debug))
.Filter.ByIncludingOnly(Matching.FromSource("TINK.Services.BluetoothLock.BLE"))
.MinimumLevel.Verbose()
.WriteTo.Logger(consoleLoggerConfig => consoleLoggerConfig
.MinimumLevel.Information()
.WriteTo.Debug()
)
.WriteTo.Logger(fileLoggerConfig => fileLoggerConfig
.Filter.ByIncludingOnly(e => LogToFileFilter(e))
.WriteTo.File(logFilePath, Logging.RollingInterval.Session)
)
.WriteTo.Logger(copriLoggerConfig => copriLoggerConfig
.MinimumLevel.Debug()
.Filter.ByIncludingOnly(Matching.FromSource(typeof(LockItBase/*Scanning, connect and management functionality */).Namespace))
.WriteTo.MemoryQueueSink()
)
.CreateLogger();

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using TINK.MultilingualResources;
using Xamarin.Essentials;
@ -584,6 +584,16 @@ namespace TINK.Model
new Version(3, 0, 338),
AppResources.ChangeLog3_0_338_SB,
new List<AppFlavor> { AppFlavor.ShareeBike }
},
{
new Version(3, 0, 339),
AppResources.ChangeLog3_0_339_SB_LB,
new List<AppFlavor> { AppFlavor.LastenradBayern, AppFlavor.ShareeBike }
},
{
new Version(3, 0, 339),
AppResources.ChangeLog3_0_339_MK,
new List<AppFlavor> { AppFlavor.MeinKonrad }
}
};