Skip to content

Commit

Permalink
Release version 5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jerielng committed Jun 21, 2023
1 parent 3a0a8da commit c3a30d6
Show file tree
Hide file tree
Showing 15 changed files with 652 additions and 626 deletions.
4 changes: 4 additions & 0 deletions BrazeProject/BrazeProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,16 @@ export const BrazeProject = (): ReactElement => {
testDate,
[testDate, 'nestedArrayval'],
{ dictInArrayKey: testDate },
{ type: 5 },
{ type: null },
],
dictKey: {
dictKey1: 'dictVal1',
dictKey2: testDate,
dictKey3: { nestedDictKey1: testDate },
dictKey4: ['nestedArrayVal1', 'nestedArrayVal2'],
dictKey5: { type: false },
type: testDate,
},
});
showToast(`Event logged: ${customEventText}`);
Expand Down
14 changes: 12 additions & 2 deletions BrazeProject/ios/BrazeProject.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
7699B88040F8A987B510C191 /* libPods-BrazeProject-BrazeProjectTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-BrazeProject-BrazeProjectTests.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
ECE697B02A3CC00B0060A95D /* BrazeReactDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ECE697AF2A3CC00B0060A95D /* BrazeReactDelegate.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -43,6 +44,9 @@
5DCACB8F33CDC322A6C60F78 /* libPods-BrazeProject.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-BrazeProject.a"; sourceTree = BUILT_PRODUCTS_DIR; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = BrazeProject/LaunchScreen.storyboard; sourceTree = "<group>"; };
89C6BE57DB24E9ADA2F236DE /* Pods-BrazeProject-BrazeProjectTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BrazeProject-BrazeProjectTests.release.xcconfig"; path = "Target Support Files/Pods-BrazeProject-BrazeProjectTests/Pods-BrazeProject-BrazeProjectTests.release.xcconfig"; sourceTree = "<group>"; };
ECE697AC2A3CBE680060A95D /* BrazeProject.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = BrazeProject.entitlements; path = BrazeProject/BrazeProject.entitlements; sourceTree = "<group>"; };
ECE697AD2A3CC0000060A95D /* BrazeReactDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BrazeReactDelegate.h; sourceTree = "<group>"; };
ECE697AF2A3CC00B0060A95D /* BrazeReactDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BrazeReactDelegate.m; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -88,6 +92,9 @@
children = (
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.mm */,
ECE697AC2A3CBE680060A95D /* BrazeProject.entitlements */,
ECE697AD2A3CC0000060A95D /* BrazeReactDelegate.h */,
ECE697AF2A3CC00B0060A95D /* BrazeReactDelegate.m */,
13B07FB51A68108700A75B9A /* Images.xcassets */,
13B07FB61A68108700A75B9A /* Info.plist */,
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -414,6 +421,7 @@
files = (
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
ECE697B02A3CC00B0060A95D /* BrazeReactDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -487,6 +495,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = BrazeProject/BrazeProject.entitlements;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 5GLZKGNWQ3;
ENABLE_BITCODE = NO;
Expand All @@ -501,7 +510,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = com.appboy.helloreact;
PRODUCT_NAME = BrazeProject;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand All @@ -515,6 +524,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = BrazeProject/BrazeProject.entitlements;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 5GLZKGNWQ3;
INFOPLIST_FILE = BrazeProject/Info.plist;
Expand All @@ -528,7 +538,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = com.appboy.helloreact;
PRODUCT_NAME = BrazeProject;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
Expand Down
38 changes: 21 additions & 17 deletions BrazeProject/ios/BrazeProject/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#import <React/RCTEventDispatcher.h>
#import "BrazeReactUtils.h"
#import "BrazeReactBridge.h"
#import "BrazeReactDelegate.h"

#import <BrazeKit/BrazeKit-Swift.h>

Expand Down Expand Up @@ -41,6 +42,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
configuration.triggerMinimumTimeInterval = 1;
configuration.logger.level = BRZLoggerLevelInfo;
Braze *braze = [BrazeReactBridge initBraze:configuration];
braze.delegate = [[BrazeReactDelegate alloc] init];
AppDelegate.braze = braze;

[self registerForPushNotifications];
Expand All @@ -52,32 +54,34 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
#pragma mark - Push Notifications

- (void)registerForPushNotifications {
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) {
UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
if (@available(iOS 12.0, *)) {
[center setNotificationCategories:BRZNotifications.categories];
[[UIApplication sharedApplication] registerForRemoteNotifications];
// authorization is requested later in the Javascript layer
} else {
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIUserNotificationTypeSound) categories:nil];
[[UIApplication sharedApplication] registerForRemoteNotifications];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
}
}
UNUserNotificationCenter *center = UNUserNotificationCenter.currentNotificationCenter;
[center setNotificationCategories:BRZNotifications.categories];
center.delegate = self;
[UIApplication.sharedApplication registerForRemoteNotifications];
// Authorization is requested later in the JavaScript layer via `Braze.requestPushPermission`.
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
(void)[AppDelegate.braze.notifications handleBackgroundNotificationWithUserInfo:userInfo
fetchCompletionHandler:completionHandler];
BOOL processedByBraze = AppDelegate.braze != nil && [AppDelegate.braze.notifications handleBackgroundNotificationWithUserInfo:userInfo
fetchCompletionHandler:completionHandler];
if (processedByBraze) {
return;
}

completionHandler(UIBackgroundFetchResultNoData);
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler {
[[BrazeReactUtils sharedInstance] populateInitialUrlForCategories:response.notification.request.content.userInfo];
(void)[AppDelegate.braze.notifications handleUserNotificationWithResponse:response
withCompletionHandler:completionHandler];
BOOL processedByBraze = AppDelegate.braze != nil && [AppDelegate.braze.notifications handleUserNotificationWithResponse:response
withCompletionHandler:completionHandler];
if (processedByBraze) {
return;
}

completionHandler();
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center
Expand Down
2 changes: 2 additions & 0 deletions BrazeProject/ios/BrazeProject/BrazeProject.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.usernotifications.time-sensitive</key>
<true/>
</dict>
</plist>
16 changes: 9 additions & 7 deletions BrazeProject/ios/BrazeProject/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>BrazeProject</string>
<key>Braze</key>
<dict>
<key>LogLevel</key>
<string>0</string>
<key>Endpoint</key>
<string>sondheim.braze.com</string>
<key>LogLevel</key>
<string>0</string>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>BrazeProject</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand All @@ -32,6 +32,8 @@
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>com.braze.helloreact</string>
<key>CFBundleURLSchemes</key>
<array>
<string>helloreact</string>
Expand All @@ -58,7 +60,7 @@
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string/>
<string></string>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
Expand Down
6 changes: 6 additions & 0 deletions BrazeProject/ios/BrazeReactDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#import <Foundation/Foundation.h>
#import <BrazeKit/BrazeKit-Swift.h>

@interface BrazeReactDelegate: NSObject<BrazeDelegate>

@end
24 changes: 24 additions & 0 deletions BrazeProject/ios/BrazeReactDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#import "BrazeReactDelegate.h"
#import <UIKit/UIKit.h>

@implementation BrazeReactDelegate

/// This delegate method determines whether to open a given URL.
///
/// Reference the `BRZURLContext` object to get additional details about the URL payload.
- (BOOL)braze:(Braze *)braze shouldOpenURL:(BRZURLContext *)context {
if ([[context.url.host lowercaseString] isEqualToString:@"braze.com"]) {
// Sample custom handling of universal links
UIApplication *application = UIApplication.sharedApplication;
NSUserActivity* userActivity = [[NSUserActivity alloc] initWithActivityType:NSUserActivityTypeBrowsingWeb];
userActivity.webpageURL = context.url;
// Routes to the `continueUserActivity` method, which should be handled in your `AppDelegate`.
[application.delegate application:application
continueUserActivity:userActivity restorationHandler:^(NSArray<id<UIUserActivityRestoring>> * _Nullable restorableObjects) {}];
return NO;
}
// Let Braze handle links otherwise
return YES;
}

@end
Loading

0 comments on commit c3a30d6

Please sign in to comment.