Skip to content

Commit

Permalink
Merge pull request #614 from Microsoft/fix/test-apps-forms-previewer
Browse files Browse the repository at this point in the history
Fix forms preview in our own apps
  • Loading branch information
guperrot authored Mar 5, 2018
2 parents 9a8b4f7 + 5a4a1ad commit 320db33
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 73 deletions.
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

0 comments on commit 320db33

Please sign in to comment.