Skip to content

Commit

Permalink
Replaced obsolete function Pointer_stringify with UTF8ToString
Browse files Browse the repository at this point in the history
Summary:
This is a request from github: #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
SergioGuerreroFB authored and facebook-github-bot committed Feb 8, 2023
1 parent b434f6f commit def5dbe
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions Facebook.Unity.Canvas/Plugins/CanvasJSSDKBindings.jslib
Original file line number Diff line number Diff line change
@@ -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);
mergeInto(LibraryManager.library, FBUnityLib);

0 comments on commit def5dbe

Please sign in to comment.