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 d425c29bae1..fd92f494eec 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 e0961b2e096..801fb5e253c 100644 --- a/src/Android/MainApplication.cs +++ b/src/Android/MainApplication.cs @@ -19,6 +19,7 @@ using XLabs.Ioc.Unity; using System.Threading.Tasks; using Plugin.Settings.Abstractions; +using Xamarin.Android.Net; namespace Bit.Android { @@ -37,6 +38,9 @@ public class MainApplication : Application, Application.IActivityLifecycleCallba 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 @@ private void SetIoc() .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 00000000000..756a5428f24 --- /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 00000000000..3cf16d36fc3 --- /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 0ebe8cdf41e..979eb8b0cfe 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 00000000000..e5c9b813106 --- /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 3e5f9952087..b4a98ff6c3f 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 3aba5c3fcd3..aab8d4457f7 100644 --- a/src/iOS.Extension/LoadingViewController.cs +++ b/src/iOS.Extension/LoadingViewController.cs @@ -278,6 +278,7 @@ private void SetIoc() .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 c7842db4261..be52eafa120 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -261,6 +261,7 @@ private void SetIoc() .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) + .RegisterType(new ContainerControlledLifetimeManager()) // Repositories // Repositories .RegisterType(new ContainerControlledLifetimeManager())