Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 54f415c

Browse files
Merge 24a3c3f into 5af0cf3
2 parents 5af0cf3 + 24a3c3f commit 54f415c

File tree

7 files changed

+69
-60
lines changed

7 files changed

+69
-60
lines changed

src/ClassLibraryTest/Class1.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace ClassLibraryTest;
2+
3+
public class Class1
4+
{
5+
public void Test()
6+
{
7+
}
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\Plugin.InAppBilling\Plugin.InAppBilling.csproj" />
11+
</ItemGroup>
12+
13+
</Project>

src/InAppBilling.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{5124C265
3131
EndProject
3232
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InAppBillingMauiTest", "InAppBillingTests\InAppBillingMauiTest\InAppBillingMauiTest.csproj", "{BAE4393A-4E17-4E60-BF53-E916505F44E1}"
3333
EndProject
34+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibraryTest", "ClassLibraryTest\ClassLibraryTest.csproj", "{766E2D00-352E-455F-9717-3F9864F3247A}"
35+
EndProject
3436
Global
3537
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3638
Debug|Any CPU = Debug|Any CPU
@@ -47,12 +49,17 @@ Global
4749
{BAE4393A-4E17-4E60-BF53-E916505F44E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
4850
{BAE4393A-4E17-4E60-BF53-E916505F44E1}.Release|Any CPU.Build.0 = Release|Any CPU
4951
{BAE4393A-4E17-4E60-BF53-E916505F44E1}.Release|Any CPU.Deploy.0 = Release|Any CPU
52+
{766E2D00-352E-455F-9717-3F9864F3247A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53+
{766E2D00-352E-455F-9717-3F9864F3247A}.Debug|Any CPU.Build.0 = Debug|Any CPU
54+
{766E2D00-352E-455F-9717-3F9864F3247A}.Release|Any CPU.ActiveCfg = Release|Any CPU
55+
{766E2D00-352E-455F-9717-3F9864F3247A}.Release|Any CPU.Build.0 = Release|Any CPU
5056
EndGlobalSection
5157
GlobalSection(SolutionProperties) = preSolution
5258
HideSolutionNode = FALSE
5359
EndGlobalSection
5460
GlobalSection(NestedProjects) = preSolution
5561
{BAE4393A-4E17-4E60-BF53-E916505F44E1} = {5124C265-C6EF-4415-9497-0EF227E43095}
62+
{766E2D00-352E-455F-9717-3F9864F3247A} = {5124C265-C6EF-4415-9497-0EF227E43095}
5663
EndGlobalSection
5764
GlobalSection(ExtensibilityGlobals) = postSolution
5865
SolutionGuid = {42D18242-8BA9-4238-9D59-10850E1C2C24}

src/InAppBillingTests/InAppBillingMauiTest/MauiProgram.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
namespace InAppBillingMauiTest
1+
using Plugin.InAppBilling;
2+
3+
namespace InAppBillingMauiTest
24
{
35
public static class MauiProgram
46
{
57
public static MauiApp CreateMauiApp()
68
{
9+
10+
#if IOS
11+
var test = new InAppBillingImplementation();
12+
#endif
713
var builder = MauiApp.CreateBuilder();
814
builder
915
.UseMauiApp<App>()

src/Plugin.InAppBilling/InAppBilling.android.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,16 @@ public override Task<bool> ConnectAsync(bool enablePendingPurchases = true, Canc
7878
BillingClientBuilder = NewBuilder(Context);
7979
BillingClientBuilder.SetListener(OnPurchasesUpdated);
8080
if (enablePendingPurchases)
81-
BillingClient = BillingClientBuilder.EnablePendingPurchases().Build();
81+
{
82+
var pendingParams = PendingPurchasesParams.NewBuilder().EnableOneTimeProducts().EnablePrepaidPlans().Build();
83+
BillingClient = BillingClientBuilder.EnablePendingPurchases(pendingParams).Build();
84+
}
8285
else
83-
BillingClient = BillingClientBuilder.Build();
86+
87+
{
88+
var pendingParams = PendingPurchasesParams.NewBuilder().EnableOneTimeProducts().Build();
89+
BillingClient = BillingClientBuilder.EnablePendingPurchases(pendingParams).Build();
90+
}
8491

8592
BillingClient.StartConnection(OnSetupFinished, OnDisconnected);
8693
// TODO: stop trying
@@ -133,7 +140,6 @@ public override Task DisconnectAsync(CancellationToken cancellationToken)
133140
return Task.CompletedTask;
134141
}
135142

136-
137143
/// <summary>
138144
/// Gets or sets if in testing mode. Only for UWP
139145
/// </summary>
@@ -483,6 +489,7 @@ static bool ParseBillingResult(BillingResult result, bool ignoreInvalidProducts
483489
return result.ResponseCode switch
484490
{
485491
BillingResponseCode.Ok => true,
492+
BillingResponseCode.NetworkError => throw new InAppBillingPurchaseException(PurchaseError.NetworkError),
486493
BillingResponseCode.UserCancelled => throw new InAppBillingPurchaseException(PurchaseError.UserCancelled),//User Cancelled, should try again
487494
BillingResponseCode.ServiceUnavailable => throw new InAppBillingPurchaseException(PurchaseError.ServiceUnavailable),//Network connection is down
488495
BillingResponseCode.ServiceDisconnected => throw new InAppBillingPurchaseException(PurchaseError.ServiceDisconnected),//Network connection is down

src/Plugin.InAppBilling/Plugin.InAppBilling.csproj

Lines changed: 21 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst;net8.0-macos</TargetFrameworks>
4-
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
3+
<TargetFrameworks>net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst;net8.0-macos;net9.0;net9.0-android;net9.0-ios;net9.0-maccatalyst;net9.0-macos</TargetFrameworks>
4+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0;net9.0-windows10.0.19041.0</TargetFrameworks>
55
<LangVersion>latest</LangVersion>
6-
<UseMaui Condition="'$(TargetFramework)' != 'net8.0'">true</UseMaui>
7-
<UseMauiEssentials Condition="'$(TargetFramework)' != 'net8.0'">true</UseMauiEssentials>
86
<SingleProject>true</SingleProject>
97
<AssemblyName>Plugin.InAppBilling</AssemblyName>
108
<RootNamespace>Plugin.InAppBilling</RootNamespace>
119
<Product>$(AssemblyName) ($(TargetFramework))</Product>
12-
<AssemblyVersion>7.0.0.0</AssemblyVersion>
13-
<AssemblyFileVersion>7.0.0.0</AssemblyFileVersion>
14-
<Version>7.0.0.0</Version>
10+
<AssemblyVersion>9.0.0.0</AssemblyVersion>
11+
<AssemblyFileVersion>9.0.0.0</AssemblyFileVersion>
12+
<Version>9.0.0.0</Version>
1513
<Authors>James Montemagno</Authors>
1614
<IsPackable>True</IsPackable>
1715
<PackageId>Plugin.InAppBilling</PackageId>
@@ -44,12 +42,12 @@
4442

4543
<!-- platform version number information -->
4644
<PropertyGroup>
47-
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('ios'))">14.2</SupportedOSPlatformVersion>
48-
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('maccatalyst'))">14.0</SupportedOSPlatformVersion>
49-
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('macos'))">13.0</SupportedOSPlatformVersion>
50-
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('android'))">21.0</SupportedOSPlatformVersion>
51-
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('windows'))">10.0.17763.0</SupportedOSPlatformVersion>
52-
<TargetPlatformMinVersion Condition="$(TargetFramework.Contains('windows'))">10.0.17763.0</TargetPlatformMinVersion>
45+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
46+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
47+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
48+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
49+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
50+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
5351
</PropertyGroup>
5452

5553
<PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
@@ -94,48 +92,17 @@
9492
<!-- Android -->
9593

9694
<ItemGroup Condition=" $(TargetFramework.Contains('-android')) ">
97-
<PackageReference Include="Microsoft.Maui.Essentials" Version="$(MauiVersion)" />
98-
<PackageReference Include="Xamarin.Android.Google.BillingClient" Version="6.2.1" />
99-
<PackageReference Include="Xamarin.AndroidX.Activity">
100-
<Version>1.9.0.4</Version>
101-
</PackageReference>
102-
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx">
103-
<Version>1.9.0.4</Version>
104-
</PackageReference>
105-
<PackageReference Include="Xamarin.AndroidX.Collection">
106-
<Version>1.4.0.6</Version>
107-
</PackageReference>
108-
<PackageReference Include="Xamarin.AndroidX.Collection.Ktx">
109-
<Version>1.4.0.5</Version>
110-
</PackageReference>
111-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData">
112-
<Version>2.8.3.1</Version>
113-
</PackageReference>
114-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Ktx">
115-
<Version>2.8.3.1</Version>
116-
</PackageReference>
117-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core">
118-
<Version>2.8.3.1</Version>
119-
</PackageReference>
120-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx">
121-
<Version>2.8.3.1</Version>
122-
</PackageReference>
123-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime">
124-
<Version>2.8.3.1</Version>
125-
</PackageReference>
126-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx">
127-
<Version>2.8.3.1</Version>
128-
</PackageReference>
129-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel">
130-
<Version>2.8.3.1</Version>
131-
</PackageReference>
132-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel.Ktx">
133-
<Version>2.8.3.1</Version>
134-
</PackageReference>
135-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModelSavedState">
136-
<Version>2.8.3.1</Version>
137-
</PackageReference>
95+
<PackageReference Include="Xamarin.Android.Google.BillingClient" Version="7.1.1.1" />
96+
</ItemGroup>
97+
98+
<ItemGroup Condition=" $(TargetFramework.Contains('net8.0-android')) ">
99+
<PackageReference Include="Microsoft.Maui.Essentials" Version="8.0.100" />
138100
</ItemGroup>
101+
102+
<ItemGroup Condition=" $(TargetFramework.Contains('net9.0-android')) ">
103+
<PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.10" />
104+
</ItemGroup>
105+
139106

140107
<ItemGroup Condition="$(TargetFramework.StartsWith('net')) == true AND $(TargetFramework.Contains('-android')) != true">
141108
<Compile Remove="**\**\*.android.cs" />

src/Plugin.InAppBilling/Shared/InAppBillingExceptions.shared.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ public enum PurchaseError
7070
FeatureNotSupported,
7171
ServiceDisconnected,
7272
ServiceTimeout,
73-
AppleTermsConditionsChanged
74-
}
73+
AppleTermsConditionsChanged,
74+
NetworkError
75+
}
7576

7677
/// <summary>
7778
/// Purchase exception

0 commit comments

Comments
 (0)