1
0
mirror of https://github.com/bitwarden/mobile.git synced 2025-01-04 18:28:15 +01:00
bitwarden-mobile/src/Android/HockeyAppCrashManagerListener.cs
2018-01-10 09:28:30 -05:00

57 lines
1.4 KiB
C#

#if !FDROID
using HockeyApp.Android;
using Bit.App.Abstractions;
using Newtonsoft.Json;
using Android.Runtime;
namespace Bit.Android
{
public class HockeyAppCrashManagerListener : CrashManagerListener
{
private readonly IAppIdService _appIdService;
private readonly IAuthService _authService;
public HockeyAppCrashManagerListener()
{ }
public HockeyAppCrashManagerListener(System.IntPtr javaRef, JniHandleOwnership transfer)
: base(javaRef, transfer)
{ }
public HockeyAppCrashManagerListener(
IAppIdService appIdService,
IAuthService authService)
{
_appIdService = appIdService;
_authService = authService;
}
public override string Description
{
get
{
if(_appIdService != null && _authService != null)
{
var log = new
{
AppId = _appIdService.AppId,
UserId = _authService.UserId
};
return JsonConvert.SerializeObject(log, Formatting.Indented);
}
else
{
return null;
}
}
}
public override bool ShouldAutoUploadCrashes()
{
return true;
}
}
}
#endif