Skip to content

Commit ea16dff

Browse files
committed
Facebook SDK For Unity 7.11.1
1 parent 07767e2 commit ea16dff

File tree

23 files changed

+244
-114
lines changed

23 files changed

+244
-114
lines changed

Facebook.Unity.Android.StrippingHack/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
using System.Reflection;
2222
using System.Runtime.CompilerServices;
2323

24-
[assembly: AssemblyVersion("7.11.0")]
24+
[assembly: AssemblyVersion("7.11.1")]

Facebook.Unity.Android/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
using System.Reflection;
2222
using System.Runtime.CompilerServices;
2323

24-
[assembly: AssemblyVersion("7.11.0")]
24+
[assembly: AssemblyVersion("7.11.1")]
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/**
2+
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3+
*
4+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5+
* copy, modify, and distribute this software in source code or binary form for use
6+
* in connection with the web services and APIs provided by Facebook.
7+
*
8+
* As with any software that integrates with the Facebook platform, your use of
9+
* this software is subject to the Facebook Developer Principles and Policies
10+
* [http://developers.facebook.com/policy/]. This copyright notice shall be
11+
* included in all copies or substantial portions of the software.
12+
*
13+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19+
*/
20+
21+
namespace Facebook.Unity.Canvas
22+
{
23+
using System.Collections.Generic;
24+
using System.Runtime.InteropServices;
25+
using UnityEngine;
26+
27+
internal class CanvasJSWrapper : ICanvasJSWrapper
28+
{
29+
public string GetSDKVersion()
30+
{
31+
return Constants.GraphApiVersion;
32+
}
33+
34+
public void DisableFullScreen()
35+
{
36+
if (Screen.fullScreen)
37+
{
38+
Screen.fullScreen = false;
39+
}
40+
}
41+
42+
public void Init(string connectFacebookUrl, string locale, int debug, string initParams, int status)
43+
{
44+
init(connectFacebookUrl, locale, debug, initParams, status);
45+
}
46+
47+
public void Login(IEnumerable<string> scope, string callback_id)
48+
{
49+
login(scope, callback_id);
50+
}
51+
52+
public void Logout() {
53+
logout();
54+
}
55+
56+
public void ActivateApp() {
57+
activateApp();
58+
}
59+
60+
public void LogAppEvent(string eventName, float? valueToSum, string parameters) {
61+
logAppEvent(eventName, valueToSum, parameters);
62+
}
63+
64+
public void LogPurchase(float purchaseAmount, string currency, string parameters) {
65+
logPurchase(purchaseAmount, currency, parameters);
66+
}
67+
68+
public void Ui(string x, string uid, string callbackMethodName) {
69+
ui(x, uid, callbackMethodName);
70+
}
71+
72+
public void InitScreenPosition() {
73+
initScreenPosition();
74+
}
75+
76+
[DllImport("__Internal")]
77+
private static extern void init(string connectFacebookUrl, string locale, int debug, string initParams, int status);
78+
79+
[DllImport("__Internal")]
80+
private static extern void login(IEnumerable<string> scope, string callback_id);
81+
82+
[DllImport("__Internal")]
83+
private static extern void logout();
84+
85+
[DllImport("__Internal")]
86+
private static extern void activateApp();
87+
88+
[DllImport("__Internal")]
89+
private static extern void logAppEvent(string eventName, float? valueToSum, string parameters);
90+
91+
[DllImport("__Internal")]
92+
private static extern void logPurchase(float purchaseAmount, string currency, string parameters);
93+
94+
[DllImport("__Internal")]
95+
private static extern void ui(string x, string uid, string callbackMethodName);
96+
97+
[DllImport("__Internal")]
98+
private static extern void initScreenPosition();
99+
}
100+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{F0ED0CDD-F963-4266-8C08-670C05BA611E}</ProjectGuid>
7+
<OutputType>Library</OutputType>
8+
<RootNamespace>Facebook.Unity.Canvas</RootNamespace>
9+
<AssemblyName>Facebook.Unity.Canvas</AssemblyName>
10+
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
11+
<ReleaseVersion>
12+
</ReleaseVersion>
13+
</PropertyGroup>
14+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
15+
<DebugSymbols>true</DebugSymbols>
16+
<DebugType>full</DebugType>
17+
<Optimize>false</Optimize>
18+
<OutputPath>bin\Debug</OutputPath>
19+
<DefineConstants>DEBUG;</DefineConstants>
20+
<ErrorReport>prompt</ErrorReport>
21+
<WarningLevel>4</WarningLevel>
22+
<ConsolePause>false</ConsolePause>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25+
<DebugType>full</DebugType>
26+
<Optimize>true</Optimize>
27+
<OutputPath>bin\Release</OutputPath>
28+
<ErrorReport>prompt</ErrorReport>
29+
<WarningLevel>4</WarningLevel>
30+
<ConsolePause>false</ConsolePause>
31+
</PropertyGroup>
32+
<ItemGroup>
33+
<Reference Include="System" />
34+
<Reference Include="UnityEngine">
35+
<HintPath>..\..\..\..\..\Applications\Unity\Unity.app\Contents\Managed\UnityEngine.dll</HintPath>
36+
</Reference>
37+
</ItemGroup>
38+
<ItemGroup>
39+
<Compile Include="Properties\AssemblyInfo.cs" />
40+
<Compile Include="CanvasJSWrapper.cs" />
41+
</ItemGroup>
42+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
43+
<ItemGroup>
44+
<ProjectReference Include="..\Facebook.Unity\Facebook.Unity.csproj">
45+
<Project>{3DFF6C0C-BB04-405D-A23F-95999630E7F8}</Project>
46+
<Name>Facebook.Unity</Name>
47+
</ProjectReference>
48+
</ItemGroup>
49+
<ItemGroup>
50+
<Folder Include="Plugins\" />
51+
</ItemGroup>
52+
</Project>

Facebook.Unity/Canvas/CanvasJSWrapper.cs renamed to Facebook.Unity.Canvas/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,7 @@
1818
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1919
*/
2020

21-
namespace Facebook.Unity.Canvas
22-
{
23-
using UnityEngine;
21+
using System.Reflection;
22+
using System.Runtime.CompilerServices;
2423

25-
internal class CanvasJSWrapper : ICanvasJSWrapper
26-
{
27-
public string GetSDKVersion()
28-
{
29-
return Constants.GraphApiVersion;
30-
}
31-
32-
public void DisableFullScreen()
33-
{
34-
if (Screen.fullScreen)
35-
{
36-
Screen.fullScreen = false;
37-
}
38-
}
39-
}
40-
}
24+
[assembly: AssemblyVersion("7.11.1")]

Facebook.Unity.Editor/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
using System.Reflection;
2222
using System.Runtime.CompilerServices;
2323

24-
[assembly: AssemblyVersion("7.11.0")]
24+
[assembly: AssemblyVersion("7.11.1")]

Facebook.Unity.Gameroom/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
using System.Reflection;
2222
using System.Runtime.CompilerServices;
2323

24-
[assembly: AssemblyVersion("7.11.0")]
24+
[assembly: AssemblyVersion("7.11.1")]

Facebook.Unity.IOS.StrippingHack/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
using System.Reflection;
2222
using System.Runtime.CompilerServices;
2323

24-
[assembly: AssemblyVersion("7.11.0")]
24+
[assembly: AssemblyVersion("7.11.1")]

Facebook.Unity.IOS/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
using System.Reflection;
2222
using System.Runtime.CompilerServices;
2323

24-
[assembly: AssemblyVersion("7.11.0")]
24+
[assembly: AssemblyVersion("7.11.1")]

Facebook.Unity.Settings/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
using System.Reflection;
2222
using System.Runtime.CompilerServices;
2323

24-
[assembly: AssemblyVersion("7.11.0")]
24+
[assembly: AssemblyVersion("7.11.1")]

Facebook.Unity.Tests/Canvas/MockCanvas.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,37 @@ public void DisableFullScreen()
4343
{
4444
// noop
4545
}
46+
47+
public void Init(string connectFacebookUrl, string locale, int debug, string initParams, int status) {
48+
// noop
49+
}
50+
51+
public void Login(IEnumerable<string> scope, string callback_id) {
52+
// noop
53+
}
54+
55+
public void Logout() {
56+
// noop
57+
}
58+
59+
public void ActivateApp() {
60+
// noop
61+
}
62+
63+
public void LogAppEvent(string eventName, float? valueToSum, string parameters) {
64+
// noop
65+
}
66+
67+
public void LogPurchase(float purchaseAmount, string currency, string parameters) {
68+
// noop
69+
}
70+
71+
public void Ui(string x, string uid, string callbackMethodName) {
72+
// noop
73+
}
74+
75+
public void InitScreenPosition() {
76+
// noop
77+
}
4678
}
4779
}

Facebook.Unity.Tests/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
using System.Reflection;
2222
using System.Runtime.CompilerServices;
2323

24-
[assembly: AssemblyVersion("7.11.0")]
24+
[assembly: AssemblyVersion("7.11.1")]

Facebook.Unity/Canvas/CanvasFacebook.cs

Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -42,32 +42,7 @@ internal sealed class CanvasFacebook : FacebookBase, ICanvasFacebookImplementati
4242
private ICanvasJSWrapper canvasJSWrapper;
4343
private HideUnityDelegate onHideUnityDelegate;
4444

45-
[DllImport("__Internal")]
46-
private static extern void init(string connectFacebookUrl, string locale, int debug, string initParams, int status);
47-
48-
[DllImport("__Internal")]
49-
private static extern void login(IEnumerable<string> scope, string callback_id);
50-
51-
[DllImport("__Internal")]
52-
private static extern void logout();
53-
54-
[DllImport("__Internal")]
55-
private static extern void activateApp();
56-
57-
[DllImport("__Internal")]
58-
private static extern void logAppEvent(string eventName, float? valueToSum, string parameters);
59-
60-
[DllImport("__Internal")]
61-
private static extern void logPurchase(float purchaseAmount, string currency, string parameters);
62-
63-
[DllImport("__Internal")]
64-
private static extern void ui(string x, string uid, string callbackMethodName);
65-
66-
[DllImport("__Internal")]
67-
private static extern void initScreenPosition();
68-
69-
public CanvasFacebook()
70-
: this(new CanvasJSWrapper(), new CallbackManager())
45+
public CanvasFacebook(): this(GetCanvasJSWrapper(), new CallbackManager())
7146
{
7247
}
7348

@@ -77,6 +52,14 @@ public CanvasFacebook(ICanvasJSWrapper canvasJSWrapper, CallbackManager callback
7752
this.canvasJSWrapper = canvasJSWrapper;
7853
}
7954

55+
private static ICanvasJSWrapper GetCanvasJSWrapper()
56+
{
57+
Assembly assembly = Assembly.Load("Facebook.Unity.Canvas");
58+
Type type = assembly.GetType("Facebook.Unity.Canvas.CanvasJSWrapper");
59+
ICanvasJSWrapper canvasJSWrapper = (ICanvasJSWrapper)Activator.CreateInstance(type);
60+
return canvasJSWrapper;
61+
}
62+
8063
public override bool LimitEventUsage { get; set; }
8164

8265
public override string SDKName
@@ -140,7 +123,7 @@ public void Init(
140123
{
141124
base.Init(onInitComplete);
142125

143-
initScreenPosition();
126+
this.canvasJSWrapper.InitScreenPosition();
144127
this.appId = appId;
145128
this.onHideUnityDelegate = hideUnityDelegate;
146129

@@ -156,7 +139,7 @@ public void Init(
156139
parameters.AddString("version", FB.GraphApiVersion);
157140

158141
// use 1/0 for booleans, otherwise you'll get strings "True"/"False"
159-
init(
142+
this.canvasJSWrapper.Init(
160143
FacebookConnectURL,
161144
javascriptSDKLocale,
162145
loadDebugJSSDK ? 1 : 0,
@@ -169,21 +152,21 @@ public override void LogInWithPublishPermissions(
169152
FacebookDelegate<ILoginResult> callback)
170153
{
171154
this.canvasJSWrapper.DisableFullScreen();
172-
login(permissions, CallbackManager.AddFacebookDelegate(callback));
155+
this.canvasJSWrapper.Login(permissions, CallbackManager.AddFacebookDelegate(callback));
173156
}
174157

175158
public override void LogInWithReadPermissions(
176159
IEnumerable<string> permissions,
177160
FacebookDelegate<ILoginResult> callback)
178161
{
179162
this.canvasJSWrapper.DisableFullScreen();
180-
login(permissions, CallbackManager.AddFacebookDelegate(callback));
163+
this.canvasJSWrapper.Login(permissions, CallbackManager.AddFacebookDelegate(callback));
181164
}
182165

183166
public override void LogOut()
184167
{
185168
base.LogOut();
186-
logout();
169+
this.canvasJSWrapper.Logout();
187170
}
188171

189172
public override void AppRequest(
@@ -227,7 +210,7 @@ public override void AppRequest(
227210

228211
public override void ActivateApp(string appId)
229212
{
230-
activateApp();
213+
this.canvasJSWrapper.ActivateApp();
231214
}
232215

233216
public override void ShareLink(
@@ -358,7 +341,7 @@ public override void AppEventsLogEvent(
358341
float? valueToSum,
359342
Dictionary<string, object> parameters)
360343
{
361-
logAppEvent(
344+
this.canvasJSWrapper.LogAppEvent(
362345
logEvent,
363346
valueToSum,
364347
MiniJSON.Json.Serialize(parameters));
@@ -369,7 +352,7 @@ public override void AppEventsLogPurchase(
369352
string currency,
370353
Dictionary<string, object> parameters)
371354
{
372-
logPurchase(
355+
this.canvasJSWrapper.LogPurchase(
373356
purchaseAmount,
374357
currency,
375358
MiniJSON.Json.Serialize(parameters));
@@ -594,7 +577,7 @@ private void UI(
594577
clonedArgs.AddString("app_id", this.canvasImpl.appId);
595578
clonedArgs.AddString("method", method);
596579
var uniqueId = this.canvasImpl.CallbackManager.AddFacebookDelegate(callback);
597-
ui(clonedArgs.ToJsonString (), uniqueId, this.callbackMethod);
580+
this.canvasImpl.canvasJSWrapper.Ui(clonedArgs.ToJsonString (), uniqueId, this.callbackMethod);
598581
}
599582
}
600583
}

0 commit comments

Comments
 (0)