-
-
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.
- Loading branch information
Showing
99 changed files
with
391 additions
and
16,473 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,57 +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; | ||
if (ret == null) | ||
{ | ||
throw NotImplementedInReferenceAssembly(); | ||
} | ||
return 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() | ||
{ | ||
#if NETSTANDARD1_0 || NETSTANDARD2_0 | ||
return null; | ||
#else | ||
#pragma warning disable IDE0022 // Use expression body for methods | ||
return new StoreReviewImplementation(); | ||
#pragma warning restore IDE0022 // Use expression body for methods | ||
static IStoreReview CreateStoreReview() | ||
{ | ||
#if ANDROID || IOS || MACCATALYST || MACOS || WINDOWS | ||
return new StoreReviewImplementation(); | ||
#else | ||
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> | ||
void 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> | ||
void 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); | ||
} |
Oops, something went wrong.