From def5dbea64f8466ad7e1aa046e5cfdd319adeb38 Mon Sep 17 00:00:00 2001 From: Sergio Guerrero Date: Wed, 8 Feb 2023 07:47:50 -0800 Subject: [PATCH] Replaced obsolete function Pointer_stringify with UTF8ToString Summary: This is a request from github: https://github.com/facebook/facebook-sdk-for-unity/issues/670 Pointer_stringify is obsolete since Unity 2021.2: https://forum.unity.com/threads/pointer_stringify-is-not-defined-pass-string-to-js.701501/ Reviewed By: JordiFB Differential Revision: D43118110 fbshipit-source-id: 13e1ec6ac2b54b73a382ffb9846b459aa5e5e4fc --- .../Plugins/CanvasJSSDKBindings.jslib | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Facebook.Unity.Canvas/Plugins/CanvasJSSDKBindings.jslib b/Facebook.Unity.Canvas/Plugins/CanvasJSSDKBindings.jslib index 0439287aa..72a022acf 100644 --- a/Facebook.Unity.Canvas/Plugins/CanvasJSSDKBindings.jslib +++ b/Facebook.Unity.Canvas/Plugins/CanvasJSSDKBindings.jslib @@ -214,9 +214,9 @@ var FBUnityLib = { }, init: function(connectFacebookUrl, locale, debug, initParams, status) { - var connectFacebookUrlString = Pointer_stringify(connectFacebookUrl); - var localeString = Pointer_stringify(locale); - var initParamsString = Pointer_stringify(initParams); + var connectFacebookUrlString = UTF8ToString(connectFacebookUrl); + var localeString = UTF8ToString(locale); + var initParamsString = UTF8ToString(initParams); FBUnity.init(connectFacebookUrlString, localeString, debug, initParamsString, status); }, @@ -226,10 +226,10 @@ var FBUnityLib = { }, login: function(scope, callback_id) { - var scopeString = Pointer_stringify(scope); + var scopeString = UTF8ToString(scope); var scopeArray = JSON.parse(scopeString); - var callback_idString = Pointer_stringify(callback_id); + var callback_idString = UTF8ToString(callback_id); FBUnity.login(scopeArray, callback_idString); }, @@ -243,34 +243,34 @@ var FBUnityLib = { }, logAppEvent: function(eventName, valueToSum, parameters) { - var eventNameString = Pointer_stringify(eventName); - var parametersString = Pointer_stringify(parameters); + var eventNameString = UTF8ToString(eventName); + var parametersString = UTF8ToString(parameters); FBUnity.logAppEvent(eventNameString, valueToSum, parametersString); }, logAppEventWithoutValue: function(eventName, parameters) { - var eventNameString = Pointer_stringify(eventName); - var parametersString = Pointer_stringify(parameters); + var eventNameString = UTF8ToString(eventName); + var parametersString = UTF8ToString(parameters); FBUnity.logAppEvent(eventNameString, null, parametersString); }, logPurchase: function(purchaseAmount, currency, parameters) { - var currencyString = Pointer_stringify(currency); - var parametersString = Pointer_stringify(parameters); + var currencyString = UTF8ToString(currency); + var parametersString = UTF8ToString(parameters); FBUnity.logPurchase(purchaseAmount, currencyString, parametersString); }, ui: function(x, uid, callbackMethodName) { - var xString = Pointer_stringify(x); - var uidString = Pointer_stringify(uid); - var callbackMethodNameString = Pointer_stringify(callbackMethodName); + var xString = UTF8ToString(x); + var uidString = UTF8ToString(uid); + var callbackMethodNameString = UTF8ToString(callbackMethodName); FBUnity.ui(xString, uidString, callbackMethodNameString); } }; autoAddDeps(LibraryManager.library, '$FBUnity'); -mergeInto(LibraryManager.library, FBUnityLib); \ No newline at end of file +mergeInto(LibraryManager.library, FBUnityLib);