Skip to content

Commit

Permalink
Added SetDomainErrorEnabled
Browse files Browse the repository at this point in the history
Summary: Added SetDomainErrorEnabled to expose iOS native Settings API SetDomainErrorEnabled.

Reviewed By: KylinChang

Differential Revision: D55773806

fbshipit-source-id: 0328bd0945ece3841f909357a0ddf97a8288357c
  • Loading branch information
jjiang10 authored and facebook-github-bot committed Apr 16, 2024
1 parent e21c70d commit 9b9dfc1
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 7 deletions.
8 changes: 8 additions & 0 deletions Facebook.Unity.IOS/IOSWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ public bool FBAdvertiserTrackingEnabled(bool advertiserTrackingEnabled)
return IOSWrapper.IOSFBAdvertiserTrackingEnabled(advertiserTrackingEnabled);
}

public bool FBDomainErrorEnabled(bool domainErrorEnabled)
{
return IOSWrapper.IOSFBDomainErrorEnabled(domainErrorEnabled);
}

public void GetAppLink(int requestId)
{
IOSWrapper.IOSFBGetAppLink(requestId);
Expand Down Expand Up @@ -523,6 +528,9 @@ public void RefreshCurrentAccessToken(int requestId)
[DllImport("__Internal")]
private static extern bool IOSFBAdvertiserTrackingEnabled(bool advertiserTrackingEnabled);

[DllImport("__Internal")]
private static extern bool IOSFBDomainErrorEnabled(bool domainErrorEnabled);

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

Expand Down
6 changes: 6 additions & 0 deletions Facebook.Unity.Tests/Mobile/IOS/MockIOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ public bool FBAdvertiserTrackingEnabled(bool advertiserTrackingEnabled)
return true;
}

public bool FBDomainErrorEnabled(bool domainErrorEnabled)
{
this.LogMethodCall();
return true;
}

public void FBAdvertiserIDCollectionEnabled(bool advertiserIDCollectionEnabled)
{
this.LogMethodCall();
Expand Down
9 changes: 9 additions & 0 deletions Facebook.Unity/FB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,15 @@ public static bool SetAdvertiserTrackingEnabled(bool advertiserTrackingEnabled)
return Mobile.MobileFacebookImpl.SetAdvertiserTrackingEnabled(advertiserTrackingEnabled);
}

/// <summary>
/// Sets the setting to enable/disable domain errors.
/// </summary>
/// <param name="domainErrorEnabled">The setting for enabling/disabling domain errors</param>
public static bool SetDomainErrorEnabled(bool domainErrorEnabled)
{
return Mobile.MobileFacebookImpl.SetDomainErrorEnabled(domainErrorEnabled);
}

/// <summary>
/// Sets device token in the purpose of uninstall tracking.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions Facebook.Unity/Mobile/Android/AndroidFacebook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ public override bool SetAdvertiserTrackingEnabled(bool advertiserTrackingEnabled
return false;
}

public override bool SetDomainErrorEnabled(bool domainErrorEnabled)
{
return false;
}

public override void SetPushNotificationsDeviceTokenString(string token)
{
this.CallFB("SetPushNotificationsDeviceTokenString", token);
Expand Down
2 changes: 2 additions & 0 deletions Facebook.Unity/Mobile/IMobileFacebook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ internal interface IMobileFacebook : IFacebook

bool SetAdvertiserTrackingEnabled(bool advertiserTrackingEnabled);

bool SetDomainErrorEnabled(bool domainErrorEnabled);

void SetDataProcessingOptions(IEnumerable<string> options, int country, int state);

void OnIAPReady(FacebookDelegate<IIAPReadyResult> callback);
Expand Down
2 changes: 2 additions & 0 deletions Facebook.Unity/Mobile/IOS/IIOSWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ internal interface IIOSWrapper

bool FBAdvertiserTrackingEnabled(bool advertiserTrackingEnabled);

bool FBDomainErrorEnabled(bool domainErrorEnabled);

void GetAppLink(int requestId);

void RefreshCurrentAccessToken(int requestId);
Expand Down
19 changes: 12 additions & 7 deletions Facebook.Unity/Mobile/IOS/IOSFacebook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ public override bool SetAdvertiserTrackingEnabled(bool advertiserTrackingEnabled
return this.iosWrapper.FBAdvertiserTrackingEnabled(advertiserTrackingEnabled);
}

public override bool SetDomainErrorEnabled(bool domainErrorEnabled)
{
return this.iosWrapper.FBDomainErrorEnabled(domainErrorEnabled);
}

public override void SetPushNotificationsDeviceTokenString(string token)
{
this.iosWrapper.SetPushNotificationsDeviceTokenString(token);
Expand Down Expand Up @@ -461,11 +466,11 @@ protected override void SetShareDialogMode(ShareDialogMode mode)
System.Convert.ToInt32(CallbackManager.AddFacebookDelegate(callback)),
caption,
videoUri.AbsolutePath.ToString());
}

public override void GetUserLocale(FacebookDelegate<ILocaleResult> callback)
{
throw new NotImplementedException();
}

public override void GetUserLocale(FacebookDelegate<ILocaleResult> callback)
{
throw new NotImplementedException();
}

private static IIOSWrapper GetIOSWrapper()
Expand Down Expand Up @@ -520,8 +525,8 @@ private static NativeDict MarshallDict(Dictionary<string, string> dict)
{
string asyncId = this.CallbackManager.AddFacebookDelegate(callback);
return Convert.ToInt32(asyncId);
}

}

private class NativeDict
{
public NativeDict()
Expand Down
2 changes: 2 additions & 0 deletions Facebook.Unity/Mobile/MobileFacebook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public override void CurrentProfile(FacebookDelegate<IProfileResult> callback)

public abstract bool SetAdvertiserTrackingEnabled(bool advertiserTrackingEnabled);

public abstract bool SetDomainErrorEnabled(bool domainErrorEnabled);

public abstract void SetPushNotificationsDeviceTokenString(string token);

public override void OnLoginComplete(ResultContainer resultContainer)
Expand Down
4 changes: 4 additions & 0 deletions Facebook.Unity/PlatformEditor/EditorFacebook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ public bool SetAdvertiserTrackingEnabled(bool advertiserTrackingEnabled)
{
return true;
}
public bool SetDomainErrorEnabled(bool domainErrorEnabled)
{
return true;
}

public void SetPushNotificationsDeviceTokenString(string token)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,12 @@ BOOL IOSFBAdvertiserTrackingEnabled(BOOL advertiserTrackingEnabled)
return [FBSDKSettings.sharedSettings isAdvertiserTrackingEnabled];
}

BOOL IOSFBDomainErrorEnabled(BOOL domainErrorEnabled)
{
[FBSDKSettings.sharedSettings setIsDomainErrorEnabled:domainErrorEnabled];
return [FBSDKSettings.sharedSettings isDomainErrorEnabled];
}

char* IOSFBSdkVersion()
{
const char* string = [[FBSDKSettings.sharedSettings sdkVersion] UTF8String];
Expand Down

0 comments on commit 9b9dfc1

Please sign in to comment.