From 23ec2e8e337856b22801288a0f25ec5895e783a2 Mon Sep 17 00:00:00 2001 From: Daniel Hok Date: Fri, 3 Dec 2021 14:24:03 -0500 Subject: [PATCH] Updating Braze SDK --- Appboy-iOS-SDK.podspec | 2 +- AppboyKit/ABKModalWebViewController.m | 4 +++- AppboyKit/include/ABKInAppMessageController.h | 11 ++++++----- AppboyKit/include/Appboy.h | 5 +++-- .../ABKContentCardsTableViewController.m | 10 ++++++++-- .../ABKInAppMessageUIDelegate.h | 7 +++---- .../ABKInAppMessage/ABKInAppMessageWindow.m | 19 ++++++++++++------- CHANGELOG.md | 14 ++++++++++++++ Example/Stopwatch/Supporting Files/Info.plist | 2 +- Package.swift | 8 ++++---- .../ObjCSample.xcodeproj/project.pbxproj | 16 +++++++++------- .../ObjCSample/ObjCSample.entitlements | 4 ++++ Samples/Core/ObjCSample/Podfile | 10 ++++++++++ Samples/Core/ObjCSample/Podfile.lock | 10 +++++----- appboy_ios_sdk.json | 2 +- appboy_ios_sdk_core.json | 2 +- appboy_ios_sdk_full.json | 2 +- 17 files changed, 86 insertions(+), 42 deletions(-) diff --git a/Appboy-iOS-SDK.podspec b/Appboy-iOS-SDK.podspec index 2174d6e99..50ebc003a 100644 --- a/Appboy-iOS-SDK.podspec +++ b/Appboy-iOS-SDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Appboy-iOS-SDK" - s.version = "4.4.0" + s.version = "4.4.1" s.summary = "This is the Braze iOS SDK for Mobile Marketing Automation" s.homepage = "http://www.braze.com" s.license = { :type => 'Commercial', :text => 'Please refer to https://github.com/Appboy/appboy-ios-sdk/blob/master/LICENSE'} diff --git a/AppboyKit/ABKModalWebViewController.m b/AppboyKit/ABKModalWebViewController.m index d5e55c113..50417278d 100644 --- a/AppboyKit/ABKModalWebViewController.m +++ b/AppboyKit/ABKModalWebViewController.m @@ -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; } diff --git a/AppboyKit/include/ABKInAppMessageController.h b/AppboyKit/include/ABKInAppMessageController.h index bf993ed9d..3cefc027e 100644 --- a/AppboyKit/include/ABKInAppMessageController.h +++ b/AppboyKit/include/ABKInAppMessageController.h @@ -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; diff --git a/AppboyKit/include/Appboy.h b/AppboyKit/include/Appboy.h index 2b151078a..ed464a91e 100644 --- a/AppboyKit/include/Appboy.h +++ b/AppboyKit/include/Appboy.h @@ -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 @@ -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: diff --git a/AppboyUI/ABKContentCards/ViewControllers/ABKContentCardsTableViewController.m b/AppboyUI/ABKContentCards/ViewControllers/ABKContentCardsTableViewController.m index e927c4c5e..6e7a1d94d 100644 --- a/AppboyUI/ABKContentCards/ViewControllers/ABKContentCardsTableViewController.m +++ b/AppboyUI/ABKContentCards/ViewControllers/ABKContentCardsTableViewController.m @@ -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; } @@ -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 { diff --git a/AppboyUI/ABKInAppMessage/ABKInAppMessageUIDelegate.h b/AppboyUI/ABKInAppMessage/ABKInAppMessageUIDelegate.h index 51e33ce81..c7969d25f 100644 --- a/AppboyUI/ABKInAppMessage/ABKInAppMessageUIDelegate.h +++ b/AppboyUI/ABKInAppMessage/ABKInAppMessageUIDelegate.h @@ -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. diff --git a/AppboyUI/ABKInAppMessage/ABKInAppMessageWindow.m b/AppboyUI/ABKInAppMessage/ABKInAppMessageWindow.m index c31c95bc3..e09071d2b 100644 --- a/AppboyUI/ABKInAppMessage/ABKInAppMessageWindow.m +++ b/AppboyUI/ABKInAppMessage/ABKInAppMessageWindow.m @@ -1,5 +1,7 @@ #import "ABKInAppMessageWindow.h" #import "ABKInAppMessageView.h" +#import "ABKInAppMessageWindowController.h" +#import "ABKInAppMessageHTMLBase.h" #import "ABKUIUtils.h" @implementation ABKInAppMessageWindow @@ -7,20 +9,23 @@ @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; } diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b34a2931..fa3386b72 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 `