Skip to content

Commit

Permalink
chore: Adjust build and logic
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Sep 18, 2024
1 parent c6b0514 commit e76bba1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/AddIns/Uno.UI.GooglePlay/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Reflection;
using Uno.Foundation.Extensibility;
using Uno.UI.GooglePlay;
using Uno.UI.Xaml.Media.Imaging.Svg;
using Windows.Services.Store.Internal;

Expand Down
17 changes: 12 additions & 5 deletions src/AddIns/Uno.UI.GooglePlay/StoreContextExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@

namespace Uno.UI.GooglePlay;

internal class StoreContextExtension : IStoreContextExtension
public class StoreContextExtension : IStoreContextExtension
{
private readonly StoreContext _storeContext;

public StoreContextExtension(object storeContext)
{
_storeContext = storeContext as StoreContext ?? throw new ArgumentNullException(nameof(storeContext));
}

public async Task<StoreRateAndReviewResult> RequestRateAndReviewAsync(CancellationToken token)
{
TaskCompletionSource<StoreRateAndReviewResult>? inAppRateTcs;
Expand All @@ -33,7 +40,8 @@ public async Task<StoreRateAndReviewResult> RequestRateAndReviewAsync(Cancellati

using var request = reviewManager.RequestReviewFlow();

request.AddOnCompleteListener(new InAppReviewListener(reviewManager, inAppRateTcs));
using var listener = new InAppReviewListener(reviewManager, inAppRateTcs);
request.AddOnCompleteListener(listener);

return await inAppRateTcs.Task;
}
Expand All @@ -56,10 +64,9 @@ public void OnComplete(Xamarin.Google.Android.Play.Core.Tasks.Task task)
var context = ContextHelper.Current;
var activity = (Activity)context;

if (!task.IsSuccessful)
if (!task.IsSuccessful || _forceReturn)
{
_inAppRateTcs?.TrySetResult(new StoreRateAndReviewResult(StoreRateAndReviewStatus.Error));

_inAppRateTcs?.TrySetResult(new(_forceReturn ? StoreRateAndReviewStatus.Succeeded : StoreRateAndReviewStatus.Error));
_launchTask?.Dispose();

return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@

<ItemGroup>
<ProjectReference Include="..\..\Uno.UI.BindingHelper.Android\Uno.UI.BindingHelper.Android.netcoremobile.csproj" />
<ProjectReference Include="..\..\AddIns\Uno.UI.GooglePlay\Uno.UI.GooglePlay.netcoremobile.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -237,16 +238,10 @@

<Import Project="..\..\..\build\nuget\uno.winui.single-project.targets" />

<Target Name="GenerateVersion"
BeforeTargets="BeforeBuild;_CompileAppManifest;_GetAndroidPackageName"
Condition="'$(GITVERSION_InformationalVersion)'!=''">
<Target Name="GenerateVersion" BeforeTargets="BeforeBuild;_CompileAppManifest;_GetAndroidPackageName" Condition="'$(GITVERSION_InformationalVersion)'!=''">

<Exec
Command="git rev-list --count HEAD"
ConsoleToMSBuild="true">
<Output
TaskParameter="ConsoleOutput"
PropertyName="_VersionCode" />
<Exec Command="git rev-list --count HEAD" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="_VersionCode" />
</Exec>

<PropertyGroup>
Expand All @@ -259,7 +254,7 @@

</Target>

<PropertyGroup >
<PropertyGroup>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Windows.Services.Store.Internal;

internal interface IStoreContextExtension
public interface IStoreContextExtension
{
Task<StoreRateAndReviewResult> RequestRateAndReviewAsync(CancellationToken token);
}

0 comments on commit e76bba1

Please sign in to comment.