Skip to content

Commit

Permalink
Updating Braze SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
hokstuff committed Jul 20, 2020
1 parent 939d03f commit 09f589d
Show file tree
Hide file tree
Showing 38 changed files with 412 additions and 123 deletions.
2 changes: 1 addition & 1 deletion Appboy-iOS-SDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Appboy-iOS-SDK"
s.version = "3.25.0"
s.version = "3.26.0"
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'}
Expand Down
9 changes: 7 additions & 2 deletions AppboyKit/headers/AppboyKitLibrary/ABKContentCard.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface ABKContentCard : NSObject <NSCopying, NSCoding>

/*!
* Card's ID.
*/
* Card's ID.
*/
@property (readonly) NSString *idString;

/*!
Expand Down Expand Up @@ -53,6 +53,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (strong, nullable) NSDictionary *extras;

/*!
* This property is set to YES if the instance represents a test content card
*/
@property (nonatomic, readonly) BOOL isTest;

/*!
* The URL string that will be opened after the card is clicked on.
*/
Expand Down
10 changes: 10 additions & 0 deletions AppboyKit/headers/AppboyKitLibrary/ABKInAppMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, strong, nullable) ABKInAppMessageDarkTheme *darkTheme;

/*!
* An optional UIUserInterfaceStyle that can be used to force dark or light mode.
*
* @discussion The default value will not override OS settings but can
* be overriden in `beforeInAppMessageDisplayed:`
* to ensure that the dark or light theme is used for any given in-app message.
* This property is of type NSInteger to avoid any iOS version dependencies.
*/
@property (nonatomic) NSInteger overrideUserInterfaceStyle;

/*!
* imageURI defines the URI of the image icon on in-app message.
* When there is a iconImage defined, the iconImage will be used and the value of property icon will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (strong, nonatomic, nullable) id<ABKInAppMessageUIControlling> inAppMessageUIController;

/*!
* This boolean determines if modal in-app messages will be dismissed when the user taps outside of the
* in-app message.
*
* @discussion The default of this value is NO but can be overriden by setting the value of ABKEnableDismissModalOnOutsideTapKey in
* appboyOptions or in the Appboy dictionary in your Info.plist file.
*/
@property BOOL enableDismissModalOnOutsideTap;

/*!
* @param delegate The in-app message delegate that implements the ABKInAppMessageControllerDelegate methods. If the delegate is
* nil, it acts as one which always returns ABKDisplayInAppMessageNow and doesn't implement all other delegate methods.
Expand Down
10 changes: 9 additions & 1 deletion AppboyKit/headers/AppboyKitLibrary/Appboy.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#import <UserNotifications/UserNotifications.h>

#ifndef APPBOY_SDK_VERSION
#define APPBOY_SDK_VERSION @"3.25.0"
#define APPBOY_SDK_VERSION @"3.26.0"
#endif

#if !TARGET_OS_TV
Expand Down Expand Up @@ -93,6 +93,14 @@ extern NSString *const ABKURLDelegateKey;
*/
extern NSString *const ABKInAppMessageControllerDelegateKey;

/*!
* This key can be set YES or NO and will configure whether a modal in-app message will be dismissed when the user clicks
* outside of the in-app message.
* If set to YES, the in-app message will be dismissed.
* If set to NO, the in-app message will not be dismissed. This is the default value.
*/
extern NSString *const ABKEnableDismissModalOnOutsideTapKey;

/*!
* Set the time interval for session time out (in seconds). This will affect the case when user has a session shorter than
* the set time interval. In that case, the session won't be close even though the user closed the app, but will continue until
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -36,7 +36,7 @@
<constraint firstAttribute="height" constant="20" id="uxr-Kf-wzO"/>
</constraints>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="249" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Title" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dBF-6R-JPA" userLabel="Title">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="249" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Title" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dBF-6R-JPA" userLabel="Title">
<rect key="frame" x="25" y="17" width="305" height="19.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<nil key="textColor"/>
Expand Down Expand Up @@ -300,15 +300,15 @@
<outlet property="unviewedLineView" destination="jPu-U8-pTJ" id="CT8-hJ-oq0"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ABKClassicImageCardCell" rowHeight="160" id="gzx-in-eIA" customClass="ABKClassicImageContentCardCell">
<rect key="frame" x="0.0" y="638" width="375" height="160"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ABKClassicImageCardCell" id="gzx-in-eIA" customClass="ABKClassicImageContentCardCell">
<rect key="frame" x="0.0" y="638" width="375" height="128.5"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="gzx-in-eIA" id="KMu-I3-bAv">
<rect key="frame" x="0.0" y="0.0" width="375" height="160"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="128.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uBL-jd-ndj" userLabel="Root View">
<rect key="frame" x="10" y="10" width="355" height="140"/>
<rect key="frame" x="10" y="10" width="355" height="108.5"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="appboy_cc_icon_pinned.png" translatesAutoresizingMaskIntoConstraints="NO" id="lIm-rR-Mrk">
<rect key="frame" x="335" y="0.0" width="20" height="20"/>
Expand Down Expand Up @@ -338,7 +338,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Link" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xBh-6s-twj">
<rect key="frame" x="94.5" y="99" width="235.5" height="16"/>
<rect key="frame" x="94.5" y="67.5" width="26" height="16"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" link="YES" staticText="YES"/>
<bool key="isElement" value="YES"/>
Expand All @@ -348,7 +348,7 @@
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="reu-jL-oVA">
<rect key="frame" x="0.0" y="132" width="355" height="8"/>
<rect key="frame" x="0.0" y="100.5" width="355" height="8"/>
<color key="backgroundColor" red="0.086274509799999996" green="0.46274509800000002" blue="0.81568627449999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="8" id="UMI-Xs-qJT"/>
Expand All @@ -357,7 +357,7 @@
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="xBh-6s-twj" firstAttribute="trailing" secondItem="UD2-VE-dlU" secondAttribute="trailing" id="0Wh-gw-fTK"/>
<constraint firstItem="xBh-6s-twj" firstAttribute="trailing" relation="lessThanOrEqual" secondItem="UD2-VE-dlU" secondAttribute="trailing" id="0Wh-gw-fTK"/>
<constraint firstItem="xBh-6s-twj" firstAttribute="top" relation="greaterThanOrEqual" secondItem="2LE-EF-Mwl" secondAttribute="bottom" constant="8" id="2GR-zZ-Ll6"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="oEA-BV-ssv" secondAttribute="bottom" priority="999" constant="20" id="5Mr-qO-tMZ"/>
<constraint firstAttribute="trailing" secondItem="UD2-VE-dlU" secondAttribute="trailing" constant="25" id="5ZT-1d-DSs"/>
Expand Down Expand Up @@ -409,7 +409,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ABKControlCardCell" rowHeight="0.0" id="PLR-fM-stV" customClass="ABKBaseContentCardCell">
<rect key="frame" x="0.0" y="798" width="375" height="0.0"/>
<rect key="frame" x="0.0" y="766.5" width="375" height="0.0"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="PLR-fM-stV" id="RF0-pj-4Y8">
<rect key="frame" x="0.0" y="0.0" width="375" height="0.0"/>
Expand Down
3 changes: 3 additions & 0 deletions AppboyUI/ABKInAppMessage/ABKInAppMessageUIController.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ - (void)showInAppMessage:(ABKInAppMessage *)inAppMessage {
windowController.supportedOrientationMask = self.supportedOrientationMask;
windowController.preferredOrientation = self.preferredOrientation;
self.inAppMessageWindowController = windowController;
if (@available(iOS 13.0, *)) {
inAppMessageViewController.overrideUserInterfaceStyle = inAppMessage.overrideUserInterfaceStyle;
}
[self.inAppMessageWindowController displayInAppMessageViewWithAnimation:inAppMessage.animateIn];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ - (void)loadView {

#pragma mark - Superclass methods

- (BOOL)overrideApplicationStatusBarHiddenState {
return YES;
}

- (BOOL)prefersStatusBarHidden {
return YES;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ - (BOOL)prefersStatusBarHidden {
return YES;
}

- (BOOL)overrideApplicationStatusBarHiddenState {
return YES;
}

#pragma mark - NSNotificationCenter selectors

- (void)keyboardWillHide {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
NS_ASSUME_NONNULL_BEGIN
@interface ABKInAppMessageModalViewController : ABKInAppMessageImmersiveViewController

/*!
* This boolean determines if the modal in-app message will be dismissed when the user taps outside of the
* in-app message.
*
* @discussion The default of this value is NO but can be overriden by setting the value of ABKEnableDismissModalOnOutsideTapKey in
* appboyOptions or in the Appboy dictionary in your Info.plist file.
*/
@property (nonatomic, assign) BOOL enableDismissOnOutsideTap;

/*!
* The NSLayoutConstraint that specifies the height of the part of the in-app message which houses
* the image.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#import "ABKInAppMessageViewController.h"
#import "ABKInAppMessageImmersive.h"
#import "ABKSDWebImageProxy.h"
#import "Appboy.h"
#import "ABKInAppMessageController.h"

static const CGFloat ModalViewCornerRadius = 8.0f;
static const CGFloat MaxModalViewWidth = 450.0f;
Expand All @@ -13,6 +15,7 @@ @implementation ABKInAppMessageModalViewController

- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.enableDismissOnOutsideTap = [Appboy sharedInstance].inAppMessageController.enableDismissModalOnOutsideTap;

if (((ABKInAppMessageImmersive *)self.inAppMessage).imageStyle == ABKInAppMessageTopImage) {
[self.view.superview addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(>=15)-[view]-(>=15)-|"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property BOOL isiPad;

/*!
* This is YES for full screen in-app message controllers, NO otherwise
*/
@property (nonatomic, readonly) BOOL overrideApplicationStatusBarHiddenState;

/*!
* @discussion This method is used for passing the in-app message property to any custom view
* controller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ - (void)viewDidDisappear:(BOOL)animated {
nil);
}

- (BOOL)overrideApplicationStatusBarHiddenState {
return NO;
- (BOOL)prefersStatusBarHidden {
return ABKUIUtils.applicationStatusBarHidden;
}

- (UIStatusBarStyle)preferredStatusBarStyle {
return ABKUIUtils.applicationStatusBarStyle;
}

#pragma mark - UIViewController Methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "ABKInAppMessageHTMLBaseViewController.h"
#import "ABKInAppMessageImmersiveViewController.h"
#import "ABKInAppMessageSlideupViewController.h"
#import "ABKInAppMessageModalViewController.h"
#import "ABKInAppMessageViewController.h"
#import "ABKURLDelegate.h"
#import "ABKUIURLUtils.h"
Expand Down Expand Up @@ -59,25 +60,28 @@ - (void)viewDidLoad {
// We want to detect the pan gesture first, so we only recognize a tap when the pan recognizer fails.
[inAppSlideupTapGesture requireGestureRecognizerToFail:inAppSlideupPanGesture];
} else if ([self.inAppMessage isKindOfClass:[ABKInAppMessageImmersive class]]) {
if (![ABKUIUtils objectIsValidAndNotEmpty:((ABKInAppMessageImmersive *)self.inAppMessage).buttons]) {
UITapGestureRecognizer *inAppImmersiveInsideTapGesture = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(inAppMessageTapped:)];
[self.inAppMessageViewController.view addGestureRecognizer:inAppImmersiveInsideTapGesture];
}
UITapGestureRecognizer *inAppImmersiveInsideTapGesture = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(inAppMessageTapped:)];
[self.inAppMessageViewController.view addGestureRecognizer:inAppImmersiveInsideTapGesture];

if ([self.inAppMessage isKindOfClass:[ABKInAppMessageModal class]]) {
self.inAppMessageWindow.handleAllTouchEvents = YES;
UITapGestureRecognizer *inAppModalOutsideTapGesture = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(inAppMessageTappedOutside:)];
[self.view addGestureRecognizer:inAppModalOutsideTapGesture];
}
}
[self.view addSubview:self.inAppMessageViewController.view];
}

- (BOOL)prefersStatusBarHidden {
if (self.inAppMessageViewController.overrideApplicationStatusBarHiddenState) {
return self.inAppMessageViewController.prefersStatusBarHidden;
}
return [UIApplication sharedApplication].statusBarHidden;
- (UIViewController *)childViewControllerForStatusBarHidden {
return self.inAppMessageViewController;
}

- (UIViewController *)childViewControllerForStatusBarStyle {
return self.inAppMessageViewController;
}

#pragma mark - Rotation
Expand Down Expand Up @@ -187,6 +191,10 @@ - (void)inAppSlideupWasPanned:(UIPanGestureRecognizer *)panGestureRecognizer {
}

- (void)inAppMessageTapped:(id)sender {
if ([self.inAppMessage isKindOfClass:[ABKInAppMessageImmersive class]] &&
[ABKUIUtils objectIsValidAndNotEmpty:((ABKInAppMessageImmersive *)self.inAppMessage).buttons]) {
return;
}
[self invalidateSlideAwayTimer];
self.inAppMessageIsTapped = YES;

Expand All @@ -197,6 +205,15 @@ - (void)inAppMessageTapped:(id)sender {
}
}

- (void)inAppMessageTappedOutside:(id)sender {
if (![self.inAppMessage isKindOfClass:[ABKInAppMessageModal class]]) {
return;
}
if (((ABKInAppMessageModalViewController *)self.inAppMessageViewController).enableDismissOnOutsideTap) {
[(ABKInAppMessageModalViewController *)self.inAppMessageViewController dismissInAppMessage:self.inAppMessage];
}
}

#pragma mark - Timer

- (void)invalidateSlideAwayTimer {
Expand Down
10 changes: 10 additions & 0 deletions AppboyUI/ABKUIUtils/ABKUIUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
*/
@property (class, nonatomic, readonly) UIViewController *activeApplicationViewController;

/*!
* The current application status bar hidden state
*/
@property (class, readonly) BOOL applicationStatusBarHidden;

/*!
* The current application status bar style
*/
@property (class, readonly) UIStatusBarStyle applicationStatusBarStyle;

+ (NSString *)getLocalizedString:(NSString *)key inAppboyBundle:(NSBundle *)appboyBundle table:(NSString *)table;
+ (BOOL)objectIsValidAndNotEmpty:(id)object;
+ (Class)getSDWebImageProxyClass;
Expand Down
Loading

0 comments on commit 09f589d

Please sign in to comment.