mirror of
https://github.com/bitwarden/android.git
synced 2024-11-01 07:35:52 +03:00
re-work hockeyapp init
This commit is contained in:
parent
0eddee5816
commit
a0a5e30f48
4 changed files with 16 additions and 13 deletions
|
@ -30,8 +30,6 @@ namespace Bit.Droid
|
||||||
[Register("com.x8bit.bitwarden.MainActivity")]
|
[Register("com.x8bit.bitwarden.MainActivity")]
|
||||||
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||||
{
|
{
|
||||||
private const string HockeyAppId = "d3834185b4a643479047b86c65293d42";
|
|
||||||
|
|
||||||
private IDeviceActionService _deviceActionService;
|
private IDeviceActionService _deviceActionService;
|
||||||
private IMessagingService _messagingService;
|
private IMessagingService _messagingService;
|
||||||
private IBroadcasterService _broadcasterService;
|
private IBroadcasterService _broadcasterService;
|
||||||
|
@ -84,8 +82,7 @@ namespace Bit.Droid
|
||||||
|
|
||||||
#if !FDROID
|
#if !FDROID
|
||||||
var hockeyAppListener = new HockeyAppCrashManagerListener(_appIdService, _userService);
|
var hockeyAppListener = new HockeyAppCrashManagerListener(_appIdService, _userService);
|
||||||
var hockeyAppTask = hockeyAppListener.InitAsync();
|
var hockeyAppTask = hockeyAppListener.InitAsync(this);
|
||||||
HockeyApp.Android.CrashManager.Register(this, HockeyAppId, hockeyAppListener);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
|
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
|
||||||
|
|
|
@ -5,11 +5,14 @@ using Newtonsoft.Json;
|
||||||
using Android.Runtime;
|
using Android.Runtime;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Android.Content;
|
||||||
|
|
||||||
namespace Bit.Droid.Utilities
|
namespace Bit.Droid.Utilities
|
||||||
{
|
{
|
||||||
public class HockeyAppCrashManagerListener : CrashManagerListener
|
public class HockeyAppCrashManagerListener : CrashManagerListener
|
||||||
{
|
{
|
||||||
|
private const string HockeyAppId = "d3834185b4a643479047b86c65293d42";
|
||||||
|
|
||||||
private readonly IAppIdService _appIdService;
|
private readonly IAppIdService _appIdService;
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
|
|
||||||
|
@ -31,10 +34,11 @@ namespace Bit.Droid.Utilities
|
||||||
_userService = userService;
|
_userService = userService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task InitAsync()
|
public async Task InitAsync(Context context)
|
||||||
{
|
{
|
||||||
_userId = await _userService.GetUserIdAsync();
|
_userId = await _userService.GetUserIdAsync();
|
||||||
_appId = await _appIdService.GetAppIdAsync();
|
_appId = await _appIdService.GetAppIdAsync();
|
||||||
|
CrashManager.Register(context, HockeyAppId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Description
|
public override string Description
|
||||||
|
|
|
@ -7,6 +7,8 @@ namespace Bit.iOS.Core.Utilities
|
||||||
{
|
{
|
||||||
public class HockeyAppCrashManagerDelegate : BITCrashManagerDelegate
|
public class HockeyAppCrashManagerDelegate : BITCrashManagerDelegate
|
||||||
{
|
{
|
||||||
|
private const string HockeyAppId = "51f96ae568ba45f699a18ad9f63046c3";
|
||||||
|
|
||||||
private readonly IAppIdService _appIdService;
|
private readonly IAppIdService _appIdService;
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
|
|
||||||
|
@ -21,11 +23,17 @@ namespace Bit.iOS.Core.Utilities
|
||||||
_userService = userService;
|
_userService = userService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task InitAsync(BITHockeyManager manager)
|
public async Task InitAsync()
|
||||||
{
|
{
|
||||||
_userId = await _userService.GetUserIdAsync();
|
_userId = await _userService.GetUserIdAsync();
|
||||||
_appId = await _appIdService.GetAppIdAsync();
|
_appId = await _appIdService.GetAppIdAsync();
|
||||||
|
var manager = BITHockeyManager.SharedHockeyManager;
|
||||||
|
manager.Configure(HockeyAppId, this);
|
||||||
|
manager.CrashManager.CrashManagerStatus = BITCrashManagerStatus.AutoSend;
|
||||||
manager.UserId = _userId;
|
manager.UserId = _userId;
|
||||||
|
manager.Authenticator.AuthenticateInstallation();
|
||||||
|
manager.DisableMetricsManager = manager.DisableFeedbackManager = manager.DisableUpdateManager = true;
|
||||||
|
manager.StartManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ApplicationLogForCrashManager(BITCrashManager crashManager)
|
public override string ApplicationLogForCrashManager(BITCrashManager crashManager)
|
||||||
|
|
|
@ -26,13 +26,7 @@ namespace Bit.iOS.Core.Utilities
|
||||||
var crashManagerDelegate = new HockeyAppCrashManagerDelegate(
|
var crashManagerDelegate = new HockeyAppCrashManagerDelegate(
|
||||||
ServiceContainer.Resolve<IAppIdService>("appIdService"),
|
ServiceContainer.Resolve<IAppIdService>("appIdService"),
|
||||||
ServiceContainer.Resolve<IUserService>("userService"));
|
ServiceContainer.Resolve<IUserService>("userService"));
|
||||||
var manager = BITHockeyManager.SharedHockeyManager;
|
var task = crashManagerDelegate.InitAsync();
|
||||||
manager.Configure("51f96ae568ba45f699a18ad9f63046c3", crashManagerDelegate);
|
|
||||||
manager.CrashManager.CrashManagerStatus = BITCrashManagerStatus.AutoSend;
|
|
||||||
manager.StartManager();
|
|
||||||
manager.Authenticator.AuthenticateInstallation();
|
|
||||||
manager.DisableMetricsManager = manager.DisableFeedbackManager = manager.DisableUpdateManager = true;
|
|
||||||
var task = crashManagerDelegate.InitAsync(manager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RegisterLocalServices()
|
public static void RegisterLocalServices()
|
||||||
|
|
Loading…
Reference in a new issue