Skip to content

fix: update braze example and readme #830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,14 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-AnalyticsReactNativeExample/Pods-AnalyticsReactNativeExample-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/BrazeKit/BrazeKit.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/BrazeUI/BrazeUI.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/BrazeKit.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/BrazeUI.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
40 changes: 22 additions & 18 deletions example/ios/AnalyticsReactNativeExample/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
// #import <CleverTap-iOS-SDK/CleverTap.h>
// #import <clevertap-react-native/CleverTapReactManager.h>

//#import "BrazeReactUtils.h"
//#import "BrazeReactBridge.h"
//#import <BrazeKit/BrazeKit-Swift.h>
// #import "BrazeReactUtils.h"
// #import "BrazeReactBridge.h"
// #import <BrazeKit/BrazeKit-Swift.h>

#if RCT_NEW_ARCH_ENABLED
#import <React/CoreModulesPlugins.h>
Expand All @@ -36,15 +36,21 @@ @interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate>
@implementation AppDelegate

//enable for Braze Plugin
//static NSString *const apiKey = @"<YOUR API KEY>";
//static NSString *const endpoint = @"<YOUR ENDPOINT>";
static NSString *const apiKey = @"<BRAZE_API_KEY";
static NSString *const endpoint = @"BRAZE_ENDPOINT";


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

// enable for Braze Plugin
// id<RCTBridgeDelegate> moduleInitializer = [[BrazeReactBridge alloc] init];
// NSURL *jsCodeLocation =
// [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
// RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
// moduleName:@"AnalyticsReactNativeExample"
// initialProperties:nil
// launchOptions:launchOptions];

RCTAppSetupPrepareApp(application);
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];

Expand All @@ -64,8 +70,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
} else {
rootView.backgroundColor = [UIColor whiteColor];
}



self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
Expand All @@ -81,9 +85,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

// enable for braze plugin
// BRZConfiguration *configuration = [[BRZConfiguration alloc] initWithApiKey:apiKey
// endpoint:endpoint];
// endpoint:endpoint];
// - Enable logging and customize the configuration here
// configuration.logger.level = BRZLoggerLevelInfo;
// configuration.logger.level = BRZLoggerLevelInfo;
// Braze *braze = [BrazeReactBridge initBraze:configuration];
// AppDelegate.braze = braze;

Expand Down Expand Up @@ -160,15 +164,15 @@ - (Class)getModuleClassFromName:(const char *)name
// enable for Braze Plugin

//#pragma mark - AppDelegate.braze
//
//static Braze *_braze = nil;
//
//+ (Braze *)braze {

// static Braze *_braze = nil;

// + (Braze *)braze {
// return _braze;
//}
//
//+ (void)setBraze:(Braze *)braze {
// _braze = braze;
// }

// + (void)setBraze:(Braze *)braze {
// _braze = braze;
//}

@end
28 changes: 24 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
PODS:
- boost (1.76.0)
- braze-react-native-sdk (4.1.0):
- BrazeKit (~> 5.13.0)
- BrazeLocation (~> 5.13.0)
- BrazeUI (~> 5.13.0)
- React-Core
- BrazeKit (5.13.0)
- BrazeLocation (5.13.0):
- BrazeKit (= 5.13.0)
- BrazeUI (5.13.0):
- BrazeKit (= 5.13.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.69.7)
- FBReactNativeSpec (0.69.7):
Expand Down Expand Up @@ -300,17 +310,18 @@ PODS:
- React
- RNGestureHandler (2.9.0):
- React-Core
- segment-analytics-react-native (2.13.5):
- segment-analytics-react-native (2.14.0):
- React-Core
- sovran-react-native
- segment-analytics-react-native-plugin-idfa (0.6.2):
- React-Core
- sovran-react-native (1.0.2):
- sovran-react-native (1.0.3):
- React-Core
- Yoga (1.14.0)

DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- "braze-react-native-sdk (from `../node_modules/@braze/react-native-sdk`)"
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
Expand Down Expand Up @@ -356,11 +367,16 @@ DEPENDENCIES:

SPEC REPOS:
trunk:
- BrazeKit
- BrazeLocation
- BrazeUI
- fmt

EXTERNAL SOURCES:
boost:
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
braze-react-native-sdk:
:path: "../node_modules/@braze/react-native-sdk"
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
FBLazyVector:
Expand Down Expand Up @@ -446,6 +462,10 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: a7c83b31436843459a1961bfd74b96033dc77234
braze-react-native-sdk: 686da10a997500422984bd4b39c78fc19fcd701a
BrazeKit: 97f6875bf05920a46a2f0c9d0e452b6b840c5f99
BrazeLocation: 571ee6bf6b2f5c1aba20d9a75e4da190f8db7e5b
BrazeUI: 31dd9f0235149f05d6f7e37f273be7293e000587
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: 6b7f5692909b4300d50e7359cdefbcd09dd30faa
FBReactNativeSpec: affcf71d996f6b0c01f68883482588297b9d5e6e
Expand Down Expand Up @@ -484,9 +504,9 @@ SPEC CHECKSUMS:
RNCAsyncStorage: 0c357f3156fcb16c8589ede67cc036330b6698ca
RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489
RNGestureHandler: 071d7a9ad81e8b83fe7663b303d132406a7d8f39
segment-analytics-react-native: 76a34e456743b72adfd0f1d7a537a0dc22b52f8b
segment-analytics-react-native: 83f46e22fcd44a85f450464ad98e6c8e128e3f8e
segment-analytics-react-native-plugin-idfa: 6165a8eb6c35fdfecc3e9f966a2c9895ed9abaf1
sovran-react-native: b237e6a8b37a754b2e1123a3130d01a07cf4e91b
sovran-react-native: 217270c2c5d1ad45b2f60e31b06b18d478018202
Yoga: 0b84a956f7393ef1f37f3bb213c516184e4a689d

PODFILE CHECKSUM: 148f23dc44ebce74497f5fef0651f1fea1f8a361
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/info.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const libraryInfo = {
name: '@segment/analytics-react-native',
version: '2.13.5',
version: '2.14.0',
};
8 changes: 4 additions & 4 deletions packages/plugins/plugin-braze/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# @segment/analytics-react-native-plugin-braze

`DestinationPlugin` for [Braze](https://www.braze.com). Wraps [`react-native-appboy-sdk`](https://github.com/Appboy/appboy-react-sdk). This Plugin should be used with a [Device Mode](https://segment.com/docs/connections/destinations/#connection-modes) connection to Braze. To connect to Braze with a Cloud Mode connection use the [Braze Middleware Plugin]((https://www.npmjs.com/package/@segment/analytics-react-native-plugin-braze))instead. It is not possible to use both plugins in one `Analytics React Native` instance.
`DestinationPlugin` for [Braze](https://www.braze.com). Wraps [`@braze/react-native-sdk`](https://github.com/Appboy/appboy-react-sdk). This Plugin should be used with a [Device Mode](https://segment.com/docs/connections/destinations/#connection-modes) connection to Braze. To connect to Braze with a Cloud Mode connection use the [Braze Middleware Plugin]((https://www.npmjs.com/package/@segment/analytics-react-native-plugin-braze))instead. It is not possible to use both plugins in one `Analytics React Native` instance.

## Installation

You need to install the `@segment/analytics-react-native-plugin-braze` and the `react-native-appboy-sdk` dependency.
You need to install the `@segment/analytics-react-native-plugin-braze` and the `@braze/react-native-sdk` dependency.

Using NPM:
```bash
npm install --save @segment/analytics-react-native-plugin-braze react-native-appboy-sdk
npm install --save @segment/analytics-react-native-plugin-braze @braze/react-native-sdk
```

Using Yarn:
```bash
yarn add @segment/analytics-react-native-plugin-braze react-native-appboy-sdk
yarn add @segment/analytics-react-native-plugin-braze @braze/react-native-sdk
```

Run `pod install` after the installation to autolink the Braze SDK.
Expand Down