Skip to content

Commit

Permalink
Updating Unity plugins for version 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hokstuff committed Dec 18, 2023
1 parent 18cb8ee commit ebfc67d
Show file tree
Hide file tree
Showing 183 changed files with 99 additions and 1,388 deletions.
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.
4 changes: 2 additions & 2 deletions Assets/Plugins/Appboy/AppboyBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,10 @@ public static BrazeInAppMessageListener inAppMessageListener {
}

/// <summary>
/// Get a single Feature Flag.
/// Get a single Feature Flag. If there is no Feature Flag with that ID, returns null.
/// </summary>
/// <value>Feature Flag</value>
public static FeatureFlag GetFeatureFlag(string id) {
public static FeatureFlag? GetFeatureFlag(string id) {
#if HAS_BRAZE_SDK
return mBinding.GetFeatureFlag(id);
#else
Expand Down
5 changes: 4 additions & 1 deletion Assets/Plugins/Appboy/BrazeAndroidPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,11 @@ public void RefreshFeatureFlags() {
Braze.Call("refreshFeatureFlags");
}

public FeatureFlag GetFeatureFlag(string id) {
public FeatureFlag? GetFeatureFlag(string id) {
var javaFeatureFlag = Braze.Call<AndroidJavaObject>("getFeatureFlag", id);
if (javaFeatureFlag == null) {
return null;
}
var javaJsonObject = javaFeatureFlag.Call<AndroidJavaObject>("forJsonPut");
var javaString = javaJsonObject.Call<string>("toString");
return new FeatureFlag((JSONObject)JSON.Parse(javaString));
Expand Down
2 changes: 1 addition & 1 deletion Assets/Plugins/Appboy/BrazePlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ void SetUserLastKnownLocation(
void AddToSubscriptionGroup(string id);
void RemoveFromSubscriptionGroup(string id);
void RefreshFeatureFlags();
FeatureFlag GetFeatureFlag(string id);
FeatureFlag? GetFeatureFlag(string id);
List<FeatureFlag> GetAllFeatureFlags();
}
5 changes: 4 additions & 1 deletion Assets/Plugins/Appboy/BrazeiOSPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,11 @@ public void RefreshFeatureFlags() {
_refreshFeatureFlags();
}

public FeatureFlag GetFeatureFlag(string id) {
public FeatureFlag? GetFeatureFlag(string id) {
string jsonStr = _getFeatureFlag(id);
if (jsonStr == null) {
return null;
}
FeatureFlag flag = new FeatureFlag((JSONObject)JSON.Parse(jsonStr));
return flag;
}
Expand Down
5 changes: 3 additions & 2 deletions Assets/Plugins/Appboy/Editor/AppboyConfigEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class AppboyConfigEditor : EditorWindow {
private AppboyConfig instance;
private Vector2 scrollPosition;
private GUILayoutOption[] buttonGuiStyle = new GUILayoutOption[] { GUILayout.ExpandWidth(true) };
// https://appboy.github.io/appboy-android-sdk/kdoc/braze-android-sdk/com.braze.ui.inappmessage/-in-app-message-operation/index.html
// https://braze-inc.github.io/braze-android-sdk/kdoc/braze-android-sdk/com.braze.ui.inappmessage/-in-app-message-operation/index.html
private string[] ANDROID_IAM_OPERATIONS = new string[] {"Display Now", "Display Later", "Discard"};

// Cross-platform settings
Expand Down Expand Up @@ -122,6 +122,7 @@ private void IOSBuildGUI() {
IOSBuildGUIPush();
EditorGUI.indentLevel--;
EditorGUILayout.Separator();
EditorGUILayout.EndVertical();

// In-App Messages
EditorGUILayout.LabelField("In-App Messages", EditorStyles.boldLabel);
Expand Down Expand Up @@ -301,7 +302,7 @@ private void AndroidBuildGUIConnectionInfo() {
GUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Space separated, capitalized DEVICE_KEY enum values.", EditorStyles.wordWrappedMiniLabel);
if (GUILayout.Button("DEVICE_KEY enums", buttonGuiStyle)) {
Application.OpenURL("https://appboy.github.io/appboy-android-sdk/javadocs/com/appboy/enums/DeviceKey.html");
Application.OpenURL("https://braze-inc.github.io/braze-android-sdk/javadocs/com/appboy/enums/DeviceKey.html");
}
GUILayout.EndHorizontal();
EditorGUI.indentLevel--;
Expand Down
49 changes: 32 additions & 17 deletions Assets/Plugins/Appboy/Editor/PostBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@
using UnityEditor.iOS.Xcode.Extensions;
#endif

namespace Appboy.Editor {
public class PostBuild {
namespace Appboy.Editor
{
public class PostBuild
{
#if UNITY_IOS
private const string AppboyAppDelegatePath = "Libraries/Plugins/iOS/AppboyAppDelegate.mm";
private const string PlistSubpath = "/Info.plist";
private const string MainTargetName = "Unity-iPhone";
private const string AppleDeveloperTeamID = "5GLZKGNWQ3";
private const string BrazeSampleAppBundleId = "com.appboy.unity.AppboySample";

private const string BRZEndpointKey = "Endpoint";
private const string BRZLogLevelKey = "LogLevel";
Expand Down Expand Up @@ -59,39 +63,50 @@ private static void ModifyProject(string path) {
project.RemoveFile(appboyAppDelegateGuid);

} else {
string mainTarget = project.GetUnityMainTargetGuid();
if (AppboyConfig.IOSIntegratesPush && !AppboyConfig.IOSDisableAutomaticPushCapability) {
AddPushEntitlement(
path,
project,
project.GetUnityMainTargetGuid()
mainTarget
);
}

// Disabled to run on Xcode 14+
project.SetBuildProperty(project.GetUnityMainTargetGuid(), "ENABLE_BITCODE", "NO");

/****** Modifying `UnityFramework.framework` ******/
string unityFramework = project.GetUnityFrameworkTargetGuid();
// - Use Braze's Apple Developer Team ID only for the sample app
string releaseConfigGUID = project.BuildConfigByName(mainTarget, "Release");
string bundleId = project.GetBuildPropertyForConfig(releaseConfigGUID, "PRODUCT_BUNDLE_IDENTIFIER");
if (bundleId == BrazeSampleAppBundleId) {
PlayerSettings.iOS.appleDeveloperTeamID = AppleDeveloperTeamID;
}
PlayerSettings.iOS.appleEnableAutomaticSigning = true;

// - Add UserNotifications.framework
project.AddFrameworkToProject(unityFramework, "UserNotifications.framework", false);
/****** Unity-iPhone (main target) ******/

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

if (AppboyConfig.IOSImportDependencies) {
// Third-party dependencies
string SDWebImageGUID = project.AddRemotePackageReferenceAtVersion("https://github.com/SDWebImage/SDWebImage/", "5.15.5");
project.AddRemotePackageFrameworkToProject(unityFramework, "SDWebImage", SDWebImageGUID, false);
project.AddRemotePackageFrameworkToProject(mainTarget, "SDWebImage", SDWebImageGUID, false);
}

// - Update UnityFramework's build settings
// - Disabled to run on Xcode 14+
project.SetBuildProperty(mainTarget, "ENABLE_BITCODE", "NO");

/****** UnityFramework.framework ******/

string unityFramework = project.GetUnityFrameworkTargetGuid();

// - Add UserNotifications.framework
project.AddFrameworkToProject(unityFramework, "UserNotifications.framework", false);

// - Update main target's build settings
project.SetBuildProperty(unityFramework, "CLANG_ENABLE_MODULES", "YES");
project.SetBuildProperty(unityFramework, "ENABLE_BITCODE", "NO"); // Disabled to run on Xcode 14+
project.AddBuildProperty(unityFramework, "OTHER_CPLUSPLUSFLAGS", "$(OTHER_CFLAGS)");
project.AddBuildProperty(unityFramework, "OTHER_CPLUSPLUSFLAGS", "-fcxx-modules");
}

File.WriteAllText(projectPath, project.WriteToString());
Expand Down
21 changes: 18 additions & 3 deletions Assets/Plugins/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
## 5.0.0

#### Breaking
- Updated the native iOS bridge [from Braze Swift SDK 6.1.0 to 7.4.0](https://github.com/braze-inc/braze-swift-sdk/compare/6.1.0...7.3.0#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed).
- The iOS repository link now points to the prebuilt dynamic XCFrameworks from this repo: `https://github.com/braze-inc/braze-swift-sdk-prebuilt-dynamic`.
- Updated the native Android bridge [from Braze Android SDK 27.0.1 to 29.0.1](https://github.com/braze-inc/braze-android-sdk/compare/v27.0.0...v29.0.1#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed).
- `AppboyBinding.GetFeatureFlag(string id)` will now return `null` if the Feature Flag does not exist.
- `FEATURE_FLAGS_UPDATED` will only trigger when a refresh request completes with success or failure, and upon initial subscription if there was previously cached data from the current session.

##### Fixed
- Fixed an issue introduced in `4.0.0` which prevented compilation on Xcode 14.3+.
- The additional `-fcxx-modules` flag under "Other C++ Flags" has been removed from the build process.
- The dependencies `BrazeKit` and `BrazeUI` now get directly linked to the main app's target, instead of being transitively linked via `UnityFramework`.
- Changed the iOS plugin to automatically update up to the next minor version, instead of up to the next major version.

## 4.3.0

> Starting with this release, this SDK will use [Semantic Versioning](https://semver.org/).
##### Changed
- Updated the Android plugin to use Braze Android SDK 27.0.1.
##### Added
- Updated the Android plugin to use [Braze Android SDK 27.0.1](https://github.com/braze-inc/braze-android-sdk/blob/master/CHANGELOG.md#2701).

## 4.2.0

#### Breaking
- Updated the Android plugin to use [Braze Android SDK 26.2.0](https://github.com/braze-inc/braze-android-sdk/blob/master/CHANGELOG.md#2620)
- Updated the Android plugin to use [Braze Android SDK 26.2.0](https://github.com/braze-inc/braze-android-sdk/blob/master/CHANGELOG.md#2620).

##### Fixed
- Fixed an issue on Android where In-App Message events would not properly get forwarded to the Unity layer.
Expand Down

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

4 changes: 2 additions & 2 deletions Assets/Plugins/iOS/AppboyAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#import "UnityAppController.h"
#import "AppboyUnityManager.h"

@import BrazeKit;
@import BrazeUI;
#import <BrazeKit/BrazeKit-Swift.h>
#import <BrazeUI/BrazeUI-Swift.h>

@interface AppboyAppDelegate : UnityAppController

Expand Down
4 changes: 2 additions & 2 deletions Assets/Plugins/iOS/AppboyBinding.m
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,13 @@ void _refreshFeatureFlags() {
[[AppboyUnityManager sharedInstance] refreshFeatureFlags];
}

// Return FeatureFlag in the form of a string, since `C` doesn't support objects
// Return Feature Flag in the form of a string, since `C` doesn't support objects
char* _getFeatureFlag(char* id) {
NSString *flagStr = [[AppboyUnityManager sharedInstance] getFeatureFlag:GetStringParam(id)];
return convertNSStringToCString(flagStr);
}

// Return FeatureFlags in the form of a string, since `C` doesn't support objects
// Return Feature Flags in the form of a string, since `C` doesn't support objects
char* _getAllFeatureFlags() {
NSString *flagStrArray = [[AppboyUnityManager sharedInstance] getAllFeatureFlags];
return convertNSStringToCString(flagStrArray);
Expand Down
4 changes: 2 additions & 2 deletions Assets/Plugins/iOS/AppboyUnityManager.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#import <Foundation/Foundation.h>
#import <UserNotifications/UserNotifications.h>

@import BrazeKit;
@import BrazeUI;
#import <BrazeKit/BrazeKit-Swift.h>
#import <BrazeUI/BrazeUI-Swift.h>

static NSString *const BRZUnityApiKey = @"ApiKey";
static NSString *const BRZUnitySdkAuthEnabledKey = @"EnableSDKAuthentication";
Expand Down
4 changes: 4 additions & 0 deletions Assets/Plugins/iOS/AppboyUnityManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,12 @@ - (void)refreshFeatureFlags {
}];
}

/// Returns the JSON string of the Feature Flag. If there is no Feature Flag with that ID, returns nil.
- (NSString *)getFeatureFlag:(NSString *)identifier {
BRZFeatureFlag *featureFlag = [braze.featureFlags featureFlagWithId:identifier];
if (!featureFlag) {
return nil;
}
NSData *data = [featureFlag json];
return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
}
Expand Down
34 changes: 0 additions & 34 deletions Assets/Plugins/iOS/Appboy_iOS_SDK.framework.meta

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit ebfc67d

Please sign in to comment.