-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and update platform support and documentation
Updated README.md to reflect .NET 8+ support for iOS, Android, MacCatalyst, and Windows, and removed outdated platform information. Changed UWP method signatures to return `Task<bool>` for `OpenStoreListing` and `OpenStoreReviewPage`. Updated Android setup instructions in README.md to remove outdated steps. Refactored `CrossStoreReview.shared.cs` and `StoreReviewImplementation` files for modern C# syntax and improved nullability. Simplified `IStoreReview.shared.cs` interface. Updated `StoreReview.Plugin.csproj` with correct metadata. Improved exception handling and logging across all platforms.
- Loading branch information
1 parent
24a1f2e
commit c1fffdc
Showing
7 changed files
with
319 additions
and
402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,49 @@ | ||
using Plugin.StoreReview.Abstractions; | ||
using System; | ||
|
||
namespace Plugin.StoreReview | ||
namespace Plugin.StoreReview; | ||
|
||
public enum ReviewStatus | ||
{ | ||
public enum ReviewStatus | ||
{ | ||
Succeeded, | ||
Error, | ||
CanceledByUser, | ||
NetworkError, | ||
Unknown | ||
} | ||
/// <summary> | ||
/// Cross platform StoreReview implemenations | ||
/// </summary> | ||
public class CrossStoreReview | ||
{ | ||
static Lazy<IStoreReview> implementation = new Lazy<IStoreReview>(() => CreateStoreReview(), System.Threading.LazyThreadSafetyMode.PublicationOnly); | ||
Succeeded, | ||
Error, | ||
CanceledByUser, | ||
NetworkError, | ||
Unknown | ||
} | ||
/// <summary> | ||
/// Cross platform StoreReview implemenations | ||
/// </summary> | ||
public class CrossStoreReview | ||
{ | ||
static readonly Lazy<IStoreReview> implementation = new(() => CreateStoreReview(), LazyThreadSafetyMode.PublicationOnly); | ||
|
||
/// <summary> | ||
/// Gets if the plugin is supported on the current platform. | ||
/// </summary> | ||
public static bool IsSupported => implementation.Value == null ? false : true; | ||
/// <summary> | ||
/// Gets if the plugin is supported on the current platform. | ||
/// </summary> | ||
public static bool IsSupported => implementation.Value != null; | ||
|
||
/// <summary> | ||
/// Current plugin implementation to use | ||
/// </summary> | ||
public static IStoreReview Current | ||
{ | ||
get | ||
{ | ||
var ret = implementation.Value; | ||
return ret is null ? throw NotImplementedInReferenceAssembly() : ret; | ||
} | ||
/// <summary> | ||
/// Current plugin implementation to use | ||
/// </summary> | ||
public static IStoreReview Current | ||
{ | ||
get | ||
{ | ||
var ret = implementation.Value; | ||
return ret is null ? throw NotImplementedInReferenceAssembly() : ret; | ||
} | ||
} | ||
|
||
static IStoreReview CreateStoreReview() | ||
{ | ||
static IStoreReview CreateStoreReview() | ||
{ | ||
#if ANDROID || IOS || MACCATALYST || MACOS || WINDOWS | ||
return new StoreReviewImplementation(); | ||
return new StoreReviewImplementation(); | ||
#else | ||
return null; | ||
return null!; | ||
#endif | ||
} | ||
} | ||
|
||
internal static Exception NotImplementedInReferenceAssembly() => | ||
new NotImplementedException("This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation."); | ||
|
||
internal static Exception NotImplementedInReferenceAssembly() => | ||
new NotImplementedException("This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation."); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,24 @@ | ||
using System.Threading.Tasks; | ||
namespace Plugin.StoreReview.Abstractions; | ||
|
||
namespace Plugin.StoreReview.Abstractions | ||
/// <summary> | ||
/// Interface for StoreReview | ||
/// </summary> | ||
public interface IStoreReview | ||
{ | ||
/// <summary> | ||
/// Interface for StoreReview | ||
/// </summary> | ||
public interface IStoreReview | ||
{ | ||
/// <summary> | ||
/// Opens the store listing. | ||
/// </summary> | ||
/// <param name="appId">App identifier.</param> | ||
Task<bool> OpenStoreListing(string appId); | ||
/// <summary> | ||
/// Opens the store listing. | ||
/// </summary> | ||
/// <param name="appId">App identifier.</param> | ||
Task<bool> OpenStoreListing(string appId); | ||
|
||
/// <summary> | ||
/// Opens the store review page. | ||
/// </summary> | ||
/// <param name="appId">App identifier.</param> | ||
Task<bool> OpenStoreReviewPage(string appId); | ||
/// <summary> | ||
/// Opens the store review page. | ||
/// </summary> | ||
/// <param name="appId">App identifier.</param> | ||
Task<bool> OpenStoreReviewPage(string appId); | ||
|
||
/// <summary> | ||
/// Requests an app review. | ||
/// </summary> | ||
Task<ReviewStatus> RequestReview(bool testMode); | ||
} | ||
/// <summary> | ||
/// Requests an app review. | ||
/// </summary> | ||
Task<ReviewStatus> RequestReview(bool testMode); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.