From 62cef0d141fd4c46fbd31d35a3ea52ec7828ccd5 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 23 Dec 2016 00:39:00 -0500 Subject: [PATCH] Log service. Linker adjustments. --- src/Android/Android.csproj | 4 +++- src/Android/MainApplication.cs | 5 +++++ src/Android/Services/LogService.cs | 13 +++++++++++++ src/App/Abstractions/Services/ILogService.cs | 7 +++++++ src/App/App.csproj | 4 ++++ src/iOS.Core/Services/LogService.cs | 13 +++++++++++++ src/iOS.Core/iOS.Core.csproj | 1 + src/iOS.Extension/LoadingViewController.cs | 1 + src/iOS/AppDelegate.cs | 1 + 9 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/Android/Services/LogService.cs create mode 100644 src/App/Abstractions/Services/ILogService.cs create mode 100644 src/iOS.Core/Services/LogService.cs diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index d425c29ba..fd92f494e 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -36,7 +36,7 @@ 4 True None - Xamarin.GooglePlayServices.Gcm;BitwardenAndroid;BitwardenApp;Microsoft.Practices.Unity;SQLite-net;Xamarin.Android.Net + PushNotification.Plugin;PushNotification.Plugin.Abstractions;Xamarin.GooglePlayServices.Base;Xamarin.GooglePlayServices.Basement;Xamarin.GooglePlayServices.Measurement;Xamarin.GooglePlayServices.Gcm;BitwardenAndroid;BitwardenApp;Microsoft.Practices.Unity;SQLite-net;Xamarin.Android.Net True False False @@ -68,6 +68,7 @@ False 1G PushNotification.Plugin;PushNotification.Plugin.Abstractions;Xamarin.GooglePlayServices.Base;Xamarin.GooglePlayServices.Basement;Xamarin.GooglePlayServices.Measurement;Xamarin.GooglePlayServices.Gcm;BitwardenAndroid;BitwardenApp;Microsoft.Practices.Unity;SQLite-net;Xamarin.Android.Net + Xamarin.Android.Net.AndroidClientHandler @@ -321,6 +322,7 @@ + diff --git a/src/Android/MainApplication.cs b/src/Android/MainApplication.cs index e0961b2e0..801fb5e25 100644 --- a/src/Android/MainApplication.cs +++ b/src/Android/MainApplication.cs @@ -19,6 +19,7 @@ using XLabs.Ioc; using XLabs.Ioc.Unity; using System.Threading.Tasks; using Plugin.Settings.Abstractions; +using Xamarin.Android.Net; namespace Bit.Android { @@ -37,6 +38,9 @@ namespace Bit.Android public MainApplication(IntPtr handle, JniHandleOwnership transer) : base(handle, transer) { + // NOTE: This is just here to stop the linker from removing AndroidClientHandler references + var handler = new AndroidClientHandler(); + if(!Resolver.IsSet) { SetIoc(); @@ -204,6 +208,7 @@ namespace Bit.Android .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) + .RegisterType(new ContainerControlledLifetimeManager()) // Repositories .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) diff --git a/src/Android/Services/LogService.cs b/src/Android/Services/LogService.cs new file mode 100644 index 000000000..756a5428f --- /dev/null +++ b/src/Android/Services/LogService.cs @@ -0,0 +1,13 @@ +using System; +using Bit.App.Abstractions; + +namespace Bit.Android.Services +{ + public class LogService : ILogService + { + public void WriteLine(string message) + { + Console.WriteLine(message); + } + } +} diff --git a/src/App/Abstractions/Services/ILogService.cs b/src/App/Abstractions/Services/ILogService.cs new file mode 100644 index 000000000..3cf16d36f --- /dev/null +++ b/src/App/Abstractions/Services/ILogService.cs @@ -0,0 +1,7 @@ +namespace Bit.App.Abstractions +{ + public interface ILogService + { + void WriteLine(string message); + } +} diff --git a/src/App/App.csproj b/src/App/App.csproj index 0ebe8cdf4..979eb8b0c 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -44,6 +44,7 @@ + @@ -229,6 +230,9 @@ ..\..\packages\Unity.3.5.1405-prerelease\lib\portable-net45+wp80+win8+wpa81+MonoAndroid10+MonoTouch10\Microsoft.Practices.Unity.dll True + + ..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\Mono.Android.dll + ..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll True diff --git a/src/iOS.Core/Services/LogService.cs b/src/iOS.Core/Services/LogService.cs new file mode 100644 index 000000000..e5c9b8131 --- /dev/null +++ b/src/iOS.Core/Services/LogService.cs @@ -0,0 +1,13 @@ +using System; +using Bit.App.Abstractions; + +namespace Bit.iOS.Core.Services +{ + public class LogService : ILogService + { + public void WriteLine(string message) + { + Console.WriteLine(message); + } + } +} diff --git a/src/iOS.Core/iOS.Core.csproj b/src/iOS.Core/iOS.Core.csproj index 3e5f99520..b4a98ff6c 100644 --- a/src/iOS.Core/iOS.Core.csproj +++ b/src/iOS.Core/iOS.Core.csproj @@ -106,6 +106,7 @@ + diff --git a/src/iOS.Extension/LoadingViewController.cs b/src/iOS.Extension/LoadingViewController.cs index 3aba5c3fc..aab8d4457 100644 --- a/src/iOS.Extension/LoadingViewController.cs +++ b/src/iOS.Extension/LoadingViewController.cs @@ -278,6 +278,7 @@ namespace Bit.iOS.Extension .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) + .RegisterType(new ContainerControlledLifetimeManager()) // Repositories .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs index c7842db42..be52eafa1 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -261,6 +261,7 @@ namespace Bit.iOS .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) + .RegisterType(new ContainerControlledLifetimeManager()) // Repositories // Repositories .RegisterType(new ContainerControlledLifetimeManager())