Skip to content

Commit

Permalink
Prep for .NET 6 and .NET MAUI
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmontemagno committed Apr 15, 2022
1 parent 7f63b93 commit 6e3d591
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 36 deletions.
102 changes: 67 additions & 35 deletions src/StoreReview.Plugin/StoreReview.Plugin.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="MSBuild.Sdk.Extras/2.1.2">
<Project Sdk="MSBuild.Sdk.Extras/3.044">

<PropertyGroup>
<TargetFrameworks>netstandard1.0;netstandard2.0;MonoAndroid10.0;Xamarin.Mac20;Xamarin.iOS10;uap10.0.19041;Xamarin.TVOS10;</TargetFrameworks>
<TargetFrameworks>netstandard2.0;MonoAndroid10.0;Xamarin.iOS10;Xamarin.TVOS10;Xamarin.Mac20;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);uap10.0.19041;net6.0-windows10.0.19041;</TargetFrameworks>
<AssemblyName>Plugin.StoreReview</AssemblyName>
<RootNamespace>Plugin.StoreReview</RootNamespace>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
Expand All @@ -17,8 +18,9 @@
<PackageProjectUrl>https://github.com/jamesmontemagno/StoreReviewPlugin</PackageProjectUrl>
<Summary>Easily request a review or open the store page for your app.</Summary>
<PackageTags>
xamarin, pcl, xam.pcl, uwp, store review, review, xamarin.forms, ios</PackageTags>
<Title>Store Review Plugin for Xamarin and Windows</Title>
xamarin, pcl, xam.pcl, uwp, store review, review, xamarin.forms, ios
</PackageTags>
<Title>Store Review Plugin for .NET MAUI, Xamarin, and Windows</Title>
<Description>
Easily request a review or open the store page for your app.
</Description>
Expand All @@ -32,29 +34,40 @@
<DefineConstants>$(DefineConstants);</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)'=='Release' And '$(OS)' == 'Windows_NT' ">
<!-- sourcelink: Declare that the Repository URL can be published to NuSpec -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- sourcelink: Embed source files that are not tracked by the source control manager to the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- sourcelink: Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
<ItemGroup Condition=" '$(Configuration)'=='Release' And '$(OS)' == 'Windows_NT' ">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
<DebugSymbols>true</DebugSymbols>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Release' ">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-ios'))">10.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-tvos'))">10.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-maccatalyst'))">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-macos'))">10.14</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-android'))">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-windows10'))">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$(TargetFramework.Contains('-windows10'))">10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)'=='Release' And '$(OS)' == 'Windows_NT' ">
<!-- sourcelink: Declare that the Repository URL can be published to NuSpec -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- sourcelink: Embed source files that are not tracked by the source control manager to the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- sourcelink: Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<ItemGroup Condition=" '$(Configuration)'=='Release' And '$(OS)' == 'Windows_NT' ">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
<DebugSymbols>true</DebugSymbols>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Release' ">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<Compile Include="**\*.shared.cs" />
Expand All @@ -68,28 +81,47 @@
<Compile Include="**\*.uwp.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.Contains('-windows')) ">
<Compile Include="**\*.uwp.cs" />
</ItemGroup>

<PropertyGroup Condition=" $(TargetFramework.StartsWith('uap10.0')) ">
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
</PropertyGroup>

<PropertyGroup Condition=" $(TargetFramework.Contains('-android')) ">
<UseMauiEssentials>true</UseMauiEssentials>
</PropertyGroup>

<ItemGroup Condition=" $(TargetFramework.Contains('-android')) ">
<Compile Include="**\*.android.cs" />
<PackageReference Include="PlayCore" Version="1.10.2-rc2" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('MonoAndroid')) ">
<Compile Include="**\*.android.cs" />
<PackageReference Include="PlayCore" Version="1.10.2-rc2" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.1" />
<PackageReference Include="PlayCore" Version="1.10.2-rc2" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.1" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.iOS')) ">
<Compile Include="**\*.apple.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.Contains('-ios')) ">
<Compile Include="**\*.apple.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.TVOS')) ">
<Compile Include="**\*.apple.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.Mac')) ">
<Compile Include="**\*.apple.cs" />
</ItemGroup>



<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.Mac')) ">
<Compile Include="**\*.apple.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.Contains('-mac')) ">
<Compile Include="**\*.apple.cs" />
</ItemGroup>

</Project>
8 changes: 7 additions & 1 deletion src/StoreReview.Plugin/StoreReviewImplementation.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
using System.Threading.Tasks;
using Task = System.Threading.Tasks.Task;

#if NET
using Microsoft.Maui.ApplicationModel;
#else
using Xamarin.Essentials;
#endif

namespace Plugin.StoreReview
{
/// <summary>
Expand Down Expand Up @@ -99,7 +105,7 @@ public async Task RequestReview(bool testMode)
}

Activity Activity =>
Xamarin.Essentials.Platform.CurrentActivity ?? throw new NullReferenceException("Current Activity is null, ensure that the MainActivity.cs file is configuring Xamarin.Essentials in your source code so the In App Billing can use it.");
Platform.CurrentActivity ?? throw new NullReferenceException("Current Activity is null, ensure that the MainActivity.cs file is configuring Essentials in your source code so the In App Billing can use it.");

bool forceReturn;
Com.Google.Android.Play.Core.Tasks.Task launchTask;
Expand Down

0 comments on commit 6e3d591

Please sign in to comment.