Skip to content

Commit

Permalink
Merge pull request #102 from qonversion/release/3.5.1
Browse files Browse the repository at this point in the history
Release 3.5.1
  • Loading branch information
SpertsyanKM authored Sep 2, 2022
2 parents 7ab2498 + a03d3ca commit 4f05cfc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
10 changes: 4 additions & 6 deletions Runtime/Scripts/Mapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ internal class Mapper
{
internal static Dictionary<string, Permission> PermissionsFromPurchaseJson(string jsonStr)
{
if (Json.Deserialize(jsonStr) is not Dictionary<string, object> result)
if (!(Json.Deserialize(jsonStr) is Dictionary<string, object> result))
{
Debug.LogError("Could not parse purchase result");
return null;
}

var resultPermissions = new Dictionary<string, Permission>();

if (result["permissions"] is not List<object> permissions)
if (!(result["permissions"] is List<object> permissions))
{
Debug.LogError("Could not parse QPermissions");
return resultPermissions;
Expand All @@ -34,15 +34,13 @@ internal static Dictionary<string, Permission> PermissionsFromPurchaseJson(strin

internal static bool GetIsCancelledFromJson(string jsonStr)
{
if (Json.Deserialize(jsonStr) is not Dictionary<string, object> result)
if (!(Json.Deserialize(jsonStr) is Dictionary<string, object> result))
{
Debug.LogError("Could not parse purchase result");
return false;
}

var isCancelled = Convert.ToBoolean(result.GetValueOrDefault("isCancelled", 0));

return isCancelled;
return result.TryGetValue("isCancelled", out var isCancelled) && Convert.ToBoolean(isCancelled);
}

internal static Dictionary<string, Permission> PermissionsFromJson(string jsonStr)
Expand Down
10 changes: 5 additions & 5 deletions Runtime/Scripts/Qonversion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class Qonversion : MonoBehaviour
private const string OnOfferingsMethodName = "OnOfferings";
private const string OnEligibilitiesMethodName = "OnEligibilities";

private const string SdkVersion = "3.5.0";
private const string SdkVersion = "3.5.1";
private const string SdkSource = "unity";

private static IQonversionWrapper _Instance;
Expand All @@ -62,14 +62,14 @@ public class Qonversion : MonoBehaviour
private static string _storedPromoProductId = null;
private static AutomationsDelegate _automationsDelegate;

private static List<OnPermissionsReceived> CheckPermissionsCallbacks { get; } = new();
private static List<OnPermissionsReceived> RestoreCallbacks { get; } = new();
private static List<OnPermissionsReceived> CheckPermissionsCallbacks { get; } = new List<OnPermissionsReceived>();
private static List<OnPermissionsReceived> RestoreCallbacks { get; } = new List<OnPermissionsReceived>();
private static OnPurchaseResultReceived PurchaseCallback { get; set; }
private static OnPurchaseResultReceived PurchaseProductCallback { get; set; }
private static OnPurchaseResultReceived UpdatePurchaseCallback { get; set; }
private static OnPurchaseResultReceived UpdatePurchaseWithProductCallback { get; set; }
private static List<OnProductsReceived> ProductsCallbacks { get; } = new();
private static List<OnOfferingsReceived> OfferingsCallbacks { get; } = new();
private static List<OnProductsReceived> ProductsCallbacks { get; } = new List<OnProductsReceived>();
private static List<OnOfferingsReceived> OfferingsCallbacks { get; } = new List<OnOfferingsReceived>();
private static OnEligibilitiesReceived EligibilitiesCallback { get; set; }
private static OnPermissionsReceived PromoPurchaseCallback { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.qonversion.unity",
"displayName": "Qonversion",
"version": "3.5.0",
"version": "3.5.1",
"unity": "2018.3",
"description": "Empower your mobile app marketing and product decisions with precise subscription data.",
"author": {
Expand Down

0 comments on commit 4f05cfc

Please sign in to comment.