import {Fragment} from 'react';
import ExternalLink from 'sentry/components/links/externalLink';
import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
import type {
Docs,
DocsParams,
OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {
getCrashReportGenericInstallStep,
getCrashReportModalConfigDescription,
getCrashReportModalIntroduction,
} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
import {csharpFeedbackOnboarding} from 'sentry/gettingStartedDocs/dotnet/dotnet';
import {t, tct} from 'sentry/locale';
import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersion';
type Params = DocsParams;
const getInstallSnippetXamarin = (params: Params) => `
Install-Package Sentry.Xamarin -Version ${getPackageVersion(
params,
'sentry.dotnet.xamarin',
'1.5.2'
)}`;
const getInstallSnippetXamarinForms = (params: Params) => `
Install-Package Sentry.Xamarin.Forms -Version ${getPackageVersion(
params,
'sentry.dotnet.xamarin-forms',
'1.5.2'
)}`;
const getConfigureSnippetAndroid = (params: Params) => `
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
SentryXamarin.Init(options =>
{
// Tells which project in Sentry to send events to:
options.Dsn = "${params.dsn}";
// When configuring for the first time, to see what the SDK is doing:
options.Debug = true;
// Set TracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.TracesSampleRate = 1.0;
// If you installed Sentry.Xamarin.Forms:
options.AddXamarinFormsIntegration();
});`;
const getConfigureSnippetIOS = (params: Params) => `
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
SentryXamarin.Init(options =>
{
options.Dsn = "${params.dsn}";
// When configuring for the first time, to see what the SDK is doing:
options.Debug = true;
// Set TracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.TracesSampleRate = 1.0;
options.AddXamarinFormsIntegration();
});`;
const getConfigureSnippetUWP = (params: Params) => `
sealed partial class App : Application
{
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
SentryXamarin.Init(options =>
{
options.Dsn = "${params.dsn}";
// When configuring for the first time, to see what the SDK is doing:
options.Debug = true;
// Set TracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.TracesSampleRate = 1.0;
options.AddXamarinFormsIntegration();
});`;
const getPerformanceInstrumentationSnippet = () => `
// Transaction can be started by providing, at minimum, the name and the operation
var transaction = SentrySdk.StartTransaction(
"test-transaction-name",
"test-transaction-operation"
);
// Transactions can have child spans (and those spans can have child spans as well)
var span = transaction.StartChild("test-child-operation");
// ...
// (Perform the operation represented by the span/transaction)
// ...
span.Finish(); // Mark the span as finished
transaction.Finish(); // Mark the transaction as finished and send it to Sentry`;
const onboarding: OnboardingConfig = {
install: params => [
{
type: StepType.INSTALL,
description: tct('Install the [strong:NuGet] package:', {
strong: ,
}),
configurations: [
{
partialLoading: params.sourcePackageRegistries.isLoading,
code: [
{
language: 'shell',
label: 'Xamarin.Forms',
value: 'xamarinForms',
code: getInstallSnippetXamarinForms(params),
},
{
language: 'shell',
label: 'Xamarin',
value: 'xamarin',
code: getInstallSnippetXamarin(params),
},
],
},
],
},
],
configure: params => [
{
type: StepType.CONFIGURE,
description: tct(
'Initialize the SDK as early as possible, like in the constructor of the [appCode:App], and Add [sentryXamarinFormsIntegrationCode:SentryXamarinFormsIntegration] as a new Integration to [sentryXamarinOptionsCode:SentryXamarinOptions] if you are going to run your app with Xamarin Forms:',
{
appCode: ,
sentryXamarinFormsIntegrationCode:
,
sentryXamarinOptionsCode:
,
}
),
configurations: [
{
description:
,
}),
language: `csharp`,
code: getConfigureSnippetAndroid(params),
},
],
},
{
description:
,
}),
language: `csharp`,
code: getConfigureSnippetIOS(params),
},
],
},
{
description:
{tct('Initialize the SDK on [code:App.xaml.cs].', {
code: ,
})}