2018-01-10 15:28:30 +01:00
|
|
|
#if !FDROID
|
2016-08-14 06:15:47 +02:00
|
|
|
using HockeyApp.Android;
|
|
|
|
using Bit.App.Abstractions;
|
|
|
|
using Newtonsoft.Json;
|
2016-08-27 20:48:14 +02:00
|
|
|
using Android.Runtime;
|
2016-08-14 06:15:47 +02:00
|
|
|
|
|
|
|
namespace Bit.Android
|
|
|
|
{
|
|
|
|
public class HockeyAppCrashManagerListener : CrashManagerListener
|
|
|
|
{
|
|
|
|
private readonly IAppIdService _appIdService;
|
|
|
|
private readonly IAuthService _authService;
|
|
|
|
|
2016-08-27 20:48:14 +02:00
|
|
|
public HockeyAppCrashManagerListener()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
public HockeyAppCrashManagerListener(System.IntPtr javaRef, JniHandleOwnership transfer)
|
|
|
|
: base(javaRef, transfer)
|
|
|
|
{ }
|
|
|
|
|
2016-08-14 06:15:47 +02:00
|
|
|
public HockeyAppCrashManagerListener(
|
|
|
|
IAppIdService appIdService,
|
|
|
|
IAuthService authService)
|
|
|
|
{
|
|
|
|
_appIdService = appIdService;
|
|
|
|
_authService = authService;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string Description
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2016-08-27 20:48:14 +02:00
|
|
|
if(_appIdService != null && _authService != null)
|
2016-08-14 06:15:47 +02:00
|
|
|
{
|
2016-08-27 20:48:14 +02:00
|
|
|
var log = new
|
|
|
|
{
|
|
|
|
AppId = _appIdService.AppId,
|
|
|
|
UserId = _authService.UserId
|
|
|
|
};
|
2016-08-14 06:15:47 +02:00
|
|
|
|
2016-08-27 20:48:14 +02:00
|
|
|
return JsonConvert.SerializeObject(log, Formatting.Indented);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2016-08-14 06:15:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override bool ShouldAutoUploadCrashes()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2018-01-10 15:28:30 +01:00
|
|
|
}
|
|
|
|
#endif
|