From 4f90838a886bfce295f9432b581f2eee2fd9b8de Mon Sep 17 00:00:00 2001 From: Kamo Spertsyan Date: Fri, 2 Sep 2022 18:36:17 +0300 Subject: [PATCH 1/2] Returned broken C# 8 support (#100) --- Runtime/Scripts/Mapper.cs | 10 ++++------ Runtime/Scripts/Qonversion.cs | 8 ++++---- 2 files changed, 8 insertions(+), 10 deletions(-) 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..d23c3b8 100644 --- a/Runtime/Scripts/Qonversion.cs +++ b/Runtime/Scripts/Qonversion.cs @@ -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; } From a03d3ca00c2d758c0eb6e43aa131de70562b4e37 Mon Sep 17 00:00:00 2001 From: SpertsyanKM Date: Fri, 2 Sep 2022 15:37:31 +0000 Subject: [PATCH 2/2] [create-pull-request] automated change --- Runtime/Scripts/Qonversion.cs | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Runtime/Scripts/Qonversion.cs b/Runtime/Scripts/Qonversion.cs index d23c3b8..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; 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": {