Skip to content

Commit

Permalink
Facebook SDK For Unity 7.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhuowen committed Jun 16, 2017
1 parent be79942 commit 7dacd75
Show file tree
Hide file tree
Showing 128 changed files with 25,428 additions and 2,131 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ TestResult.xml
# Ignore Plugin Folders which are build by build
/UnitySDK/Assets/Plugins/

# Ignore Unity Jar Resolver which is pulled in by build script
/UnitySDK/Assets/PlayServicesResolver.meta
/UnitySDK/Assets/PlayServicesResolver/

# Ignore Current Facebook Settings
FacebookSettings.asset*

Expand All @@ -79,3 +83,14 @@ StyleCop.Cache.meta

# Nuget packages
/packages/

# AN SDK builds
ads/Assets/AudienceNetwork/Plugins/Android/libs/ads-release.aar
ads/Assets/AudienceNetwork/Plugins/iOS/libs/FBAudienceNetwork.framework/FBAudienceNetwork
ads/Assets/AudienceNetwork/Plugins/iOS/libs/FBAudienceNetwork.framework/Headers/*.h
ads/Assets/AudienceNetwork/Plugins/iOS/libs/FBAudienceNetwork.framework/Info.plist
ads/Assets/AudienceNetwork/Plugins/iOS/libs/FBAudienceNetwork.framework/Modules/module.modulemap
ads/Assets/AudienceNetwork/Editor/iOS.meta
ads/Assets/AudienceNetwork/Plugins/Android/libs/ads-release.aar.meta
ads/Assets/AudienceNetwork/Plugins/iOS/libs/FBAudienceNetwork.framework/*.h.meta
ads/Assets/AudienceNetwork/Plugins/iOS/libs/FBAudienceNetwork.framework/Headers/*.h.meta
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<RootNamespace>Facebook.Unity.Android.StrippingHack</RootNamespace>
<AssemblyName>Facebook.Unity.Android</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<ReleaseVersion></ReleaseVersion>
<ReleaseVersion>
</ReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;

[assembly: AssemblyVersion("7.9.0")]
[assembly: AssemblyVersion("7.10.0")]
2 changes: 1 addition & 1 deletion Facebook.Unity.Android/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;

[assembly: AssemblyVersion("7.9.0")]
[assembly: AssemblyVersion("7.10.0")]
Binary file not shown.
4 changes: 4 additions & 0 deletions Facebook.Unity.Editor/Facebook.Unity.Editor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Google.VersionHandler">
<HintPath>..\UnitySDK\Assets\PlayServicesResolver\Editor\Google.VersionHandler.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="FacebookBuild.cs" />
Expand All @@ -54,6 +57,7 @@
<Compile Include="iOS\PListDict.cs" />
<Compile Include="iOS\PListParser.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="android\AndroidSupportLibraryResolver.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand Down
8 changes: 7 additions & 1 deletion Facebook.Unity.Editor/FacebookBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ internal class FacebookBuild
private const string SDKPath = "Assets/FacebookSDK/SDK/";
private const string ExamplesPath = "Assets/FacebookSDK/Examples/";
private const string PluginsPath = "Assets/FacebookSDK/Plugins/";
private const string PlayServicesResolverPath = "Assets/PlayServicesResolver/";

public enum Target
{
Expand Down Expand Up @@ -82,11 +83,16 @@ public static string ExportPackage()
string[] sdkFiles = (string[])Directory.GetFiles(SDKPath, "*.*", SearchOption.AllDirectories);
string[] exampleFiles = (string[])Directory.GetFiles(ExamplesPath, "*.*", SearchOption.AllDirectories);
string[] pluginsFiles = (string[])Directory.GetFiles(PluginsPath, "*.*", SearchOption.AllDirectories);
string[] files = new string[facebookFiles.Length + sdkFiles.Length + exampleFiles.Length + pluginsFiles.Length];

string[] playServicesResolverFiles = (string[])Directory.GetFiles(PlayServicesResolverPath, "*.*",
SearchOption.AllDirectories);
string[] files = new string[facebookFiles.Length + sdkFiles.Length + exampleFiles.Length +
pluginsFiles.Length + playServicesResolverFiles.Length];
facebookFiles.CopyTo(files, 0);
sdkFiles.CopyTo(files, facebookFiles.Length);
exampleFiles.CopyTo(files, sdkFiles.Length + facebookFiles.Length);
pluginsFiles.CopyTo(files, sdkFiles.Length + facebookFiles.Length + exampleFiles.Length);
playServicesResolverFiles.CopyTo(files, sdkFiles.Length + facebookFiles.Length + exampleFiles.Length + pluginsFiles.Length);

AssetDatabase.ExportPackage(
files,
Expand Down
7 changes: 4 additions & 3 deletions Facebook.Unity.Editor/FacebookPostprocess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ public static void OnPostProcessBuild(BuildTarget target, string path)
if (target == BuildTarget.Android)
{
// The default Bundle Identifier for Unity does magical things that causes bad stuff to happen
if (PlayerSettings.bundleIdentifier == "com.Company.ProductName")
{
Debug.LogError("The default Unity Bundle Identifier (com.Company.ProductName) will not work correctly.");
var defaultIdentifier = "com.Company.ProductName";

if (Utility.GetApplicationIdentifier() == defaultIdentifier) {
Debug.LogError ("The default Unity Bundle Identifier (com.Company.ProductName) will not work correctly.");
}

if (!FacebookAndroidUtil.SetupProperly)
Expand Down
24 changes: 1 addition & 23 deletions Facebook.Unity.Editor/FacebookSettingsEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class FacebookSettingsEditor : Editor
private bool showAndroidUtils = false;
private bool showIOSSettings = false;
private bool showAppLinksSettings = false;
private bool showFacebookUploadBuildSettings = false;
private bool showAboutSection = false;

private GUIContent appNameLabel = new GUIContent(
Expand All @@ -62,10 +61,6 @@ public class FacebookSettingsEditor : Editor
private GUIContent classNameLabel = new GUIContent("Class Name [?]", "aka: the activity name");
private GUIContent debugAndroidKeyLabel = new GUIContent("Debug Android Key Hash [?]", "Copy this key to the Facebook Settings in order to test a Facebook Android app");

private GUIContent uploadAccessTokenLabel = new GUIContent(
"Upload Access Token [?]",
"Use this to upload build for Facebook platform");

private GUIContent sdkVersion = new GUIContent("SDK Version [?]", "This Unity Facebook SDK version. If you have problems or compliments please include this so we know exactly what version to look out for.");

public FacebookSettingsEditor()
Expand Down Expand Up @@ -304,7 +299,7 @@ private void AndroidUtilGUI()

EditorGUILayout.LabelField(
"Copy and Paste these into your \"Native Android App\" Settings on developers.facebook.com/apps");
this.SelectableLabelField(this.packageNameLabel, PlayerSettings.bundleIdentifier);
this.SelectableLabelField(this.packageNameLabel, Utility.GetApplicationIdentifier());
this.SelectableLabelField(this.classNameLabel, ManifestMod.DeepLinkingActivityName);
this.SelectableLabelField(this.debugAndroidKeyLabel, FacebookAndroidUtil.DebugKeyHash);
if (GUILayout.Button("Regenerate Android Manifest"))
Expand Down Expand Up @@ -361,23 +356,6 @@ private void AppLinksUtilGUI()
}
}

private void UploadBuildSettingsGUI()
{
this.showFacebookUploadBuildSettings = EditorGUILayout.Foldout(
this.showFacebookUploadBuildSettings,
"Upload Facebook Build Settings");

if (this.showFacebookUploadBuildSettings)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(this.uploadAccessTokenLabel, GUILayout.Width(135), GUILayout.Height(16));
FacebookSettings.UploadAccessToken = EditorGUILayout.TextField(FacebookSettings.UploadAccessToken);
EditorGUILayout.EndHorizontal();
}

EditorGUILayout.Space();
}

private void AboutGUI()
{
this.showAboutSection = EditorGUILayout.Foldout(this.showAboutSection, "About the Facebook SDK");
Expand Down
2 changes: 1 addition & 1 deletion Facebook.Unity.Editor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;

[assembly: AssemblyVersion("7.9.0")]
[assembly: AssemblyVersion("7.10.0")]
20 changes: 20 additions & 0 deletions Facebook.Unity.Editor/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ namespace Facebook.Unity.Editor
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor;

public static class Utility
{
private static string BundleIdentifier = "bundleIdentifier";
private static string ApplicationIdentifier = "applicationIdentifier";

public static T Pop<T>(this IList<T> list)
{
if (!list.Any())
Expand Down Expand Up @@ -54,5 +59,20 @@ public static bool TryGetValue<T>(
value = default(T);
return false;
}

public static string GetApplicationIdentifier()
{
Type playerSettingType = typeof(PlayerSettings);
PropertyInfo info = playerSettingType.GetProperty(ApplicationIdentifier)
?? playerSettingType.GetProperty(BundleIdentifier);
if (info != null) {
string applicationIdentifier = (string)info.GetValue(playerSettingType, null);
if (applicationIdentifier is string) {
return applicationIdentifier;
}
}

return null;
}
}
}
126 changes: 126 additions & 0 deletions Facebook.Unity.Editor/android/AndroidSupportLibraryResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
* copy, modify, and distribute this software in source code or binary form for use
* in connection with the web services and APIs provided by Facebook.
*
* As with any software that integrates with the Facebook platform, your use of
* this software is subject to the Facebook Developer Principles and Policies
* [http://developers.facebook.com/policy/]. This copyright notice shall be
* included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
* copy, modify, and distribute this software in source code or binary form for use
* in connection with the web services and APIs provided by Facebook.
*
* As with any software that integrates with the Facebook platform, your use of
* this software is subject to the Facebook Developer Principles and Policies
* [http://developers.facebook.com/policy/]. This copyright notice shall be
* included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

namespace Facebook.Unity.Editor
{
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

[InitializeOnLoad]
public class AndroidSupportLibraryResolver
{
static AndroidSupportLibraryResolver()
{
AndroidSupportLibraryResolver.setupDependencies();
}

private static void setupDependencies()
{
// Setup the resolver using reflection as the module may not be
// available at compile time.
Type playServicesSupport = Google.VersionHandler.FindClass(
"Google.JarResolver",
"Google.JarResolver.PlayServicesSupport");

if (playServicesSupport == null) {
return;
}

object svcSupport = Google.VersionHandler.InvokeStaticMethod(
playServicesSupport,
"CreateInstance",
new object[] {
"FacebookUnitySDK",
EditorPrefs.GetString("AndroidSdkRoot"),
"ProjectSettings"
});

// com.android.support:support-v4
Google.VersionHandler.InvokeInstanceMethod(
svcSupport,
"DependOn",
new object[] {
"com.android.support",
"support-v4",
"25.3.1"
},
namedArgs: new Dictionary<string, object>() {
{
"packageIds",
new string[] {
"extra-android-m2repository"
}
}
});

AndroidSupportLibraryResolver.addSupportLibraryDepenency(svcSupport, "support-v4", "25.3.1");
AndroidSupportLibraryResolver.addSupportLibraryDepenency(svcSupport, "appcompat-v7", "25.3.1");
AndroidSupportLibraryResolver.addSupportLibraryDepenency(svcSupport, "cardview-v7", "25.3.1");
AndroidSupportLibraryResolver.addSupportLibraryDepenency(svcSupport, "customtabs", "25.3.1");

}

public static void addSupportLibraryDepenency(
object svcSupport,
String packageName,
String version)
{
Debug.LogWarning("App - " + packageName + ":" + version);
Google.VersionHandler.InvokeInstanceMethod(
svcSupport,
"DependOn",
new object[] {
"com.android.support",
packageName,
version
},
namedArgs: new Dictionary<string, object>() {
{
"packageIds",
new string[] {
"extra-android-m2repository"
}
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D8F7CF97-7FE9-48B7-A30C-CB14BAA73010}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Facebook.Unity.Arcade</RootNamespace>
<AssemblyName>Facebook.Unity.Arcade</AssemblyName>
<RootNamespace>Facebook.Unity.Gameroom</RootNamespace>
<AssemblyName>Facebook.Unity.Gameroom</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<ReleaseVersion>
</ReleaseVersion>
Expand Down Expand Up @@ -40,8 +40,8 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ArcadeWrapper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="GameroomWrapper.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand Down
Loading

0 comments on commit 7dacd75

Please sign in to comment.