Skip to content

Commit

Permalink
General improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
FabriBertani committed Jan 3, 2024
1 parent f997a11 commit d6d6da1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
20 changes: 20 additions & 0 deletions Plugin.Maui.AppRating/AppRating.net.cs
@@ -0,0 +1,20 @@

namespace Plugin.Maui.AppRating;

partial class AppRatingImplementation : IAppRating
{
public Task PerformInAppRateAsync(bool isTestOrDebugMode)
{
throw new NotImplementedException();
}

public Task PerformRatingOnStoreAsync(string appId)
{
throw new NotImplementedException();
}

public Task PerformRatingOnStoreAsync(string packageName = "", string applicationId = "", string productId = "")
{
throw new NotImplementedException();
}
}
Expand Up @@ -15,11 +15,9 @@ public Task PerformInAppRateAsync(bool isTestOrDebugMode)

if (UIDevice.CurrentDevice.CheckSystemVersion(14, 0))
{
var windowScene = UIApplication.SharedApplication?.ConnectedScenes?
if (UIApplication.SharedApplication?.ConnectedScenes?
.ToArray<UIScene>()?
.FirstOrDefault(ws => ws.ActivationState == UISceneActivationState.ForegroundActive) as UIWindowScene;

if (windowScene != null)
.FirstOrDefault(ws => ws.ActivationState == UISceneActivationState.ForegroundActive) is UIWindowScene windowScene)
{
SKStoreReviewController.RequestReview(windowScene);

Expand Down
9 changes: 5 additions & 4 deletions Plugin.Maui.AppRating/Platforms/iOS/AppRating.ios.cs
@@ -1,5 +1,6 @@
using Foundation;
using StoreKit;
using System.Runtime.Versioning;
using UIKit;

namespace Plugin.Maui.AppRating;
Expand All @@ -17,11 +18,9 @@ public Task PerformInAppRateAsync(bool isTestOrDebugMode)
{
if (UIDevice.CurrentDevice.CheckSystemVersion(14, 0))
{
var windowScene = UIApplication.SharedApplication?.ConnectedScenes?
if (UIApplication.SharedApplication?.ConnectedScenes?
.ToArray<UIScene>()?
.FirstOrDefault(ws => ws.ActivationState == UISceneActivationState.ForegroundActive) as UIWindowScene;

if (windowScene != null)
.FirstOrDefault(ws => ws.ActivationState == UISceneActivationState.ForegroundActive) is UIWindowScene windowScene)
{
SKStoreReviewController.RequestReview(windowScene);

Expand All @@ -31,7 +30,9 @@ public Task PerformInAppRateAsync(bool isTestOrDebugMode)
}
}

#pragma warning disable CA1422
SKStoreReviewController.RequestReview();
#pragma warning restore CA1422

tcs.SetResult(true);
}
Expand Down

0 comments on commit d6d6da1

Please sign in to comment.