Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix forms preview in our own apps #614

Merged
merged 2 commits into from
Mar 5, 2018
Merged
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
55 changes: 27 additions & 28 deletions Apps/Contoso.Forms.Demo/Contoso.Forms.Demo/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ public partial class App : Application
const string androidKey = "987b5941-4fac-4968-933e-98a7ff29237c";
const string iosKey = "fe2bf05d-f4f9-48a6-83d9-ea8033fbb644";

static App()
{
Crashes.SendingErrorReport += SendingErrorReportHandler;
Crashes.SentErrorReport += SentErrorReportHandler;
Crashes.FailedToSendErrorReport += FailedToSendErrorReportHandler;
Push.PushNotificationReceived += OnPushNotificationReceived;
}

public App()
{
InitializeComponent();
Expand All @@ -35,26 +27,33 @@ public App()

protected override void OnStart()
{
AppCenter.LogLevel = LogLevel.Verbose;
Crashes.ShouldProcessErrorReport = ShouldProcess;
Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler;
Crashes.GetErrorAttachments = GetErrorAttachments;
Distribute.ReleaseAvailable = OnReleaseAvailable;
AppCenter.Start($"uwp={uwpKey};android={androidKey};ios={iosKey}",
typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push));

AppCenter.GetInstallIdAsync().ContinueWith(installId =>
{
AppCenterLog.Info(LogTag, "AppCenter.InstallId=" + installId.Result);
});
Crashes.HasCrashedInLastSessionAsync().ContinueWith(hasCrashed =>
{
AppCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + hasCrashed.Result);
});
Crashes.GetLastSessionCrashReportAsync().ContinueWith(report =>
{
AppCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.Exception=" + report.Result?.Exception);
});
if (!AppCenter.Configured)
{
AppCenter.LogLevel = LogLevel.Verbose;
Crashes.SendingErrorReport += SendingErrorReportHandler;
Crashes.SendingErrorReport += SendingErrorReportHandler;
Crashes.SentErrorReport += SentErrorReportHandler;
Crashes.FailedToSendErrorReport += FailedToSendErrorReportHandler;
Crashes.ShouldProcessErrorReport = ShouldProcess;
Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler;
Crashes.GetErrorAttachments = GetErrorAttachments;
Distribute.ReleaseAvailable = OnReleaseAvailable;
Push.PushNotificationReceived += OnPushNotificationReceived;
AppCenter.Start($"uwp={uwpKey};android={androidKey};ios={iosKey}",
typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push));
AppCenter.GetInstallIdAsync().ContinueWith(installId =>
{
AppCenterLog.Info(LogTag, "AppCenter.InstallId=" + installId.Result);
});
Crashes.HasCrashedInLastSessionAsync().ContinueWith(hasCrashed =>
{
AppCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + hasCrashed.Result);
});
Crashes.GetLastSessionCrashReportAsync().ContinueWith(report =>
{
AppCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.Exception=" + report.Result?.Exception);
});
}
}

protected override void OnSleep()
Expand Down
90 changes: 45 additions & 45 deletions Apps/Contoso.Forms.Puppet/Contoso.Forms.Puppet/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,9 @@ public partial class App
public const string LogTag = "AppCenterXamarinPuppet";

// App Center keys
private const string UwpKey = "a678b499-1912-4a94-9d97-25b569284d3a";
private const string AndroidKey = "bff0949b-7970-439d-9745-92cdc59b10fe";
private const string IosKey = "b889c4f2-9ac2-4e2e-ae16-dae54f2c5899";

static App()
{
// Set event handlers in static constructor to avoid duplication
Crashes.SendingErrorReport += SendingErrorReportHandler;
Crashes.SentErrorReport += SentErrorReportHandler;
Crashes.FailedToSendErrorReport += FailedToSendErrorReportHandler;
Push.PushNotificationReceived += PrintNotification;
}
const string UwpKey = "a678b499-1912-4a94-9d97-25b569284d3a";
const string AndroidKey = "bff0949b-7970-439d-9745-92cdc59b10fe";
const string IosKey = "b889c4f2-9ac2-4e2e-ae16-dae54f2c5899";

public App()
{
Expand All @@ -37,39 +28,48 @@ public App()

protected override void OnStart()
{
AppCenterLog.Assert(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel);
AppCenter.LogLevel = LogLevel.Verbose;
AppCenterLog.Info(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel);
AppCenterLog.Info(LogTag, "AppCenter.Configured=" + AppCenter.Configured);

// Set callbacks
Crashes.ShouldProcessErrorReport = ShouldProcess;
Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler;
Crashes.GetErrorAttachments = GetErrorAttachments;
Distribute.ReleaseAvailable = OnReleaseAvailable;

AppCenterLog.Assert(LogTag, "AppCenter.Configured=" + AppCenter.Configured);
AppCenter.SetLogUrl("https://in-integration.dev.avalanch.es");
Distribute.SetInstallUrl("http://install.appcenter-int.trafficmanager.net");
Distribute.SetApiUrl("https://appcenter-int.trafficmanager.net/api/v0.1");
AppCenter.Start($"uwp={UwpKey};android={AndroidKey};ios={IosKey}", typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push));
AppCenter.IsEnabledAsync().ContinueWith(enabled =>
{
AppCenterLog.Info(LogTag, "AppCenter.Enabled=" + enabled.Result);
});
AppCenter.GetInstallIdAsync().ContinueWith(installId =>
{
AppCenterLog.Info(LogTag, "AppCenter.InstallId=" + installId.Result);
});
AppCenterLog.Info(LogTag, "AppCenter.SdkVersion=" + AppCenter.SdkVersion);
Crashes.HasCrashedInLastSessionAsync().ContinueWith(hasCrashed =>
{
AppCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + hasCrashed.Result);
});
Crashes.GetLastSessionCrashReportAsync().ContinueWith(report =>
{
AppCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.Exception=" + report.Result?.Exception);
});
if (!AppCenter.Configured)
{
AppCenterLog.Assert(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel);
AppCenter.LogLevel = LogLevel.Verbose;
AppCenterLog.Info(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel);
AppCenterLog.Info(LogTag, "AppCenter.Configured=" + AppCenter.Configured);

// Set callbacks
Crashes.ShouldProcessErrorReport = ShouldProcess;
Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler;
Crashes.GetErrorAttachments = GetErrorAttachments;
Distribute.ReleaseAvailable = OnReleaseAvailable;

// Event handlers
Crashes.SendingErrorReport += SendingErrorReportHandler;
Crashes.SentErrorReport += SentErrorReportHandler;
Crashes.FailedToSendErrorReport += FailedToSendErrorReportHandler;
Push.PushNotificationReceived += PrintNotification;

AppCenterLog.Assert(LogTag, "AppCenter.Configured=" + AppCenter.Configured);
AppCenter.SetLogUrl("https://in-integration.dev.avalanch.es");
Distribute.SetInstallUrl("http://install.appcenter-int.trafficmanager.net");
Distribute.SetApiUrl("https://appcenter-int.trafficmanager.net/api/v0.1");
AppCenter.Start($"uwp={UwpKey};android={AndroidKey};ios={IosKey}", typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push));
AppCenter.IsEnabledAsync().ContinueWith(enabled =>
{
AppCenterLog.Info(LogTag, "AppCenter.Enabled=" + enabled.Result);
});
AppCenter.GetInstallIdAsync().ContinueWith(installId =>
{
AppCenterLog.Info(LogTag, "AppCenter.InstallId=" + installId.Result);
});
AppCenterLog.Info(LogTag, "AppCenter.SdkVersion=" + AppCenter.SdkVersion);
Crashes.HasCrashedInLastSessionAsync().ContinueWith(hasCrashed =>
{
AppCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + hasCrashed.Result);
});
Crashes.GetLastSessionCrashReportAsync().ContinueWith(report =>
{
AppCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.Exception=" + report.Result?.Exception);
});
}
}

static void PrintNotification(object sender, PushNotificationReceivedEventArgs e)
Expand Down