Integrate App Center SDK into Sample App (#557)

* Update NuGets!

* Added App Center Integration. Added SDKs, build scripts for app Ids, and enabled distribute all sample apps.

* cat test

* Fix android!

* Remove cat

* Add file for common constants! Fix sh scripts.

* Update readme!
This commit is contained in:
James Montemagno 2018-11-01 21:07:47 -04:00 коммит произвёл Jonathan Dick
Родитель e70634a8e6
Коммит 33c37f2f8e
18 изменённых файлов: 2114 добавлений и 1914 удалений

Просмотреть файл

@ -65,7 +65,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.1.0.637273" />
<PackageReference Include="Xamarin.Forms" Version="3.3.0.912540" />
<PackageReference Include="Xamarin.Android.Support.Design" Version="27.0.2.1" />
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="27.0.2.1" />
<PackageReference Include="Xamarin.Android.Support.v4" Version="27.0.2.1" />
@ -75,7 +75,7 @@
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="27.0.2.1" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.devices" Version="2.3.3" />
<PackageReference Include="xunit.runner.devices" Version="2.4.48" />
<PackageReference Include="UnitTests.HeadlessRunner" Version="2.0.0" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -29,11 +29,11 @@
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.6.41" PrivateAssets="All" />
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.6.55" PrivateAssets="All" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="Xamarin.Forms" Version="3.1.0.637273" />
<PackageReference Include="Xamarin.Forms" Version="3.3.0.912540" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.devices" Version="2.3.3" />
<PackageReference Include="xunit.runner.devices" Version="2.4.48" />
<PackageReference Include="UnitTests.HeadlessRunner" Version="2.0.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<ProjectReference Include="..\..\Xamarin.Essentials\Xamarin.Essentials.csproj" />

Просмотреть файл

@ -127,10 +127,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="UnitTests.HeadlessRunner" Version="2.0.0" />
<PackageReference Include="Xamarin.Forms" Version="3.1.0.637273" />
<PackageReference Include="Xamarin.Forms" Version="3.3.0.912540" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.1.5" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.devices" Version="2.3.3" />
<PackageReference Include="xunit.runner.devices" Version="2.4.48" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -110,9 +110,9 @@
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.1.0.637273" />
<PackageReference Include="Xamarin.Forms" Version="3.3.0.912540" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.devices" Version="2.3.3" />
<PackageReference Include="xunit.runner.devices" Version="2.4.48" />
<PackageReference Include="UnitTests.HeadlessRunner" Version="2.0.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>

Просмотреть файл

@ -16,6 +16,11 @@ iOS, Android, and UWP offer unique operating system and platform APIs that devel
| App Center | Sample App | Android | [![Build status](https://build.appcenter.ms/v0.1/apps/7a1f46ca-ba2f-477e-aacc-ff013c7d5f7a/branches/master/badge)](https://appcenter.ms) |
| App Center | Sample App | iOS | [![Build status](https://build.appcenter.ms/v0.1/apps/43b39e9e-2b2b-482f-8afa-e9906334c85e/branches/master/badge)](https://appcenter.ms) |
## Sample App
Try out Xamarin.Essentials on your device!
* [Android Sample App](https://install.appcenter.ms/orgs/microsoft-liveplayer/apps/essentials-android/distribution_groups/public%20testers) via App Center.
## Installation
Xamarin.Essentials is available via:

3884
Samples/Samples.Android/Resources/Resource.designer.cs сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -74,7 +74,19 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.1.0.637273" />
<PackageReference Include="Microsoft.AppCenter">
<Version>1.10.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Analytics">
<Version>1.10.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Crashes">
<Version>1.10.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Distribute">
<Version>1.10.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="3.3.0.912540" />
<PackageReference Include="Xamarin.Android.Support.Design" Version="27.0.2.1" />
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="27.0.2.1" />
<PackageReference Include="Xamarin.Android.Support.v4" Version="27.0.2.1" />

Просмотреть файл

@ -0,0 +1,8 @@
#!/usr/bin/env bash
echo "Variables:"
# Updating manifest
sed -i '' "s/AC_ANDROID/$AC_ANDROID/g" $BUILD_REPOSITORY_LOCALPATH/Samples/Samples/Helpers/CommonConstants.cs
echo "Manifest updated!"

Просмотреть файл

@ -126,7 +126,19 @@
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.1.0.637273" />
<PackageReference Include="Microsoft.AppCenter">
<Version>1.10.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Analytics">
<Version>1.10.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Crashes">
<Version>1.10.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Distribute">
<Version>1.10.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="3.3.0.912540" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.1.5" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>

Просмотреть файл

@ -1,4 +1,5 @@
using Foundation;
using Microsoft.AppCenter.Distribute;
using UIKit;
namespace Samples.iOS
@ -9,6 +10,7 @@ namespace Samples.iOS
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
Xamarin.Forms.Forms.Init();
Distribute.DontCheckForUpdatesInDebug();
LoadApplication(new App());
return base.FinishedLaunching(app, options);

Просмотреть файл

@ -55,5 +55,14 @@
<string>1.0</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Access to your location is required for cool things to happen!</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>appcenter-APP_SECRET</string>
</array>
</dict>
</array>
</dict>
</plist>

Просмотреть файл

@ -98,7 +98,19 @@
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.1.0.637273" />
<PackageReference Include="Microsoft.AppCenter">
<Version>1.10.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Analytics">
<Version>1.10.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Crashes">
<Version>1.10.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Distribute">
<Version>1.10.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="3.3.0.912540" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
@ -116,7 +128,9 @@
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<None Include="Entitlements.plist" />
<None Include="Info.plist" />
<None Include="Info.plist">
<SubType>Designer</SubType>
</None>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -1,7 +1,13 @@
using Samples.View;
using Microsoft.AppCenter;
using Microsoft.AppCenter.Analytics;
using Microsoft.AppCenter.Crashes;
using Microsoft.AppCenter.Distribute;
using Samples.Helpers;
using Samples.View;
using Xamarin.Essentials;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using Device = Xamarin.Forms.Device;
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
@ -20,6 +26,19 @@ namespace Samples
protected override void OnStart()
{
if ((Device.RuntimePlatform == Device.Android && CommonConstants.AppCenterAndroid != "AC_ANDROID") ||
(Device.RuntimePlatform == Device.iOS && CommonConstants.AppCenteriOS != "AC_IOS") ||
(Device.RuntimePlatform == Device.UWP && CommonConstants.AppCenterUWP != "AC_UWP"))
{
AppCenter.Start(
$"ios={CommonConstants.AppCenteriOS};" +
$"android={CommonConstants.AppCenterAndroid};" +
$"uwp={CommonConstants.AppCenterUWP}",
typeof(Analytics),
typeof(Crashes),
typeof(Distribute));
}
// set UWP Map Key
Geocoding.MapKey = "RJHqIE53Onrqons5CNOx~FrDr3XhjDTyEXEjng-CRoA~Aj69MhNManYUKxo6QcwZ0wmXBtyva0zwuHB04rFYAPf7qqGJ5cHb03RCDw1jIW8l";
}

Просмотреть файл

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Samples.Helpers
{
public static class CommonConstants
{
internal const string AppCenterAndroid = "AC_ANDROID";
internal const string AppCenteriOS = "AC_IOS";
internal const string AppCenterUWP = "AC_UWP";
}
}

Просмотреть файл

@ -19,7 +19,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.1.0.637273" />
<PackageReference Include="Microsoft.AppCenter" Version="1.10.0" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="1.10.0" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="1.10.0" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="1.10.0" />
<PackageReference Include="Xamarin.Forms" Version="3.3.0.912540" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>

Просмотреть файл

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />

Просмотреть файл

@ -54,8 +54,8 @@
</ItemGroup>
<ItemGroup>
<None Include="..\nugetreadme.txt" PackagePath="readme.txt" Pack="true" />
<PackageReference Include="mdoc" Version="5.7.3.4" PrivateAssets="All" />
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.6.46" PrivateAssets="All" />
<PackageReference Include="mdoc" Version="5.7.4" PrivateAssets="All" />
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.6.55" PrivateAssets="All" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<Compile Include="**\*.shared.cs" />
<Compile Include="**\*.shared.*.cs" />

10
appcenter-post-clone.sh Normal file
Просмотреть файл

@ -0,0 +1,10 @@
#!/usr/bin/env bash
echo "Variables:"
# Updating manifest
sed -i '' "s/AC_IOS/$AC_IOS/g" $BUILD_REPOSITORY_LOCALPATH/Samples/Samples/Helpers/CommonConstants
sed -i '' "s/APP_SECRET/$APP_SECRET/g" $BUILD_REPOSITORY_LOCALPATH/Samples/Samples.iOS/Info.plist
echo "Manifest updated!"