diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index 44cf4a075..f73682491 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -119,6 +119,10 @@ + + ..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll + True + ..\..\packages\modernhttpclient.2.4.2\lib\MonoAndroid\OkHttp.dll True @@ -292,6 +296,7 @@ + diff --git a/src/Android/HockeyAppCrashManagerListener.cs b/src/Android/HockeyAppCrashManagerListener.cs new file mode 100644 index 000000000..9e489a145 --- /dev/null +++ b/src/Android/HockeyAppCrashManagerListener.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/src/Android/MainActivity.cs b/src/Android/MainActivity.cs index e23e2433f..f77914ca3 100644 --- a/src/Android/MainActivity.cs +++ b/src/Android/MainActivity.cs @@ -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(); + var authService = Resolver.Resolve(); + + HockeyApp.Android.CrashManager.Register(this, HockeyAppId, + new HockeyAppCrashManagerListener(appIdService, authService)); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App.App( diff --git a/src/Android/Properties/AssemblyInfo.cs b/src/Android/Properties/AssemblyInfo.cs index f7a7e13bb..079abf04d 100644 --- a/src/Android/Properties/AssemblyInfo.cs +++ b/src/Android/Properties/AssemblyInfo.cs @@ -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: // diff --git a/src/Android/packages.config b/src/Android/packages.config index dd229e29b..2e0129791 100644 --- a/src/Android/packages.config +++ b/src/Android/packages.config @@ -7,6 +7,7 @@ + diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs index 2c650805f..2205e41f1 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -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(),