Skip to content

Commit

Permalink
Updating Braze SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
hokstuff committed Dec 3, 2021
1 parent 203326e commit cb64700
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 25 deletions.
4 changes: 3 additions & 1 deletion AppboyKit/ABKModalWebViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ - (void)dealloc {
*
*/
- (WKWebView *)getWebView {
WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero];
WKWebViewConfiguration *webViewConfiguration = [[WKWebViewConfiguration alloc] init];
webViewConfiguration.allowsInlineMediaPlayback = YES;
WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:webViewConfiguration];
webView.navigationDelegate = self;
return webView;
}
Expand Down
11 changes: 6 additions & 5 deletions AppboyKit/include/ABKInAppMessageController.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ NS_ASSUME_NONNULL_BEGIN
- (NSInteger)inAppMessagesRemainingOnStack;

/*!
* @param newInAppMessage A new in-app message that will be added into the top of the stack of in-app messages that haven't been displayed yet.
* @discussion This method allows you to request display of an in-app message. It adds the in-app message object to the top of the in-app message stack
* and tries to display it immediately.
*
* @discussion This method allows you to display a custom in-app message. It adds the in-app message object to the top of the in-app message stack
* and tries to display immediately.
* If you add an ABKInAppMessage instance that you received through a Braze delegate method - i.e. one that is associated with a campaign or Canvas,
* then impression and click analytics will work automatically. If you add an ABKInAppMessage instance that you instantiated yourself programmatically
* (uncommon), then analytics will not be available.
*
* Note: Clicks and impressions of in-app messages added by this method will not be collected by Braze and will not be
* reflected on the dashboard.
* @param newInAppMessage the in-app message to add.
*/
- (void)addInAppMessage:(ABKInAppMessage *)newInAppMessage;

Expand Down
5 changes: 3 additions & 2 deletions AppboyKit/include/Appboy.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#import "ABKSdkMetadata.h"

#ifndef APPBOY_SDK_VERSION
#define APPBOY_SDK_VERSION @"4.4.0"
#define APPBOY_SDK_VERSION @"4.4.1"
#endif

#if !TARGET_OS_TV
Expand Down Expand Up @@ -389,7 +389,8 @@ typedef NS_ENUM(NSInteger, ABKChannel) {
* @param userId The new user's ID (from the host application).
*
* @discussion
* This method changes the user's ID.
* This method changes the user's ID. These user IDs should be private and not easily obtained (e.g. not a plain
* email address or username).
*
* When you first start using Braze on a device, the user is considered "anonymous". You can use this method to
* optionally identify a user with a unique ID, which enables the following:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ - (void)setUpEmptyFeedLabel {
self.emptyFeedLabel = [[UILabel alloc] init];
self.emptyFeedLabel.font = [ABKUIUtils preferredFontForTextStyle:UIFontTextStyleBody weight:UIFontWeightRegular];
self.emptyFeedLabel.textAlignment = NSTextAlignmentCenter;
self.emptyFeedLabel.numberOfLines = 2;
self.emptyFeedLabel.numberOfLines = 0;
self.emptyFeedLabel.translatesAutoresizingMaskIntoConstraints = NO;
}

Expand All @@ -98,7 +98,13 @@ - (void)setUpEmptyFeedView {

NSLayoutConstraint *centerXConstraint = [self.emptyFeedLabel.centerXAnchor constraintEqualToAnchor:self.emptyFeedView.centerXAnchor];
NSLayoutConstraint *centerYConstraint = [self.emptyFeedLabel.centerYAnchor constraintEqualToAnchor:self.emptyFeedView.centerYAnchor];
[NSLayoutConstraint activateConstraints:@[centerXConstraint, centerYConstraint]];
NSLayoutConstraint *leftConstraint = [self.emptyFeedLabel.leftAnchor constraintEqualToAnchor:self.emptyFeedView.leftAnchor];
NSLayoutConstraint *rightConstraint = [self.emptyFeedLabel.rightAnchor constraintEqualToAnchor:self.emptyFeedView.rightAnchor];
NSLayoutConstraint *topConstraint = [self.emptyFeedLabel.topAnchor constraintEqualToAnchor:self.emptyFeedView.topAnchor];
NSLayoutConstraint *bottomConstraint = [self.emptyFeedLabel.bottomAnchor constraintEqualToAnchor:self.emptyFeedView.bottomAnchor];
[NSLayoutConstraint activateConstraints:@[centerXConstraint, centerYConstraint,
leftConstraint, rightConstraint,
topConstraint, bottomConstraint]];
}

- (void)dealloc {
Expand Down
7 changes: 3 additions & 4 deletions AppboyUI/ABKInAppMessage/ABKInAppMessageUIDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ NS_ASSUME_NONNULL_BEGIN
* * make the in-app message clickable when there is no button(s) on it.
* * stretch/shrink the in-app message view to fix the whole screen.
*
* NOTE: The returned view controller should be a ABKInAppMessageViewController or preferably, a subclass of
* ABKInAppMessageViewController. The view of the returned view controller should be an instance of ABKInAppMessageView or its
* subclass.
* @returns An ABKInAppMessageViewController subclass for which the view is an ABKInAppMessageView
* instance or subclass. Returning nil will prevent the in-app message from displaying.
*/
- (ABKInAppMessageViewController *)inAppMessageViewControllerWithInAppMessage:(ABKInAppMessage *)inAppMessage;
- (nullable ABKInAppMessageViewController *)inAppMessageViewControllerWithInAppMessage:(ABKInAppMessage *)inAppMessage;

/*!
* @param inAppMessage The in-app message object being offered to the delegate.
Expand Down
19 changes: 12 additions & 7 deletions AppboyUI/ABKInAppMessage/ABKInAppMessageWindow.m
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
#import "ABKInAppMessageWindow.h"
#import "ABKInAppMessageView.h"
#import "ABKInAppMessageWindowController.h"
#import "ABKInAppMessageHTMLBase.h"
#import "ABKUIUtils.h"

@implementation ABKInAppMessageWindow

// Touches handled by ABKInAppMessageWindow:
// - all if `handleAllTouchEvents == YES`
// - in `ABKInAppMessageView` or one of its subviews
// - in `UIAlertController` or one of its previous responder so that alerts
// presented can be interacted with (e.g. `window.alert()` in an HTML in-app
// message)
// - in any of the native WebKit UI elements (e.g. popovers)
// - all if displaying an HTML in-app message
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {

// Get the view in the hierarchy that contains the point
UIView *hitTestResult = [super hitTest:point withEvent:event];

// Always returns the view for HTML in-app messages
if ([self.rootViewController isKindOfClass:[ABKInAppMessageWindowController class]]) {
ABKInAppMessageWindowController *controller = (ABKInAppMessageWindowController *)self.rootViewController;
if ([controller.inAppMessage isKindOfClass:[ABKInAppMessageHTMLBase class]]) {
return hitTestResult;
}
}

// Handles the touch event
if (self.handleAllTouchEvents ||
[ABKUIUtils responderChainOf:hitTestResult hasKindOfClass:[ABKInAppMessageView class]] ||
[ABKUIUtils responderChainOf:hitTestResult hasKindOfClass:[UIAlertController class]] ||
[ABKUIUtils responderChainOf:hitTestResult hasClassPrefixedWith:@"WK"]) {
[ABKUIUtils responderChainOf:hitTestResult hasKindOfClass:[ABKInAppMessageView class]]) {
return hitTestResult;
}

Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## 4.4.1

##### Fixed
- Fixes an issue in which `input` elements with `type="date"` in HTML in-app messages do not respond to some user interactions on iOS 14 and iOS 15.
- Fixes `ABKSdkMetadata` availibility when using the dynamic variant of the SDK.
- Fixes an issue in which the default content cards UI's empty feed label does not wrap properly when the device is using Larger Accessibility Sizes for its text size.

##### Changed
- Changed `ABKInAppMessageUIDelegate.inAppMessageViewControllerWithInAppMessage:` to accept a `nil` return value.

##### Added
- Adds support for the `playsinline` attribute on HTML `<video>` elements within webpages that are opened in the app by Braze.
- Adds XCFramework support for the Core integration via Carthage. Please follow the [Carthage migration guide](https://github.com/Carthage/Carthage#migrating-a-project-from-framework-bundles-to-xcframeworks) when transitioning to the new artifact.

## 4.4.0

##### Breaking
Expand Down
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ let package = Package(
targets: [
.binaryTarget(
name: "AppboyKitLibrary",
url: "https://github.com/Appboy/appboy-ios-sdk/releases/download/4.4.0/AppboyKitLibrary.xcframework.zip",
checksum: "34a7056db4ae1e24caa8933f6d98694f4baa1652fafb1c457570e9955ee2d8ec"
url: "https://github.com/Appboy/appboy-ios-sdk/releases/download/4.4.1/AppboyKitLibrary.xcframework.zip",
checksum: "4a7ed372331828676f55ebd389721ae8f6980999c157939a57b5203764f1dd38"
),
.target(
name: "AppboyKit",
Expand Down Expand Up @@ -53,8 +53,8 @@ let package = Package(
),
.binaryTarget(
name: "AppboyPushStoryFramework",
url: "https://github.com/Appboy/appboy-ios-sdk/releases/download/4.4.0/AppboyPushStoryFramework.xcframework.zip",
checksum: "b8695594e57f6c0d7235d49dc875dd4c4468cbb31c2de61db0ac1204f4cc8235"
url: "https://github.com/Appboy/appboy-ios-sdk/releases/download/4.4.1/AppboyPushStoryFramework.xcframework.zip",
checksum: "769d695b72772921ef645a16f1f5632bfcab24a6455c3973594e24f51897e5bc"
),
.target(
name: "AppboyPushStory",
Expand Down

0 comments on commit cb64700

Please sign in to comment.