Skip to content

Commit

Permalink
Updating Braze SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
hokstuff committed Oct 9, 2020
1 parent 0e1e249 commit 4b6e0db
Show file tree
Hide file tree
Showing 58 changed files with 294 additions and 157 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.28.0"
s.version = "3.29.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
Binary file modified AppboyKit/Appboy.bundle/Info.plist
Binary file not shown.
2 changes: 1 addition & 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.28.0"
#define APPBOY_SDK_VERSION @"3.29.0"
#endif

#if !TARGET_OS_TV
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ @implementation ABKContentCardsTableViewController

- (instancetype)init {
UIStoryboard *st = [UIStoryboard storyboardWithName:@"ABKContentCardsStoryboard"
bundle:[NSBundle bundleForClass:[ABKContentCardsTableViewController class]]];
bundle:[ABKUIUtils bundle:[ABKContentCardsTableViewController class]]];
ABKContentCardsTableViewController *vc = [st instantiateViewControllerWithIdentifier:@"ABKContentCardsTableViewController"];
self = vc;
return self;
Expand Down Expand Up @@ -409,14 +409,14 @@ - (void)cancelCachingCardImages {

+ (instancetype)getNavigationContentCardsViewController {
UIStoryboard *st = [UIStoryboard storyboardWithName:@"ABKContentCardsStoryboard"
bundle:[NSBundle bundleForClass:[ABKContentCardsTableViewController class]]];
bundle:[ABKUIUtils bundle:[ABKContentCardsTableViewController class]]];
ABKContentCardsTableViewController *vc = [st instantiateViewControllerWithIdentifier:@"ABKContentCardsTableViewController"];
return vc;
}

- (NSString *)localizedAppboyContentCardsString:(NSString *)key {
return [ABKUIUtils getLocalizedString:key
inAppboyBundle:[NSBundle bundleForClass:[ABKContentCardsTableViewController class]]
inAppboyBundle:[ABKUIUtils bundle:[ABKContentCardsTableViewController class]]
table:@"AppboyContentCardsLocalizable"];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#import "ABKContentCardsViewController.h"
#import "ABKUIUtils.h"

@implementation ABKContentCardsViewController

- (instancetype)init {
UIStoryboard *st = [UIStoryboard storyboardWithName:@"ABKContentCardsStoryboard"
bundle:[NSBundle bundleForClass:[ABKContentCardsViewController class]]];
bundle:[ABKUIUtils bundle:[ABKContentCardsViewController class]]];
ABKContentCardsViewController *nf = [st instantiateViewControllerWithIdentifier:@"ABKContentCardsViewController"];
self = nf;
self.contentCardsViewController = self.viewControllers[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ - (void)applyCard:(ABKContentCard *)card {
- (UIImage *)getPlaceHolderImage {
return [ABKUIUtils getImageWithName:@"appboy_cc_noimage_lrg"
type:@"png"
inAppboyBundle:[NSBundle bundleForClass:[ABKBaseContentCardCell class]]];
inAppboyBundle:[ABKUIUtils bundle:[ABKBaseContentCardCell class]]];
}

- (void)applyAppboyAttributedTextStyleFrom:(NSString *)text forLabel:(UILabel *)label {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ - (void)viewDidAppear:(BOOL)animated {
}

- (void)loadView {
[[NSBundle bundleForClass:[ABKInAppMessageFullViewController class]] loadNibNamed:@"ABKInAppMessageFullViewController"
[[ABKUIUtils bundle:[ABKInAppMessageFullViewController class]] loadNibNamed:@"ABKInAppMessageFullViewController"
owner:self
options:nil];
self.inAppMessageHeaderLabel.font = HeaderLabelDefaultFont;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ - (void)viewDidLayoutSubviews {
}

- (void)loadView {
[[NSBundle bundleForClass:[ABKInAppMessageModalViewController class]]
[[ABKUIUtils bundle:[ABKInAppMessageModalViewController class]]
loadNibNamed:@"ABKInAppMessageModalViewController"
owner:self
options:nil];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ @interface ABKInAppMessageSlideupViewController()
@implementation ABKInAppMessageSlideupViewController

- (void)loadView {
[[NSBundle bundleForClass:[ABKInAppMessageSlideupViewController class]] loadNibNamed:@"ABKInAppMessageSlideupViewController"
[[ABKUIUtils bundle:[ABKInAppMessageSlideupViewController class]] loadNibNamed:@"ABKInAppMessageSlideupViewController"
owner:self
options:nil];
self.inAppMessageMessageLabel.font = MessageLabelDefaultFont;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ - (BOOL)applyIconToLabelView:(UILabel *)iconLabelView {
// Check if font awesome is already registered in the application. If not, register it.
// The size can be any number here.
if ([UIFont fontWithName:FontAwesomeName size:30] == nil) {
NSString *fontPath = [[NSBundle bundleForClass:[ABKInAppMessageViewController class]]
NSString *fontPath = [[ABKUIUtils bundle:[ABKInAppMessageViewController class]]
pathForResource:FontAwesomeName
ofType:@"otf"];
NSData *fontData = [NSData dataWithContentsOfFile:fontPath];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#import "ABKUIUtils.h"
#import "ABKFeedWebViewController.h"
#import "ABKUIURLUtils.h"

#import <SDWebImage/SDWebImagePrefetcher.h>
#import <SDWebImage/UIImageView+WebCache.h>

Expand All @@ -14,7 +15,7 @@ @implementation ABKNewsFeedTableViewController

- (instancetype)init {
UIStoryboard *st = [UIStoryboard storyboardWithName:@"ABKNewsFeedCardStoryboard"
bundle:[NSBundle bundleForClass:[ABKNewsFeedTableViewController class]]];
bundle:[ABKUIUtils bundle:[ABKNewsFeedTableViewController class]]];
ABKNewsFeedTableViewController *nf = [st instantiateViewControllerWithIdentifier:@"ABKNewsFeedTableViewController"];
self = nf;
return self;
Expand Down Expand Up @@ -232,14 +233,14 @@ - (void)cacheAllCardImages {

+ (instancetype)getNavigationFeedViewController {
UIStoryboard *st = [UIStoryboard storyboardWithName:@"ABKNewsFeedCardStoryboard"
bundle:[NSBundle bundleForClass:[ABKNewsFeedTableViewController class]]];
bundle:[ABKUIUtils bundle:[ABKNewsFeedTableViewController class]]];
ABKNewsFeedTableViewController *nf = [st instantiateViewControllerWithIdentifier:@"ABKNewsFeedTableViewController"];
return nf;
}

- (NSString *)localizedAppboyFeedString:(NSString *)key {
return [ABKUIUtils getLocalizedString:key
inAppboyBundle:[NSBundle bundleForClass:[ABKNewsFeedTableViewController class]]
inAppboyBundle:[ABKUIUtils bundle:[ABKNewsFeedTableViewController class]]
table:@"AppboyFeedLocalizable"];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#import "ABKNewsFeedViewController.h"
#import "ABKNewsFeedTableViewController.h"
#import "ABKUIUtils.h"

@implementation ABKNewsFeedViewController

- (instancetype)init {
UIStoryboard *st = [UIStoryboard storyboardWithName:@"ABKNewsFeedCardStoryboard"
bundle:[NSBundle bundleForClass:[ABKNewsFeedViewController class]]];
bundle:[ABKUIUtils bundle:[ABKNewsFeedViewController class]]];
ABKNewsFeedViewController *nf = [st instantiateViewControllerWithIdentifier:@"ABKNewsFeedViewController"];
self = nf;
_newsFeed = self.viewControllers[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ + (NSString *)findCellIdentifierWithCard:(ABKCard *)card {
- (UIImage *)getPlaceHolderImage {
return [ABKUIUtils getImageWithName:@"img-noimage-lrg"
type:@"png"
inAppboyBundle:[NSBundle bundleForClass:[ABKNFBaseCardCell class]]];
inAppboyBundle:[ABKUIUtils bundle:[ABKNFBaseCardCell class]]];
}

@end
5 changes: 5 additions & 0 deletions AppboyUI/ABKUIUtils/ABKUIUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
*/
@property (class, readonly) UIStatusBarStyle applicationStatusBarStyle;

/*!
* Given a class, this method searches across multiple locations and returns the associated bundle for that class
*/
+ (NSBundle *)bundle:(Class)bundleClass;

+ (NSString *)getLocalizedString:(NSString *)key inAppboyBundle:(NSBundle *)appboyBundle table:(NSString *)table;
+ (BOOL)objectIsValidAndNotEmpty:(id)object;
+ (Class)getSDWebImageProxyClass;
Expand Down
12 changes: 12 additions & 0 deletions AppboyUI/ABKUIUtils/ABKUIUtils.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#import "ABKUIUtils.h"
#import "ABKSDWebImageProxy.h"

#define ABKUISPMBundlePath @"/Appboy_iOS_SDK_AppboyUI.bundle/"

static NSString *const LocalizedAppboyStringNotFound = @"not found";
static NSUInteger const iPhoneXHeight = 2436.0;
static NSUInteger const iPhoneXRHeight = 1792.0;
Expand All @@ -9,6 +11,16 @@

@implementation ABKUIUtils

#pragma mark - Bundle Helper

+ (NSBundle *)bundle:(Class)bundleClass {
NSString *spmBundleAt = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:ABKUISPMBundlePath];
if ([[NSFileManager defaultManager] fileExistsAtPath:spmBundleAt]) {
return [NSBundle bundleWithPath:spmBundleAt];
}
return [NSBundle bundleForClass:bundleClass];
}

#pragma mark - View Hierarchy Helpers

// Used in unit tests to mock the UIApplication instance used.
Expand Down
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKBannerContentCardCell.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKBaseContentCardCell.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKClassicContentCardCell.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKClassicImageContentCardCell.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKContentCardsViewController.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKFeedWebViewController.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKInAppMessageUIButton.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKInAppMessageUIController.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKInAppMessageUIDelegate.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKInAppMessageView.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKInAppMessageViewController.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKInAppMessageWindow.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKNFBannerCardCell.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKNFBaseCardCell.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKNFCaptionedMessageCardCell.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKNFClassicCardCell.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKNewsFeedTableViewController.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKNewsFeedViewController.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKUIURLUtils.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/ABKUIUtils.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/AppboyContentCards.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/AppboyInAppMessage.h
1 change: 1 addition & 0 deletions AppboyUI/include/AppboyUI/AppboyNewsFeed.h
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## 3.29.0

##### Added
- Adds initial support for Swift Package Manager. There are 2 new packages that have been added: `AppboyKit` for the core SDK and `AppboyUI` for the full SDK (including UI elements), which correspond to the `Appboy-iOS-SDK/Core` and `Appboy-iOS-SDK` pods, respectively.
- Note that tvOS support is not available via Swift Package Manager for this release. Push Stories is only available through a side-by-side integration with Cocoapods.
- To add the package to your project follow these steps:
- Select `File > Swift Packages > Add Package Dependency`.
- In the search bar, enter `https://github.com/Appboy/Appboy-ios-sdk`.
- Select _one_ of `AppboyKit` or `AppboyUI`. Note that `AppboyUI` includes `AppboyKit` automatically.
- In your app's target, under `Build Settings > Other Linker Flags`, add the `-ObjC` linker flag.
- In the Xcode menu, click `Product > Scheme > Edit Scheme...`
- Click the expand ▶️ next to `Build` and select `Post-actions`. Press `+` and select `New Run Script Action`.
- In the dropdown next to `Provide build settings from`, select your app's target.
- Copy this script into the open field:
```
rm -rf "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Frameworks/libAppboyKitLibrary.a"
rm -rf "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Plugins/libAppboyKitLibrary.a"
```
## 3.28.0
##### Breaking
Expand Down
Loading

0 comments on commit 4b6e0db

Please sign in to comment.