Skip to content

Commit

Permalink
Updating Unity plugins for version 7.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vanessaland committed Aug 30, 2024
1 parent e61b43c commit 7a309fe
Show file tree
Hide file tree
Showing 40 changed files with 1,595 additions and 73 deletions.
Binary file added .github/assets/logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/logo-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Plugins/Android/appboy-ui.aar
Binary file not shown.
Binary file modified Assets/Plugins/Android/appboy-unity.aar
Binary file not shown.
Binary file modified Assets/Plugins/Android/appboy.aar
Binary file not shown.
52 changes: 52 additions & 0 deletions Assets/Plugins/Appboy/AppboyBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ public static void SetUserPhoneNumber(string phoneNumber) {
#endif
}

public static void SetUserLanguage(string language) {
#if HAS_BRAZE_SDK
mBinding.SetUserLanguage(language);
#endif
}

public static void SetCustomUserAttribute(string key, bool value) {
#if HAS_BRAZE_SDK
mBinding.SetCustomUserAttribute(key, value);
Expand Down Expand Up @@ -560,6 +566,38 @@ public static string GetInstallTrackingId() {
#endif
}

/// <summary>
/// This method informs Braze whether ad-tracking has been enabled for this device.
/// Note that the SDK does not automatically collect this data.
/// </summary>
/// <param name='adTrackingEnabled'>
/// Whether ad-tracking is enabled.
/// </param>
/// <param name='googleAdvertisingId'>
/// The Google Advertising ID. (Android-only)
/// </param>
public static void SetAdTrackingEnabled(bool adTrackingEnabled, string googleAdvertisingId) {
#if HAS_BRAZE_SDK
mBinding.SetAdTrackingEnabled(adTrackingEnabled, googleAdvertisingId);
#endif
}

/// <summary>
/// This method updates the list of data types you wish to declare or remove as tracked user data.
/// For more details, refer to Braze's [Privacy Manifest documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/swift/privacy_manifest/).
///
/// No-op on Android.
///
/// </summary>
/// <param name='allowList'>
/// The list of tracking properties to update.
/// </param>
public static void UpdateTrackingPropertyAllowList(TrackingPropertyAllowList allowList) {
#if HAS_BRAZE_SDK
mBinding.UpdateTrackingPropertyAllowList(allowList);
#endif
}

public static void SetAttributionData(string network, string campaign, string adgroup, string creative) {
#if HAS_BRAZE_SDK
mBinding.SetAttributionData(network, campaign, adgroup, creative);
Expand Down Expand Up @@ -649,6 +687,18 @@ public static void DisplayNextInAppMessage() {
#endif
}

/// <summary>
/// Hides the currently displayed in-app message, if applicable.
/// </summary>
public static void HideCurrentInAppMessage() {
#if HAS_BRAZE_SDK
mBinding.HideCurrentInAppMessage();
#endif
}

/// <summary>
/// Displays the Content Card feed.
/// </summary>
public static void DisplayContentCards() {
#if HAS_BRAZE_SDK
mBinding.DisplayContentCards();
Expand Down Expand Up @@ -704,7 +754,9 @@ public static BrazeInAppMessageListener inAppMessageListener {
/// Get a single Feature Flag. If there is no Feature Flag with that ID, returns null.
/// </summary>
/// <value>Feature Flag</value>
#nullable enable
public static FeatureFlag? GetFeatureFlag(string id) {
#nullable disable
#if HAS_BRAZE_SDK
return mBinding.GetFeatureFlag(id);
#else
Expand Down
19 changes: 19 additions & 0 deletions Assets/Plugins/Appboy/BrazeAndroidPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ public void SetUserPhoneNumber(string phoneNumber) {
GetCurrentUser().Call<bool>("setPhoneNumber", phoneNumber);
}

public void SetUserLanguage(string language) {
GetCurrentUser().Call<bool>("setLanguage", language);
}

public void SetCustomUserAttribute(string key, bool value) {
GetCurrentUser().Call<bool>("setCustomUserAttribute", key, value);
}
Expand Down Expand Up @@ -424,6 +428,15 @@ public string GetInstallTrackingId() {
return Braze.Call<string>("getDeviceId");
}

public void SetAdTrackingEnabled(bool adTrackingEnabled, string googleAdvertisingId) {
Braze.Call("setGoogleAdvertisingId", googleAdvertisingId, adTrackingEnabled);
Debug.Log("Setting adTrackingEnabled to: " + adTrackingEnabled + " with Google Advertising ID: " + googleAdvertisingId);
}

public void UpdateTrackingPropertyAllowList(TrackingPropertyAllowList allowList) {
// No-op on Android: iOS only feature.
}

public void SetAttributionData(string network, string campaign, string adgroup, string creative) {
var attributionData = new AndroidJavaObject("com.braze.models.outgoing.AttributionData", network, campaign, adgroup, creative);
GetCurrentUser().Call<bool>("setAttributionData", attributionData);
Expand Down Expand Up @@ -457,6 +470,10 @@ public void DisplayNextInAppMessage() {
BrazeUnityActivity.Call("requestDisplayInAppMessage");
}

public void HideCurrentInAppMessage() {
BrazeInAppMessageManager.Call("hideCurrentlyDisplayingInAppMessage", true);
}

public void DisplayContentCards() {
BrazeUnityActivity.Call("launchContentCardsActivity");
}
Expand All @@ -473,7 +490,9 @@ public void RefreshFeatureFlags() {
Braze.Call("refreshFeatureFlags");
}

#nullable enable
public FeatureFlag? GetFeatureFlag(string id) {
#nullable disable
var javaFeatureFlag = Braze.Call<AndroidJavaObject>("getFeatureFlag", id);
if (javaFeatureFlag == null) {
return null;
Expand Down
6 changes: 6 additions & 0 deletions Assets/Plugins/Appboy/BrazePlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Dictionary<string, object> properties
void SetUserEmailNotificationSubscriptionType(AppboyNotificationSubscriptionType emailNotificationSubscriptionType);
void SetUserPushNotificationSubscriptionType(AppboyNotificationSubscriptionType pushNotificationSubscriptionType);
void SetUserPhoneNumber(string phoneNumber);
void SetUserLanguage(string language);

void SetCustomUserAttribute(string key, bool value);
void SetCustomUserAttribute(string key, int value);
Expand Down Expand Up @@ -95,6 +96,8 @@ void SetUserLastKnownLocation(
void DisableSDK();

string GetInstallTrackingId();
void SetAdTrackingEnabled(bool adTrackingEnabled, string googleAdvertisingId);
void UpdateTrackingPropertyAllowList(TrackingPropertyAllowList allowList);
void SetAttributionData(string network, string campaign, string adgroup, string creative);

void RequestLocationInitialization();
Expand All @@ -105,11 +108,14 @@ void SetUserLastKnownLocation(
void ConfigureListener(BrazeUnityMessageType messageType, string gameobject, string method);
void SetInAppMessageDisplayAction(BrazeUnityInAppMessageDisplayActionType actionType);
void DisplayNextInAppMessage();
void HideCurrentInAppMessage();
void DisplayContentCards();
void AddToSubscriptionGroup(string id);
void RemoveFromSubscriptionGroup(string id);
void RefreshFeatureFlags();
#nullable enable
FeatureFlag? GetFeatureFlag(string id);
#nullable disable
List<FeatureFlag> GetAllFeatureFlags();
void LogFeatureFlagImpression(string id);
}
31 changes: 31 additions & 0 deletions Assets/Plugins/Appboy/BrazeiOSPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public class BrazeiOSPlatform : BrazePlatform {
[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _setUserPhoneNumber(string phoneNumber);

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _setUserLanguage(string language);

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _setUserGender(int gender);

Expand Down Expand Up @@ -149,6 +152,9 @@ public class BrazeiOSPlatform : BrazePlatform {
[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _displayNextInAppMessage();

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _hideCurrentInAppMessage();

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _wipeData();

Expand All @@ -170,6 +176,12 @@ public class BrazeiOSPlatform : BrazePlatform {
[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern string _getInstallTrackingId();

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _setAdTrackingEnabled(bool adTrackingEnabled, string googleAdvertisingId);

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _updateTrackingPropertyAllowList(string allowList);

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _registerAppboyPushMessages(string registrationTokenBase64);

Expand Down Expand Up @@ -271,6 +283,10 @@ public void SetUserPhoneNumber(string phoneNumber) {
_setUserPhoneNumber(phoneNumber);
}

public void SetUserLanguage(string language) {
_setUserLanguage(language);
}

public void SetCustomUserAttribute(string key, bool value) {
_setCustomUserAttributeBool(key, value);
}
Expand Down Expand Up @@ -370,6 +386,10 @@ public void DisplayNextInAppMessage() {
_displayNextInAppMessage();
}

public void HideCurrentInAppMessage() {
_hideCurrentInAppMessage();
}

public void SetInAppMessageDisplayAction(BrazeUnityInAppMessageDisplayActionType actionType) {
_setInAppMessageDisplayAction((int)actionType);
}
Expand Down Expand Up @@ -446,6 +466,15 @@ public string GetInstallTrackingId() {
return _getInstallTrackingId();
}

public void SetAdTrackingEnabled(bool adTrackingEnabled, string googleAdvertisingId) {
_setAdTrackingEnabled(adTrackingEnabled, googleAdvertisingId);
}

public void UpdateTrackingPropertyAllowList(TrackingPropertyAllowList allowList) {
var allowListString = Json.Serialize(allowList.ToDictionary());
_updateTrackingPropertyAllowList(allowListString);
}

public void SetAttributionData(string network, string campaign, string adgroup, string creative) {
_setAttributionData(network, campaign, adgroup, creative);
}
Expand Down Expand Up @@ -503,7 +532,9 @@ public void RefreshFeatureFlags() {
_refreshFeatureFlags();
}

#nullable enable
public FeatureFlag? GetFeatureFlag(string id) {
#nullable disable
string jsonStr = _getFeatureFlag(id);
if (jsonStr == null) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Plugins/Appboy/Editor/PostBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private static void ModifyProject(string path) {
/****** Unity-iPhone (main target) ******/

// - Add packages via SPM
string brazeGUID = project.AddRemotePackageReferenceAtVersionUpToNextMinor("https://github.com/braze-inc/braze-swift-sdk-prebuilt-dynamic", "9.0.0");
string brazeGUID = project.AddRemotePackageReferenceAtVersionUpToNextMinor("https://github.com/braze-inc/braze-swift-sdk-prebuilt-dynamic", "10.1.0");
project.AddRemotePackageFrameworkToProject(mainTarget, "BrazeKit", brazeGUID, false);
project.AddRemotePackageFrameworkToProject(mainTarget, "BrazeUI", brazeGUID, false);

Expand Down
Loading

0 comments on commit 7a309fe

Please sign in to comment.