Skip to content

Commit

Permalink
Merge pull request #382 from Microsoft/develop
Browse files Browse the repository at this point in the history
Version 0.14.0
  • Loading branch information
guperrot authored Jul 12, 2017
2 parents b5aa0f5 + e24ef5f commit fbae7a8
Show file tree
Hide file tree
Showing 152 changed files with 1,442 additions and 1,098 deletions.
1 change: 1 addition & 0 deletions Apps/Contoso.Android.Puppet/Contoso.Android.Puppet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
<Compile Include="PropertiesActivity.cs" />
<Compile Include="FakeService.cs" />
<Compile Include="ModulePages\PageFragment.cs" />
<Compile Include="CrashActivity.cs" />
</ItemGroup>
<ItemGroup>
<None Include="GettingStarted.Xamarin" />
Expand Down
14 changes: 14 additions & 0 deletions Apps/Contoso.Android.Puppet/CrashActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.App;
using Android.OS;

namespace Contoso.Android.Puppet
{
[Activity(Label = "CrashActivity")]
public class CrashActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
// will crash with super not called, a pure Java exception with no .NET crash handler.
}
}
}
18 changes: 14 additions & 4 deletions Apps/Contoso.Android.Puppet/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,27 @@ protected override void OnCreate(Bundle savedInstanceState)
Distribute.ReleaseAvailable = OnReleaseAvailable;

MobileCenterLog.Assert(LogTag, "MobileCenter.Configured=" + MobileCenter.Configured);
MobileCenterLog.Assert(LogTag, "MobileCenter.InstallId (before configure)=" + MobileCenter.InstallId);
MobileCenter.SetLogUrl("https://in-integration.dev.avalanch.es");
Distribute.SetInstallUrl("http://install.asgard-int.trafficmanager.net");
Distribute.SetApiUrl("https://asgard-int.trafficmanager.net/api/v0.1");
MobileCenter.Start("bff0949b-7970-439d-9745-92cdc59b10fe", typeof(Analytics), typeof(Crashes), typeof(Distribute));

MobileCenterLog.Info(LogTag, "MobileCenter.InstallId=" + MobileCenter.InstallId);
MobileCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + Crashes.HasCrashedInLastSession);
MobileCenter.IsEnabledAsync().ContinueWith(enabled =>
{
MobileCenterLog.Info(LogTag, "MobileCenter.Enabled=" + enabled.Result);
});
MobileCenter.GetInstallIdAsync().ContinueWith(installId =>
{
MobileCenterLog.Info(LogTag, "MobileCenter.InstallId=" + installId.Result);
});
Crashes.HasCrashedInLastSessionAsync().ContinueWith(hasCrashed =>
{
MobileCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + hasCrashed.Result);
});
Crashes.GetLastSessionCrashReportAsync().ContinueWith(report =>
{
MobileCenterLog.Info(LogTag, " Crashes.LastSessionCrashReport.Exception=" + report.Result?.Exception);
MobileCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.Exception=" + report.Result?.Exception);
MobileCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.Throwable=" + report.Result?.AndroidDetails?.Throwable);
});
}

Expand Down
12 changes: 6 additions & 6 deletions Apps/Contoso.Android.Puppet/ModulePages/AnalyticsFragment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ public override void OnViewCreated(View view, Bundle savedInstanceState)
UpdateState();
}

protected override void UpdateState()
protected override async void UpdateState()
{
AnalyticsEnabledSwitch.CheckedChange -= UpdateEnabled;
AnalyticsEnabledSwitch.Enabled = true;
AnalyticsEnabledSwitch.Checked = Analytics.Enabled;
AnalyticsEnabledSwitch.Enabled = MobileCenter.Enabled;
AnalyticsEnabledSwitch.Checked = await Analytics.IsEnabledAsync();
AnalyticsEnabledSwitch.Enabled = await MobileCenter.IsEnabledAsync();
AnalyticsEnabledSwitch.CheckedChange += UpdateEnabled;
PropertiesCountLabel.Text = mEventProperties.Count.ToString();
}

private void UpdateEnabled(object sender, CompoundButton.CheckedChangeEventArgs e)
private async void UpdateEnabled(object sender, CompoundButton.CheckedChangeEventArgs e)
{
Analytics.Enabled = e.IsChecked;
AnalyticsEnabledSwitch.Checked = Analytics.Enabled;
await Analytics.SetEnabledAsync(e.IsChecked);
AnalyticsEnabledSwitch.Checked = await Analytics.IsEnabledAsync();
}

private void Properties(object sender, EventArgs e)
Expand Down
21 changes: 15 additions & 6 deletions Apps/Contoso.Android.Puppet/ModulePages/CrashesFragment.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.IO;
using Android.Content;
using Android.OS;
using Android.Views;
using Android.Widget;
Expand All @@ -17,6 +18,7 @@ public class CrashesFragment : PageFragment
private Button CrashWithNullReferenceExceptionButton;
private Button CatchNullReferenceExceptionButton;
private Button CrashAsyncButton;
private Button CrashSuperNotCalledButton;

public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
Expand All @@ -35,6 +37,7 @@ public override void OnViewCreated(View view, Bundle savedInstanceState)
CrashWithNullReferenceExceptionButton = view.FindViewById(Resource.Id.crash_with_null_reference_exception) as Button;
CatchNullReferenceExceptionButton = view.FindViewById(Resource.Id.catch_null_reference_exception) as Button;
CrashAsyncButton = view.FindViewById(Resource.Id.crash_async) as Button;
CrashSuperNotCalledButton = view.FindViewById(Resource.Id.crash_super_not_called) as Button;

// Subscribe to events.
CrashesEnabledSwitch.CheckedChange += UpdateEnabled;
Expand All @@ -44,23 +47,24 @@ public override void OnViewCreated(View view, Bundle savedInstanceState)
CrashWithNullReferenceExceptionButton.Click += CrashWithNullReferenceException;
CatchNullReferenceExceptionButton.Click += CatchNullReferenceException;
CrashAsyncButton.Click += CrashAsync;
CrashSuperNotCalledButton.Click += CrashSuperNotCalled;

UpdateState();
}

protected override void UpdateState()
protected override async void UpdateState()
{
CrashesEnabledSwitch.CheckedChange -= UpdateEnabled;
CrashesEnabledSwitch.Enabled = true;
CrashesEnabledSwitch.Checked = Crashes.Enabled;
CrashesEnabledSwitch.Enabled = MobileCenter.Enabled;
CrashesEnabledSwitch.Checked = await Crashes.IsEnabledAsync();
CrashesEnabledSwitch.Enabled = await MobileCenter.IsEnabledAsync();
CrashesEnabledSwitch.CheckedChange += UpdateEnabled;
}

private void UpdateEnabled(object sender, CompoundButton.CheckedChangeEventArgs e)
private async void UpdateEnabled(object sender, CompoundButton.CheckedChangeEventArgs e)
{
Crashes.Enabled = e.IsChecked;
CrashesEnabledSwitch.Checked = Crashes.Enabled;
await Crashes.SetEnabledAsync(e.IsChecked);
CrashesEnabledSwitch.Checked = await Crashes.IsEnabledAsync();
}

private void TestCrash(object sender, EventArgs e)
Expand Down Expand Up @@ -115,6 +119,11 @@ async private void CrashAsync(object sender, EventArgs e)
await FakeService.DoStuffInBackground();
}

private void CrashSuperNotCalled(object sender, EventArgs e)
{
StartActivity(new Intent(Activity, typeof(CrashActivity)));
}

static Exception PrepareException()
{
try
Expand Down
12 changes: 6 additions & 6 deletions Apps/Contoso.Android.Puppet/ModulePages/DistributeFragment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ public override void OnViewCreated(View view, Bundle savedInstanceState)
UpdateState();
}

protected override void UpdateState()
protected override async void UpdateState()
{
DistributeEnabledSwitch.CheckedChange -= UpdateEnabled;
DistributeEnabledSwitch.Enabled = true;
DistributeEnabledSwitch.Checked = Distribute.Enabled;
DistributeEnabledSwitch.Enabled = MobileCenter.Enabled;
DistributeEnabledSwitch.Checked = await Distribute.IsEnabledAsync();
DistributeEnabledSwitch.Enabled = await MobileCenter.IsEnabledAsync();
DistributeEnabledSwitch.CheckedChange += UpdateEnabled;
}

private void UpdateEnabled(object sender, CompoundButton.CheckedChangeEventArgs e)
private async void UpdateEnabled(object sender, CompoundButton.CheckedChangeEventArgs e)
{
Distribute.Enabled = e.IsChecked;
DistributeEnabledSwitch.Checked = Distribute.Enabled;
await Distribute.SetEnabledAsync(e.IsChecked);
DistributeEnabledSwitch.Checked = await Distribute.IsEnabledAsync();
}
}
}
10 changes: 5 additions & 5 deletions Apps/Contoso.Android.Puppet/ModulePages/MobileCenterFragment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ public override void OnViewCreated(View view, Bundle savedInstanceState)
UpdateState();
}

protected override void UpdateState()
protected override async void UpdateState()
{
MobileCenterEnabledSwitch.CheckedChange -= UpdateEnabled;
MobileCenterEnabledSwitch.Checked = MobileCenter.Enabled;
MobileCenterEnabledSwitch.Checked = await MobileCenter.IsEnabledAsync();
MobileCenterEnabledSwitch.CheckedChange += UpdateEnabled;
LogLevelLabel.Text = LogLevelNames[MobileCenter.LogLevel];
LogWriteLevelLabel.Text = LogLevelNames[mLogWriteLevel];
Expand All @@ -91,10 +91,10 @@ public override void OnActivityResult(int requestCode, int resultCode, Intent da
}
}

private void UpdateEnabled(object sender, CompoundButton.CheckedChangeEventArgs e)
private async void UpdateEnabled(object sender, CompoundButton.CheckedChangeEventArgs e)
{
MobileCenter.Enabled = e.IsChecked;
MobileCenterEnabledSwitch.Checked = MobileCenter.Enabled;
await MobileCenter.SetEnabledAsync(e.IsChecked);
MobileCenterEnabledSwitch.Checked = await MobileCenter.IsEnabledAsync();
}

private void LogLevelClicked(object sender, EventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion Apps/Contoso.Android.Puppet/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.microsoft.azure.mobile.xamarin.puppet" android:versionCode="26" android:versionName="0.13.1-SNAPSHOT" android:installLocation="auto">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.microsoft.azure.mobile.xamarin.puppet" android:versionCode="28" android:versionName="0.14.0-SNAPSHOT" android:installLocation="auto">
<uses-sdk android:minSdkVersion="16" />
<application android:label="SXPuppet" android:icon="@drawable/Icon" android:theme="@style/PuppetTheme" />
</manifest>
4 changes: 2 additions & 2 deletions Apps/Contoso.Android.Puppet/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.13.1.0")]
[assembly: AssemblyInformationalVersion("0.13.1-SNAPSHOT")]
[assembly: AssemblyFileVersion("0.14.0.0")]
[assembly: AssemblyInformationalVersion("0.14.0-SNAPSHOT")]
5 changes: 5 additions & 0 deletions Apps/Contoso.Android.Puppet/Resources/layout/Crashes.axml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
android:text="@string/CrashAsync"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/crash_super_not_called"
android:text="@string/CrashSuperNotCalled"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
</LinearLayout>
68 changes: 32 additions & 36 deletions Apps/Contoso.Android.Puppet/Resources/values/Strings.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="ApplicationName">Mobile Center Puppet</string>
<string name="MobileCenterTitle">Mobile Center</string>
<string name="AnalyticsTitle">Analytics</string>
<string name="CrashesTitle">Crashes</string>
<string name="DistributeTitle">Distribute</string>

<string name="MobileCenterEnabled">Mobile Center Enabled</string>
<string name="MobileCenterLogLevel">Log Level</string>
<string name="MobileCenterLogMessage">Log Message</string>
<string name="MobileCenterLogTag">Log Tag</string>
<string name="MobileCenterWriteLog">Write Log</string>

<string name="AnalyticsEnabled">Analytics Enabled</string>
<string name="AnalyticsEventName">Event Name</string>
<string name="AnalyticsProperties">Properties</string>
<string name="AnalyticsAddProperty">Add Property</string>
<string name="AnalyticsTrackEvent">Track Event</string>

<string name="CrashesEnabled">Crashes Enabled</string>
<string name="TestCrash">Generate Test Crash</string>
<string name="DivideByZero">Divide 42 by 0</string>
<string name="CrashWithAggregateException">Crash With Aggregate Exception</string>
<string name="CrashWithNullReferenceException">Crash With NullReferenceException</string>
<string name="CatchNullReferenceException">Test Catching NullReferenceException</string>
<string name="CrashAsync">Crash Inside Async Task</string>

<string name="DistributeEnabled">Distribute Enabled</string>

<string name="MobileCenterTitle">Mobile Center</string>
<string name="AnalyticsTitle">Analytics</string>
<string name="CrashesTitle">Crashes</string>
<string name="DistributeTitle">Distribute</string>
<string name="MobileCenterEnabled">Mobile Center Enabled</string>
<string name="MobileCenterLogLevel">Log Level</string>
<string name="MobileCenterLogMessage">Log Message</string>
<string name="MobileCenterLogTag">Log Tag</string>
<string name="MobileCenterWriteLog">Write Log</string>
<string name="AnalyticsEnabled">Analytics Enabled</string>
<string name="AnalyticsEventName">Event Name</string>
<string name="AnalyticsProperties">Properties</string>
<string name="AnalyticsAddProperty">Add Property</string>
<string name="AnalyticsTrackEvent">Track Event</string>
<string name="CrashesEnabled">Crashes Enabled</string>
<string name="TestCrash">Generate Test Crash</string>
<string name="DivideByZero">Divide 42 by 0</string>
<string name="CrashWithAggregateException">Crash With Aggregate Exception</string>
<string name="CrashWithNullReferenceException">Crash With NullReferenceException</string>
<string name="CatchNullReferenceException">Test Catching NullReferenceException</string>
<string name="CrashAsync">Crash Inside Async Task</string>
<string name="CrashSuperNotCalled">Crash Java: SuperNotCalledException</string>
<string name="DistributeEnabled">Distribute Enabled</string>
<string name="crash_confirmation_dialog_title">Unexpected crash found</string>
<string name="crash_confirmation_dialog_message">Would you like to send an anonymous report so we can fix the problem?</string>
<string name="crash_confirmation_dialog_not_send_button">Don\'t Send</string>
<string name="crash_confirmation_dialog_always_send_button">Always Send</string>
<string name="crash_confirmation_dialog_send_button">Send</string>
<string name="version_x_available">Version {0} available!</string>
<string name="add_property_dialog_title">Add Property</string>
<string name="add_property_dialog_message">Please enter a property values to add to the event</string>
<string name="add_property_dialog_add_button">Add Property</string>
<string name="add_property_dialog_cancel_button">Cancel</string>
<string name="crash_confirmation_dialog_message">Would you like to send an anonymous report so we can fix the problem?</string>
<string name="crash_confirmation_dialog_not_send_button">Don\'t Send</string>
<string name="crash_confirmation_dialog_always_send_button">Always Send</string>
<string name="crash_confirmation_dialog_send_button">Send</string>
<string name="version_x_available">Version {0} available!</string>
<string name="add_property_dialog_title">Add Property</string>
<string name="add_property_dialog_message">Please enter a property values to add to the event</string>
<string name="add_property_dialog_add_button">Add Property</string>
<string name="add_property_dialog_cancel_button">Cancel</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
XA_BROKEN_EXCEPTION_TRANSITIONS=true
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<AndroidLinkMode>None</AndroidLinkMode>
<EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
<AndroidEnableMultiDex>true</AndroidEnableMultiDex>
<AndroidSupportedAbis>arm64-v8a;armeabi;armeabi-v7a;x86;x86_64</AndroidSupportedAbis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -138,6 +139,12 @@
<Reference Include="Xamarin.Firebase.Messaging">
<HintPath>..\..\..\packages\Xamarin.Firebase.Messaging.42.1024.0-beta1\lib\MonoAndroid70\Xamarin.Firebase.Messaging.dll</HintPath>
</Reference>
<Reference Include="HockeySDK.AndroidBindings">
<HintPath>..\..\..\packages\HockeySDK.Xamarin.4.1.5\lib\MonoAndroid403\HockeySDK.AndroidBindings.dll</HintPath>
</Reference>
<Reference Include="HockeySDK">
<HintPath>..\..\..\packages\HockeySDK.Xamarin.4.1.5\lib\MonoAndroid403\HockeySDK.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
Expand Down Expand Up @@ -210,6 +217,9 @@
<ItemGroup>
<GoogleServicesJson Include="google-services.json" />
</ItemGroup>
<ItemGroup>
<AndroidEnvironment Include="AndroidEnvironment.cfg" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
<Import Project="..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using Com.Microsoft.Azure.Mobile.Analytics;
using Com.Microsoft.Azure.Mobile.Analytics.Channel;
using Com.Microsoft.Azure.Mobile.Ingestion.Models;
using HockeyApp.Android;
using HockeyApp.Android.Utils;
using Microsoft.Azure.Mobile;
using Microsoft.Azure.Mobile.Push;

Expand All @@ -26,6 +28,13 @@ protected override void OnCreate(Bundle savedInstanceState)
LoadApplication(new App());
}

protected override void OnResume()
{
base.OnResume();
HockeyLog.LogLevel = 2;
CrashManager.Register(this, "2c7e569100194bafa2a30f5c648d44fe");
}

protected override void OnNewIntent(Android.Content.Intent intent)
{
base.OnNewIntent(intent);
Expand All @@ -50,5 +59,4 @@ public void OnBeforeSending(ILog log)
MobileCenterLog.Debug(App.LogTag, "Analytics listener OnBeforeSendingEventLog");
}
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="26" android:versionName="0.13.1-SNAPSHOT" package="com.microsoft.azure.mobile.xamarin.forms.puppet">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="29" android:versionName="0.14.0-SNAPSHOT" package="com.microsoft.azure.mobile.xamarin.forms.puppet">
<uses-sdk android:minSdkVersion="15" />
<application android:label="MCFPuppet">
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.13.1.0")]
[assembly: AssemblyInformationalVersion("0.13.1-SNAPSHOT")]
[assembly: AssemblyFileVersion("0.14.0.0")]
[assembly: AssemblyInformationalVersion("0.14.0-SNAPSHOT")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
Expand Down
Loading

0 comments on commit fbae7a8

Please sign in to comment.