Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/App/App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@
<!--<ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>-->
</PropertyGroup>

<!-- Sentry -->

<!--
For testing also uploading Debug builds but in general just Release is fine:
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
-->
<PropertyGroup>
<!-- TODO Change. Can be set via env var or via command line to msbuild -->
<SentryOrg>bruno-garcia</SentryOrg>
<SentryProject>playground</SentryProject>
<!-- Missing property: Set SENTRY_AUTH_TOKEN env var at build time to upload symbols/sources -->

<!-- To get line number for release builds for C#, Java/Kotlin and Native (C/C++/Objective-C/Swift) stack traces. -->
<SentryUploadSymbols>true</SentryUploadSymbols>
<!-- Embeds all sources into the PDBs to get source context in Sentry -->
<EmbedAllSources>true</EmbedAllSources>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android|AnyCPU'">
<AndroidEnableMultiDex>True</AndroidEnableMultiDex>
<UseInterpreter>False</UseInterpreter>
Expand Down Expand Up @@ -99,6 +117,7 @@
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
<PackageReference Include="PCLCrypto" Version="2.1.40-alpha" />
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageReference Include="Sentry.Maui" Version="4.0.0-beta.1" />
</ItemGroup>

<!--<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<PackageReference Include="AsyncAwaitBestPractices.MVVM" Version="6.0.6" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageReference Include="Sentry.Maui" Version="4.0.0-beta.1" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<PackageReference Include="Xamarin.GooglePlayServices.SafetyNet" Version="118.0.1.5" />
Expand Down
3 changes: 3 additions & 0 deletions src/Core/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public static MauiAppBuilder ConfigureMauiAppBuilder(Action<IEffectsBuilder> cus
builder.UseMauiApp<Bit.App.App>();
}
builder
.UseSentry(o => {
o.Dsn = "https://[email protected]/4504930623356928";
})
.UseMauiCommunityToolkit()
.UseMauiCompatibility()
.UseMauiCameraView()
Expand Down
60 changes: 60 additions & 0 deletions src/Core/Pages/Settings/AboutSettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,41 @@
HorizontalOptions="FillAndExpand" />
<BoxView StyleClass="box-row-separator" />

<controls:ExternalLinkItemView
Title="{u:I18n ThrowAndCapture}"
GoToLinkCommand="{Binding ThrowAndCaptureCommand}"
StyleClass="settings-external-link-item"
HorizontalOptions="FillAndExpand" />
<BoxView StyleClass="box-row-separator" />

<controls:ExternalLinkItemView
Title="{u:I18n ThrowUnhandled}"
GoToLinkCommand="{Binding ThrowUnhandledCommand}"
StyleClass="settings-external-link-item"
HorizontalOptions="FillAndExpand" />
<BoxView StyleClass="box-row-separator" />

<controls:ExternalLinkItemView
Title="{u:I18n ThrowBackgroundUnhandled}"
GoToLinkCommand="{Binding ThrowBackgroundUnhandledCommand}"
StyleClass="settings-external-link-item"
HorizontalOptions="FillAndExpand" />
<BoxView StyleClass="box-row-separator" />

<controls:ExternalLinkItemView
Title="{u:I18n JavaCrash}"
GoToLinkCommand="{Binding JavaCrashCommand}"
StyleClass="settings-external-link-item"
HorizontalOptions="FillAndExpand" />
<BoxView StyleClass="box-row-separator" />

<controls:ExternalLinkItemView
Title="{u:I18n NativeCrash}"
GoToLinkCommand="{Binding NativeCrashCommand}"
StyleClass="settings-external-link-item"
HorizontalOptions="FillAndExpand" />
<BoxView StyleClass="box-row-separator" />

<StackLayout
Padding="16,12"
Orientation="Horizontal">
Expand All @@ -80,5 +115,30 @@
</controls:IconLabel>

</StackLayout>
<VerticalStackLayout
Spacing="25"
Padding="30,0"
VerticalOptions="Center">

<Image
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
HeightRequest="200"
HorizontalOptions="Center" />

<Label
Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />

<Label
Text="Welcome to .NET Multi-platform App UI"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
FontSize="18"
HorizontalOptions="Center" />

</VerticalStackLayout>
</StackLayout>
</pages:BaseContentPage>
56 changes: 56 additions & 0 deletions src/Core/Pages/Settings/AboutSettingsPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Bit.Core.Abstractions;
using Bit.Core.Utilities;
using CommunityToolkit.Mvvm.Input;
using Sentry;

namespace Bit.App.Pages
{
Expand Down Expand Up @@ -52,6 +53,42 @@ public AboutSettingsPageViewModel()

CopyAppInfoCommand = CreateDefaultAsyncRelayCommand(
() => clipboardService.CopyTextAsync(AppInfo), allowsMultipleExecutions: false);

ThrowAndCaptureCommand = CreateDefaultAsyncRelayCommand(
OnCapturedExceptionClicked, allowsMultipleExecutions: false);

ThrowUnhandledCommand = CreateDefaultAsyncRelayCommand(
() =>
{
#pragma warning disable CS0618 // These are test Crash methods!
SentrySdk.CauseCrash(CrashType.Managed);
return Task.CompletedTask;
}, allowsMultipleExecutions: false);

ThrowBackgroundUnhandledCommand = CreateDefaultAsyncRelayCommand(

() =>
{
SentrySdk.CauseCrash(CrashType.ManagedBackgroundThread);
return Task.CompletedTask;
}, allowsMultipleExecutions: false);

JavaCrashCommand = CreateDefaultAsyncRelayCommand(
() =>
{
#if ANDROID
SentrySdk.CauseCrash(CrashType.Java);
#endif
return Task.CompletedTask;
}, allowsMultipleExecutions: false);

NativeCrashCommand = CreateDefaultAsyncRelayCommand(
() =>
{
SentrySdk.CauseCrash(CrashType.Native);
return Task.CompletedTask;
#pragma warning restore CS0618 // Type or member is obsolete
}, allowsMultipleExecutions: false);
}

public bool ShouldSubmitCrashLogs
Expand Down Expand Up @@ -84,6 +121,11 @@ public string AppInfo
public ICommand GoToLearnAboutOrgsCommand { get; }
public ICommand RateTheAppCommand { get; }
public ICommand CopyAppInfoCommand { get; }
public ICommand ThrowAndCaptureCommand { get; }
public ICommand ThrowUnhandledCommand { get; }
public ICommand ThrowBackgroundUnhandledCommand { get; }
public ICommand JavaCrashCommand { get; }
public ICommand NativeCrashCommand { get; }

public async Task InitAsync()
{
Expand Down Expand Up @@ -122,6 +164,20 @@ private async Task RateAppAsync()
}
}

private Task OnCapturedExceptionClicked()
{
try
{
throw new ApplicationException("This exception was thrown and captured manually, without crashing the app.");
}
catch (Exception ex)
{
SentrySdk.CaptureException(ex);
}

return Task.CompletedTask;
}

/// INFO: Left here in case we need to debug push notifications
/// <summary>
/// Sets up app info plus debugging information for push notifications.
Expand Down