|
@ -117,6 +117,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AppCenter.Rum.And
|
|||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.AppCenter.Rum.Shared", "SDK\AppCenterRum\Microsoft.AppCenter.Rum.Shared\Microsoft.AppCenter.Rum.Shared.shproj", "{8E7B80C4-D22A-4F80-A7AE-E3882E72FFB3}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.AppCenter.Crashes.Shared.Targets", "SDK\AppCenterCrashes\Microsoft.AppCenter.Crashes.Shared.Targets\Microsoft.AppCenter.Crashes.Shared.Targets.shproj", "{CAE55C79-1601-400D-86BF-03AB8CC5B8B9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
SDK\AppCenter\Microsoft.AppCenter.Shared\Microsoft.AppCenter.Shared.projitems*{119c1730-e109-4bc9-aa89-9dca2c50bfd5}*SharedItemsImports = 4
|
||||
|
@ -2163,6 +2165,7 @@ Global
|
|||
{7E130457-B427-4043-A5A2-9484CB5809BF} = {96552695-58F3-472E-8654-52ECE3EE5CF2}
|
||||
{7F7FA7ED-1386-41B5-A11E-656B7F85A8F9} = {96552695-58F3-472E-8654-52ECE3EE5CF2}
|
||||
{8E7B80C4-D22A-4F80-A7AE-E3882E72FFB3} = {96552695-58F3-472E-8654-52ECE3EE5CF2}
|
||||
{CAE55C79-1601-400D-86BF-03AB8CC5B8B9} = {7FAAA086-4453-4B62-AD9A-2E2ED216E3C4}
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
Policies = $0
|
||||
|
|
|
@ -7,5 +7,6 @@
|
|||
public const string Info = "Info";
|
||||
public const string Warning = "Warning";
|
||||
public const string Error = "Error";
|
||||
public const string FirebaseAnalyticsEnabledKey = "FirebaseAnalyticsEnabled";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\packages\Xamarin.Build.Download.0.4.4\build\Xamarin.Build.Download.props" Condition="Exists('..\..\packages\Xamarin.Build.Download.0.4.4\build\Xamarin.Build.Download.props')" />
|
||||
<Import Project="..\..\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.props" Condition="Exists('..\..\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
|
@ -17,7 +17,7 @@
|
|||
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
|
||||
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<AndroidTlsProvider>
|
||||
</AndroidTlsProvider>
|
||||
|
@ -54,40 +54,73 @@
|
|||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Xamarin.Android.Support.Annotations">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Annotations.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Annotations.dll</HintPath>
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Annotations.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Annotations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Arch.Core.Common">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Arch.Core.Common.1.0.0\lib\MonoAndroid80\Xamarin.Android.Arch.Core.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Arch.Lifecycle.Common">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Arch.Lifecycle.Common.1.0.1\lib\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Arch.Lifecycle.Runtime">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Arch.Lifecycle.Runtime.1.0.0\lib\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Runtime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Compat">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Compat.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Compat.dll</HintPath>
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Compat.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Compat.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Core.UI">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Core.UI.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Core.UI.dll</HintPath>
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Core.UI.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Core.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Core.Utils">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Core.Utils.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Core.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Media.Compat">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Media.Compat.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Media.Compat.dll</HintPath>
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Core.Utils.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Core.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Fragment">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Fragment.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Fragment.dll</HintPath>
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Fragment.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Fragment.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Media.Compat">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Media.Compat.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Media.Compat.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Transition">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Transition.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Transition.dll</HintPath>
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Transition.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Transition.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v4">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.v4.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.v4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v7.RecyclerView">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.v7.RecyclerView.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.v7.RecyclerView.dll</HintPath>
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.v7.RecyclerView.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.v7.RecyclerView.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Vector.Drawable">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Vector.Drawable.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Vector.Drawable.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Animated.Vector.Drawable">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.dll</HintPath>
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Animated.Vector.Drawable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v7.AppCompat">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.v7.AppCompat.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.v7.AppCompat.dll</HintPath>
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.v7.AppCompat.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.v7.AppCompat.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Design">
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Design.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Design.dll</HintPath>
|
||||
<HintPath>..\..\packages\Xamarin.Android.Support.Design.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Design.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.GooglePlayServices.Basement">
|
||||
<HintPath>..\..\packages\Xamarin.GooglePlayServices.Basement.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.GooglePlayServices.Basement.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.GooglePlayServices.Tasks">
|
||||
<HintPath>..\..\packages\Xamarin.GooglePlayServices.Tasks.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.GooglePlayServices.Tasks.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Firebase.Common">
|
||||
<HintPath>..\..\packages\Xamarin.Firebase.Common.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.Firebase.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Firebase.Iid">
|
||||
<HintPath>..\..\packages\Xamarin.Firebase.Iid.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.Firebase.Iid.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Firebase.Analytics.Impl">
|
||||
<HintPath>..\..\packages\Xamarin.Firebase.Analytics.Impl.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.Firebase.Analytics.Impl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Firebase.Analytics">
|
||||
<HintPath>..\..\packages\Xamarin.Firebase.Analytics.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.Firebase.Analytics.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Firebase.Messaging">
|
||||
<HintPath>..\..\packages\Xamarin.Firebase.Messaging.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.Firebase.Messaging.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -96,7 +129,7 @@
|
|||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ModulePages\AnalyticsFragment.cs" />
|
||||
<Compile Include="ModulePages\CrashesFragment.cs" />
|
||||
<Compile Include="ModulePages\DistributeFragment.cs" />
|
||||
<Compile Include="ModulePages\OthersFragment.cs" />
|
||||
<Compile Include="ModulePages\AppCenterFragment.cs" />
|
||||
<Compile Include="PagerAdapter.cs" />
|
||||
<Compile Include="Constants.cs" />
|
||||
|
@ -105,6 +138,7 @@
|
|||
<Compile Include="FakeService.cs" />
|
||||
<Compile Include="ModulePages\PageFragment.cs" />
|
||||
<Compile Include="CrashActivity.cs" />
|
||||
<Compile Include="Preferences.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="GettingStarted.Xamarin" />
|
||||
|
@ -119,7 +153,7 @@
|
|||
<AndroidResource Include="Resources\layout\AppCenter.axml" />
|
||||
<AndroidResource Include="Resources\layout\Analytics.axml" />
|
||||
<AndroidResource Include="Resources\layout\Crashes.axml" />
|
||||
<AndroidResource Include="Resources\layout\Distribute.axml" />
|
||||
<AndroidResource Include="Resources\layout\Others.axml" />
|
||||
<AndroidResource Include="Resources\values\styles.xml" />
|
||||
<AndroidResource Include="Resources\drawable-hdpi\icon.png" />
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\icon.png" />
|
||||
|
@ -167,6 +201,14 @@
|
|||
<Project>{11D31A79-0F09-4708-8097-3D1C5D886547}</Project>
|
||||
<Name>Microsoft.AppCenter.Distribute.Android.Bindings</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SDK\AppCenterPush\Microsoft.AppCenter.Push.Android\Microsoft.AppCenter.Push.Android.csproj">
|
||||
<Project>{DF7C7C03-E335-4C23-83BA-8E490AC5B61D}</Project>
|
||||
<Name>Microsoft.AppCenter.Push.Android</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SDK\AppCenterPush\Microsoft.AppCenter.Push.Android.Bindings\Microsoft.AppCenter.Push.Android.Bindings.csproj">
|
||||
<Project>{80B9A47A-7A97-4E5A-9706-43ACB25A7240}</Project>
|
||||
<Name>Microsoft.AppCenter.Push.Android.Bindings</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="ModulePages\" />
|
||||
|
@ -175,6 +217,12 @@
|
|||
<Folder Include="Resources\drawable-xhdpi\" />
|
||||
<Folder Include="Resources\drawable-xxhdpi\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<GoogleServicesJson Include="google-services.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProguardConfiguration Include="proguard.cfg" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -183,17 +231,28 @@
|
|||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Annotations.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Annotations.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Annotations.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Annotations.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Compat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Compat.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Compat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Compat.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Core.UI.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Core.UI.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Core.UI.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Core.UI.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Core.Utils.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Core.Utils.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Core.Utils.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Core.Utils.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Media.Compat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Media.Compat.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Media.Compat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Media.Compat.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Fragment.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Fragment.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Fragment.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Fragment.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Transition.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Transition.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Transition.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Transition.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.v7.RecyclerView.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.v7.RecyclerView.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.v7.RecyclerView.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.v7.RecyclerView.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Vector.Drawable.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.v7.AppCompat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.v7.AppCompat.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.v7.AppCompat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.v7.AppCompat.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Design.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Design.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Design.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Design.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Build.Download.0.4.4\build\Xamarin.Build.Download.targets" Condition="Exists('..\..\packages\Xamarin.Build.Download.0.4.4\build\Xamarin.Build.Download.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.targets" Condition="Exists('..\..\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Annotations.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Annotations.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Arch.Core.Common.1.0.0\build\MonoAndroid80\Xamarin.Android.Arch.Core.Common.targets" Condition="Exists('..\..\packages\Xamarin.Android.Arch.Core.Common.1.0.0\build\MonoAndroid80\Xamarin.Android.Arch.Core.Common.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Arch.Lifecycle.Common.1.0.1\build\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Common.targets" Condition="Exists('..\..\packages\Xamarin.Android.Arch.Lifecycle.Common.1.0.1\build\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Common.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Arch.Lifecycle.Runtime.1.0.0\build\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Runtime.targets" Condition="Exists('..\..\packages\Xamarin.Android.Arch.Lifecycle.Runtime.1.0.0\build\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Runtime.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Compat.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Compat.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Compat.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Compat.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Core.UI.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Core.UI.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Core.UI.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Core.UI.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Core.Utils.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Core.Utils.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Core.Utils.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Core.Utils.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Fragment.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Fragment.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Fragment.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Fragment.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Media.Compat.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Media.Compat.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Media.Compat.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Media.Compat.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Transition.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Transition.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Transition.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Transition.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.v4.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.v4.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.v4.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.v4.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.v7.RecyclerView.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.v7.RecyclerView.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.v7.RecyclerView.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.v7.RecyclerView.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Vector.Drawable.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Animated.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Animated.Vector.Drawable.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.v7.AppCompat.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.v7.AppCompat.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.v7.AppCompat.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.v7.AppCompat.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Design.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Design.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Design.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Design.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.GooglePlayServices.Basement.60.1142.0-beta2\build\MonoAndroid80\Xamarin.GooglePlayServices.Basement.targets" Condition="Exists('..\..\packages\Xamarin.GooglePlayServices.Basement.60.1142.0-beta2\build\MonoAndroid80\Xamarin.GooglePlayServices.Basement.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.GooglePlayServices.Tasks.60.1142.0-beta2\build\MonoAndroid80\Xamarin.GooglePlayServices.Tasks.targets" Condition="Exists('..\..\packages\Xamarin.GooglePlayServices.Tasks.60.1142.0-beta2\build\MonoAndroid80\Xamarin.GooglePlayServices.Tasks.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Firebase.Common.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Common.targets" Condition="Exists('..\..\packages\Xamarin.Firebase.Common.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Common.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Firebase.Iid.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Iid.targets" Condition="Exists('..\..\packages\Xamarin.Firebase.Iid.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Iid.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Firebase.Analytics.Impl.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Analytics.Impl.targets" Condition="Exists('..\..\packages\Xamarin.Firebase.Analytics.Impl.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Analytics.Impl.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Firebase.Analytics.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Analytics.targets" Condition="Exists('..\..\packages\Xamarin.Firebase.Analytics.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Analytics.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Firebase.Messaging.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Messaging.targets" Condition="Exists('..\..\packages\Xamarin.Firebase.Messaging.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Messaging.targets')" />
|
||||
</Project>
|
|
@ -1,4 +1,5 @@
|
|||
using Android.App;
|
||||
using System.Linq;
|
||||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
using Android.OS;
|
||||
using Android.Support.Design.Widget;
|
||||
|
@ -8,6 +9,7 @@ using Microsoft.AppCenter;
|
|||
using Microsoft.AppCenter.Analytics;
|
||||
using Microsoft.AppCenter.Crashes;
|
||||
using Microsoft.AppCenter.Distribute;
|
||||
using Microsoft.AppCenter.Push;
|
||||
|
||||
namespace Contoso.Android.Puppet
|
||||
{
|
||||
|
@ -18,6 +20,12 @@ namespace Contoso.Android.Puppet
|
|||
{
|
||||
const string LogTag = "AppCenterXamarinPuppet";
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
Push.PushNotificationReceived -= PrintNotification;
|
||||
}
|
||||
|
||||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
@ -49,12 +57,22 @@ namespace Contoso.Android.Puppet
|
|||
Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler;
|
||||
|
||||
Distribute.ReleaseAvailable = OnReleaseAvailable;
|
||||
|
||||
AppCenterLog.Assert(LogTag, "AppCenter.Configured=" + AppCenter.Configured);
|
||||
AppCenter.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");
|
||||
AppCenter.Start("bff0949b-7970-439d-9745-92cdc59b10fe", typeof(Analytics), typeof(Crashes), typeof(Distribute));
|
||||
|
||||
// Enable Firebase Analytics if set
|
||||
var enableAnalytics = Preferences.SharedPreferences.GetBoolean(Constants.FirebaseAnalyticsEnabledKey, false);
|
||||
if (enableAnalytics)
|
||||
{
|
||||
Push.EnableFirebaseAnalytics();
|
||||
}
|
||||
|
||||
Push.PushNotificationReceived += PrintNotification;
|
||||
|
||||
AppCenter.Start("bff0949b-7970-439d-9745-92cdc59b10fe", typeof(Analytics), typeof(Crashes),
|
||||
typeof(Push), typeof(Distribute));
|
||||
|
||||
AppCenter.IsEnabledAsync().ContinueWith(enabled =>
|
||||
{
|
||||
|
@ -75,6 +93,19 @@ namespace Contoso.Android.Puppet
|
|||
});
|
||||
}
|
||||
|
||||
void PrintNotification(object sender, PushNotificationReceivedEventArgs e)
|
||||
{
|
||||
var alertDialog = new AlertDialog.Builder(this, Resource.Style.AppCompatDialogStyle);
|
||||
alertDialog.SetTitle(e.Title);
|
||||
var message = e.Message;
|
||||
if (e.CustomData != null && e.CustomData.Count > 0)
|
||||
{
|
||||
message += "\nCustom data = {" + string.Join(",", e.CustomData.Select(kv => kv.Key + "=" + kv.Value)) + "}";
|
||||
}
|
||||
alertDialog.SetMessage(message);
|
||||
alertDialog.Show();
|
||||
}
|
||||
|
||||
void SendingErrorReportHandler(object sender, SendingErrorReportEventArgs e)
|
||||
{
|
||||
AppCenterLog.Info(LogTag, "Sending error report");
|
||||
|
|
|
@ -6,6 +6,7 @@ using Android.Views;
|
|||
using Android.Widget;
|
||||
using Microsoft.AppCenter;
|
||||
using Microsoft.AppCenter.Crashes;
|
||||
using Uri = Android.Net.Uri;
|
||||
|
||||
namespace Contoso.Android.Puppet
|
||||
{
|
||||
|
@ -19,6 +20,7 @@ namespace Contoso.Android.Puppet
|
|||
private Button CatchNullReferenceExceptionButton;
|
||||
private Button CrashAsyncButton;
|
||||
private Button CrashSuperNotCalledButton;
|
||||
private Button CrashJavaFromDotNetButton;
|
||||
|
||||
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
|
@ -38,6 +40,7 @@ namespace Contoso.Android.Puppet
|
|||
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;
|
||||
CrashJavaFromDotNetButton = view.FindViewById(Resource.Id.crash_java_from_dotnet) as Button;
|
||||
|
||||
// Subscribe to events.
|
||||
CrashesEnabledSwitch.CheckedChange += UpdateEnabled;
|
||||
|
@ -48,6 +51,7 @@ namespace Contoso.Android.Puppet
|
|||
CatchNullReferenceExceptionButton.Click += CatchNullReferenceException;
|
||||
CrashAsyncButton.Click += CrashAsync;
|
||||
CrashSuperNotCalledButton.Click += CrashSuperNotCalled;
|
||||
CrashJavaFromDotNetButton.Click += CrashJavaFromDotNet;
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
|
@ -124,6 +128,11 @@ namespace Contoso.Android.Puppet
|
|||
StartActivity(new Intent(Activity, typeof(CrashActivity)));
|
||||
}
|
||||
|
||||
private void CrashJavaFromDotNet(object sender, EventArgs e)
|
||||
{
|
||||
Uri.Parse(null);
|
||||
}
|
||||
|
||||
static Exception PrepareException()
|
||||
{
|
||||
try
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
using Android.OS;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Microsoft.AppCenter;
|
||||
using Microsoft.AppCenter.Distribute;
|
||||
|
||||
namespace Contoso.Android.Puppet
|
||||
{
|
||||
public class DistributeFragment : PageFragment
|
||||
{
|
||||
private Switch DistributeEnabledSwitch;
|
||||
|
||||
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
return inflater.Inflate(Resource.Layout.Distribute, container, false);
|
||||
}
|
||||
|
||||
public override void OnViewCreated(View view, Bundle savedInstanceState)
|
||||
{
|
||||
base.OnViewCreated(view, savedInstanceState);
|
||||
|
||||
// Find views.
|
||||
DistributeEnabledSwitch = view.FindViewById(Resource.Id.enabled_distribute) as Switch;
|
||||
|
||||
// Subscribe to events.
|
||||
DistributeEnabledSwitch.CheckedChange += UpdateEnabled;
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
protected override async void UpdateState()
|
||||
{
|
||||
DistributeEnabledSwitch.CheckedChange -= UpdateEnabled;
|
||||
DistributeEnabledSwitch.Enabled = true;
|
||||
DistributeEnabledSwitch.Checked = await Distribute.IsEnabledAsync();
|
||||
DistributeEnabledSwitch.Enabled = await AppCenter.IsEnabledAsync();
|
||||
DistributeEnabledSwitch.CheckedChange += UpdateEnabled;
|
||||
}
|
||||
|
||||
private async void UpdateEnabled(object sender, CompoundButton.CheckedChangeEventArgs e)
|
||||
{
|
||||
await Distribute.SetEnabledAsync(e.IsChecked);
|
||||
DistributeEnabledSwitch.Checked = await Distribute.IsEnabledAsync();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
using Android.OS;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Microsoft.AppCenter;
|
||||
using Microsoft.AppCenter.Distribute;
|
||||
using Microsoft.AppCenter.Push;
|
||||
|
||||
namespace Contoso.Android.Puppet
|
||||
{
|
||||
public class OthersFragment : PageFragment
|
||||
{
|
||||
private Switch DistributeEnabledSwitch;
|
||||
private Switch PushEnabledSwitch;
|
||||
private Switch FirebaseAnalyticsEnabledSwitch;
|
||||
|
||||
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
return inflater.Inflate(Resource.Layout.Others, container, false);
|
||||
}
|
||||
|
||||
public override void OnViewCreated(View view, Bundle savedInstanceState)
|
||||
{
|
||||
base.OnViewCreated(view, savedInstanceState);
|
||||
|
||||
// Find views.
|
||||
DistributeEnabledSwitch = view.FindViewById(Resource.Id.enabled_distribute) as Switch;
|
||||
PushEnabledSwitch = view.FindViewById(Resource.Id.enabled_push) as Switch;
|
||||
FirebaseAnalyticsEnabledSwitch = view.FindViewById(Resource.Id.enabled_firebase_analytics) as Switch;
|
||||
|
||||
// Subscribe to events.
|
||||
DistributeEnabledSwitch.CheckedChange += UpdateDistributeEnabled;
|
||||
PushEnabledSwitch.CheckedChange += UpdatePushEnabled;
|
||||
FirebaseAnalyticsEnabledSwitch.CheckedChange += UpdateFirebaseAnalyticsEnabled;
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
protected override async void UpdateState()
|
||||
{
|
||||
DistributeEnabledSwitch.CheckedChange -= UpdateDistributeEnabled;
|
||||
DistributeEnabledSwitch.Enabled = true;
|
||||
DistributeEnabledSwitch.Checked = await Distribute.IsEnabledAsync();
|
||||
DistributeEnabledSwitch.Enabled = await AppCenter.IsEnabledAsync();
|
||||
DistributeEnabledSwitch.CheckedChange += UpdateDistributeEnabled;
|
||||
|
||||
PushEnabledSwitch.CheckedChange -= UpdatePushEnabled;
|
||||
PushEnabledSwitch.Enabled = true;
|
||||
PushEnabledSwitch.Checked = await Push.IsEnabledAsync();
|
||||
PushEnabledSwitch.Enabled = await AppCenter.IsEnabledAsync();
|
||||
PushEnabledSwitch.CheckedChange += UpdatePushEnabled;
|
||||
|
||||
FirebaseAnalyticsEnabledSwitch.CheckedChange -= UpdateFirebaseAnalyticsEnabled;
|
||||
var enableAnalytics = Preferences.SharedPreferences.GetBoolean(Constants.FirebaseAnalyticsEnabledKey, false);
|
||||
FirebaseAnalyticsEnabledSwitch.Checked = enableAnalytics;
|
||||
FirebaseAnalyticsEnabledSwitch.CheckedChange += UpdateFirebaseAnalyticsEnabled;
|
||||
}
|
||||
|
||||
private async void UpdateDistributeEnabled(object sender, CompoundButton.CheckedChangeEventArgs e)
|
||||
{
|
||||
await Distribute.SetEnabledAsync(e.IsChecked);
|
||||
DistributeEnabledSwitch.Checked = await Distribute.IsEnabledAsync();
|
||||
}
|
||||
|
||||
private async void UpdatePushEnabled(object sender, CompoundButton.CheckedChangeEventArgs e)
|
||||
{
|
||||
await Push.SetEnabledAsync(e.IsChecked);
|
||||
PushEnabledSwitch.Checked = await Distribute.IsEnabledAsync();
|
||||
}
|
||||
|
||||
private void UpdateFirebaseAnalyticsEnabled(object sender, CompoundButton.CheckedChangeEventArgs e)
|
||||
{
|
||||
var editor = Preferences.SharedPreferences.Edit();
|
||||
editor.PutBoolean(Constants.FirebaseAnalyticsEnabledKey, e.IsChecked);
|
||||
FirebaseAnalyticsEnabledSwitch.Checked = e.IsChecked;
|
||||
editor.Apply();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@ namespace Contoso.Android.Puppet
|
|||
case 0: return new AppCenterFragment();
|
||||
case 1: return new AnalyticsFragment();
|
||||
case 2: return new CrashesFragment();
|
||||
case 3: return new DistributeFragment();
|
||||
case 3: return new OthersFragment();
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace Contoso.Android.Puppet
|
|||
case 0: return new String(mContext.GetString(Resource.String.AppCenterTitle));
|
||||
case 1: return new String(mContext.GetString(Resource.String.AnalyticsTitle));
|
||||
case 2: return new String(mContext.GetString(Resource.String.CrashesTitle));
|
||||
case 3: return new String(mContext.GetString(Resource.String.DistributeTitle));
|
||||
case 3: return new String(mContext.GetString(Resource.String.OthersTitle));
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
|
||||
namespace Contoso.Android.Puppet
|
||||
{
|
||||
public static class Preferences
|
||||
{
|
||||
private const string SharedPreferencesName = "ContosoAppPrefs";
|
||||
|
||||
public static ISharedPreferences SharedPreferences =>
|
||||
Application.Context.GetSharedPreferences(SharedPreferencesName, FileCreationMode.Private);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.microsoft.appcenter.xamarin.puppet" android:versionCode="41" android:versionName="1.0.1-SNAPSHOT" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="16" />
|
||||
<application android:label="SXPuppet" android:icon="@drawable/Icon" android:theme="@style/PuppetTheme" />
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.microsoft.appcenter.xamarin.puppet" android:versionCode="43" android:versionName="1.1.0-SNAPSHOT" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26" />
|
||||
<application android:label="SXPuppet" android:icon="@drawable/Icon" android:theme="@style/PuppetTheme">
|
||||
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
|
||||
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
||||
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
</manifest>
|
|
@ -25,5 +25,5 @@ using System.Runtime.InteropServices;
|
|||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1-SNAPSHOT")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.1.0-SNAPSHOT")]
|
||||
|
|
|
@ -65,6 +65,11 @@
|
|||
android:text="@string/CrashSuperNotCalled"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:id="@+id/crash_java_from_dotnet"
|
||||
android:text="@string/CrashJavaFromDotNet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
|
@ -1,31 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="@string/DistributeEnabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp" />
|
||||
<Switch
|
||||
android:id="@+id/enabled_distribute"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="25px"
|
||||
android:minHeight="25px">
|
||||
<LinearLayout
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp"
|
||||
android:id="@+id/linearLayout3">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/linearLayout1">
|
||||
<TextView
|
||||
android:text="@string/DistributeEnabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:id="@+id/textView1" />
|
||||
<Switch
|
||||
android:id="@+id/enabled_distribute"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp"
|
||||
android:id="@+id/linearLayout3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/linearLayout1">
|
||||
<TextView
|
||||
android:text="@string/PushEnabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:id="@+id/textView1" />
|
||||
<Switch
|
||||
android:id="@+id/enabled_push"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp"
|
||||
android:id="@+id/linearLayout3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/linearLayout1">
|
||||
<TextView
|
||||
android:text="@string/FirebaseAnalyticsEnabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:id="@+id/textView1" />
|
||||
<Switch
|
||||
android:id="@+id/enabled_firebase_analytics"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
|
@ -4,7 +4,7 @@
|
|||
<string name="AppCenterTitle">App Center</string>
|
||||
<string name="AnalyticsTitle">Analytics</string>
|
||||
<string name="CrashesTitle">Crashes</string>
|
||||
<string name="DistributeTitle">Distribute</string>
|
||||
<string name="OthersTitle">Others</string>
|
||||
<string name="AppCenterEnabled">App Center Enabled</string>
|
||||
<string name="AppCenterLogLevel">Log Level</string>
|
||||
<string name="AppCenterLogMessage">Log Message</string>
|
||||
|
@ -17,12 +17,15 @@
|
|||
<string name="AnalyticsTrackEvent">Track Event</string>
|
||||
<string name="CrashesEnabled">Crashes Enabled</string>
|
||||
<string name="TestCrash">Generate Test Crash</string>
|
||||
<string name="PushEnabled">Push Enabled</string>
|
||||
<string name="FirebaseAnalyticsEnabled">Firebase Analytics Enabled</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="CrashSuperNotCalled">Crash Pure Java: SuperNotCalledException</string>
|
||||
<string name="CrashJavaFromDotNet">Crash Java from .NET</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>
|
||||
|
|
|
@ -1,16 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="25.3.1" targetFramework="monoandroid71" />
|
||||
<package id="Xamarin.Android.Support.Annotations" version="25.3.1" targetFramework="monoandroid71" />
|
||||
<package id="Xamarin.Android.Support.Compat" version="25.3.1" targetFramework="monoandroid71" />
|
||||
<package id="Xamarin.Android.Support.Core.UI" version="25.3.1" targetFramework="monoandroid71" />
|
||||
<package id="Xamarin.Android.Support.Core.Utils" version="25.3.1" targetFramework="monoandroid71" />
|
||||
<package id="Xamarin.Android.Support.Design" version="25.3.1" targetFramework="monoandroid71" />
|
||||
<package id="Xamarin.Android.Support.Fragment" version="25.3.1" targetFramework="monoandroid71" />
|
||||
<package id="Xamarin.Android.Support.Media.Compat" version="25.3.1" targetFramework="monoandroid71" />
|
||||
<package id="Xamarin.Android.Support.Transition" version="25.3.1" targetFramework="monoandroid71" />
|
||||
<package id="Xamarin.Android.Support.v7.AppCompat" version="25.3.1" targetFramework="monoandroid71" />
|
||||
<package id="Xamarin.Android.Support.v7.RecyclerView" version="25.3.1" targetFramework="monoandroid71" />
|
||||
<package id="Xamarin.Android.Support.Vector.Drawable" version="25.3.1" targetFramework="monoandroid71" />
|
||||
<package id="Xamarin.Build.Download" version="0.4.4" targetFramework="monoandroid71" />
|
||||
<package id="Xamarin.Android.Arch.Core.Common" version="1.0.0" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Arch.Lifecycle.Common" version="1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Arch.Lifecycle.Runtime" version="1.0.0" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.Annotations" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.Compat" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.Core.UI" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.Core.Utils" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.Design" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.Fragment" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.Media.Compat" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.Transition" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.v4" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.v7.AppCompat" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.v7.RecyclerView" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.Vector.Drawable" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Build.Download" version="0.4.7" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Firebase.Analytics" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Firebase.Analytics.Impl" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Firebase.Common" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Firebase.Core" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Firebase.Iid" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Firebase.Messaging" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.GooglePlayServices.Basement" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.GooglePlayServices.Tasks" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
</packages>
|
|
@ -0,0 +1,4 @@
|
|||
-dontwarn com.google.android.gms.**
|
||||
-keep class com.google.firebase.provider.FirebaseInitProvider
|
||||
-keep class com.google.firebase.iid.FirebaseInstanceIdReceiver
|
||||
-keep class com.google.firebase.messaging.FirebaseMessagingService
|
|
@ -55,6 +55,7 @@
|
|||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="FilePicker.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
|
@ -80,8 +81,5 @@
|
|||
<ItemGroup>
|
||||
<ProguardConfiguration Include="proguard.cfg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<GoogleServicesJson Include="google-services.json" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,130 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
using Android.Provider;
|
||||
using Android.Text.Format;
|
||||
using Android.Webkit;
|
||||
using Contoso.Forms.Demo.Droid;
|
||||
using Xamarin.Forms;
|
||||
|
||||
// Make this class visible to the DependencyService manager.
|
||||
[assembly: Dependency(typeof(FilePicker))]
|
||||
|
||||
namespace Contoso.Forms.Demo.Droid
|
||||
{
|
||||
public class FilePicker : IFilePicker
|
||||
{
|
||||
public Task<string> PickFile()
|
||||
{
|
||||
Intent intent;
|
||||
if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
|
||||
{
|
||||
intent = new Intent(Intent.ActionOpenDocument);
|
||||
intent.AddCategory(Intent.CategoryOpenable);
|
||||
}
|
||||
else
|
||||
{
|
||||
intent = new Intent(Intent.ActionGetContent);
|
||||
}
|
||||
intent.SetType("*/*");
|
||||
var activity = Xamarin.Forms.Forms.Context as MainActivity;
|
||||
activity.StartActivityForResult(Intent.CreateChooser(intent, "Select attachment file"), MainActivity.FileAttachmentId);
|
||||
activity.FileAttachmentTaskCompletionSource = new TaskCompletionSource<string>();
|
||||
return activity.FileAttachmentTaskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public Tuple<byte[], string, string> ReadFile(string file)
|
||||
{
|
||||
var uri = Android.Net.Uri.Parse(file);
|
||||
var activity = Xamarin.Forms.Forms.Context as MainActivity;
|
||||
|
||||
// Data
|
||||
byte[] data = null;
|
||||
using (var inputStream = activity.ContentResolver.OpenInputStream(uri))
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
inputStream.CopyTo(memoryStream);
|
||||
data = memoryStream.ToArray();
|
||||
}
|
||||
|
||||
// Name
|
||||
string name = "";
|
||||
var cursor = activity.ContentResolver.Query(uri, null, null, null, null);
|
||||
try
|
||||
{
|
||||
if (cursor != null && cursor.MoveToFirst())
|
||||
{
|
||||
var nameIndex = cursor.GetColumnIndex(OpenableColumns.DisplayName);
|
||||
if (!cursor.IsNull(nameIndex))
|
||||
{
|
||||
name = cursor.GetString(nameIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cursor?.Close();
|
||||
}
|
||||
|
||||
// Mime
|
||||
string mime = null;
|
||||
if (uri.Scheme == ContentResolver.SchemeContent)
|
||||
{
|
||||
mime = activity.ContentResolver.GetType(uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
var extension = MimeTypeMap.GetFileExtensionFromUrl(file);
|
||||
mime = MimeTypeMap.Singleton.GetMimeTypeFromExtension(extension.ToLower());
|
||||
}
|
||||
return new Tuple<byte[], string, string>(data, name, mime);
|
||||
}
|
||||
|
||||
public string GetFileDescription(string file)
|
||||
{
|
||||
if (string.IsNullOrEmpty(file))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var uri = Android.Net.Uri.Parse(file);
|
||||
var activity = Xamarin.Forms.Forms.Context as MainActivity;
|
||||
|
||||
string name = null;
|
||||
string size = null;
|
||||
var cursor = activity.ContentResolver.Query(uri, null, null, null, null);
|
||||
try
|
||||
{
|
||||
if (cursor != null && cursor.MoveToFirst())
|
||||
{
|
||||
var nameIndex = cursor.GetColumnIndex(OpenableColumns.DisplayName);
|
||||
var sizeIndex = cursor.GetColumnIndex(OpenableColumns.Size);
|
||||
if (!cursor.IsNull(nameIndex))
|
||||
{
|
||||
name = cursor.GetString(nameIndex);
|
||||
}
|
||||
if (!cursor.IsNull(sizeIndex))
|
||||
{
|
||||
size = Formatter.FormatFileSize(activity, cursor.GetLong(sizeIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cursor?.Close();
|
||||
}
|
||||
|
||||
string result = "";
|
||||
if (name != null)
|
||||
{
|
||||
result += "File: " + name;
|
||||
}
|
||||
if (size != null)
|
||||
{
|
||||
result += " Size: " + size;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using Android.App;
|
||||
using System.Threading.Tasks;
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Content.PM;
|
||||
using Android.OS;
|
||||
|
@ -9,6 +10,10 @@ namespace Contoso.Forms.Demo.Droid
|
|||
[Activity(Label = "ACFDemo", Icon = "@drawable/icon", Theme = "@style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||
{
|
||||
public static readonly int FileAttachmentId = 1;
|
||||
|
||||
public TaskCompletionSource<string> FileAttachmentTaskCompletionSource { set; get; }
|
||||
|
||||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
TabLayoutResource = Resource.Layout.Tabbar;
|
||||
|
@ -26,5 +31,19 @@ namespace Contoso.Forms.Demo.Droid
|
|||
base.OnNewIntent(intent);
|
||||
Push.CheckLaunchedFromNotification(this, intent);
|
||||
}
|
||||
|
||||
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
|
||||
{
|
||||
base.OnActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == FileAttachmentId)
|
||||
{
|
||||
var uri = resultCode == Result.Ok && data != null ? data.Data : null;
|
||||
if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat && uri != null)
|
||||
{
|
||||
ContentResolver.TakePersistableUriPermission(uri, data.Flags & ActivityFlags.GrantReadUriPermission);
|
||||
}
|
||||
FileAttachmentTaskCompletionSource.SetResult(uri?.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"Microsoft.AppCenter.Distribute": "1.0.1",
|
||||
"Microsoft.AppCenter.Push": "1.0.1",
|
||||
"Xamarin.Build.Download": "0.4.7",
|
||||
"Xamarin.Forms": "2.4.0.38779"
|
||||
"Xamarin.Forms": "2.5.0.91635"
|
||||
},
|
||||
"frameworks": {
|
||||
"MonoAndroid,Version=v8.0": {}
|
||||
|
|
|
@ -5,4 +5,11 @@
|
|||
xmlns:local="using:Contoso.Forms.Demo.UWP"
|
||||
RequestedTheme="Light">
|
||||
|
||||
<!-- Remove force converting to lowercase titles of table section. -->
|
||||
<Application.Resources>
|
||||
<DataTemplate x:Key="TableSection">
|
||||
<TextBlock Margin="0,20,0,0" Text="{Binding Title}" Style="{ThemeResource SubtitleTextBlockStyle}" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=Self},Converter={StaticResource CollapseWhenEmpty}}" />
|
||||
</DataTemplate>
|
||||
</Application.Resources>
|
||||
|
||||
</Application>
|
||||
|
|
До Ширина: | Высота: | Размер: 7.5 KiB После Ширина: | Высота: | Размер: 36 KiB |
До Ширина: | Высота: | Размер: 2.9 KiB После Ширина: | Высота: | Размер: 14 KiB |
До Ширина: | Высота: | Размер: 1.6 KiB После Ширина: | Высота: | Размер: 4.0 KiB |
До Ширина: | Высота: | Размер: 1.2 KiB После Ширина: | Высота: | Размер: 1.2 KiB |
До Ширина: | Высота: | Размер: 3.1 KiB После Ширина: | Высота: | Размер: 15 KiB |
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
|
||||
<Identity Name="10805zumoTestUser.AppCenter-Contoso.Forms.Demo.UWP" Publisher="CN=B2D1C358-6AF8-4416-BF73-129CC1F3C152" Version="1.0.1.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="fbe02dcf-2c7d-4740-9c2b-0df5e15916e5" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
|
@ -15,10 +15,10 @@
|
|||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Contoso.Forms.Demo.UWP.App">
|
||||
<uap:VisualElements DisplayName="AppCenter-Contoso.Forms.Demo.UWP" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Contoso.Forms.Demo.UWP" BackgroundColor="transparent">
|
||||
<uap:VisualElements DisplayName="AppCenter Demo UWP" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Contoso.Forms.Demo.UWP" BackgroundColor="transparent">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
|
||||
</uap:DefaultTile>
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="white" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"Microsoft.AppCenter.Distribute": "1.0.1",
|
||||
"Microsoft.AppCenter.Push": "1.0.1",
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2",
|
||||
"Xamarin.Forms": "2.4.0.38779"
|
||||
"Xamarin.Forms": "2.5.0.91635"
|
||||
},
|
||||
"frameworks": {
|
||||
"uap10.0.10586": {}
|
||||
|
|
|
@ -117,6 +117,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
<Compile Include="FilePicker.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\bolt%402x.png" />
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using Contoso.Forms.Demo.iOS;
|
||||
using Foundation;
|
||||
using MobileCoreServices;
|
||||
using Photos;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
|
||||
// Make this class visible to the DependencyService manager.
|
||||
[assembly: Dependency(typeof(FilePicker))]
|
||||
|
||||
namespace Contoso.Forms.Demo.iOS
|
||||
{
|
||||
public class FilePicker : IFilePicker
|
||||
{
|
||||
public async Task<string> PickFile()
|
||||
{
|
||||
var status = await PHPhotoLibrary.RequestAuthorizationAsync();
|
||||
if (status != PHAuthorizationStatus.Authorized)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
var imagePicker = new UIImagePickerController();
|
||||
imagePicker.FinishedPickingMedia += (sender, args) => {
|
||||
taskCompletionSource.SetResult(args.ReferenceUrl?.AbsoluteString);
|
||||
imagePicker.DismissModalViewController(true);
|
||||
};
|
||||
imagePicker.Canceled += (sender, args) => {
|
||||
taskCompletionSource.SetResult(null);
|
||||
imagePicker.DismissModalViewController(true);
|
||||
};
|
||||
UIWindow window = UIApplication.SharedApplication.KeyWindow;
|
||||
var viewController = window.RootViewController;
|
||||
viewController.PresentModalViewController(imagePicker, true);
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public Tuple<byte[], string, string> ReadFile(string file)
|
||||
{
|
||||
Tuple<byte[], string, string> result = null;
|
||||
var asset = PHAsset.FetchAssets(new[] { new NSUrl(file) }, null).LastObject as PHAsset;
|
||||
if (asset != null)
|
||||
{
|
||||
var options = new PHImageRequestOptions { Synchronous = true };
|
||||
PHImageManager.DefaultManager.RequestImageData(asset, options,(data, dataUti, orientation, info) => {
|
||||
var extension = new NSUrl(dataUti).PathExtension;
|
||||
var uti = UTType.CreatePreferredIdentifier(UTType.TagClassFilenameExtension, extension, null);
|
||||
var mime = UTType.GetPreferredTag(uti, UTType.TagClassMIMEType);
|
||||
var dataBytes = new byte[data.Length];
|
||||
Marshal.Copy(data.Bytes, dataBytes, 0, Convert.ToInt32(data.Length));
|
||||
result = new Tuple<byte[], string, string>(dataBytes, dataUti, mime);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public string GetFileDescription(string file)
|
||||
{
|
||||
if (string.IsNullOrEmpty(file))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
long fileSize = 0;
|
||||
var asset = PHAsset.FetchAssets(new[] { new NSUrl(file) }, null).LastObject as PHAsset;
|
||||
if (asset != null)
|
||||
{
|
||||
var options = new PHImageRequestOptions { Synchronous = true };
|
||||
PHImageManager.DefaultManager.RequestImageData(asset, options, (data, dataUti, orientation, info) => {
|
||||
fileSize = Convert.ToInt64(data.Length);
|
||||
});
|
||||
}
|
||||
return NSByteCountFormatter.Format(fileSize, NSByteCountFormatterCountStyle.Binary);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -76,5 +76,7 @@
|
|||
<array>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>Select photo for attachment</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Microsoft.AppCenter.Crashes": "1.0.1",
|
||||
"Microsoft.AppCenter.Distribute": "1.0.1",
|
||||
"Microsoft.AppCenter.Push": "1.0.1",
|
||||
"Xamarin.Forms": "2.4.0.38779"
|
||||
"Xamarin.Forms": "2.5.0.91635"
|
||||
},
|
||||
"frameworks": {
|
||||
"Xamarin.iOS,Version=v1.0": {}
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Contoso.Forms.Demo.AddPropertyContentPage">
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="Property Name" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="120" />
|
||||
<Entry HorizontalOptions="FillAndExpand" x:Name="NameEntry" />
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Demo.AddPropertyContentPage">
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="Property Name" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="120" />
|
||||
<Entry HorizontalOptions="FillAndExpand" x:Name="NameEntry" />
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="Property Value" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="120" />
|
||||
<Entry HorizontalOptions="FillAndExpand" x:Name="ValueEntry" />
|
||||
</StackLayout>
|
||||
<Button Text="Add Property" Clicked="AddProperty" FontAttributes="Bold" Margin="0,20,0,0" />
|
||||
<Button Text="Cancel" TextColor="Red" Clicked="Cancel" />
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="Property Value" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="120" />
|
||||
<Entry HorizontalOptions="FillAndExpand" x:Name="ValueEntry" />
|
||||
</StackLayout>
|
||||
<Button Text="Add Property" Clicked="AddProperty" />
|
||||
<Button Text="Cancel" TextColor="Red" Clicked="Cancel" />
|
||||
</StackLayout>
|
||||
</ContentPage>
|
|
@ -12,16 +12,16 @@ namespace Contoso.Forms.Demo
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
void AddProperty(object sender, EventArgs e)
|
||||
async void AddProperty(object sender, EventArgs e)
|
||||
{
|
||||
Property addedProperty = new Property(NameEntry.Text, ValueEntry.Text);
|
||||
PropertyAdded.Invoke(addedProperty);
|
||||
Navigation.PopModalAsync();
|
||||
await Navigation.PopModalAsync();
|
||||
}
|
||||
|
||||
void Cancel(object sender, EventArgs e)
|
||||
async void Cancel(object sender, EventArgs e)
|
||||
{
|
||||
Navigation.PopModalAsync();
|
||||
await Navigation.PopModalAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Contoso.Forms.Demo.App">
|
||||
<Application xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Demo.App">
|
||||
<Application.Resources>
|
||||
<!-- Application resource dictionary -->
|
||||
</Application.Resources>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AppCenter;
|
||||
using Microsoft.AppCenter.Analytics;
|
||||
|
@ -180,11 +180,36 @@ namespace Contoso.Forms.Demo
|
|||
|
||||
IEnumerable<ErrorAttachmentLog> GetErrorAttachments(ErrorReport report)
|
||||
{
|
||||
return new ErrorAttachmentLog[]
|
||||
var attachments = new List<ErrorAttachmentLog>();
|
||||
if (Current.Properties.TryGetValue(CrashesContentPage.TextAttachmentKey, out var textAttachment) &&
|
||||
textAttachment is string text)
|
||||
{
|
||||
ErrorAttachmentLog.AttachmentWithText("Hello world!", "hello.txt"),
|
||||
ErrorAttachmentLog.AttachmentWithBinary(Encoding.UTF8.GetBytes("Fake image"), "fake_image.jpeg", "image/jpeg")
|
||||
};
|
||||
var attachment = ErrorAttachmentLog.AttachmentWithText(text, "hello.txt");
|
||||
attachments.Add(attachment);
|
||||
}
|
||||
if (Current.Properties.TryGetValue(CrashesContentPage.FileAttachmentKey, out var fileAttachment) &&
|
||||
fileAttachment is string file)
|
||||
{
|
||||
var filePicker = DependencyService.Get<IFilePicker>();
|
||||
if (filePicker != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = filePicker.ReadFile(file);
|
||||
if (result != null)
|
||||
{
|
||||
var attachment = ErrorAttachmentLog.AttachmentWithBinary(result.Item1, result.Item2, result.Item3);
|
||||
attachments.Add(attachment);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
AppCenterLog.Warn(LogTag, "Couldn't read file attachment", e);
|
||||
Current.Properties.Remove(CrashesContentPage.FileAttachmentKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
return attachments;
|
||||
}
|
||||
|
||||
bool OnReleaseAvailable(ReleaseDetails releaseDetails)
|
||||
|
|
|
@ -62,6 +62,10 @@
|
|||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Views\TextAttachmentView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
|
@ -97,6 +101,10 @@
|
|||
<Compile Include="ModulePages\CustomPropertiesContentPage.xaml.cs">
|
||||
<DependentUpon>CustomPropertiesContentPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="IFilePicker.cs" />
|
||||
<Compile Include="Views\TextAttachmentView.xaml.cs">
|
||||
<DependentUpon>TextAttachmentView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="project.json" />
|
||||
|
|
|
@ -5,9 +5,9 @@ namespace Contoso.Forms.Demo
|
|||
{
|
||||
static class FakeService
|
||||
{
|
||||
internal async static Task DoStuffInBackground()
|
||||
internal static async Task DoStuffInBackground()
|
||||
{
|
||||
await Task.Run(() => { throw new IOException("Server did not respond"); });
|
||||
await Task.Run(() => throw new IOException("Server did not respond"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contoso.Forms.Demo
|
||||
{
|
||||
public interface IFilePicker
|
||||
{
|
||||
Task<string> PickFile();
|
||||
Tuple<byte[], string, string> ReadFile(string file);
|
||||
string GetFileDescription(string file);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TabbedPage Title="App Center Demo App" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Contoso.Forms.Demo;assembly=Contoso.Forms.Demo" x:Class="Contoso.Forms.Demo.MainDemoPage">
|
||||
<TabbedPage Title="AppCenter Demo Application"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:local="clr-namespace:Contoso.Forms.Demo;assembly=Contoso.Forms.Demo"
|
||||
x:Class="Contoso.Forms.Demo.MainDemoPage">
|
||||
<local:AppCenterContentPage />
|
||||
<local:AnalyticsContentPage />
|
||||
<local:CrashesContentPage />
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage Title="Analytics" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Contoso.Forms.Demo.AnalyticsContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection>
|
||||
<SwitchCell Text="Analytics Enabled" On="true" x:Name="EnabledSwitchCell" OnChanged="UpdateEnabled"/>
|
||||
</TableSection>
|
||||
<TableSection>
|
||||
<EntryCell Label="Event Name" HorizontalTextAlignment="Start" x:Name="EventNameCell"/>
|
||||
<ViewCell Tapped="PropertiesCellTapped">
|
||||
<StackLayout Orientation="Horizontal" Margin="15,0,15,0">
|
||||
<Label Text="Properties" HorizontalOptions="StartAndExpand" VerticalOptions="Center" />
|
||||
<Label Text="0" HorizontalOptions="EndAndExpand" VerticalOptions="Center" x:Name="NumPropertiesLabel" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="AddProperty">
|
||||
<Button Text="Add Property" Clicked="AddProperty" InputTransparent="true"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="TrackEvent">
|
||||
<Button Text="Track Event" InputTransparent="true" Clicked="TrackEvent"/>
|
||||
</ViewCell>
|
||||
</TableSection>
|
||||
</TableView>
|
||||
<ContentPage Title="Analytics"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Demo.AnalyticsContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection Title="Analytics Settings">
|
||||
<SwitchCell Text="Analytics Enabled" On="true" x:Name="EnabledSwitchCell" OnChanged="UpdateEnabled" />
|
||||
</TableSection>
|
||||
<TableSection Title="Tracking Events">
|
||||
<EntryCell Label="Event Name" HorizontalTextAlignment="Start" x:Name="EventNameCell" />
|
||||
<ViewCell Tapped="PropertiesCellTapped">
|
||||
<StackLayout Orientation="Horizontal" Margin="15,0,15,0">
|
||||
<Label Text="Properties" HorizontalOptions="StartAndExpand" VerticalOptions="Center" />
|
||||
<Label Text="0" HorizontalOptions="EndAndExpand" VerticalOptions="Center" TextColor="Gray" x:Name="NumPropertiesLabel" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="AddProperty">
|
||||
<Button Text="Add Property" Clicked="AddProperty" InputTransparent="true" />
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="TrackEvent">
|
||||
<Button Text="Track Event" InputTransparent="true" Clicked="TrackEvent" FontAttributes="Bold" />
|
||||
</ViewCell>
|
||||
</TableSection>
|
||||
</TableView>
|
||||
</ContentPage>
|
||||
|
|
|
@ -8,13 +8,14 @@ namespace Contoso.Forms.Demo
|
|||
{
|
||||
public class Property
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public string Value { get; private set; }
|
||||
|
||||
public Property(string propertyName, string propertyValue)
|
||||
{
|
||||
Name = propertyName;
|
||||
Value = propertyValue;
|
||||
}
|
||||
public string Name;
|
||||
public string Value;
|
||||
}
|
||||
|
||||
[Android.Runtime.Preserve(AllMembers = true)]
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage Title="App Center" xmlns:local="clr-namespace:Contoso.Forms.Demo"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Contoso.Forms.Demo.AppCenterContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection>
|
||||
<SwitchCell Text="AppCenter Enabled" On="true" x:Name="AppCenterEnabledSwitchCell" OnChanged="UpdateEnabled"/>
|
||||
</TableSection>
|
||||
</TableView>
|
||||
</ContentPage>
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Demo.AppCenterContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection Title="AppCenter Settings">
|
||||
<SwitchCell Text="AppCenter Enabled" On="true" x:Name="AppCenterEnabledSwitchCell" OnChanged="UpdateEnabled"/>
|
||||
</TableSection>
|
||||
</TableView>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,28 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage Title="Crashes"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Demo.CrashesContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection>
|
||||
<SwitchCell Text="Crashes Enabled" On="true" x:Name="CrashesEnabledSwitchCell" OnChanged="UpdateEnabled"/>
|
||||
</TableSection>
|
||||
<TableSection>
|
||||
<ViewCell Tapped="TestCrash">
|
||||
<Button Text="Generate Test Crash" InputTransparent="true" Clicked="TestCrash"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="DivideByZero">
|
||||
<Button Text="Divide 42 by 0" InputTransparent="true" Clicked="DivideByZero"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="CrashWithAggregateException">
|
||||
<Button Text="Crash With Aggregate Exception" InputTransparent="true" Clicked="CrashWithAggregateException"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="CrashWithNullReferenceException">
|
||||
<Button Text="Crash With NullReferenceException" InputTransparent="true" Clicked="CrashWithNullReferenceException"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="CrashAsync">
|
||||
<Button Text="Crash Inside Async Task" InputTransparent="true" Clicked="CrashAsync"/>
|
||||
</ViewCell>
|
||||
</TableSection>
|
||||
</TableView>
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Demo.CrashesContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection Title="Crashes Settings">
|
||||
<SwitchCell Text="Crashes Enabled" On="true" x:Name="CrashesEnabledSwitchCell" OnChanged="UpdateEnabled"/>
|
||||
<SwitchCell Text="Handle Exceptions" On="false" x:Name="HandleExceptionsSwitchCell"/>
|
||||
</TableSection>
|
||||
<TableSection Title="Attachments">
|
||||
<TextCell Text="Text Attachment" x:Name="TextAttachmentCell" Tapped="TextAttachment"/>
|
||||
<TextCell Text="Binary Attachment" x:Name="FileAttachmentCell" Tapped="FileAttachment"/>
|
||||
</TableSection>
|
||||
<TableSection Title="Test Crashes">
|
||||
<ViewCell Tapped="TestCrash">
|
||||
<Button Text="Generate Test Crash" InputTransparent="true" Clicked="TestCrash"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="DivideByZero">
|
||||
<Button Text="Divide 42 by 0" InputTransparent="true" Clicked="DivideByZero"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="CrashWithAggregateException">
|
||||
<Button Text="Crash With Aggregate Exception" InputTransparent="true" Clicked="CrashWithAggregateException"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="CrashWithNullReferenceException">
|
||||
<Button Text="Crash With NullReferenceException" InputTransparent="true" Clicked="CrashWithNullReferenceException"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="CrashAsync">
|
||||
<Button Text="Crash Inside Async Task" InputTransparent="true" Clicked="CrashAsync"/>
|
||||
</ViewCell>
|
||||
</TableSection>
|
||||
</TableView>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,20 +1,27 @@
|
|||
#define DEBUG
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Contoso.Forms.Demo.Views;
|
||||
using Microsoft.AppCenter;
|
||||
using Microsoft.AppCenter.Crashes;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Contoso.Forms.Demo
|
||||
{
|
||||
using XamarinDevice = Xamarin.Forms.Device;
|
||||
|
||||
[Android.Runtime.Preserve(AllMembers = true)]
|
||||
public partial class CrashesContentPage
|
||||
{
|
||||
public const string TextAttachmentKey = "TEXT_ATTACHMENT";
|
||||
public const string FileAttachmentKey = "FILE_ATTACHMENT";
|
||||
|
||||
public CrashesContentPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.iOS)
|
||||
if (XamarinDevice.RuntimePlatform == XamarinDevice.iOS)
|
||||
{
|
||||
Icon = "socket.png";
|
||||
}
|
||||
|
@ -25,6 +32,59 @@ namespace Contoso.Forms.Demo
|
|||
base.OnAppearing();
|
||||
CrashesEnabledSwitchCell.On = await Crashes.IsEnabledAsync();
|
||||
CrashesEnabledSwitchCell.IsEnabled = await AppCenter.IsEnabledAsync();
|
||||
|
||||
// Attachments
|
||||
if (Application.Current.Properties.TryGetValue(TextAttachmentKey, out var textAttachment) &&
|
||||
textAttachment is string text)
|
||||
{
|
||||
TextAttachmentCell.Detail = text;
|
||||
}
|
||||
if (Application.Current.Properties.TryGetValue(FileAttachmentKey, out var fileAttachment) &&
|
||||
fileAttachment is string file)
|
||||
{
|
||||
var filePicker = DependencyService.Get<IFilePicker>();
|
||||
try
|
||||
{
|
||||
FileAttachmentCell.Detail = filePicker?.GetFileDescription(file);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.WriteLine("Couldn't read file attachment: {0}", e.Message);
|
||||
Application.Current.Properties.Remove(FileAttachmentKey);
|
||||
}
|
||||
}
|
||||
if (XamarinDevice.RuntimePlatform == XamarinDevice.UWP)
|
||||
{
|
||||
TextAttachmentCell.IsEnabled = false;
|
||||
FileAttachmentCell.IsEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
async void UpdateEnabled(object sender, ToggledEventArgs e)
|
||||
{
|
||||
await Crashes.SetEnabledAsync(e.Value);
|
||||
}
|
||||
|
||||
async void TextAttachment(object sender, EventArgs e)
|
||||
{
|
||||
var text = await TextAttachmentView.Show(Navigation);
|
||||
((TextCell)sender).Detail = text;
|
||||
Application.Current.Properties[TextAttachmentKey] = text;
|
||||
await Application.Current.SavePropertiesAsync();
|
||||
}
|
||||
|
||||
async void FileAttachment(object sender, EventArgs e)
|
||||
{
|
||||
var filePicker = DependencyService.Get<IFilePicker>();
|
||||
if (filePicker == null)
|
||||
{
|
||||
Debug.WriteLine("File attachment isn't implemented");
|
||||
return;
|
||||
}
|
||||
var file = await filePicker.PickFile();
|
||||
((TextCell)sender).Detail = filePicker.GetFileDescription(file);
|
||||
Application.Current.Properties[FileAttachmentKey] = file;
|
||||
await Application.Current.SavePropertiesAsync();
|
||||
}
|
||||
|
||||
void TestCrash(object sender, EventArgs e)
|
||||
|
@ -40,11 +100,6 @@ namespace Contoso.Forms.Demo
|
|||
#pragma warning restore CS0219
|
||||
}
|
||||
|
||||
async void UpdateEnabled(object sender, ToggledEventArgs e)
|
||||
{
|
||||
await Crashes.SetEnabledAsync(e.Value);
|
||||
}
|
||||
|
||||
private void CrashWithNullReferenceException(object sender, EventArgs e)
|
||||
{
|
||||
TriggerNullReferenceException();
|
||||
|
@ -54,9 +109,9 @@ namespace Contoso.Forms.Demo
|
|||
{
|
||||
string[] values = { "one", null, "two" };
|
||||
for (int ctr = 0; ctr <= values.GetUpperBound(0); ctr++)
|
||||
System.Diagnostics.Debug.WriteLine("{0}{1}", values[ctr].Trim(),
|
||||
Debug.WriteLine("{0}{1}", values[ctr].Trim(),
|
||||
ctr == values.GetUpperBound(0) ? "" : ", ");
|
||||
System.Diagnostics.Debug.WriteLine("");
|
||||
Debug.WriteLine("");
|
||||
}
|
||||
|
||||
private void CrashWithAggregateException(object sender, EventArgs e)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage Title="Custom Properties"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Demo.CustomPropertiesContentPage">
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Demo.CustomPropertiesContentPage">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<ScrollView Orientation="Vertical">
|
||||
<StackLayout Orientation="Vertical" x:Name="PropertiesContainer">
|
||||
<StackLayout Orientation="Vertical" x:Name="PropertiesContainer" Padding="10">
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
<Button Text="Add property" Clicked="AddProperty_Clicked" x:Name="AddProperty"/>
|
||||
<Button Text="Send" Clicked="Send_Clicked" x:Name="Send"/>
|
||||
<Button Text="Add property" Clicked="AddProperty_Clicked" x:Name="AddProperty" Margin="0,20,0,0" />
|
||||
<Button Text="Send" Clicked="Send_Clicked" x:Name="Send" FontAttributes="Bold" />
|
||||
</StackLayout>
|
||||
</ContentPage>
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage Title="Others"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Demo.OthersContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection Title="Distribute">
|
||||
<SwitchCell Text="Distribute Enabled" On="true" x:Name="DistributeEnabledSwitchCell" OnChanged="UpdateDistributeEnabled"/>
|
||||
</TableSection>
|
||||
<TableSection Title="Push">
|
||||
<SwitchCell Text="Push Enabled" On="true" x:Name="PushEnabledSwitchCell" OnChanged="UpdatePushEnabled"/>
|
||||
</TableSection>
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Demo.OthersContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection Title="Distribute">
|
||||
<SwitchCell Text="Distribute Enabled" On="true" x:Name="DistributeEnabledSwitchCell" OnChanged="UpdateDistributeEnabled"/>
|
||||
</TableSection>
|
||||
<TableSection Title="Push">
|
||||
<SwitchCell Text="Push Enabled" On="true" x:Name="PushEnabledSwitchCell" OnChanged="UpdatePushEnabled"/>
|
||||
</TableSection>
|
||||
</TableView>
|
||||
</ContentPage>
|
||||
|
|
|
@ -22,11 +22,11 @@ namespace Contoso.Forms.Demo
|
|||
protected override async void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
var mcEnabled = await AppCenter.IsEnabledAsync();
|
||||
var acEnabled = await AppCenter.IsEnabledAsync();
|
||||
DistributeEnabledSwitchCell.On = await Distribute.IsEnabledAsync();
|
||||
DistributeEnabledSwitchCell.IsEnabled = mcEnabled;
|
||||
DistributeEnabledSwitchCell.IsEnabled = acEnabled;
|
||||
PushEnabledSwitchCell.On = await Push.IsEnabledAsync();
|
||||
PushEnabledSwitchCell.IsEnabled = mcEnabled;
|
||||
PushEnabledSwitchCell.IsEnabled = acEnabled;
|
||||
}
|
||||
|
||||
async void UpdateDistributeEnabled(object sender, ToggledEventArgs e)
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Contoso.Forms.Demo.PropertiesContentPage">
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Demo.PropertiesContentPage"
|
||||
Title="Event Properties">
|
||||
<ListView x:Name="PropertyList">
|
||||
|
||||
</ListView>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<StackLayout Orientation="Horizontal" Padding="10">
|
||||
<Label Text="{Binding Name}" />
|
||||
<Label Text="{Binding Value}" TextColor="Gray" HorizontalOptions="EndAndExpand" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Contoso.Forms.Demo
|
||||
|
@ -9,17 +8,7 @@ namespace Contoso.Forms.Demo
|
|||
public PropertiesContentPage(List<Property> EventProperties)
|
||||
{
|
||||
InitializeComponent();
|
||||
Title = "Event Properties";
|
||||
|
||||
List<string> properties = new List<string>();
|
||||
|
||||
foreach (Property property in EventProperties)
|
||||
{
|
||||
string propertyString = property.Name + ": " + property.Value;
|
||||
properties.Add(propertyString);
|
||||
}
|
||||
|
||||
PropertyList.ItemsSource = properties;
|
||||
PropertyList.ItemsSource = EventProperties;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,20 @@
|
|||
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Demo.CustomPropertyView">
|
||||
<ContentView.Content>
|
||||
<Frame OutlineColor="DarkGray">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<Entry x:Name="PropertyKey"></Entry>
|
||||
<Picker x:Name="PropertyType" SelectedIndexChanged="PropertyType_SelectedIndexChanged"></Picker>
|
||||
<StackLayout x:Name="PropertyValueHolder"/>
|
||||
<Frame OutlineColor="DarkGray">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="Key" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="60" />
|
||||
<Entry HorizontalOptions="FillAndExpand" x:Name="PropertyKey" />
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
</ContentView.Content>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="Type" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="60" />
|
||||
<Picker HorizontalOptions="FillAndExpand" x:Name="PropertyType" SelectedIndexChanged="PropertyType_SelectedIndexChanged" />
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Horizontal" IsVisible="false" x:Name="PropertyValue">
|
||||
<Label Text="Value" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="60" />
|
||||
<StackLayout HorizontalOptions="FillAndExpand" x:Name="PropertyValueHolder" />
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
</ContentView>
|
|
@ -24,7 +24,8 @@ namespace Contoso.Forms.Demo
|
|||
{
|
||||
properties.Clear(PropertyKey.Text);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
View view = PropertyValueHolder.Children[0];
|
||||
switch ((PropertyTypes)PropertyType.SelectedIndex)
|
||||
{
|
||||
|
@ -38,7 +39,8 @@ namespace Contoso.Forms.Demo
|
|||
}
|
||||
break;
|
||||
case PropertyTypes.DateTime:
|
||||
DateTime date = new DateTime(DatePicker.Date.Year, DatePicker.Date.Month, DatePicker.Date.Day, TimePicker.Time.Hours, TimePicker.Time.Minutes, TimePicker.Time.Seconds);
|
||||
DateTime date = new DateTime(DatePicker.Date.Year, DatePicker.Date.Month, DatePicker.Date.Day,
|
||||
TimePicker.Time.Hours, TimePicker.Time.Minutes, TimePicker.Time.Seconds);
|
||||
properties.Set(PropertyKey.Text, date);
|
||||
break;
|
||||
case PropertyTypes.String:
|
||||
|
@ -60,26 +62,31 @@ namespace Contoso.Forms.Demo
|
|||
private void PropertyType_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
PropertyValueHolder.Children.Clear();
|
||||
switch ((PropertyTypes) PropertyType.SelectedIndex)
|
||||
PropertyValue.IsVisible = false;
|
||||
switch ((PropertyTypes)PropertyType.SelectedIndex)
|
||||
{
|
||||
case PropertyTypes.Boolean:
|
||||
PropertyValueHolder.Children.Add(new Switch());
|
||||
PropertyValue.IsVisible = true;
|
||||
break;
|
||||
case PropertyTypes.Number:
|
||||
Editor NumberEditor = new Editor() { Keyboard = Keyboard.Numeric};
|
||||
Editor NumberEditor = new Editor() { Keyboard = Keyboard.Numeric };
|
||||
NumberEditor.TextChanged += NumberEditor_TextChanged;
|
||||
PropertyValueHolder.Children.Add(NumberEditor);
|
||||
PropertyValue.IsVisible = true;
|
||||
break;
|
||||
case PropertyTypes.DateTime:
|
||||
StackLayout DateTimeLayout = new StackLayout() { Orientation = StackOrientation.Vertical};
|
||||
StackLayout DateTimeLayout = new StackLayout() { Orientation = StackOrientation.Vertical };
|
||||
DatePicker = new DatePicker() { Date = DateTime.Now };
|
||||
DateTimeLayout.Children.Add(DatePicker);
|
||||
TimePicker = new TimePicker() { Time = DateTime.Now.TimeOfDay };
|
||||
DateTimeLayout.Children.Add(TimePicker);
|
||||
PropertyValueHolder.Children.Add(DateTimeLayout);
|
||||
PropertyValue.IsVisible = true;
|
||||
break;
|
||||
case PropertyTypes.String:
|
||||
PropertyValueHolder.Children.Add(new Editor());
|
||||
PropertyValue.IsVisible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Demo.Views.TextAttachmentView">
|
||||
<StackLayout Orientation="Vertical" VerticalOptions="StartAndExpand" Padding="20">
|
||||
<Label Text="Text Attachment" HorizontalOptions="Center" FontAttributes="Bold" Margin="10" />
|
||||
<Frame Padding="5">
|
||||
<Editor x:Name="Text" HeightRequest="100" />
|
||||
</Frame>
|
||||
<StackLayout Orientation="Horizontal" HorizontalOptions="Center" >
|
||||
<Button WidthRequest="100" Text="OK" Clicked="OK" FontAttributes="Bold" />
|
||||
<Button WidthRequest="100" Text="Cancel" Clicked="Cancel" />
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage>
|
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Contoso.Forms.Demo.Views
|
||||
{
|
||||
public partial class TextAttachmentView : ContentPage
|
||||
{
|
||||
private readonly TaskCompletionSource<string> _taskCompletionSource = new TaskCompletionSource<string>();
|
||||
private INavigation _navigation;
|
||||
|
||||
public TextAttachmentView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
Text.Focus();
|
||||
}
|
||||
|
||||
public static Task<string> Show(INavigation navegation)
|
||||
{
|
||||
var view = new TextAttachmentView();
|
||||
view._navigation = navegation;
|
||||
navegation.PushModalAsync(view);
|
||||
return view._taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
async void OK(object sender, EventArgs args)
|
||||
{
|
||||
var result = Text.Text;
|
||||
await _navigation.PopModalAsync();
|
||||
_taskCompletionSource.SetResult(result);
|
||||
}
|
||||
|
||||
async void Cancel(object sender, EventArgs args)
|
||||
{
|
||||
await _navigation.PopModalAsync();
|
||||
_taskCompletionSource.SetResult(null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"Microsoft.AppCenter.Distribute": "1.0.1",
|
||||
"Microsoft.AppCenter.Push": "1.0.1",
|
||||
"NETStandard.Library": "1.6.1",
|
||||
"Xamarin.Forms": "2.4.0.38779"
|
||||
"Xamarin.Forms": "2.5.0.91635"
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard1.0": {}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\packages\Xamarin.Forms.2.4.0.38779\build\netstandard1.0\Xamarin.Forms.props" Condition="Exists('..\..\..\packages\Xamarin.Forms.2.4.0.38779\build\netstandard1.0\Xamarin.Forms.props')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Forms.2.5.0.121934\build\netstandard1.0\Xamarin.Forms.props" Condition="Exists('..\..\..\packages\Xamarin.Forms.2.5.0.121934\build\netstandard1.0\Xamarin.Forms.props')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.props" Condition="Exists('..\..\..\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
|
@ -45,7 +45,7 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidManagedSymbols>true</AndroidManagedSymbols>
|
||||
<AndroidLinkMode>Full</AndroidLinkMode>
|
||||
<AndroidLinkSkip>Xamarin.Android.Support.v7.AppCompat;Xamarin.Android.Support.Core.UI</AndroidLinkSkip>
|
||||
<AndroidLinkSkip>Xamarin.Android.Support.v7.AppCompat;Xamarin.Android.Support.Core.UI;Microsoft.AppCenter.Crashes</AndroidLinkSkip>
|
||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||
<AndroidSupportedAbis>armeabi-v7a;armeabi;x86;arm64-v8a;x86_64</AndroidSupportedAbis>
|
||||
<EnableProguard>true</EnableProguard>
|
||||
|
@ -63,27 +63,6 @@
|
|||
<Reference Include="HockeySDK">
|
||||
<HintPath>..\..\..\packages\HockeySDK.Xamarin.5.0.0\lib\MonoAndroid403\HockeySDK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.GooglePlayServices.Basement">
|
||||
<HintPath>..\..\..\packages\Xamarin.GooglePlayServices.Basement.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.GooglePlayServices.Basement.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.GooglePlayServices.Tasks">
|
||||
<HintPath>..\..\..\packages\Xamarin.GooglePlayServices.Tasks.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.GooglePlayServices.Tasks.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Firebase.Common">
|
||||
<HintPath>..\..\..\packages\Xamarin.Firebase.Common.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.Firebase.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Firebase.Iid">
|
||||
<HintPath>..\..\..\packages\Xamarin.Firebase.Iid.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.Firebase.Iid.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Firebase.Analytics.Impl">
|
||||
<HintPath>..\..\..\packages\Xamarin.Firebase.Analytics.Impl.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.Firebase.Analytics.Impl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Firebase.Analytics">
|
||||
<HintPath>..\..\..\packages\Xamarin.Firebase.Analytics.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.Firebase.Analytics.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Firebase.Messaging">
|
||||
<HintPath>..\..\..\packages\Xamarin.Firebase.Messaging.60.1142.0-beta2\lib\MonoAndroid80\Xamarin.Firebase.Messaging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Annotations">
|
||||
<HintPath>..\..\..\packages\Xamarin.Android.Support.Annotations.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Annotations.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -142,25 +121,26 @@
|
|||
<HintPath>..\..\..\packages\Xamarin.Android.Support.v7.MediaRouter.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.v7.MediaRouter.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FormsViewGroup">
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.4.0.38779\lib\MonoAndroid10\FormsViewGroup.dll</HintPath>
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\FormsViewGroup.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Forms.Core">
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.4.0.38779\lib\MonoAndroid10\Xamarin.Forms.Core.dll</HintPath>
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Forms.Platform.Android">
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.4.0.38779\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll</HintPath>
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Forms.Platform">
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.4.0.38779\lib\MonoAndroid10\Xamarin.Forms.Platform.dll</HintPath>
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Forms.Xaml">
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.4.0.38779\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath>
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="FilePicker.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
|
@ -236,22 +216,8 @@
|
|||
<ItemGroup>
|
||||
<AndroidEnvironment Include="AndroidEnvironment.cfg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<GoogleServicesJson Include="google-services.json" />
|
||||
</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')" />
|
||||
<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.3.163-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.3.163-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.targets" Condition="Exists('..\..\..\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.GooglePlayServices.Basement.60.1142.0-beta2\build\MonoAndroid80\Xamarin.GooglePlayServices.Basement.targets" Condition="Exists('..\..\..\packages\Xamarin.GooglePlayServices.Basement.60.1142.0-beta2\build\MonoAndroid80\Xamarin.GooglePlayServices.Basement.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.GooglePlayServices.Tasks.60.1142.0-beta2\build\MonoAndroid80\Xamarin.GooglePlayServices.Tasks.targets" Condition="Exists('..\..\..\packages\Xamarin.GooglePlayServices.Tasks.60.1142.0-beta2\build\MonoAndroid80\Xamarin.GooglePlayServices.Tasks.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Firebase.Common.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Common.targets" Condition="Exists('..\..\..\packages\Xamarin.Firebase.Common.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Common.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Firebase.Iid.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Iid.targets" Condition="Exists('..\..\..\packages\Xamarin.Firebase.Iid.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Iid.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Firebase.Analytics.Impl.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Analytics.Impl.targets" Condition="Exists('..\..\..\packages\Xamarin.Firebase.Analytics.Impl.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Analytics.Impl.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Firebase.Analytics.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Analytics.targets" Condition="Exists('..\..\..\packages\Xamarin.Firebase.Analytics.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Analytics.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Firebase.Messaging.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Messaging.targets" Condition="Exists('..\..\..\packages\Xamarin.Firebase.Messaging.60.1142.0-beta2\build\MonoAndroid80\Xamarin.Firebase.Messaging.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Android.Support.Annotations.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets" Condition="Exists('..\..\..\packages\Xamarin.Android.Support.Annotations.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Android.Arch.Core.Common.1.0.0\build\MonoAndroid80\Xamarin.Android.Arch.Core.Common.targets" Condition="Exists('..\..\..\packages\Xamarin.Android.Arch.Core.Common.1.0.0\build\MonoAndroid80\Xamarin.Android.Arch.Core.Common.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Android.Arch.Lifecycle.Common.1.0.1\build\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Common.targets" Condition="Exists('..\..\..\packages\Xamarin.Android.Arch.Lifecycle.Common.1.0.1\build\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Common.targets')" />
|
||||
|
@ -271,5 +237,5 @@
|
|||
<Import Project="..\..\..\packages\Xamarin.Android.Support.v7.AppCompat.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.v7.AppCompat.targets" Condition="Exists('..\..\..\packages\Xamarin.Android.Support.v7.AppCompat.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.v7.AppCompat.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Android.Support.Design.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Design.targets" Condition="Exists('..\..\..\packages\Xamarin.Android.Support.Design.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Design.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Android.Support.v7.MediaRouter.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.v7.MediaRouter.targets" Condition="Exists('..\..\..\packages\Xamarin.Android.Support.v7.MediaRouter.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.v7.MediaRouter.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Forms.2.4.0.38779\build\netstandard1.0\Xamarin.Forms.targets" Condition="Exists('..\..\..\packages\Xamarin.Forms.2.4.0.38779\build\netstandard1.0\Xamarin.Forms.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Forms.2.5.0.121934\build\netstandard1.0\Xamarin.Forms.targets" Condition="Exists('..\..\..\packages\Xamarin.Forms.2.5.0.121934\build\netstandard1.0\Xamarin.Forms.targets')" />
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
using Android.Provider;
|
||||
using Android.Text.Format;
|
||||
using Android.Webkit;
|
||||
using Contoso.Forms.Puppet.Droid;
|
||||
using Xamarin.Forms;
|
||||
|
||||
// Make this class visible to the DependencyService manager.
|
||||
[assembly: Dependency(typeof(FilePicker))]
|
||||
|
||||
namespace Contoso.Forms.Puppet.Droid
|
||||
{
|
||||
public class FilePicker : IFilePicker
|
||||
{
|
||||
public Task<string> PickFile()
|
||||
{
|
||||
Intent intent;
|
||||
if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
|
||||
{
|
||||
intent = new Intent(Intent.ActionOpenDocument);
|
||||
intent.AddCategory(Intent.CategoryOpenable);
|
||||
}
|
||||
else
|
||||
{
|
||||
intent = new Intent(Intent.ActionGetContent);
|
||||
}
|
||||
intent.SetType("*/*");
|
||||
var activity = Xamarin.Forms.Forms.Context as MainActivity;
|
||||
activity.StartActivityForResult(Intent.CreateChooser(intent, "Select attachment file"), MainActivity.FileAttachmentId);
|
||||
activity.FileAttachmentTaskCompletionSource = new TaskCompletionSource<string>();
|
||||
return activity.FileAttachmentTaskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public Tuple<byte[], string, string> ReadFile(string file)
|
||||
{
|
||||
var uri = Android.Net.Uri.Parse(file);
|
||||
var activity = Xamarin.Forms.Forms.Context as MainActivity;
|
||||
|
||||
// Data
|
||||
byte[] data = null;
|
||||
using (var inputStream = activity.ContentResolver.OpenInputStream(uri))
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
inputStream.CopyTo(memoryStream);
|
||||
data = memoryStream.ToArray();
|
||||
}
|
||||
|
||||
// Name
|
||||
string name = "";
|
||||
var cursor = activity.ContentResolver.Query(uri, null, null, null, null);
|
||||
try
|
||||
{
|
||||
if (cursor != null && cursor.MoveToFirst())
|
||||
{
|
||||
var nameIndex = cursor.GetColumnIndex(OpenableColumns.DisplayName);
|
||||
if (!cursor.IsNull(nameIndex))
|
||||
{
|
||||
name = cursor.GetString(nameIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cursor?.Close();
|
||||
}
|
||||
|
||||
// Mime
|
||||
string mime = null;
|
||||
if (uri.Scheme == ContentResolver.SchemeContent)
|
||||
{
|
||||
mime = activity.ContentResolver.GetType(uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
var extension = MimeTypeMap.GetFileExtensionFromUrl(file);
|
||||
mime = MimeTypeMap.Singleton.GetMimeTypeFromExtension(extension.ToLower());
|
||||
}
|
||||
return new Tuple<byte[], string, string>(data, name, mime);
|
||||
}
|
||||
|
||||
public string GetFileDescription(string file)
|
||||
{
|
||||
if (string.IsNullOrEmpty(file))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var uri = Android.Net.Uri.Parse(file);
|
||||
var activity = Xamarin.Forms.Forms.Context as MainActivity;
|
||||
|
||||
string name = null;
|
||||
string size = null;
|
||||
var cursor = activity.ContentResolver.Query(uri, null, null, null, null);
|
||||
try
|
||||
{
|
||||
if (cursor != null && cursor.MoveToFirst())
|
||||
{
|
||||
var nameIndex = cursor.GetColumnIndex(OpenableColumns.DisplayName);
|
||||
var sizeIndex = cursor.GetColumnIndex(OpenableColumns.Size);
|
||||
if (!cursor.IsNull(nameIndex))
|
||||
{
|
||||
name = cursor.GetString(nameIndex);
|
||||
}
|
||||
if (!cursor.IsNull(sizeIndex))
|
||||
{
|
||||
size = Formatter.FormatFileSize(activity, cursor.GetLong(sizeIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cursor?.Close();
|
||||
}
|
||||
|
||||
string result = "";
|
||||
if (name != null)
|
||||
{
|
||||
result += "File: " + name;
|
||||
}
|
||||
if (size != null)
|
||||
{
|
||||
result += " Size: " + size;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
using Android.App;
|
||||
using System.Threading.Tasks;
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Content.PM;
|
||||
using Android.OS;
|
||||
using Com.Microsoft.Appcenter.Analytics;
|
||||
|
@ -14,6 +16,10 @@ namespace Contoso.Forms.Puppet.Droid
|
|||
[Activity(Label = "ACFPuppet", Icon = "@drawable/icon", Theme = "@style/PuppetTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, LaunchMode = LaunchMode.SingleTop)]
|
||||
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||
{
|
||||
public static readonly int FileAttachmentId = 1;
|
||||
|
||||
public TaskCompletionSource<string> FileAttachmentTaskCompletionSource { set; get; }
|
||||
|
||||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
TabLayoutResource = Resource.Layout.Tabbar;
|
||||
|
@ -24,7 +30,7 @@ namespace Contoso.Forms.Puppet.Droid
|
|||
Xamarin.Forms.Forms.Init(this, savedInstanceState);
|
||||
|
||||
AndroidAnalytics.SetListener(new AndroidAnalyticsListener());
|
||||
|
||||
Push.SetSenderId("177539951155");
|
||||
LoadApplication(new App());
|
||||
}
|
||||
|
||||
|
@ -35,11 +41,25 @@ namespace Contoso.Forms.Puppet.Droid
|
|||
CrashManager.Register(this, "2c7e569100194bafa2a30f5c648d44fe");
|
||||
}
|
||||
|
||||
protected override void OnNewIntent(Android.Content.Intent intent)
|
||||
protected override void OnNewIntent(Intent intent)
|
||||
{
|
||||
base.OnNewIntent(intent);
|
||||
Push.CheckLaunchedFromNotification(this, intent);
|
||||
}
|
||||
|
||||
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
|
||||
{
|
||||
base.OnActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == FileAttachmentId)
|
||||
{
|
||||
var uri = resultCode == Result.Ok && data != null ? data.Data : null;
|
||||
if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat && uri != null)
|
||||
{
|
||||
ContentResolver.TakePersistableUriPermission(uri, data.Flags & ActivityFlags.GrantReadUriPermission);
|
||||
}
|
||||
FileAttachmentTaskCompletionSource.SetResult(uri?.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class AndroidAnalyticsListener : Java.Lang.Object, IAnalyticsListener
|
||||
|
@ -60,3 +80,4 @@ namespace Contoso.Forms.Puppet.Droid
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="42" android:versionName="1.0.1-SNAPSHOT" package="com.microsoft.appcenter.xamarin.forms.puppet">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="44" android:versionName="1.1.0-SNAPSHOT" package="com.microsoft.appcenter.xamarin.forms.puppet">
|
||||
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="26" />
|
||||
<application android:label="ACFPuppet">
|
||||
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
|
||||
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
||||
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
|
||||
<permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature" />
|
||||
<application android:label="ACFPuppet" />
|
||||
</manifest>
|
|
@ -19,8 +19,8 @@ using Android.App;
|
|||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1-SNAPSHOT")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.1.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.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
echo "Executing post clone script in `pwd`"
|
||||
pushd $APPCENTER_SOURCE_DIRECTORY
|
||||
sed -i '' "s/NUGET_PASSWORD/$NUGET_PASSWORD/g" NuGet.config
|
||||
echo $GOOGLE_SERVICES_JSON | base64 -D > Apps/Contoso.Forms.Puppet/Contoso.Forms.Puppet.Droid/google-services.json
|
||||
./build.sh -t=externals-android
|
||||
popd
|
|
@ -21,13 +21,5 @@
|
|||
<package id="Xamarin.Android.Support.v7.RecyclerView" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Android.Support.Vector.Drawable" version="26.1.0.1" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Build.Download" version="0.4.7" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Firebase.Analytics" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Firebase.Analytics.Impl" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Firebase.Common" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Firebase.Core" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Firebase.Iid" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Firebase.Messaging" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Forms" version="2.4.0.38779" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.GooglePlayServices.Basement" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.GooglePlayServices.Tasks" version="60.1142.0-beta2" targetFramework="monoandroid80" />
|
||||
<package id="Xamarin.Forms" version="2.5.0.121934" targetFramework="monoandroid80" />
|
||||
</packages>
|
|
@ -1,9 +1 @@
|
|||
-dontwarn com.google.android.gms.**
|
||||
-dontwarn android.app.NotificationManager
|
||||
-dontwarn android.app.NotificationChannel
|
||||
-dontwarn android.app.Notification$Builder
|
||||
-dontwarn android.content.pm.PackageManager
|
||||
-keep class com.google.firebase.provider.FirebaseInitProvider
|
||||
-keep class com.google.firebase.iid.FirebaseInstanceIdReceiver
|
||||
-keep class com.microsoft.appcenter.push.TokenService
|
||||
-keep class com.microsoft.appcenter.push.PushMessagingService
|
||||
-dontwarn com.microsoft.appcenter.push.**
|
|
@ -5,4 +5,11 @@
|
|||
xmlns:local="using:Contoso.Forms.Puppet.UWP"
|
||||
RequestedTheme="Light">
|
||||
|
||||
<!-- Remove force converting to lowercase titles of table section. -->
|
||||
<Application.Resources>
|
||||
<DataTemplate x:Key="TableSection">
|
||||
<TextBlock Margin="0,20,0,0" Text="{Binding Title}" Style="{ThemeResource SubtitleTextBlockStyle}" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=Self},Converter={StaticResource CollapseWhenEmpty}}" />
|
||||
</DataTemplate>
|
||||
</Application.Resources>
|
||||
|
||||
</Application>
|
||||
|
|
До Ширина: | Высота: | Размер: 7.5 KiB После Ширина: | Высота: | Размер: 36 KiB |
До Ширина: | Высота: | Размер: 2.9 KiB После Ширина: | Высота: | Размер: 14 KiB |
До Ширина: | Высота: | Размер: 1.6 KiB После Ширина: | Высота: | Размер: 4.0 KiB |
До Ширина: | Высота: | Размер: 1.2 KiB После Ширина: | Высота: | Размер: 1.2 KiB |
До Ширина: | Высота: | Размер: 3.1 KiB После Ширина: | Высота: | Размер: 15 KiB |
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
|
||||
<Identity Name="10805zumoTestUser.AppCenter-Contoso.Forms.Puppet.U" Publisher="CN=B2D1C358-6AF8-4416-BF73-129CC1F3C152" Version="1.0.1.0" />
|
||||
<Identity Name="10805zumoTestUser.AppCenter-Contoso.Forms.Puppet.U" Publisher="CN=B2D1C358-6AF8-4416-BF73-129CC1F3C152" Version="1.1.0.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="55497ed8-b2ac-4485-ba79-e2b65bb720ed" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Properties>
|
||||
<DisplayName>AppCenter-Contoso.Forms.Puppet.UWP</DisplayName>
|
||||
|
@ -15,10 +15,10 @@
|
|||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Contoso.Forms.Puppet.UWP.App">
|
||||
<uap:VisualElements DisplayName="AppCenter-Contoso.Forms.Puppet.UWP" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Contoso.Forms.Puppet.UWP" BackgroundColor="transparent">
|
||||
<uap:VisualElements DisplayName="AppCenter Puppet UWP" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Contoso.Forms.Puppet.UWP" BackgroundColor="white">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
|
||||
</uap:DefaultTile>
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="white" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
|
|
@ -24,5 +24,5 @@ using System.Runtime.InteropServices;
|
|||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2",
|
||||
"Xamarin.Forms": "2.4.0.38779"
|
||||
"Xamarin.Forms": "2.5.0.91635"
|
||||
},
|
||||
"frameworks": {
|
||||
"uap10.0": {}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\packages\Xamarin.Forms.2.4.0.38779\build\netstandard1.0\Xamarin.Forms.props" Condition="Exists('..\..\..\packages\Xamarin.Forms.2.4.0.38779\build\netstandard1.0\Xamarin.Forms.props')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Forms.2.5.0.91635\build\netstandard1.0\Xamarin.Forms.props" Condition="Exists('..\..\..\packages\Xamarin.Forms.2.5.0.91635\build\netstandard1.0\Xamarin.Forms.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
||||
|
@ -58,6 +58,7 @@
|
|||
<MtouchArch>i386, x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
<MtouchExtraArgs>--linkskip=Microsoft.AppCenter.Crashes</MtouchExtraArgs>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
@ -85,16 +86,16 @@
|
|||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
<Reference Include="Xamarin.Forms.Core">
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.4.0.38779\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.5.0.91635\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Forms.Platform">
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.4.0.38779\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.5.0.91635\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Forms.Platform.iOS">
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.4.0.38779\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll</HintPath>
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.5.0.91635\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Forms.Xaml">
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.4.0.38779\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
|
||||
<HintPath>..\..\..\packages\Xamarin.Forms.2.5.0.91635\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -118,6 +119,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
<Compile Include="FilePicker.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\bolt%402x.png" />
|
||||
|
@ -175,5 +177,5 @@
|
|||
<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')" />
|
||||
<Import Project="..\..\packages\Xamarin.Forms.2.3.3.163-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.3.163-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Forms.2.3.3.168\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\..\..\packages\Xamarin.Forms.2.3.3.168\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Forms.2.4.0.38779\build\netstandard1.0\Xamarin.Forms.targets" Condition="Exists('..\..\..\packages\Xamarin.Forms.2.4.0.38779\build\netstandard1.0\Xamarin.Forms.targets')" />
|
||||
<Import Project="..\..\..\packages\Xamarin.Forms.2.5.0.91635\build\netstandard1.0\Xamarin.Forms.targets" Condition="Exists('..\..\..\packages\Xamarin.Forms.2.5.0.91635\build\netstandard1.0\Xamarin.Forms.targets')" />
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using Contoso.Forms.Puppet.iOS;
|
||||
using Foundation;
|
||||
using MobileCoreServices;
|
||||
using Photos;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
|
||||
// Make this class visible to the DependencyService manager.
|
||||
[assembly: Dependency(typeof(FilePicker))]
|
||||
|
||||
namespace Contoso.Forms.Puppet.iOS
|
||||
{
|
||||
public class FilePicker : IFilePicker
|
||||
{
|
||||
public async Task<string> PickFile()
|
||||
{
|
||||
var status = await PHPhotoLibrary.RequestAuthorizationAsync();
|
||||
if (status != PHAuthorizationStatus.Authorized)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
var imagePicker = new UIImagePickerController();
|
||||
imagePicker.FinishedPickingMedia += (sender, args) => {
|
||||
taskCompletionSource.SetResult(args.ReferenceUrl?.AbsoluteString);
|
||||
imagePicker.DismissModalViewController(true);
|
||||
};
|
||||
imagePicker.Canceled += (sender, args) => {
|
||||
taskCompletionSource.SetResult(null);
|
||||
imagePicker.DismissModalViewController(true);
|
||||
};
|
||||
UIWindow window = UIApplication.SharedApplication.KeyWindow;
|
||||
var viewController = window.RootViewController;
|
||||
viewController.PresentModalViewController(imagePicker, true);
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public Tuple<byte[], string, string> ReadFile(string file)
|
||||
{
|
||||
Tuple<byte[], string, string> result = null;
|
||||
var asset = PHAsset.FetchAssets(new[] { new NSUrl(file) }, null).LastObject as PHAsset;
|
||||
if (asset != null)
|
||||
{
|
||||
var options = new PHImageRequestOptions { Synchronous = true };
|
||||
PHImageManager.DefaultManager.RequestImageData(asset, options,(data, dataUti, orientation, info) => {
|
||||
var extension = new NSUrl(dataUti).PathExtension;
|
||||
var uti = UTType.CreatePreferredIdentifier(UTType.TagClassFilenameExtension, extension, null);
|
||||
var mime = UTType.GetPreferredTag(uti, UTType.TagClassMIMEType);
|
||||
var dataBytes = new byte[data.Length];
|
||||
Marshal.Copy(data.Bytes, dataBytes, 0, Convert.ToInt32(data.Length));
|
||||
result = new Tuple<byte[], string, string>(dataBytes, dataUti, mime);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public string GetFileDescription(string file)
|
||||
{
|
||||
if (string.IsNullOrEmpty(file))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
long fileSize = 0;
|
||||
var asset = PHAsset.FetchAssets(new[] { new NSUrl(file) }, null).LastObject as PHAsset;
|
||||
if (asset != null)
|
||||
{
|
||||
var options = new PHImageRequestOptions { Synchronous = true };
|
||||
PHImageManager.DefaultManager.RequestImageData(asset, options, (data, dataUti, orientation, info) => {
|
||||
fileSize = Convert.ToInt64(data.Length);
|
||||
});
|
||||
}
|
||||
return NSByteCountFormatter.Format(fileSize, NSByteCountFormatterCountStyle.Binary);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,9 +5,9 @@
|
|||
<key>CFBundleIdentifier</key>
|
||||
<string>com.microsoft.appcenter.xamarin.forms.puppet</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.1</string>
|
||||
<string>1.1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0.1</string>
|
||||
<string>1.1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
|
@ -76,5 +76,7 @@
|
|||
<array>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>Select photo for attachment</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
echo "Executing post clone script in `pwd`"
|
||||
pushd $APPCENTER_SOURCE_DIRECTORY
|
||||
sed -i '' "s/NUGET_PASSWORD/$NUGET_PASSWORD/g" NuGet.config
|
||||
./build.sh -t=externals-ios
|
||||
popd
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Xamarin.Forms" version="2.4.0.38779" targetFramework="xamarinios10" />
|
||||
<package id="Xamarin.Forms" version="2.5.0.91635" targetFramework="xamarinios10" />
|
||||
</packages>
|
|
@ -1,15 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Contoso.Forms.Puppet.AddPropertyContentPage">
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="Property Name" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="120" />
|
||||
<Entry HorizontalOptions="FillAndExpand" x:Name="NameEntry" />
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Puppet.AddPropertyContentPage">
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="Property Name" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="120" />
|
||||
<Entry HorizontalOptions="FillAndExpand" x:Name="NameEntry" />
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="Property Value" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="120" />
|
||||
<Entry HorizontalOptions="FillAndExpand" x:Name="ValueEntry" />
|
||||
</StackLayout>
|
||||
<Button Text="Add Property" Clicked="AddProperty" FontAttributes="Bold" Margin="0,20,0,0" />
|
||||
<Button Text="Cancel" TextColor="Red" Clicked="Cancel" />
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="Property Value" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="120" />
|
||||
<Entry HorizontalOptions="FillAndExpand" x:Name="ValueEntry" />
|
||||
</StackLayout>
|
||||
<Button Text="Add Property" Clicked="AddProperty" />
|
||||
<Button Text="Cancel" TextColor="Red" Clicked="Cancel" />
|
||||
</StackLayout>
|
||||
</ContentPage>
|
|
@ -1,12 +1,12 @@
|
|||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Contoso.Forms.Puppet
|
||||
{
|
||||
[Android.Runtime.Preserve(AllMembers = true)]
|
||||
public partial class AddPropertyContentPage : ContentPage
|
||||
public partial class AddPropertyContentPage
|
||||
{
|
||||
public event Action<Property> PropertyAdded;
|
||||
|
||||
public AddPropertyContentPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Contoso.Forms.Puppet.App">
|
||||
<Application xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Puppet.App">
|
||||
<Application.Resources>
|
||||
<!-- Application resource dictionary -->
|
||||
</Application.Resources>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AppCenter;
|
||||
using Microsoft.AppCenter.Analytics;
|
||||
|
@ -23,17 +22,29 @@ namespace Contoso.Forms.Puppet
|
|||
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;
|
||||
}
|
||||
|
||||
public App()
|
||||
{
|
||||
InitializeComponent();
|
||||
MainPage = new NavigationPage(new MainPuppetPage());
|
||||
}
|
||||
|
||||
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
|
||||
// Set callbacks
|
||||
Crashes.ShouldProcessErrorReport = ShouldProcess;
|
||||
Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler;
|
||||
Crashes.GetErrorAttachments = GetErrorAttachments;
|
||||
|
@ -41,27 +52,11 @@ namespace Contoso.Forms.Puppet
|
|||
|
||||
AppCenterLog.Assert(LogTag, "AppCenter.Configured=" + AppCenter.Configured);
|
||||
AppCenter.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");
|
||||
Distribute.SetInstallUrl("http://install.appcenter-int.trafficmanager.net");
|
||||
Distribute.SetApiUrl("https://appcenter-int.trafficmanager.net/api/v0.1");
|
||||
RealUserMeasurements.SetRumKey("b1919553367d44d8b0ae72594c74e0ff");
|
||||
AppCenter.Start($"uwp={UwpKey};android={AndroidKey};ios={IosKey}",
|
||||
typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push), typeof(RealUserMeasurements));
|
||||
|
||||
// Need to use reflection because moving this to the Android specific
|
||||
// code causes crash. (Unable to access properties before init is called).
|
||||
if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.Android)
|
||||
{
|
||||
if (!Properties.ContainsKey(OthersContentPage.FirebaseEnabledKey))
|
||||
{
|
||||
Properties[OthersContentPage.FirebaseEnabledKey] = false;
|
||||
}
|
||||
|
||||
if ((bool)Properties[OthersContentPage.FirebaseEnabledKey])
|
||||
{
|
||||
typeof(Push).GetRuntimeMethod("EnableFirebaseAnalytics", new Type[0]).Invoke(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
AppCenter.IsEnabledAsync().ContinueWith(enabled =>
|
||||
{
|
||||
AppCenterLog.Info(LogTag, "AppCenter.Enabled=" + enabled.Result);
|
||||
|
@ -81,15 +76,6 @@ namespace Contoso.Forms.Puppet
|
|||
});
|
||||
}
|
||||
|
||||
static App()
|
||||
{
|
||||
// set event handlers in static constructor to avoid duplication
|
||||
Crashes.SendingErrorReport += SendingErrorReportHandler;
|
||||
Crashes.SentErrorReport += SentErrorReportHandler;
|
||||
Crashes.FailedToSendErrorReport += FailedToSendErrorReportHandler;
|
||||
Push.PushNotificationReceived += PrintNotification;
|
||||
}
|
||||
|
||||
static void PrintNotification(object sender, PushNotificationReceivedEventArgs e)
|
||||
{
|
||||
Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
|
||||
|
@ -109,7 +95,7 @@ namespace Contoso.Forms.Puppet
|
|||
|
||||
var report = e.Report;
|
||||
|
||||
//test some values
|
||||
// Test some values
|
||||
if (report.Exception != null)
|
||||
{
|
||||
AppCenterLog.Info(LogTag, report.Exception.ToString());
|
||||
|
@ -126,7 +112,7 @@ namespace Contoso.Forms.Puppet
|
|||
|
||||
var report = e.Report;
|
||||
|
||||
//test some values
|
||||
// Test some values
|
||||
if (report.Exception != null)
|
||||
{
|
||||
AppCenterLog.Info(LogTag, report.Exception.ToString());
|
||||
|
@ -148,7 +134,7 @@ namespace Contoso.Forms.Puppet
|
|||
|
||||
var report = e.Report;
|
||||
|
||||
//test some values
|
||||
// Test some values
|
||||
if (report.Exception != null)
|
||||
{
|
||||
AppCenterLog.Info(LogTag, report.Exception.ToString());
|
||||
|
@ -200,12 +186,36 @@ namespace Contoso.Forms.Puppet
|
|||
|
||||
static IEnumerable<ErrorAttachmentLog> GetErrorAttachments(ErrorReport report)
|
||||
{
|
||||
return new[]
|
||||
var attachments = new List<ErrorAttachmentLog>();
|
||||
if (Current.Properties.TryGetValue(CrashesContentPage.TextAttachmentKey, out var textAttachment) &&
|
||||
textAttachment is string text)
|
||||
{
|
||||
ErrorAttachmentLog.AttachmentWithText("Hello world!", "hello.txt"),
|
||||
null,
|
||||
ErrorAttachmentLog.AttachmentWithBinary(Encoding.UTF8.GetBytes("Fake image"), "fake_image.jpeg", "image/jpeg")
|
||||
};
|
||||
var attachment = ErrorAttachmentLog.AttachmentWithText(text, "hello.txt");
|
||||
attachments.Add(attachment);
|
||||
}
|
||||
if (Current.Properties.TryGetValue(CrashesContentPage.FileAttachmentKey, out var fileAttachment) &&
|
||||
fileAttachment is string file)
|
||||
{
|
||||
var filePicker = DependencyService.Get<IFilePicker>();
|
||||
if (filePicker != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = filePicker.ReadFile(file);
|
||||
if (result != null)
|
||||
{
|
||||
var attachment = ErrorAttachmentLog.AttachmentWithBinary(result.Item1, result.Item2, result.Item3);
|
||||
attachments.Add(attachment);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
AppCenterLog.Warn(LogTag, "Couldn't read file attachment", e);
|
||||
Current.Properties.Remove(CrashesContentPage.FileAttachmentKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
return attachments;
|
||||
}
|
||||
|
||||
bool OnReleaseAvailable(ReleaseDetails releaseDetails)
|
||||
|
|
|
@ -60,11 +60,16 @@
|
|||
<EmbeddedResource Include="ModulePages\OthersContentPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Views\TextAttachmentView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="IFilePicker.cs" />
|
||||
<Compile Include="MainPuppetPage.cs">
|
||||
<DependentUpon>MainPuppetPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
@ -99,6 +104,9 @@
|
|||
</Compile>
|
||||
<Compile Include="FakeService.cs" />
|
||||
<Compile Include="PreserveAttribute.cs" />
|
||||
<Compile Include="Views\TextAttachmentView.xaml.cs">
|
||||
<DependentUpon>TextAttachmentView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="project.json" />
|
||||
|
|
|
@ -5,9 +5,9 @@ namespace Contoso.Forms.Puppet
|
|||
{
|
||||
static class FakeService
|
||||
{
|
||||
internal async static Task DoStuffInBackground()
|
||||
internal static async Task DoStuffInBackground()
|
||||
{
|
||||
await Task.Run(() => { throw new IOException("Server did not respond"); });
|
||||
await Task.Run(() => throw new IOException("Server did not respond"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contoso.Forms.Puppet
|
||||
{
|
||||
public interface IFilePicker
|
||||
{
|
||||
Task<string> PickFile();
|
||||
Tuple<byte[], string, string> ReadFile(string file);
|
||||
string GetFileDescription(string file);
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
using Microsoft.AppCenter;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AppCenter;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Contoso.Forms.Puppet
|
||||
{
|
||||
public partial class LogLevelPage : ContentPage
|
||||
public partial class LogLevelPage
|
||||
{
|
||||
private Dictionary<string, LogLevel> LogLevels;
|
||||
public event Action<LogLevel> LevelSelected;
|
||||
|
@ -23,11 +23,11 @@ namespace Contoso.Forms.Puppet
|
|||
LogLevels.Add(Constants.Error, LogLevel.Error);
|
||||
}
|
||||
|
||||
void UpdateLogLevel(object sender, System.EventArgs e)
|
||||
void UpdateLogLevel(object sender, EventArgs e)
|
||||
{
|
||||
string level = ((TextCell)sender).Text;
|
||||
LevelSelected.Invoke(LogLevels[level]);
|
||||
((NavigationPage)App.Current.MainPage).PopAsync();
|
||||
string level = ((Button)sender).Text;
|
||||
LevelSelected?.Invoke(LogLevels[level]);
|
||||
((NavigationPage)Application.Current.MainPage).PopAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Contoso.Forms.Puppet" x:Class="Contoso.Forms.Puppet.LogLevelPage">
|
||||
<ContentPage.Content>
|
||||
<TableView Intent="Form">
|
||||
<TableSection>
|
||||
<TextCell Tapped="UpdateLogLevel" Text="{x:Static local:Constants.Verbose}" />
|
||||
<TextCell Tapped="UpdateLogLevel" Text="{x:Static local:Constants.Debug}" />
|
||||
<TextCell Tapped="UpdateLogLevel" Text="{x:Static local:Constants.Info}" />
|
||||
<TextCell Tapped="UpdateLogLevel" Text="{x:Static local:Constants.Warning}" />
|
||||
<TextCell Tapped="UpdateLogLevel" Text="{x:Static local:Constants.Error}" />
|
||||
</TableSection>
|
||||
</TableView>
|
||||
</ContentPage.Content>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:local="clr-namespace:Contoso.Forms.Puppet"
|
||||
x:Class="Contoso.Forms.Puppet.LogLevelPage">
|
||||
<StackLayout Padding="20">
|
||||
<Button Clicked="UpdateLogLevel" Text="{x:Static local:Constants.Verbose}" />
|
||||
<Button Clicked="UpdateLogLevel" Text="{x:Static local:Constants.Debug}" />
|
||||
<Button Clicked="UpdateLogLevel" Text="{x:Static local:Constants.Info}" />
|
||||
<Button Clicked="UpdateLogLevel" Text="{x:Static local:Constants.Warning}" />
|
||||
<Button Clicked="UpdateLogLevel" Text="{x:Static local:Constants.Error}" />
|
||||
</StackLayout>
|
||||
</ContentPage>
|
|
@ -1,8 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TabbedPage Title="App Center Puppet App" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Contoso.Forms.Puppet;assembly=Contoso.Forms.Puppet" x:Class="Contoso.Forms.Puppet.MainPuppetPage">
|
||||
<TabbedPage Title="AppCenter Puppet Application"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:local="clr-namespace:Contoso.Forms.Puppet;assembly=Contoso.Forms.Puppet"
|
||||
x:Class="Contoso.Forms.Puppet.MainPuppetPage">
|
||||
<local:AppCenterContentPage/>
|
||||
<local:AnalyticsContentPage/>
|
||||
<local:CrashesContentPage/>
|
||||
<local:AnalyticsContentPage/>
|
||||
<local:CrashesContentPage/>
|
||||
<local:CustomPropertiesContentPage/>
|
||||
<local:OthersContentPage/>
|
||||
<local:OthersContentPage/>
|
||||
</TabbedPage>
|
|
@ -1,23 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage Title="Analytics" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Contoso.Forms.Puppet.AnalyticsContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection>
|
||||
<SwitchCell Text="Analytics Enabled" On="true" x:Name="EnabledSwitchCell" OnChanged="UpdateEnabled"/>
|
||||
</TableSection>
|
||||
<TableSection>
|
||||
<EntryCell Label="Event Name" HorizontalTextAlignment="Start" x:Name="EventNameCell"/>
|
||||
<ViewCell Tapped="PropertiesCellTapped">
|
||||
<StackLayout Orientation="Horizontal" Margin="15,0,15,0">
|
||||
<Label Text="Properties" HorizontalOptions="StartAndExpand" VerticalOptions="Center" />
|
||||
<Label Text="0" HorizontalOptions="EndAndExpand" VerticalOptions="Center" x:Name="NumPropertiesLabel" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="AddProperty">
|
||||
<Button Text="Add Property" Clicked="AddProperty" InputTransparent="true"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="TrackEvent">
|
||||
<Button Text="Track Event" InputTransparent="true" Clicked="TrackEvent"/>
|
||||
</ViewCell>
|
||||
</TableSection>
|
||||
</TableView>
|
||||
<ContentPage Title="Analytics"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Puppet.AnalyticsContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection Title="Analytics Settings">
|
||||
<SwitchCell Text="Analytics Enabled" On="true" x:Name="EnabledSwitchCell" OnChanged="UpdateEnabled" />
|
||||
</TableSection>
|
||||
<TableSection Title="Tracking Events">
|
||||
<EntryCell Label="Event Name" HorizontalTextAlignment="Start" x:Name="EventNameCell" />
|
||||
<ViewCell Tapped="PropertiesCellTapped">
|
||||
<StackLayout Orientation="Horizontal" Margin="15,0,15,0">
|
||||
<Label Text="Properties" HorizontalOptions="StartAndExpand" VerticalOptions="Center" />
|
||||
<Label Text="0" HorizontalOptions="EndAndExpand" VerticalOptions="Center" TextColor="Gray" x:Name="NumPropertiesLabel" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="AddProperty">
|
||||
<Button Text="Add Property" Clicked="AddProperty" InputTransparent="true" />
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="TrackEvent">
|
||||
<Button Text="Track Event" InputTransparent="true" Clicked="TrackEvent" FontAttributes="Bold" />
|
||||
</ViewCell>
|
||||
</TableSection>
|
||||
</TableView>
|
||||
</ContentPage>
|
||||
|
|
|
@ -8,13 +8,14 @@ namespace Contoso.Forms.Puppet
|
|||
{
|
||||
public class Property
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public string Value { get; private set; }
|
||||
|
||||
public Property(string propertyName, string propertyValue)
|
||||
{
|
||||
Name = propertyName;
|
||||
Value = propertyValue;
|
||||
}
|
||||
public string Name;
|
||||
public string Value;
|
||||
}
|
||||
|
||||
[Android.Runtime.Preserve(AllMembers = true)]
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage Title="App Center" xmlns:local="clr-namespace:Contoso.Forms.Puppet"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Contoso.Forms.Puppet.AppCenterContentPage">
|
||||
<ContentPage Title="App Center"
|
||||
xmlns:local="clr-namespace:Contoso.Forms.Puppet"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Contoso.Forms.Puppet.AppCenterContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection>
|
||||
<TableSection Title="AppCenter Settings">
|
||||
<SwitchCell Text="App Center Enabled" On="true" x:Name="AppCenterEnabledSwitchCell" OnChanged="UpdateEnabled"/>
|
||||
</TableSection>
|
||||
<TableSection>
|
||||
<ViewCell Tapped="LogLevelCellTapped">
|
||||
<StackLayout Orientation="Horizontal" Margin="15,0,15,0">
|
||||
<Label Text="Log level" HorizontalOptions="StartAndExpand" VerticalOptions="Center" />
|
||||
<Label Text="Log Level" HorizontalOptions="StartAndExpand" VerticalOptions="Center" />
|
||||
<Label Text="Verbose" HorizontalOptions="EndAndExpand" VerticalOptions="Center" TextColor="Gray" x:Name="LogLevelLabel" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</TableSection>
|
||||
<TableSection>
|
||||
<TableSection Title="Logging">
|
||||
<EntryCell Label="Log Message" x:Name="LogMessageEntryCell"/>
|
||||
<EntryCell Label="Log Tag" x:Name="LogTagEntryCell"/>
|
||||
<ViewCell Tapped="LogWriteLevelCellTapped">
|
||||
<StackLayout Orientation="Horizontal" Margin="15,0,15,0">
|
||||
<Label Text="Log Level" HorizontalOptions="StartAndExpand" VerticalOptions="Center" />
|
||||
<Label Text="{x:Static local:Constants.Verbose}" HorizontalOptions="EndAndExpand" VerticalOptions="Center" TextColor="Gray" x:Name="LogWriteLevelLabel" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="LogWriteLevelCellTapped">
|
||||
<StackLayout Orientation="Horizontal" Margin="15,0,15,0">
|
||||
<Label Text="Log Level" HorizontalOptions="StartAndExpand" VerticalOptions="Center" />
|
||||
<Label Text="{x:Static local:Constants.Verbose}" HorizontalOptions="EndAndExpand" VerticalOptions="Center" TextColor="Gray" x:Name="LogWriteLevelLabel" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="WriteLog">
|
||||
<Button Text="Write Log" InputTransparent="true" Clicked="WriteLog"/>
|
||||
</ViewCell>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using Microsoft.AppCenter;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AppCenter;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Contoso.Forms.Puppet
|
||||
|
@ -70,7 +70,7 @@ namespace Contoso.Forms.Puppet
|
|||
((NavigationPage)Application.Current.MainPage).PushAsync(page);
|
||||
}
|
||||
|
||||
void WriteLog(object sender, System.EventArgs e)
|
||||
void WriteLog(object sender, EventArgs e)
|
||||
{
|
||||
string message = LogMessageEntryCell.Text;
|
||||
string tag = LogTagEntryCell.Text;
|
||||
|
|
|
@ -1,32 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage Title="Crashes"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Puppet.CrashesContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection>
|
||||
<SwitchCell Text="Crashes Enabled" On="true" x:Name="CrashesEnabledSwitchCell" OnChanged="UpdateEnabled"/>
|
||||
<SwitchCell Text="Handle Exceptions" On="false" x:Name="HandleExceptionsSwitchCell"/>
|
||||
</TableSection>
|
||||
<TableSection>
|
||||
<ViewCell Tapped="TestException">
|
||||
<Button Text="Generate Test Exception" InputTransparent="true" Clicked="TestException"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="DivideByZero">
|
||||
<Button Text="Divide 42 by 0" InputTransparent="true" Clicked="DivideByZero"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="AggregateException">
|
||||
<Button Text="Aggregate Exception" InputTransparent="true" Clicked="AggregateException"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="NullReferenceException">
|
||||
<Button Text="NullReferenceException" InputTransparent="true" Clicked="NullReferenceException"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="CatchNullReferenceException">
|
||||
<Button Text="Test Catching NullReferenceException" InputTransparent="true" Clicked="CatchNullReferenceException"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="AsyncException">
|
||||
<Button Text="Exception Inside Async Task" InputTransparent="true" Clicked="AsyncException"/>
|
||||
</ViewCell>
|
||||
</TableSection>
|
||||
</TableView>
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Puppet.CrashesContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection Title="Crashes Settings">
|
||||
<SwitchCell Text="Crashes Enabled" On="true" x:Name="CrashesEnabledSwitchCell" OnChanged="UpdateEnabled"/>
|
||||
<SwitchCell Text="Handle Exceptions" On="false" x:Name="HandleExceptionsSwitchCell"/>
|
||||
</TableSection>
|
||||
<TableSection Title="Attachments">
|
||||
<TextCell Text="Text Attachment" x:Name="TextAttachmentCell" Tapped="TextAttachment"/>
|
||||
<TextCell Text="Binary Attachment" x:Name="FileAttachmentCell" Tapped="FileAttachment"/>
|
||||
</TableSection>
|
||||
<TableSection Title="Test Crashes">
|
||||
<ViewCell Tapped="TestException">
|
||||
<Button Text="Generate Test Exception" InputTransparent="true" Clicked="TestException"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="DivideByZero">
|
||||
<Button Text="Divide 42 by 0" InputTransparent="true" Clicked="DivideByZero"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="AggregateException">
|
||||
<Button Text="Aggregate Exception" InputTransparent="true" Clicked="AggregateException"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="NullReferenceException">
|
||||
<Button Text="NullReferenceException" InputTransparent="true" Clicked="NullReferenceException"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="CatchNullReferenceException">
|
||||
<Button Text="Test Catching NullReferenceException" InputTransparent="true" Clicked="CatchNullReferenceException"/>
|
||||
</ViewCell>
|
||||
<ViewCell Tapped="AsyncException">
|
||||
<Button Text="Exception Inside Async Task" InputTransparent="true" Clicked="AsyncException"/>
|
||||
</ViewCell>
|
||||
</TableSection>
|
||||
</TableView>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,19 +1,26 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Contoso.Forms.Puppet.Views;
|
||||
using Microsoft.AppCenter;
|
||||
using Microsoft.AppCenter.Crashes;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Contoso.Forms.Puppet
|
||||
{
|
||||
using XamarinDevice = Xamarin.Forms.Device;
|
||||
|
||||
[Android.Runtime.Preserve(AllMembers = true)]
|
||||
public partial class CrashesContentPage
|
||||
{
|
||||
public const string TextAttachmentKey = "TEXT_ATTACHMENT";
|
||||
public const string FileAttachmentKey = "FILE_ATTACHMENT";
|
||||
|
||||
public CrashesContentPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.iOS)
|
||||
if (XamarinDevice.RuntimePlatform == XamarinDevice.iOS)
|
||||
{
|
||||
Icon = "socket.png";
|
||||
}
|
||||
|
@ -24,6 +31,32 @@ namespace Contoso.Forms.Puppet
|
|||
base.OnAppearing();
|
||||
CrashesEnabledSwitchCell.On = await Crashes.IsEnabledAsync();
|
||||
CrashesEnabledSwitchCell.IsEnabled = await AppCenter.IsEnabledAsync();
|
||||
|
||||
// Attachments
|
||||
if (Application.Current.Properties.TryGetValue(TextAttachmentKey, out var textAttachment) &&
|
||||
textAttachment is string text)
|
||||
{
|
||||
TextAttachmentCell.Detail = text;
|
||||
}
|
||||
if (Application.Current.Properties.TryGetValue(FileAttachmentKey, out var fileAttachment) &&
|
||||
fileAttachment is string file)
|
||||
{
|
||||
var filePicker = DependencyService.Get<IFilePicker>();
|
||||
try
|
||||
{
|
||||
FileAttachmentCell.Detail = filePicker?.GetFileDescription(file);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.WriteLine("Couldn't read file attachment: {0}", e.Message);
|
||||
Application.Current.Properties.Remove(FileAttachmentKey);
|
||||
}
|
||||
}
|
||||
if (XamarinDevice.RuntimePlatform == XamarinDevice.UWP)
|
||||
{
|
||||
TextAttachmentCell.IsEnabled = false;
|
||||
FileAttachmentCell.IsEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
async void UpdateEnabled(object sender, ToggledEventArgs e)
|
||||
|
@ -31,6 +64,28 @@ namespace Contoso.Forms.Puppet
|
|||
await Crashes.SetEnabledAsync(e.Value);
|
||||
}
|
||||
|
||||
async void TextAttachment(object sender, EventArgs e)
|
||||
{
|
||||
var text = await TextAttachmentView.Show(Navigation);
|
||||
((TextCell)sender).Detail = text;
|
||||
Application.Current.Properties[TextAttachmentKey] = text;
|
||||
await Application.Current.SavePropertiesAsync();
|
||||
}
|
||||
|
||||
async void FileAttachment(object sender, EventArgs e)
|
||||
{
|
||||
var filePicker = DependencyService.Get<IFilePicker>();
|
||||
if (filePicker == null)
|
||||
{
|
||||
Debug.WriteLine("File attachment isn't implemented");
|
||||
return;
|
||||
}
|
||||
var file = await filePicker.PickFile();
|
||||
((TextCell)sender).Detail = filePicker.GetFileDescription(file);
|
||||
Application.Current.Properties[FileAttachmentKey] = file;
|
||||
await Application.Current.SavePropertiesAsync();
|
||||
}
|
||||
|
||||
void HandleOrThrow(Action action)
|
||||
{
|
||||
try
|
||||
|
@ -64,7 +119,7 @@ namespace Contoso.Forms.Puppet
|
|||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("null reference exception");
|
||||
Debug.WriteLine("null reference exception");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,9 +135,9 @@ namespace Contoso.Forms.Puppet
|
|||
{
|
||||
var val = values[ctr].Trim();
|
||||
var separator = ctr == values.GetUpperBound(0) ? "" : ", ";
|
||||
System.Diagnostics.Debug.WriteLine("{0}{1}", val, separator);
|
||||
Debug.WriteLine("{0}{1}", val, separator);
|
||||
}
|
||||
System.Diagnostics.Debug.WriteLine("");
|
||||
Debug.WriteLine("");
|
||||
}
|
||||
|
||||
void AggregateException(object sender, EventArgs e)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage Title="Custom Properties"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Puppet.CustomPropertiesContentPage">
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Puppet.CustomPropertiesContentPage">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<ScrollView Orientation="Vertical">
|
||||
<StackLayout Orientation="Vertical" x:Name="PropertiesContainer">
|
||||
<StackLayout Orientation="Vertical" x:Name="PropertiesContainer" Padding="10">
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
<Button Text="Add property" Clicked="AddProperty_Clicked" x:Name="AddProperty"/>
|
||||
<Button Text="Send" Clicked="Send_Clicked" x:Name="Send"/>
|
||||
<Button Text="Add property" Clicked="AddProperty_Clicked" x:Name="AddProperty" Margin="0,20,0,0" />
|
||||
<Button Text="Send" Clicked="Send_Clicked" x:Name="Send" FontAttributes="Bold" />
|
||||
</StackLayout>
|
||||
</ContentPage>
|
|
@ -1,18 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage Title="Others"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Puppet.OthersContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection Title="Distribute">
|
||||
<SwitchCell Text="Distribute Enabled" On="true" x:Name="DistributeEnabledSwitchCell" OnChanged="UpdateDistributeEnabled"/>
|
||||
</TableSection>
|
||||
<TableSection Title="Push">
|
||||
<SwitchCell Text="Push Enabled" On="true" x:Name="PushEnabledSwitchCell" OnChanged="UpdatePushEnabled"/>
|
||||
<SwitchCell Text="Firebase Analytics Enabled" On="true" x:Name="FirebaseAnalyticsEnabledSwitchCell" OnChanged="UpdateFirebaseAnalyticsEnabled"/>
|
||||
</TableSection>
|
||||
<TableSection Title="Rum">
|
||||
<SwitchCell Text="Rum Enabled" On="true" x:Name="RumEnabledSwitchCell" OnChanged="UpdateRumEnabled"/>
|
||||
</TableSection>
|
||||
</TableView>
|
||||
</ContentPage>
|
||||
<ContentPage Title="Others" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Contoso.Forms.Puppet.OthersContentPage">
|
||||
<TableView Intent="Form">
|
||||
<TableSection Title="Distribute">
|
||||
<SwitchCell Text="Distribute Enabled" On="true" x:Name="DistributeEnabledSwitchCell" OnChanged="UpdateDistributeEnabled" />
|
||||
</TableSection>
|
||||
<TableSection Title="Push">
|
||||
<SwitchCell Text="Push Enabled" On="true" x:Name="PushEnabledSwitchCell" OnChanged="UpdatePushEnabled" />
|
||||
</TableSection>
|
||||
<TableSection Title="Rum">
|
||||
<SwitchCell Text="Rum Enabled" On="true" x:Name="RumEnabledSwitchCell" OnChanged="UpdateRumEnabled" />
|
||||
</TableSection>
|
||||
</TableView>
|
||||
</ContentPage>
|
|
@ -11,9 +11,6 @@ namespace Contoso.Forms.Puppet
|
|||
[Android.Runtime.Preserve(AllMembers = true)]
|
||||
public partial class OthersContentPage
|
||||
{
|
||||
|
||||
public const string FirebaseEnabledKey = "FIREBASE_ENABLED";
|
||||
|
||||
public OthersContentPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -21,11 +18,6 @@ namespace Contoso.Forms.Puppet
|
|||
{
|
||||
Icon = "handbag.png";
|
||||
}
|
||||
if (XamarinDevice.RuntimePlatform != XamarinDevice.Android)
|
||||
{
|
||||
FirebaseAnalyticsEnabledSwitchCell.On = false;
|
||||
FirebaseAnalyticsEnabledSwitchCell.IsEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override async void OnAppearing()
|
||||
|
@ -36,14 +28,6 @@ namespace Contoso.Forms.Puppet
|
|||
DistributeEnabledSwitchCell.IsEnabled = acEnabled;
|
||||
PushEnabledSwitchCell.On = await Push.IsEnabledAsync();
|
||||
PushEnabledSwitchCell.IsEnabled = acEnabled;
|
||||
if (XamarinDevice.RuntimePlatform == XamarinDevice.Android)
|
||||
{
|
||||
if (!Application.Current.Properties.ContainsKey(FirebaseEnabledKey))
|
||||
{
|
||||
Application.Current.Properties[FirebaseEnabledKey] = false;
|
||||
}
|
||||
FirebaseAnalyticsEnabledSwitchCell.On = (bool)Application.Current.Properties[FirebaseEnabledKey];
|
||||
}
|
||||
RumEnabledSwitchCell.On = await RealUserMeasurements.IsEnabledAsync();
|
||||
RumEnabledSwitchCell.IsEnabled = acEnabled;
|
||||
}
|
||||
|
@ -58,11 +42,6 @@ namespace Contoso.Forms.Puppet
|
|||
await Push.SetEnabledAsync(e.Value);
|
||||
}
|
||||
|
||||
void UpdateFirebaseAnalyticsEnabled(object sender, ToggledEventArgs e)
|
||||
{
|
||||
Application.Current.Properties[FirebaseEnabledKey] = e.Value;
|
||||
}
|
||||
|
||||
async void UpdateRumEnabled(object sender, ToggledEventArgs e)
|
||||
{
|
||||
await RealUserMeasurements.SetEnabledAsync(e.Value);
|
||||
|
|
|
@ -17,8 +17,8 @@ using System.Reflection;
|
|||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1-SNAPSHOT")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.1.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.
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Contoso.Forms.Puppet.PropertiesContentPage">
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Contoso.Forms.Puppet.PropertiesContentPage"
|
||||
Title="Event Properties">
|
||||
<ListView x:Name="PropertyList">
|
||||
|
||||
</ListView>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<StackLayout Orientation="Horizontal" Padding="10">
|
||||
<Label Text="{Binding Name}" />
|
||||
<Label Text="{Binding Value}" TextColor="Gray" HorizontalOptions="EndAndExpand" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Contoso.Forms.Puppet
|
||||
|
@ -9,17 +8,7 @@ namespace Contoso.Forms.Puppet
|
|||
public PropertiesContentPage(List<Property> EventProperties)
|
||||
{
|
||||
InitializeComponent();
|
||||
Title = "Event Properties";
|
||||
|
||||
List<string> properties = new List<string>();
|
||||
|
||||
foreach (Property property in EventProperties)
|
||||
{
|
||||
string propertyString = property.Name + ": " + property.Value;
|
||||
properties.Add(propertyString);
|
||||
}
|
||||
|
||||
PropertyList.ItemsSource = properties;
|
||||
PropertyList.ItemsSource = EventProperties;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|