Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
xk0fe authored Jan 27, 2021
2 parents bc7a99a + 2ea2ec5 commit 08a7dfa
Show file tree
Hide file tree
Showing 80 changed files with 3,308 additions and 119 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ build
# vim temp files
*.swp

# Arc generated
.phutil_module_cache

# Unity3D generated meta files
*.pidb.meta

Expand Down
40 changes: 39 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [9.0.0] - 2021-01-10

### Added

- Limited Login. See the [docs](https://developers.facebook.com/docs/facebook-login/ios/limited-login/) for a general overview and implementation details.

## [8.1.1] - 2020-10-25

### Fixed

- Add use_frameworks! to Podfile
- Avoid adding swift standard libs

## [8.1.0] - 2020-10-14

### Fixed

- Fixed AndroidSdk path detection in Unity 2019 and above

## [8.0.0] - 2020-09-27

### Added

- Added method `SetAdvertiserTrackingEnabled` to overwrite the `advertiser_tracking_enabled` flag

### Changed

- Bumped native SDK version to 8.0.0
- Bumped Graph API version to 8.0

### Fixed

- Fixed lock up issue in Facebook Login

## [7.21.2] - 2020-08-14

### Added
Expand Down Expand Up @@ -104,7 +138,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- Links -->

[Unreleased]: https://github.com/facebook/facebook-sdk-for-unity/compare/sdk-version-7.21.2...HEAD
[Unreleased]: https://github.com/facebook/facebook-sdk-for-unity/compare/sdk-version-9.0.0...HEAD
[9.0.0]: https://github.com/facebook/facebook-sdk-for-unity/compare/sdk-version-8.1.1...sdk-version-9.0.0
[8.1.1]: https://github.com/facebook/facebook-sdk-for-unity/compare/sdk-version-8.1.0...sdk-version-8.1.1
[8.1.0]: https://github.com/facebook/facebook-sdk-for-unity/compare/sdk-version-8.0.0...sdk-version-8.1.0
[8.0.0]: https://github.com/facebook/facebook-sdk-for-unity/compare/sdk-version-7.21.2...sdk-version-8.0.0
[7.21.2]: https://github.com/facebook/facebook-sdk-for-unity/compare/sdk-version-7.21.1...sdk-version-7.21.2
[7.21.1]: https://github.com/facebook/facebook-sdk-for-unity/compare/sdk-version-7.21.0...sdk-version-7.21.1
[7.21.0]: https://github.com/facebook/facebook-sdk-for-unity/compare/sdk-version-7.20.0...sdk-version-7.21.0
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.21.2")]
[assembly: AssemblyVersion("9.0.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.21.2")]
[assembly: AssemblyVersion("9.0.0")]
2 changes: 1 addition & 1 deletion Facebook.Unity.Canvas/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.21.2")]
[assembly: AssemblyVersion("9.0.0")]
20 changes: 20 additions & 0 deletions Facebook.Unity.Editor/FacebookPostprocess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ namespace Facebook.Unity.Editor

public static class XCodePostProcess
{
[PostProcessBuildAttribute(45)]
private static void PostProcessBuild_iOS(BuildTarget target, string buildPath)
{
if (target == BuildTarget.iOS)
{
string podFilePath = Path.Combine(buildPath, "Podfile");
string contents = File.ReadAllText(podFilePath);
bool isUnityIphoneInPodFile = contents.Contains("Unity-iPhone");
using (StreamWriter sw = File.AppendText(podFilePath))
{
if (!isUnityIphoneInPodFile)
{
sw.WriteLine("target 'Unity-iPhone' do");
sw.WriteLine("end");
}
sw.WriteLine("use_frameworks!");
}
}
}

[PostProcessBuild(100)]
public static void OnPostProcessBuild(BuildTarget target, string path)
{
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.21.2")]
[assembly: AssemblyVersion("9.0.0")]
25 changes: 24 additions & 1 deletion Facebook.Unity.Editor/android/FacebookAndroidUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
namespace Facebook.Unity.Editor
{
using System.Diagnostics;
using System.IO;
using System.Text;
using Facebook.Unity.Settings;
using UnityEditor;
Expand Down Expand Up @@ -106,14 +107,36 @@ private static string DebugKeyStorePath

public static bool HasAndroidSDK()
{
return EditorPrefs.HasKey("AndroidSdkRoot") && System.IO.Directory.Exists(EditorPrefs.GetString("AndroidSdkRoot"));
string sdkPath = GetAndroidSdkPath();
return !string.IsNullOrEmpty(sdkPath) && System.IO.Directory.Exists(sdkPath);
}

public static bool HasAndroidKeystoreFile()
{
return System.IO.File.Exists(DebugKeyStorePath);
}

public static string GetAndroidSdkPath()
{
string sdkPath = EditorPrefs.GetString("AndroidSdkRoot");
#if UNITY_2019_1_OR_NEWER
if (string.IsNullOrEmpty(sdkPath) || EditorPrefs.GetBool("SdkUseEmbedded"))
{
string androidPlayerDir = BuildPipeline.GetPlaybackEngineDirectory(BuildTarget.Android, BuildOptions.None);
if (!string.IsNullOrEmpty(androidPlayerDir))
{
string androidPlayerSdkDir = Path.Combine(androidPlayerDir, "SDK");
if (System.IO.Directory.Exists(androidPlayerSdkDir))
{
sdkPath = androidPlayerSdkDir;
}
}
}
#endif

return sdkPath;
}

private static string GetKeyHash(string alias, string keyStore, string password)
{
var proc = new Process();
Expand Down
3 changes: 3 additions & 0 deletions Facebook.Unity.Editor/iOS/FixupFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public static void AddBuildFlag(string path)
proj.AddBuildProperty(targetGUID, "GCC_PREPROCESSOR_DEFINITIONS", " $(inherited) FBSDKCOCOAPODS=1");
proj.AddBuildProperty(targetGUID, "OTHER_LDFLAGS", "-ObjC");
proj.AddBuildProperty(targetGUID, "SWIFT_VERSION", "5.0");
proj.AddBuildProperty(targetGUID, "LD_RUNPATH_SEARCH_PATHS", "@executable_path/Frameworks");
proj.AddBuildProperty(targetGUID, "LIBRARY_SEARCH_PATHS", "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)");
proj.AddBuildProperty(targetGUID, "LIBRARY_SEARCH_PATHS", "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)");
proj.AddFrameworkToProject(targetGUID, "Accelerate.framework", true);
File.WriteAllText(projPath, proj.WriteToString());
}
Expand Down
2 changes: 1 addition & 1 deletion Facebook.Unity.Gameroom/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.21.2")]
[assembly: AssemblyVersion("9.0.0")]
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.21.2")]
[assembly: AssemblyVersion("9.0.0")]
87 changes: 87 additions & 0 deletions Facebook.Unity.IOS/IOSWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

namespace Facebook.Unity.IOS
{
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Facebook.Unity.Mobile.IOS;
Expand All @@ -39,6 +40,15 @@ public void Init(
unityUserAgentSuffix);
}

public void LoginWithTrackingPreference(
int requestId,
string scope,
string tracking,
string nonce)
{
IOSWrapper.IOSFBLoginWithTrackingPreference(requestId, scope, tracking, nonce);
}

public void LogInWithReadPermissions(
int requestId,
string scope)
Expand Down Expand Up @@ -195,6 +205,11 @@ public void FBAdvertiserIDCollectionEnabled(bool advertiserIDCollectionEnabled)
IOSWrapper.IOSFBAdvertiserIDCollectionEnabled(advertiserIDCollectionEnabled);
}

public bool FBAdvertiserTrackingEnabled(bool advertiserTrackingEnabled)
{
return IOSWrapper.IOSFBAdvertiserTrackingEnabled(advertiserTrackingEnabled);
}

public void GetAppLink(int requestId)
{
IOSWrapper.IOSFBGetAppLink(requestId);
Expand Down Expand Up @@ -228,6 +243,62 @@ public void SetDataProcessingOptions(string[] options, int country, int state)
IOSWrapper.IOSFBSetDataProcessingOptions(options, options.Length, country, state);
}

public AuthenticationToken CurrentAuthenticationToken()
{
String authenticationTokenString = IOSWrapper.IOSFBCurrentAuthenticationToken();
if (String.IsNullOrEmpty(authenticationTokenString))
{
return null;
}
try
{
IDictionary<string, string> token = Utilities.ParseStringDictionaryFromString(authenticationTokenString);
string tokenString;
string nonce;
token.TryGetValue("auth_token_string", out tokenString);
token.TryGetValue("auth_nonce", out nonce);
return new AuthenticationToken(tokenString, nonce);
}
catch (Exception)
{
return null;
}
}

public Profile CurrentProfile()
{
String profileString = IOSWrapper.IOSFBCurrentProfile();
if (String.IsNullOrEmpty(profileString))
{
return null;
}
try
{
IDictionary<string, string> profile = Utilities.ParseStringDictionaryFromString(profileString);
string userID;
string firstName;
string middleName;
string lastName;
string name;
string email;
string imageURL;
string linkURL;
profile.TryGetValue("userID", out userID);
profile.TryGetValue("firstName", out firstName);
profile.TryGetValue("middleName", out middleName);
profile.TryGetValue("lastName", out lastName);
profile.TryGetValue("name", out name);
profile.TryGetValue("email", out email);
profile.TryGetValue("imageURL", out imageURL);
profile.TryGetValue("linkURL", out linkURL);
return new Profile(userID, firstName, middleName, lastName, name, email, imageURL, linkURL);
}
catch (Exception)
{
return null;
}
}

public void UploadImageToMediaLibrary(
int requestId,
string caption,
Expand Down Expand Up @@ -274,6 +345,13 @@ private static extern void IOSFBLogInWithReadPermissions(
int requestId,
string scope);

[DllImport("__Internal")]
private static extern void IOSFBLoginWithTrackingPreference(
int requestId,
string scope,
string tracking,
string nonce);

[DllImport("__Internal")]
private static extern void IOSFBLogInWithPublishPermissions(
int requestId,
Expand Down Expand Up @@ -351,6 +429,9 @@ private static extern void IOSFBAppEventsLogPurchase(
[DllImport("__Internal")]
private static extern void IOSFBAdvertiserIDCollectionEnabled(bool advertiserIDCollectionEnabledID);

[DllImport("__Internal")]
private static extern bool IOSFBAdvertiserTrackingEnabled(bool advertiserTrackingEnabled);

[DllImport("__Internal")]
private static extern void IOSFBGetAppLink(int requestID);

Expand Down Expand Up @@ -397,5 +478,11 @@ private static extern void IOSFBUpdateUserProperties(
int numParams,
string[] paramKeys,
string[] paramVals);

[DllImport("__Internal")]
private static extern string IOSFBCurrentAuthenticationToken();

[DllImport("__Internal")]
private static extern string IOSFBCurrentProfile();
}
}
2 changes: 1 addition & 1 deletion Facebook.Unity.IOS/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.21.2")]
[assembly: AssemblyVersion("9.0.0")]
2 changes: 1 addition & 1 deletion Facebook.Unity.Settings/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.21.2")]
[assembly: AssemblyVersion("9.0.0")]
28 changes: 28 additions & 0 deletions Facebook.Unity.Tests/Mobile/IOS/MockIOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,33 @@ public void LogInWithPublishPermissions(
this.LoginCommon(requestId, scope);
}

public void LoginWithTrackingPreference(
int requestId,
string scope,
string tracking,
string nonce)
{
this.LogMethodCall();
this.LoginCommon(requestId, scope);
}

public void LogOut()
{
this.LogMethodCall();
}

public AuthenticationToken CurrentAuthenticationToken()
{
this.LogMethodCall();
return null;
}

public Profile CurrentProfile()
{
this.LogMethodCall();
return null;
}

public void SetPushNotificationsDeviceTokenString(string token)
{
this.LogMethodCall();
Expand Down Expand Up @@ -167,6 +189,12 @@ public void FBAutoLogAppEventsEnabled(bool autoLogAppEventsEnabled)
this.LogMethodCall();
}

public bool FBAdvertiserTrackingEnabled(bool advertiserTrackingEnabled)
{
this.LogMethodCall();
return true;
}

public void FBAdvertiserIDCollectionEnabled(bool advertiserIDCollectionEnabled)
{
this.LogMethodCall();
Expand Down
2 changes: 1 addition & 1 deletion Facebook.Unity.Tests/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.21.2")]
[assembly: AssemblyVersion("9.0.0")]
Loading

0 comments on commit 08a7dfa

Please sign in to comment.