Skip to content

Commit

Permalink
Updated FB plugin to 7.2 beta.
Browse files Browse the repository at this point in the history
updated to latest playfab sdks

fixed a few dozen deprecated warnings and errors.
  • Loading branch information
zac-playfab committed Sep 14, 2016
1 parent bb4b3b9 commit 3bcd991
Show file tree
Hide file tree
Showing 941 changed files with 19,802 additions and 20,226 deletions.
2 changes: 1 addition & 1 deletion UnicornBattle/Assets/Facebook.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion UnicornBattle/Assets/Facebook/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 85 additions & 0 deletions UnicornBattle/Assets/Facebook/Editor/FacebookBuild.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/**
* 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 System.IO;
using UnityEditor;
using UnityEngine;

public class FacebookBuild
{
private const string FacebookPath = "Assets/Facebook/";
private const string ExamplesPath = "Assets/Examples/";
private const string PluginsPath = "Assets/Plugins/";

public enum Target
{
DEBUG,
RELEASE
}

// Exporting the *.unityPackage for Asset store
public static void ExportPackage()
{
Debug.Log("Exporting Facebook Unity Package...");

var path = "FacebookSDK.unitypackage";

try
{
if (!File.Exists(Path.Combine(Application.dataPath, "Temp")))
{
AssetDatabase.CreateFolder("Assets", "Temp");
}

AssetDatabase.MoveAsset(FacebookPath + "Resources/FacebookSettings.asset", "Assets/Temp/FacebookSettings.asset");
AssetDatabase.DeleteAsset(PluginsPath + "Android/AndroidManifest.xml");
AssetDatabase.DeleteAsset(PluginsPath + "Android/AndroidManifest.xml.meta");

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

AssetDatabase.ExportPackage(
files,
path,
ExportPackageOptions.IncludeDependencies | ExportPackageOptions.Recurse);
}
finally
{
// Move files back no matter what
AssetDatabase.MoveAsset("Assets/Temp/FacebookSettings.asset", FacebookPath + "Resources/FacebookSettings.asset");
AssetDatabase.DeleteAsset("Assets/Temp");

// regenerate the manifest
UnityEditor.FacebookEditor.ManifestMod.GenerateManifest();
}

Debug.Log("Finished exporting!");
}
}
}
12 changes: 12 additions & 0 deletions UnicornBattle/Assets/Facebook/Editor/FacebookBuild.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 44 additions & 31 deletions UnicornBattle/Assets/Facebook/Editor/FacebookPostprocess.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,47 @@
using System;
using System.IO;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.FacebookEditor;
using UnityEditor.XCodeEditor;
/**
* 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 UnityEditor.FacebookEditor
{
using System;
using System.IO;
using Facebook.Unity;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.FacebookEditor;
using UnityEngine;

public static class XCodePostProcess
{
[PostProcessBuild(100)]
public static void OnPostProcessBuild(BuildTarget target, string path)
{
// If integrating with facebook on any platform, throw a warning if the app id is invalid
if (!FBSettings.IsValidAppId)
if (!Facebook.Unity.FacebookSettings.IsValidAppId)
{
Debug.LogWarning("You didn't specify a Facebook app ID. Please add one using the Facebook menu in the main Unity editor.");
}
// Unity renamed build target from iPhone to iOS in Unity 5, this keeps both versions happy
if (target.ToString() == "iOS" || target.ToString() == "iPhone")
{
UnityEditor.XCodeEditor.XCProject project = new UnityEditor.XCodeEditor.XCProject(path);

// Find and run through all projmods files to patch the project

string projModPath = System.IO.Path.Combine(Application.dataPath, "Facebook/Editor/iOS");
var files = System.IO.Directory.GetFiles(projModPath, "*.projmods", System.IO.SearchOption.AllDirectories);
foreach (var file in files)
{
project.ApplyMod(Application.dataPath, file);
}
project.Save();

// Unity renamed build target from iPhone to iOS in Unity 5, this keeps both versions happy
if (target.ToString() == "iOS" || target.ToString() == "iPhone")
{
UpdatePlist(path);
FixupFiles.FixSimulator(path);
FixupFiles.AddVersionDefine(path);
Expand All @@ -46,7 +55,8 @@ public static void OnPostProcessBuild(BuildTarget target, string path)
{
Debug.LogError("The default Unity Bundle Identifier (com.Company.ProductName) will not work correctly.");
}
if (!FacebookAndroidUtil.IsSetupProperly())

if (!FacebookAndroidUtil.SetupProperly)
{
Debug.LogError("Your Android setup is not correct. See Settings in Facebook menu.");
}
Expand All @@ -61,19 +71,22 @@ public static void OnPostProcessBuild(BuildTarget target, string path)

public static void UpdatePlist(string path)
{
const string fileName = "Info.plist";
string appId = FBSettings.AppId;
string fullPath = Path.Combine(path, fileName);
const string FileName = "Info.plist";
string appId = FacebookSettings.AppId;
string fullPath = Path.Combine(path, FileName);

if (string.IsNullOrEmpty(appId) || appId.Equals("0"))
{
Debug.LogError("You didn't specify a Facebook app ID. Please add one using the Facebook menu in the main Unity editor.");
return;
}

var fbParser = new FBPListParser(fullPath);
fbParser.UpdateFBSettings(appId, FBSettings.AllAppIds);
fbParser.WriteToFile();

var facebookParser = new PListParser(fullPath);
facebookParser.UpdateFBSettings(
appId,
FacebookSettings.IosURLSuffix,
FacebookSettings.AppLinkSchemes[FacebookSettings.SelectedAppIndex].Schemes);
facebookParser.WriteToFile();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3bcd991

Please sign in to comment.