Skip to content

Commit

Permalink
Log service. Linker adjustments.
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Dec 23, 2016
1 parent 548132c commit 62cef0d
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Android/Android.csproj
Expand Up @@ -36,7 +36,7 @@
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
<AndroidLinkMode>None</AndroidLinkMode>
<AndroidLinkSkip>Xamarin.GooglePlayServices.Gcm;BitwardenAndroid;BitwardenApp;Microsoft.Practices.Unity;SQLite-net;Xamarin.Android.Net</AndroidLinkSkip>
<AndroidLinkSkip>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</AndroidLinkSkip>
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
<BundleAssemblies>False</BundleAssemblies>
<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
Expand Down Expand Up @@ -68,6 +68,7 @@
<DebugSymbols>False</DebugSymbols>
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
<AndroidLinkSkip>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</AndroidLinkSkip>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
</PropertyGroup>
<ItemGroup>
<Reference Include="Acr.Support.Android, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down Expand Up @@ -321,6 +322,7 @@
<Compile Include="Services\KeyStoreStorageService.cs" />
<Compile Include="MainActivity.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\LogService.cs" />
<Compile Include="Services\ReflectionService.cs" />
<Compile Include="Services\SqlService.cs" />
<Compile Include="SplashActivity.cs" />
Expand Down
5 changes: 5 additions & 0 deletions src/Android/MainApplication.cs
Expand Up @@ -19,6 +19,7 @@
using XLabs.Ioc.Unity;
using System.Threading.Tasks;
using Plugin.Settings.Abstractions;
using Xamarin.Android.Net;

namespace Bit.Android
{
Expand All @@ -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();
Expand Down Expand Up @@ -204,6 +208,7 @@ private void SetIoc()
.RegisterType<IGoogleAnalyticsService, GoogleAnalyticsService>(new ContainerControlledLifetimeManager())
.RegisterType<IDeviceInfoService, DeviceInfoService>(new ContainerControlledLifetimeManager())
.RegisterType<ILocalizeService, LocalizeService>(new ContainerControlledLifetimeManager())
.RegisterType<ILogService, LogService>(new ContainerControlledLifetimeManager())
// Repositories
.RegisterType<IFolderRepository, FolderRepository>(new ContainerControlledLifetimeManager())
.RegisterType<IFolderApiRepository, FolderApiRepository>(new ContainerControlledLifetimeManager())
Expand Down
13 changes: 13 additions & 0 deletions 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);
}
}
}
7 changes: 7 additions & 0 deletions src/App/Abstractions/Services/ILogService.cs
@@ -0,0 +1,7 @@
namespace Bit.App.Abstractions
{
public interface ILogService
{
void WriteLine(string message);
}
}
4 changes: 4 additions & 0 deletions src/App/App.csproj
Expand Up @@ -44,6 +44,7 @@
<Compile Include="Abstractions\Services\IAuthService.cs" />
<Compile Include="Abstractions\Services\IClipboardService.cs" />
<Compile Include="Abstractions\Services\IKeyDerivationService.cs" />
<Compile Include="Abstractions\Services\ILogService.cs" />
<Compile Include="Abstractions\Services\IReflectionService.cs" />
<Compile Include="Abstractions\Services\ISiteService.cs" />
<Compile Include="Abstractions\Services\IFolderService.cs" />
Expand Down Expand Up @@ -229,6 +230,9 @@
<HintPath>..\..\packages\Unity.3.5.1405-prerelease\lib\portable-net45+wp80+win8+wpa81+MonoAndroid10+MonoTouch10\Microsoft.Practices.Unity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Android">
<HintPath>..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\Mono.Android.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
Expand Down
13 changes: 13 additions & 0 deletions 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);
}
}
}
1 change: 1 addition & 0 deletions src/iOS.Core/iOS.Core.csproj
Expand Up @@ -106,6 +106,7 @@
<Compile Include="Services\DeviceInfoService.cs" />
<Compile Include="Services\KeyChainStorageService.cs" />
<Compile Include="Services\CommonCryptoKeyDerivationService.cs" />
<Compile Include="Services\LogService.cs" />
<Compile Include="Services\Settings.cs" />
<Compile Include="Services\GoogleAnalyticsService.cs" />
<Compile Include="Services\LocalizeService.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/iOS.Extension/LoadingViewController.cs
Expand Up @@ -278,6 +278,7 @@ private void SetIoc()
.RegisterType<ILockService, LockService>(new ContainerControlledLifetimeManager())
.RegisterType<IGoogleAnalyticsService, GoogleAnalyticsService>(new ContainerControlledLifetimeManager())
.RegisterType<ILocalizeService, LocalizeService>(new ContainerControlledLifetimeManager())
.RegisterType<ILogService, LogService>(new ContainerControlledLifetimeManager())
// Repositories
.RegisterType<IFolderRepository, FolderRepository>(new ContainerControlledLifetimeManager())
.RegisterType<IFolderApiRepository, FolderApiRepository>(new ContainerControlledLifetimeManager())
Expand Down
1 change: 1 addition & 0 deletions src/iOS/AppDelegate.cs
Expand Up @@ -261,6 +261,7 @@ private void SetIoc()
.RegisterType<IGoogleAnalyticsService, GoogleAnalyticsService>(new ContainerControlledLifetimeManager())
.RegisterType<IDeviceInfoService, DeviceInfoService>(new ContainerControlledLifetimeManager())
.RegisterType<ILocalizeService, LocalizeService>(new ContainerControlledLifetimeManager())
.RegisterType<ILogService, LogService>(new ContainerControlledLifetimeManager())
// Repositories
// Repositories
.RegisterType<IFolderRepository, FolderRepository>(new ContainerControlledLifetimeManager())
Expand Down

0 comments on commit 62cef0d

Please sign in to comment.