1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-09-29 04:07:37 +02:00

hockeyapp custom listener for android. Disable some hockeyapp features in ios since we use google analytics.

This commit is contained in:
Kyle Spearrin 2016-08-14 00:15:47 -04:00
parent d6a66d1eb0
commit de244efbf9
6 changed files with 53 additions and 2 deletions

View File

@ -119,6 +119,10 @@
</Reference>
<Reference Include="Mono.Android" />
<Reference Include="mscorlib" />
<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>
</Reference>
<Reference Include="OkHttp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\modernhttpclient.2.4.2\lib\MonoAndroid\OkHttp.dll</HintPath>
<Private>True</Private>
@ -292,6 +296,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Controls\ExtendedTableViewRenderer.cs" />
<Compile Include="HockeyAppCrashManagerListener.cs" />
<Compile Include="LoginService.cs" />
<Compile Include="Controls\ExtendedEditorRenderer.cs" />
<Compile Include="Controls\ExtendedNavigationPage.cs" />

View File

@ -0,0 +1,39 @@
using HockeyApp.Android;
using Bit.App.Abstractions;
using Newtonsoft.Json;
namespace Bit.Android
{
public class HockeyAppCrashManagerListener : CrashManagerListener
{
private readonly IAppIdService _appIdService;
private readonly IAuthService _authService;
public HockeyAppCrashManagerListener(
IAppIdService appIdService,
IAuthService authService)
{
_appIdService = appIdService;
_authService = authService;
}
public override string Description
{
get
{
var log = new
{
AppId = _appIdService.AppId,
UserId = _authService.UserId
};
return JsonConvert.SerializeObject(log, Formatting.Indented);
}
}
public override bool ShouldAutoUploadCrashes()
{
return true;
}
}
}

View File

@ -19,12 +19,18 @@ namespace Bit.Android
[Activity(Label = "bitwarden", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
private const string HockeyAppId = "d3834185b4a643479047b86c65293d42";
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
Console.WriteLine("A OnCreate");
HockeyApp.Android.CrashManager.Register(this);
var appIdService = Resolver.Resolve<IAppIdService>();
var authService = Resolver.Resolve<IAuthService>();
HockeyApp.Android.CrashManager.Register(this, HockeyAppId,
new HockeyAppCrashManagerListener(appIdService, authService));
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App.App(

View File

@ -15,7 +15,6 @@ using Android.App;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: MetaData("net.hockeyapp.android.appIdentifier", Value = "d3834185b4a643479047b86c65293d42")]
// Version information for an assembly consists of the following four values:
//

View File

@ -7,6 +7,7 @@
<package id="CommonServiceLocator" version="1.3" targetFramework="monoandroid60" />
<package id="HockeySDK.Xamarin" version="4.1.0-beta3" targetFramework="monoandroid60" />
<package id="modernhttpclient" version="2.4.2" targetFramework="monoandroid50" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="monoandroid60" />
<package id="PCLCrypto" version="2.0.147" targetFramework="monoandroid60" />
<package id="PInvoke.BCrypt" version="0.3.2" targetFramework="monoandroid60" />
<package id="PInvoke.Kernel32" version="0.3.2" targetFramework="monoandroid60" />

View File

@ -55,6 +55,7 @@ namespace Bit.iOS
manager.UserId = appIdService.AppId;
manager.StartManager();
manager.Authenticator.AuthenticateInstallation();
manager.DisableMetricsManager = manager.DisableFeedbackManager = manager.DisableUpdateManager = true;
LoadApplication(new App.App(
Resolver.Resolve<IAuthService>(),