From bc54f708cae6454582011d2aee2cd48d48281c48 Mon Sep 17 00:00:00 2001 From: TheJoKlLa Date: Sun, 19 Sep 2021 19:40:00 +0200 Subject: [PATCH] Added: Network Security Config https://devblogs.microsoft.com/xamarin/cleartext-http-android-network-security/ --- Borepin/Borepin.Android/Borepin.Android.csproj | 5 +++++ .../Properties/AndroidManifest.xml | 2 +- .../Resources/Resource.designer.cs | 15 +++++++++------ .../Resources/xml/network_security_config.xml | 4 ++++ Borepin/Borepin/PageModel/MachinePageModel.cs | 4 ++++ Borepin/Borepin/Service/BFFH/BFFHService.cs | 7 ++++--- FabAccessAPI/Connection.cs | 6 +++--- 7 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 Borepin/Borepin.Android/Resources/xml/network_security_config.xml diff --git a/Borepin/Borepin.Android/Borepin.Android.csproj b/Borepin/Borepin.Android/Borepin.Android.csproj index 9a7f116..883ec85 100644 --- a/Borepin/Borepin.Android/Borepin.Android.csproj +++ b/Borepin/Borepin.Android/Borepin.Android.csproj @@ -172,6 +172,11 @@ + + + Designer + + diff --git a/Borepin/Borepin.Android/Properties/AndroidManifest.xml b/Borepin/Borepin.Android/Properties/AndroidManifest.xml index 4f7167e..7df5fb8 100644 --- a/Borepin/Borepin.Android/Properties/AndroidManifest.xml +++ b/Borepin/Borepin.Android/Properties/AndroidManifest.xml @@ -1,7 +1,7 @@  - + \ No newline at end of file diff --git a/Borepin/Borepin.Android/Resources/Resource.designer.cs b/Borepin/Borepin.Android/Resources/Resource.designer.cs index e20f84c..6c3acd7 100644 --- a/Borepin/Borepin.Android/Resources/Resource.designer.cs +++ b/Borepin/Borepin.Android/Resources/Resource.designer.cs @@ -24432,22 +24432,25 @@ namespace Borepin.Droid public const int image_share_filepaths = 2131820544; // aapt resource value: 0x7F110001 - public const int standalone_badge = 2131820545; + public const int network_security_config = 2131820545; // aapt resource value: 0x7F110002 - public const int standalone_badge_gravity_bottom_end = 2131820546; + public const int standalone_badge = 2131820546; // aapt resource value: 0x7F110003 - public const int standalone_badge_gravity_bottom_start = 2131820547; + public const int standalone_badge_gravity_bottom_end = 2131820547; // aapt resource value: 0x7F110004 - public const int standalone_badge_gravity_top_start = 2131820548; + public const int standalone_badge_gravity_bottom_start = 2131820548; // aapt resource value: 0x7F110005 - public const int standalone_badge_offset = 2131820549; + public const int standalone_badge_gravity_top_start = 2131820549; // aapt resource value: 0x7F110006 - public const int xamarin_essentials_fileprovider_file_paths = 2131820550; + public const int standalone_badge_offset = 2131820550; + + // aapt resource value: 0x7F110007 + public const int xamarin_essentials_fileprovider_file_paths = 2131820551; static Xml() { diff --git a/Borepin/Borepin.Android/Resources/xml/network_security_config.xml b/Borepin/Borepin.Android/Resources/xml/network_security_config.xml new file mode 100644 index 0000000..aeb2df1 --- /dev/null +++ b/Borepin/Borepin.Android/Resources/xml/network_security_config.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Borepin/Borepin/PageModel/MachinePageModel.cs b/Borepin/Borepin/PageModel/MachinePageModel.cs index 7fce2e4..790b61e 100644 --- a/Borepin/Borepin/PageModel/MachinePageModel.cs +++ b/Borepin/Borepin/PageModel/MachinePageModel.cs @@ -31,6 +31,8 @@ namespace Borepin.PageModel #region Data public override async Task LoadData() { + IsBusy = true; + IMachineSystem machineSystem = await _BFFHService.GetMachineSystemInterface(); IInfoInterface info = await machineSystem.Info(); @@ -66,6 +68,7 @@ namespace Borepin.PageModel Machine.IUseInterface useInterface = _Machine.Use; await useInterface.Use(); + await LoadData(); } private ICommand _GiveBackMachineCommand; @@ -80,6 +83,7 @@ namespace Borepin.PageModel Machine.IInUseInterface inUseInterface = _Machine.Inuse; await inUseInterface.GiveBack(); + await LoadData(); } #endregion diff --git a/Borepin/Borepin/Service/BFFH/BFFHService.cs b/Borepin/Borepin/Service/BFFH/BFFHService.cs index 52f8c97..45bea61 100644 --- a/Borepin/Borepin/Service/BFFH/BFFHService.cs +++ b/Borepin/Borepin/Service/BFFH/BFFHService.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Capnp.Rpc; using System.Collections.Generic; using FabAccessAPI.Schema; +using System.Net.Http; namespace Borepin.Service.BFFH { @@ -18,11 +19,11 @@ namespace Borepin.Service.BFFH _CredentialService = credentialService; } - public Model.Connection ActiveConnection { get; private set; } + public Connection ActiveConnection { get; private set; } public bool IsAuthenticated { get; private set; } - public async Task Connect(Model.Connection connection) + public async Task Connect(Connection connection) { if (_Connection != null || ActiveConnection != null) { @@ -63,7 +64,7 @@ namespace Borepin.Service.BFFH return await Task.FromResult(true); } - public async Task Authenticate(Model.Connection connection, string password) + public async Task Authenticate(Connection connection, string password) { await _Connection.Auth("PLAIN", new Dictionary { { "Username", ActiveConnection.Username }, { "Password", password } }); diff --git a/FabAccessAPI/Connection.cs b/FabAccessAPI/Connection.cs index f3c0c46..2f16e29 100644 --- a/FabAccessAPI/Connection.cs +++ b/FabAccessAPI/Connection.cs @@ -19,7 +19,7 @@ namespace FabAccessAPI public TcpRpcClient? RpcClient => _rpcClient; #region Log - private static readonly log4net.ILog _Log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + //private static readonly log4net.ILog _Log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); #endregion /// @@ -30,7 +30,7 @@ namespace FabAccessAPI { _rpcClient = rpcClient; _bootstrapCap = _rpcClient.GetMain(); - _Log.Debug($"Done bootstraping API connection."); + //_Log.Debug($"Done bootstraping API connection."); } /// @@ -46,7 +46,7 @@ namespace FabAccessAPI var authCap = await _bootstrapCap.AuthenticationSystem(cancellationToken_); _auth = new Auth(authCap); var mechs = await _auth.GetMechanisms(); - _Log.Debug($"The Server supports the following auth mechs: {string.Join(", ", mechs)}"); + //_Log.Debug($"The Server supports the following auth mechs: {string.Join(", ", mechs)}"); if (!mechs.Contains(mech)) {