Skip to content

Commit

Permalink
Release version 12.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jerielng committed Aug 23, 2024
1 parent d48d365 commit 8c42a02
Show file tree
Hide file tree
Showing 18 changed files with 98 additions and 53 deletions.
2 changes: 1 addition & 1 deletion BrazeProject/.ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0
3.3.0
4 changes: 2 additions & 2 deletions BrazeProject/BrazeProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export const BrazeProject = (): ReactElement => {
- type: ${data.payload_type}
- title: ${data.title}
- is_silent: ${data.is_silent}
`
`,
);
console.log(JSON.stringify(data, undefined, 2));
},
Expand Down Expand Up @@ -448,7 +448,7 @@ export const BrazeProject = (): ReactElement => {
};

const launchContentCardsPress = () => {
Braze.launchContentCards();
Braze.launchContentCards(true);
};

const refreshFeatureFlagsPress = () => {
Expand Down
10 changes: 5 additions & 5 deletions BrazeProject/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,21 @@ GEM
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.7)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.3)
strscan
ruby-macho (2.5.1)
strscan (3.1.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.23.0)
xcodeproj (1.25.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
rexml (>= 3.3.2, < 4.0)

PLATFORMS
ruby
Expand All @@ -95,7 +95,7 @@ DEPENDENCIES
cocoapods (>= 1.13, < 1.15)

RUBY VERSION
ruby 3.0.0p0
ruby 3.3.0p0

BUNDLED WITH
2.2.3
4 changes: 2 additions & 2 deletions BrazeProject/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ target 'BrazeProject' do
end

target 'BrazeProjectRichPush' do
pod 'BrazeNotificationService', '~> 10.0.0'
pod 'BrazeNotificationService', '~> 10.1.0'
end

target 'BrazeProjectPushStory' do
pod 'BrazePushStory', '~> 10.0.0'
pod 'BrazePushStory', '~> 10.1.0'
end
40 changes: 20 additions & 20 deletions BrazeProject/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PODS:
- boost (1.83.0)
- braze-react-native-sdk (12.0.0):
- BrazeKit (~> 10.0.0)
- BrazeLocation (~> 10.0.0)
- BrazeUI (~> 10.0.0)
- braze-react-native-sdk (12.1.0):
- BrazeKit (~> 10.1.0)
- BrazeLocation (~> 10.1.0)
- BrazeUI (~> 10.1.0)
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -24,13 +24,13 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- BrazeKit (10.0.0)
- BrazeLocation (10.0.0):
- BrazeKit (= 10.0.0)
- BrazeNotificationService (10.0.0)
- BrazePushStory (10.0.0)
- BrazeUI (10.0.0):
- BrazeKit (= 10.0.0)
- BrazeKit (10.1.0)
- BrazeLocation (10.1.0):
- BrazeKit (= 10.1.0)
- BrazeNotificationService (10.1.0)
- BrazePushStory (10.1.0)
- BrazeUI (10.1.0):
- BrazeKit (= 10.1.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.74.1)
- fmt (9.1.0)
Expand Down Expand Up @@ -1201,8 +1201,8 @@ PODS:
DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- "braze-react-native-sdk (from `../node_modules/@braze/react-native-sdk`)"
- BrazeNotificationService (~> 10.0.0)
- BrazePushStory (~> 10.0.0)
- BrazeNotificationService (~> 10.1.0)
- BrazePushStory (~> 10.1.0)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- fmt (from `../node_modules/react-native/third-party-podspecs/fmt.podspec`)
Expand Down Expand Up @@ -1383,12 +1383,12 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
braze-react-native-sdk: f38c750aae3abd6d5879845e883b0e9a5500ad63
BrazeKit: e4b29ecd51a0eed8f30e9a365a867f16ffe28378
BrazeLocation: f79747d5c09219fcdf64505f1e7f85a924783415
BrazeNotificationService: 6ad3b778978f42f183eef19380bdaa22b1a229ad
BrazePushStory: 9be7623b1d30b0eeb3e58687aafca7f80d98ac97
BrazeUI: 9d1aabd20f08f16592e131543de9eaf836d0d33e
braze-react-native-sdk: 9dbf4f67576140e7e9e6beb26080e381d03ae1eb
BrazeKit: 6ad539cc8cfd2760c0e1974df17362b8a5c97dbc
BrazeLocation: e84bbd252a7629e170fab497f7bf20b1ee8ce399
BrazeNotificationService: 40ae6c233ab5acd3d14a30cf946123232d36a624
BrazePushStory: 67f7d1ebb3e12e3bd5aea3b9e827554eb58afdb5
BrazeUI: 6516c7a30396a3b338a685f9b79beea8204ff3ea
DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5
FBLazyVector: 898d14d17bf19e2435cafd9ea2a1033efe445709
fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120
Expand Down Expand Up @@ -1444,6 +1444,6 @@ SPEC CHECKSUMS:
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: 348f8b538c3ed4423eb58a8e5730feec50bce372

PODFILE CHECKSUM: 5334401a024772f852231af4f3b511c680ec8868
PODFILE CHECKSUM: 49899bf8fdca53a73c5a62c498d18013c3ba14eb

COCOAPODS: 1.15.2
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
⚠️ In version 2.0.0, we changed the iOS bridge from AppboyKit, which is written in Objective-C, to the new [Swift SDK](https://github.com/braze-inc/braze-swift-sdk). If you are upgrading from a version below 2.0.0 to a version above 2.0.0, please read [the instructions](https://github.com/braze-inc/braze-react-native-sdk/blob/master/CHANGELOG.md#200) to ensure a smooth transition and backward compatibility.

## 12.1.0

##### Added
- Updates the native iOS version bindings [from Braze Swift SDK 10.0.0 to 10.1.0](https://github.com/braze-inc/braze-swift-sdk/compare/10.0.0...10.1.0#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed).

## 12.0.0

##### Breaking
Expand Down
12 changes: 10 additions & 2 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,17 @@ test('it calls BrazeReactBridge.logNewsFeedCardImpression', () => {
expect(NativeBrazeReactModule.logNewsFeedCardImpression).toBeCalledWith(id);
});

test('it calls BrazeReactBridge.launchContentCards', () => {
test('it calls BrazeReactBridge.launchContentCards without parameters', () => {
Braze.launchContentCards();
expect(NativeBrazeReactModule.launchContentCards).toBeCalled();
expect(NativeBrazeReactModule.launchContentCards).toBeCalledWith(false);
});

test('it calls BrazeReactBridge.launchContentCards with parameters', () => {
Braze.launchContentCards(true);
expect(NativeBrazeReactModule.launchContentCards).toBeCalledWith(true);

Braze.launchContentCards(false);
expect(NativeBrazeReactModule.launchContentCards).toBeCalledWith(false);
});

test('it calls BrazeReactBridge.getContentCards', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class BrazeReactBridgeImpl(
getNewsFeedCardById(id)?.logImpression()
}

fun launchContentCards() {
fun launchContentCards(dismissAutomaticallyOnCardClick: Boolean) {
val intent = Intent(currentActivity, ContentCardsActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
this.reactApplicationContext.startActivity(intent)
Expand Down
4 changes: 2 additions & 2 deletions android/src/newarch/com/braze/reactbridge/BrazeReactBridge.kt
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ class BrazeReactBridge(reactContext: ReactApplicationContext): NativeBrazeReactM
brazeImpl.getNewsFeedCards(promise)
}

override fun launchContentCards() {
brazeImpl.launchContentCards()
override fun launchContentCards(dismissAutomaticallyOnCardClick: Boolean) {
brazeImpl.launchContentCards(dismissAutomaticallyOnCardClick)
}

override fun requestContentCardsRefresh() {
Expand Down
4 changes: 2 additions & 2 deletions android/src/oldarch/com/braze/reactbridge/BrazeReactBridge.kt
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ class BrazeReactBridge(reactContext: ReactApplicationContext?) : ReactContextBas
}

@ReactMethod
fun launchContentCards() {
brazeImpl.launchContentCards()
fun launchContentCards(dismissAutomaticallyOnCardClick: Boolean) {
brazeImpl.launchContentCards(dismissAutomaticallyOnCardClick)
}

@ReactMethod
Expand Down
6 changes: 3 additions & 3 deletions braze-react-native-sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Pod::Spec.new do |s|

install_modules_dependencies(s)

s.dependency 'BrazeKit', '~> 10.0.0'
s.dependency 'BrazeLocation', '~> 10.0.0'
s.dependency 'BrazeUI', '~> 10.0.0'
s.dependency 'BrazeKit', '~> 10.1.0'
s.dependency 'BrazeLocation', '~> 10.1.0'
s.dependency 'BrazeUI', '~> 10.1.0'

# Swift/Objective-C compatibility
s.pod_target_xcconfig = {
Expand Down
5 changes: 3 additions & 2 deletions iOS/BrazeReactBridge/BrazeReactBridge/BrazeReactBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,10 @@ - (nullable BRZContentCardRaw *)getContentCardById:(NSString *)idString {
return nil;
}

RCT_EXPORT_METHOD(launchContentCards) {
RCT_EXPORT_METHOD(launchContentCards:(BOOL)dismissAutomaticallyOnCardClick) {
RCTLogInfo(@"launchContentCards called");
[brazeUIHandler launchContentCards:braze];
[brazeUIHandler launchContentCards:braze
dismissAutomatically:dismissAutomaticallyOnCardClick];
}

RCT_EXPORT_METHOD(getContentCards:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
Expand Down
2 changes: 1 addition & 1 deletion iOS/BrazeReactBridge/BrazeReactBridge/BrazeUIHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
- (void)useDefaultPresenterDelegate:(Braze *)braze;
- (void)deinitPresenterDelegate:(Braze *)braze;
- (void)dismissInAppMessage:(Braze *)braze;
- (void)launchContentCards:(Braze *)braze;
- (void)launchContentCards:(Braze *)braze dismissAutomatically:(BOOL)dismissAutomatically;

@end
32 changes: 27 additions & 5 deletions iOS/BrazeReactBridge/BrazeReactBridge/BrazeUIHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
@import BrazeKit;
@import BrazeUI;

@interface BrazeUIHandler () <BrazeInAppMessageUIDelegate>
@interface BrazeUIHandler () <BrazeInAppMessageUIDelegate, BrazeContentCardUIViewControllerDelegate>

@property (nonatomic) BOOL dismissFeedOnContentCardClick;

@end

@implementation BrazeUIHandler
Expand Down Expand Up @@ -41,12 +44,18 @@ - (void)deinitPresenterDelegate:(Braze *)braze {
((BrazeInAppMessageUI *)braze.inAppMessagePresenter).delegate = nil;
}

- (void)launchContentCards:(Braze *)braze {
BRZContentCardUIModalViewController *contentCardsModal = [[BRZContentCardUIModalViewController alloc] initWithBraze:braze];
contentCardsModal.navigationItem.title = @"Content Cards";
- (void)launchContentCards:(Braze *)braze dismissAutomatically:(BOOL)dismissAutomatically {
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
UIViewController *mainViewController = keyWindow.rootViewController;
[mainViewController presentViewController:contentCardsModal animated:YES completion:nil];
self.dismissFeedOnContentCardClick = dismissAutomatically;

if (![mainViewController.presentedViewController isKindOfClass:[BRZContentCardUIModalViewController class]]) {
BRZContentCardUIModalViewController *contentCardsModal = [[BRZContentCardUIModalViewController alloc] initWithBraze:braze];
contentCardsModal.navigationItem.title = @"Content Cards";
contentCardsModal.viewController.delegate = self;

[mainViewController presentViewController:contentCardsModal animated:YES completion:nil];
}
}

- (void)dismissInAppMessage:(Braze *)braze {
Expand All @@ -73,4 +82,17 @@ - (enum BRZInAppMessageUIDisplayChoice)inAppMessage:(BrazeInAppMessageUI *)ui
}
}

#pragma mark - `BrazeContentCardUIViewControllerDelegate`

- (BOOL)contentCardController:(BRZContentCardUIViewController *)controller
shouldProcess:(NSURL *)url
card:(BRZContentCardRaw *)card {
// In-app web view presentation requires the base modal to be available, so we don't want to dismiss it here.
BOOL isSchemeBased = ![url.scheme isEqual:@"https"] && ![url.scheme isEqual:@"http"];
if (!card.useWebView && self.dismissFeedOnContentCardClick && isSchemeBased) {
[controller dismissViewControllerAnimated:YES completion:nil];
}
return YES;
}

@end
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@braze/react-native-sdk",
"version": "12.0.0",
"version": "12.1.0",
"description": "Braze SDK for React Native.",
"main": "src/index.js",
"types": "src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/NativeBrazeReactModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export interface Spec extends TurboModule {
logNewsFeedCardClicked(cardId: string): void;
logNewsFeedCardImpression(cardId: string): void;
getNewsFeedCards(): Promise<NewsFeedCard[]>;
launchContentCards(): void;
launchContentCards(dismissAutomaticallyOnCardClick: boolean): void;
requestContentCardsRefresh(): void;
logContentCardClicked(cardId: string): void;
logContentCardDismissed(cardId: string): void;
Expand Down
9 changes: 7 additions & 2 deletions src/braze.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,14 @@ export class Braze {
// Content Cards
/**
* Launches the Content Cards UI element.
*
* @param {boolean | undefined} dismissAutomaticallyOnCardClick
* When enabled, the feed UI will automatically dismiss on scheme-based deep link clicks.
* This setting is a no-op on Android, which already removes the Content Cards feed when opening a deep link.
*/
static launchContentCards() {
this.bridge.launchContentCards();
static launchContentCards(dismissAutomaticallyOnCardClick) {
const dismissAutomatically = typeof dismissAutomaticallyOnCardClick === 'boolean' ? dismissAutomaticallyOnCardClick : false;
this.bridge.launchContentCards(dismissAutomatically);
}

/**
Expand Down
6 changes: 5 additions & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,12 @@ export type ContentCard =

/**
* Launches the Content Cards UI element.
*
* @param {boolean | undefined} dismissAutomaticallyOnCardClick
* When enabled, the feed UI will automatically dismiss on scheme-based deep link clicks.
* This setting is a no-op on Android, which already removes the Content Cards feed when opening a deep link.
*/
export function launchContentCards(): void;
export function launchContentCards(dismissAutomaticallyOnCardClick?: boolean): void;

/**
* Requests a refresh of the content cards from Braze's servers.
Expand Down

0 comments on commit 8c42a02

Please sign in to comment.