Skip to content

Commit

Permalink
Updating Braze SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
hokstuff committed Sep 14, 2021
1 parent 4807134 commit 41de83d
Show file tree
Hide file tree
Showing 27 changed files with 422 additions and 74 deletions.
4 changes: 2 additions & 2 deletions 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 = "4.3.2"
s.version = "4.3.3"
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 All @@ -20,7 +20,7 @@ Pod::Spec.new do |s|
sc.ios.library = 'z'
sc.frameworks = 'SystemConfiguration', 'QuartzCore', 'CoreText', 'WebKit'
sc.source_files = 'AppboyKit/include/*.h', 'AppboyKit/ABKModalWebViewController.m', 'AppboyKit/ABKNoConnectionLocalization.m', 'AppboyKit/ABKLocationManagerProvider.m'
sc.resource_bundle = { 'Appboy' => 'AppboyKit/Appboy.bundle/*.lproj' }
sc.resource_bundle = { 'Appboy' => ['AppboyKit/Appboy.bundle/*.{lproj,txt}'] }
sc.vendored_framework = 'AppboyKit/AppboyKitLibrary.xcframework'
sc.weak_framework = 'CoreTelephony', 'UserNotifications'
end
Expand Down
15 changes: 7 additions & 8 deletions AppboyKit/ABKModalWebViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ - (void)viewDidLoad {
[self setViewControllers:@[webViewController]];

[self.webView loadRequest:[NSURLRequest requestWithURL:self.url]];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}

- (void)observeValueForKeyPath:(NSString *)keyPath
Expand Down Expand Up @@ -123,8 +122,9 @@ - (void)closeButtonPressed:(id)sender {

#pragma mark - WKNavigationDelegate methods

- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
- (void)webView:(WKWebView *)webView
decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
NSString *urlString = [[navigationAction.request.mainDocumentURL absoluteString] lowercaseString];
NSArray *stringComponents = [urlString componentsSeparatedByString:@":"];
if ([stringComponents[1] hasPrefix:@"//itunes.apple.com"] ||
Expand All @@ -140,15 +140,14 @@ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati
decisionHandler(WKNavigationActionPolicyAllow);
}

- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
self.progressBar.alpha = 0.0;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}

- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation
withError:(NSError *)error{
- (void)webView:(WKWebView *)webView
didFailProvisionalNavigation:(WKNavigation *)navigation
withError:(NSError *)error {
self.progressBar.alpha = 0.0;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

// Display localized "No Connection" message
UILabel *label = [[UILabel alloc] init];
Expand Down
20 changes: 20 additions & 0 deletions AppboyKit/Appboy.bundle/ZipArchive_LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2010-2015, ZipArchive, https://github.com/ZipArchive

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 4 additions & 4 deletions AppboyKit/include/ABKPushUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return YES if the user notification was sent from Braze servers.
*/
+ (BOOL)isAppboyUserNotification:(UNNotificationResponse *)response NS_AVAILABLE_IOS(10.0);
+ (BOOL)isAppboyUserNotification:(UNNotificationResponse *)response API_AVAILABLE(ios(10.0), macCatalyst(14.0));

/*!
* @param userInfo The userInfo dictionary passed to application:didReceiveRemoteNotification:fetch​Completion​Handler:
Expand Down Expand Up @@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
* your app doesn't take any undesired or unnecessary actions upon receiving Braze's uninstall tracking notifications
* (e.g., pinging your server for content).
*/
+ (BOOL)isUninstallTrackingUserNotification:(UNNotificationResponse *)response NS_AVAILABLE_IOS(10.0);
+ (BOOL)isUninstallTrackingUserNotification:(UNNotificationResponse *)response API_AVAILABLE(ios(10.0), macCatalyst(14.0));

/*!
* @param userInfo The userInfo dictionary passed to application:didReceiveRemoteNotification:fetchCompletionHandler:
Expand All @@ -69,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN
* your app doesn't take any undesired or unnecessary actions upon receiving Braze's geofence sync notifications
* (e.g., pinging your server for content).
*/
+ (BOOL)isGeofencesSyncUserNotification:(UNNotificationResponse *)response NS_AVAILABLE_IOS(10.0);
+ (BOOL)isGeofencesSyncUserNotification:(UNNotificationResponse *)response API_AVAILABLE(ios(10.0), macCatalyst(14.0));

/*!
* @param userInfo The userInfo dictionary passed to application:didReceiveRemoteNotification:fetchCompletionHandler:
Expand Down Expand Up @@ -111,7 +111,7 @@ NS_ASSUME_NONNULL_BEGIN
/*!
* @return A set of the default UNNotificationCategories used by Braze.
*/
+ (NSSet<UNNotificationCategory *> *)getAppboyUNNotificationCategorySet NS_AVAILABLE_IOS(10.0);
+ (NSSet<UNNotificationCategory *> *)getAppboyUNNotificationCategorySet API_AVAILABLE(ios(10.0), macCatalyst(14.0));

+ (NSSet<UIUserNotificationCategory *> *)getAppboyUIUserNotificationCategorySet __deprecated_msg("Please use `getAppboyUNNotificationCategorySet` instead.");

Expand Down
16 changes: 16 additions & 0 deletions AppboyKit/include/ABKUser.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,22 @@ typedef NS_ENUM(NSInteger, ABKNotificationSubscriptionType) {
*/
- (BOOL)setPushNotificationSubscriptionType:(ABKNotificationSubscriptionType)pushNotificationSubscriptionType;

/*!
* Adds the user to a Subscription Group.
*
* @param groupId The string UUID corresponding to the subscription group, provided by the Braze dashboard.
* @return YES if the user was successfully added, else NO. If not, the groupId might have been nil or invalid.
*/
- (BOOL)addToSubscriptionGroupWithGroupId:(NSString *)groupId;

/*!
* Removes the user from a Subscription Group.
*
* @param groupId The string UUID corresponding to the subscription group, provided by the Braze dashboard.
* @return YES if the user was successfully removed, else NO. If not, the groupId might have been nil or invalid.
*/
- (BOOL)removeFromSubscriptionGroupWithGroupId:(NSString *)groupId;

/*!
* @param key The String name of the custom user attribute
* @param value A boolean value to set as a custom attribute
Expand Down
2 changes: 1 addition & 1 deletion AppboyKit/include/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 @"4.3.2"
#define APPBOY_SDK_VERSION @"4.3.3"
#endif

#if !TARGET_OS_TV
Expand Down
Binary file modified AppboyPushStory/Resources/ABKPageView.nib
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

- (instancetype)initWithNotification:(UNNotification *)notification
storiesView:(ABKStoriesView *)storiesView
appGroup:(NSString *)appGroup API_AVAILABLE(ios(10.0));
appGroup:(NSString *)appGroup API_AVAILABLE(ios(10.0), macCatalyst(14.0));

- (UNNotificationContentExtensionResponseOption)didReceiveNotificationResponse:(UNNotificationResponse *)response API_AVAILABLE(ios(10.0));
- (UNNotificationContentExtensionResponseOption)didReceiveNotificationResponse:(UNNotificationResponse *)response API_AVAILABLE(ios(10.0), macCatalyst(14.0));

- (void)viewWillDisappear;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEd
[card logContentCardDismissed];
[self.cards removeObjectAtIndex:indexPath.row];
[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

if (self.cards.count == 0) {
[self hideTableViewAndShowViewInBackground:self.emptyFeedView];
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ - (void)viewDidLoad {
context:nil];

[self.webView loadRequest:[NSURLRequest requestWithURL:self.url]];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}

- (void)observeValueForKeyPath:(NSString *)keyPath
Expand Down Expand Up @@ -121,8 +120,9 @@ - (void)closeButtonPressed:(id)sender {

#pragma mark - WKNavigationDelegate methods

- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
- (void)webView:(WKWebView *)webView
decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
NSString *urlString = [[navigationAction.request.mainDocumentURL absoluteString] lowercaseString];
NSArray *stringComponents = [urlString componentsSeparatedByString:@":"];
if ([stringComponents[1] hasPrefix:@"//itunes.apple.com"] ||
Expand All @@ -138,16 +138,15 @@ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati
decisionHandler(WKNavigationActionPolicyAllow);
}

- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
self.progressBar.alpha = 0.0;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}

- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation
withError:(NSError *)error{
- (void)webView:(WKWebView *)webView
didFailProvisionalNavigation:(WKNavigation *)navigation
withError:(NSError *)error {
self.progressBar.alpha = 0.0;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;


UILabel *label = [[UILabel alloc] init];
label.textAlignment = NSTextAlignmentCenter;
label.numberOfLines = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#import "ABKUIUtils.h"
#import "ABKInAppMessageWindowController.h"
#import "ABKInAppMessageWebViewBridge.h"
#import "ABKUIURLUtils.h"

static NSString *const ABKBlankURLString = @"about:blank";
static NSString *const ABKHTMLInAppButtonIdKey = @"abButtonId";
Expand Down Expand Up @@ -145,16 +146,20 @@ - (WKWebView *)webView:(WKWebView *)webView
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
NSURL *url = navigationAction.request.URL;

// Handle normal html resource loading
BOOL isSystemOpen = [ABKUIURLUtils URLHasSystemScheme:url];
BOOL isIframeLoad = navigationAction.targetFrame != nil && ![navigationAction.sourceFrame isEqual:navigationAction.targetFrame];
NSString *assetPath = ((ABKInAppMessageHTMLBase *)self.inAppMessage).assetsLocalDirectoryPath.absoluteString;
BOOL isHandledByWebView =
!url ||
isIframeLoad ||
[ABKUIUtils string:url.absoluteString isEqualToString:ABKBlankURLString] ||
[ABKUIUtils string:url.path isEqualToString:assetPath] ||
[ABKUIUtils string:url.lastPathComponent isEqualToString:ABKInAppMessageHTMLFileName];
!isSystemOpen &&
(
!url ||
isIframeLoad ||
[ABKUIUtils string:url.absoluteString isEqualToString:ABKBlankURLString] ||
[ABKUIUtils string:url.path isEqualToString:assetPath] ||
[ABKUIUtils string:url.lastPathComponent isEqualToString:ABKInAppMessageHTMLFileName]
);

if (isHandledByWebView) {
decisionHandler(WKNavigationActionPolicyAllow);
Expand Down
15 changes: 7 additions & 8 deletions AppboyUI/ABKNewsFeed/ViewControllers/ABKFeedWebViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ - (void)viewDidLoad {
context:nil];

[self.webView loadRequest:[NSURLRequest requestWithURL:self.url]];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}

- (void)observeValueForKeyPath:(NSString *)keyPath
Expand Down Expand Up @@ -121,8 +120,9 @@ - (void)closeButtonPressed:(id)sender {

#pragma mark - WKNavigationDelegate methods

- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
- (void)webView:(WKWebView *)webView
decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
NSString *urlString = [[navigationAction.request.mainDocumentURL absoluteString] lowercaseString];
NSArray *stringComponents = [urlString componentsSeparatedByString:@":"];
if ([stringComponents[1] hasPrefix:@"//itunes.apple.com"] ||
Expand All @@ -138,15 +138,14 @@ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati
decisionHandler(WKNavigationActionPolicyAllow);
}

- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
self.progressBar.alpha = 0.0;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}

- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation
withError:(NSError *)error{
- (void)webView:(WKWebView *)webView
didFailProvisionalNavigation:(WKNavigation *)navigation
withError:(NSError *)error {
self.progressBar.alpha = 0.0;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

// Display localized "No Connection" message
UILabel *label = [[UILabel alloc] init];
Expand Down
1 change: 1 addition & 0 deletions AppboyUI/ABKUIUtils/ABKUIURLUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
fromChannel:(ABKChannel)channel
withExtras:(NSDictionary *)extras;
+ (BOOL)URL:(NSURL *)url shouldOpenInWebView:(BOOL)openUrlInWebView;
+ (BOOL)URLHasSystemScheme:(NSURL *)url;
+ (void)openURLWithSystem:(NSURL *)url;
+ (UIViewController *)topmostViewControllerWithRootViewController:(UIViewController *)viewController;
+ (void)displayModalWebViewWithURL:(NSURL *)url
Expand Down
16 changes: 16 additions & 0 deletions AppboyUI/ABKUIUtils/ABKUIURLUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ + (BOOL)URLHasValidWebScheme:(NSURL *)url {
[ABKUIUtils string:[url.scheme lowercaseString] isEqualToString:@"https"]);
}

+ (BOOL)URLHasSystemScheme:(NSURL *)url {
static dispatch_once_t once;
static NSSet<NSString *> *systemSchemes;
dispatch_once(&once, ^{
systemSchemes = [NSSet setWithArray:@[
@"mailto",
@"tel",
@"facetime",
@"facetime-audio",
@"sms"
]];
});

return [systemSchemes containsObject:[url.scheme lowercaseString]];
}

+ (void)openURLWithSystem:(NSURL *)url {
if (![NSThread isMainThread]) {
dispatch_sync(dispatch_get_main_queue(), ^{
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 4.3.3

##### Fixed
- Fixes a race-condition occasionally preventing HTML in-app messages with assets from being displayed from a test push.
- Fixes an issue which prevented HTML in-app messages from opening `sms:`, `mailto:`, `tel:`, `facetime:` and `facetime-audio:` urls.
- Previously, those urls would fail to open silently.
- Fixes an issue where `ABKContentCardsTableViewController` was not displaying the "no update" label after the last card was deleted from the feed.

##### Added
- Adds methods `addToSubscriptionGroupWithGroupId:` and `removeFromSubscriptionGroupWithGroupId:` to `ABKUser` to manage SMS/Email Subscription Groups.
- Also adds `appboyBridge.getUser().addToSubscriptionGroup(groupId)` and `appboyBridge.getUser().removeFromSubscriptionGroup(groupId)` to the javascript interface for HTML in-app messages.

## 4.3.2

##### Fixed
Expand Down Expand Up @@ -42,7 +54,7 @@
- See the [Content Cards documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/ios/content_cards/) for more information.

##### Fixed
- Fixes an issue with Dynamic Type support introduced in [3.34.0](#3.34.0) to be compatible with iOS 9.
- Fixes an issue with Dynamic Type support introduced in [3.34.0](#3340) to be compatible with iOS 9.

##### Added
- Adds support for new SDK Authentication feature.
Expand Down
Loading

0 comments on commit 41de83d

Please sign in to comment.