diff --git a/Runtime/Scripts/Mapper.cs b/Runtime/Scripts/Mapper.cs index 844324e..a76ade4 100644 --- a/Runtime/Scripts/Mapper.cs +++ b/Runtime/Scripts/Mapper.cs @@ -9,7 +9,7 @@ internal class Mapper { internal static Dictionary PermissionsFromPurchaseJson(string jsonStr) { - if (Json.Deserialize(jsonStr) is not Dictionary result) + if (!(Json.Deserialize(jsonStr) is Dictionary result)) { Debug.LogError("Could not parse purchase result"); return null; @@ -17,7 +17,7 @@ internal static Dictionary PermissionsFromPurchaseJson(strin var resultPermissions = new Dictionary(); - if (result["permissions"] is not List permissions) + if (!(result["permissions"] is List permissions)) { Debug.LogError("Could not parse QPermissions"); return resultPermissions; @@ -34,15 +34,13 @@ internal static Dictionary PermissionsFromPurchaseJson(strin internal static bool GetIsCancelledFromJson(string jsonStr) { - if (Json.Deserialize(jsonStr) is not Dictionary result) + if (!(Json.Deserialize(jsonStr) is Dictionary 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 PermissionsFromJson(string jsonStr) diff --git a/Runtime/Scripts/Qonversion.cs b/Runtime/Scripts/Qonversion.cs index 8895071..5ff0742 100644 --- a/Runtime/Scripts/Qonversion.cs +++ b/Runtime/Scripts/Qonversion.cs @@ -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; @@ -62,14 +62,14 @@ public class Qonversion : MonoBehaviour private static string _storedPromoProductId = null; private static AutomationsDelegate _automationsDelegate; - private static List CheckPermissionsCallbacks { get; } = new(); - private static List RestoreCallbacks { get; } = new(); + private static List CheckPermissionsCallbacks { get; } = new List(); + private static List RestoreCallbacks { get; } = new List(); 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 ProductsCallbacks { get; } = new(); - private static List OfferingsCallbacks { get; } = new(); + private static List ProductsCallbacks { get; } = new List(); + private static List OfferingsCallbacks { get; } = new List(); private static OnEligibilitiesReceived EligibilitiesCallback { get; set; } private static OnPermissionsReceived PromoPurchaseCallback { get; set; } diff --git a/package.json b/package.json index 8cdfde1..2ce1592 100644 --- a/package.json +++ b/package.json @@ -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": {