Skip to content

Commit

Permalink
Apptentive IOS SDK 5.2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
frankus committed Mar 17, 2020
1 parent bff5c14 commit 23b7bc1
Show file tree
Hide file tree
Showing 69 changed files with 834 additions and 302 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: objective-c
osx_image: xcode11
xcode_project: Apptentive/Apptentive.xcodeproj
xcode_scheme: Apptentive
xcode_destination: platform=iOS Simulator,OS=13.0,name=iPhone 11
notifications:
slack:
secure: "dg4pLEaCPh1xcb7c6nKEAbyG0YKxkiKk3LrPknLEvTY1wleD/+yG3yLqhNPkm9wirqlxSn5Hh0A/ukm8gvMsb98v/IuslXCLmBYE5jJ0OC41+Ou0UIYcIRREbCsoH5EVwetPGbpC9gA89yrtO1JO/6a9UEBRDibRjHe7ZPj6q70="
60 changes: 44 additions & 16 deletions Apptentive/Apptentive.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "01A2CF901E49062700C2103A"
BuildableName = "Apptentive.framework"
BlueprintName = "Apptentive"
ReferencedContainer = "container:Apptentive.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -40,22 +49,13 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "01A2CF901E49062700C2103A"
BuildableName = "Apptentive.framework"
BlueprintName = "Apptentive"
ReferencedContainer = "container:Apptentive.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableThreadSanitizer = "YES"
enableUBSanitizer = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand All @@ -71,8 +71,6 @@
ReferencedContainer = "container:Apptentive.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
2 changes: 1 addition & 1 deletion Apptentive/Apptentive/Apptentive.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ FOUNDATION_EXPORT double ApptentiveVersionNumber;
FOUNDATION_EXPORT const unsigned char ApptentiveVersionString[];

/** The version number of the Apptentive SDK. */
#define kApptentiveVersionString @"5.2.8"
#define kApptentiveVersionString @"5.2.9"

/** The version number of the Apptentive API platform. */
#define kApptentiveAPIVersionString @"9"
Expand Down
30 changes: 19 additions & 11 deletions Apptentive/Apptentive/Apptentive.m
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,8 @@ - (BOOL)didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHan
return (apptentivePayload != nil);
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (BOOL)didReceiveLocalNotification:(UILocalNotification *)notification fromViewController:(UIViewController *)viewController {
if ([self presentMessageCenterIfNeededForUserInfo:notification.userInfo fromViewController:viewController]) {
ApptentiveLogInfo(ApptentiveLogTagPush, @"Apptentive local notification received.");
Expand All @@ -793,6 +795,7 @@ - (BOOL)didReceiveLocalNotification:(UILocalNotification *)notification fromView
return NO;
}
}
#pragma clang diagnostic pop

- (BOOL)didReceveUserNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
return [self didReceveUserNotificationResponse:response fromViewController:nil withCompletionHandler:completionHandler];
Expand Down Expand Up @@ -878,20 +881,25 @@ - (void)fireLocalNotificationWithUserInfo:(NSDictionary *)userInfo {

return;
}
}
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if ([[UIApplication sharedApplication].delegate respondsToSelector:@selector(application:didReceiveLocalNotification:)]) {
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.alertTitle = title;
localNotification.alertBody = body;
localNotification.userInfo = apptentiveUserInfo;
localNotification.soundName = [soundName isEqualToString:@"default"] ? UILocalNotificationDefaultSoundName : soundName;

if ([[UIApplication sharedApplication].delegate respondsToSelector:@selector(application:didReceiveLocalNotification:)]) {
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.alertTitle = title;
localNotification.alertBody = body;
localNotification.userInfo = apptentiveUserInfo;
localNotification.soundName = [soundName isEqualToString:@"default"] ? UILocalNotificationDefaultSoundName : soundName;
[[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];

[[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];
} else {
ApptentiveLogError(ApptentiveLogTagPush, @"Your app is not properly configured to accept Apptentive Message Center push notifications.");
ApptentiveLogError(ApptentiveLogTagPush, @"Please see the push notification section of the integration guide for assistance: https://learn.apptentive.com/knowledge-base/ios-integration-reference/#push-notifications.");
return;
}
#pragma clang diagnostic pop
}

ApptentiveLogError(ApptentiveLogTagPush, @"Your app is not properly configured to accept Apptentive Message Center push notifications.");
ApptentiveLogError(ApptentiveLogTagPush, @"Please see the push notification section of the integration guide for assistance: https://learn.apptentive.com/knowledge-base/ios-integration-reference/#push-notifications.");
}

#pragma mark - UNUserNotificationCenterDelegate methods
Expand Down
22 changes: 12 additions & 10 deletions Apptentive/Apptentive/ApptentiveStyleSheet.m
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,8 @@ - (instancetype)init {
_sizeAdjustment = 1.0;

if (@available(iOS 13.0, *)) {
#ifdef __IPHONE_13_0
_secondaryColor = [UIColor secondaryLabelColor];
_failureColor = [UIColor systemRedColor];
#else
_secondaryColor = [UIColor colorWithRed:118.0 / 255.0 green:118.0 / 255.0 blue:122.0 / 255.0 alpha:1.0];
_failureColor = [UIColor colorWithRed:218.0 / 255.0 green:53.0 / 255.0 blue:71.0 / 255.0 alpha:1.0];
#endif
} else {
_secondaryColor = [UIColor colorWithRed:118.0 / 255.0 green:118.0 / 255.0 blue:122.0 / 255.0 alpha:1.0];
_failureColor = [UIColor colorWithRed:218.0 / 255.0 green:53.0 / 255.0 blue:71.0 / 255.0 alpha:1.0];
Expand Down Expand Up @@ -459,25 +454,32 @@ - (UIColor *)appearanceColorForClass:(Class)klass property:(SEL)propertySelector

- (void)inheritDefaultColors {
if (@available(iOS 13.0, *)) {
#ifdef __IPHONE_13_0
_primaryColor = self.primaryColor ?: [UIColor labelColor];
_separatorColor = self.separatorColor ?: [UIColor separatorColor];
_backgroundColor = self.backgroundColor ?: [UIColor systemBackgroundColor];
_collectionBackgroundColor = self.collectionBackgroundColor ?: [UIColor systemGroupedBackgroundColor];
_placeholderColor = self.placeholderColor ?: [UIColor placeholderTextColor];
#else
[self inheritAppearanceColors];
#endif
} else {
[self inheritAppearanceColors];
}
}

- (void)inheritAppearanceColors {
UIColor *tableViewBackgroundColor;

if (@available(iOS 13.0, *)) {
tableViewBackgroundColor = UIColor.systemGroupedBackgroundColor;
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
tableViewBackgroundColor = UIColor.groupTableViewBackgroundColor;
#pragma clang diagnostic pop
}

_primaryColor = self.primaryColor ?: [self appearanceColorForClass:[UILabel class] property:@selector(textColor) default:[UIColor blackColor]];
_separatorColor = self.separatorColor ?: [self appearanceColorForClass:[UITableView class] property:@selector(separatorColor) default:[UIColor colorWithRed:199.0 / 255.0 green:200.0 / 255.0 blue:204.0 / 255.0 alpha:1.0]];
_backgroundColor = self.backgroundColor ?: [self appearanceColorForClass:[UITableViewCell class] property:@selector(backgroundColor) default:[UIColor whiteColor]];
_collectionBackgroundColor = self.collectionBackgroundColor ?: [self appearanceColorForClass:[UITableView class] property:@selector(backgroundColor) default:[UIColor groupTableViewBackgroundColor]];
_collectionBackgroundColor = self.collectionBackgroundColor ?: [self appearanceColorForClass:[UITableView class] property:@selector(backgroundColor) default:tableViewBackgroundColor];
_placeholderColor = self.placeholderColor ?: [UIColor colorWithRed:0 green:0 blue:25.0 / 255.0 alpha:56.0 / 255.0];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ @interface ApptentiveHUDViewController ()

@property (strong, nonatomic) IBOutlet UIView *HUDView;
@property (nullable, strong, nonatomic) UIWindow *hostWindow;
@property (strong, nonatomic) UIWindow *previousKeyWindow;
@property (strong, nonatomic) NSTimer *hideTimer;
@property (strong, nonatomic) UIGestureRecognizer *tapGestureRecognizer;

Expand Down Expand Up @@ -96,7 +95,6 @@ - (void)showInAlertWindow {
self.animationDuration = fmin(self.animationDuration ?: 0.25, self.interval / 2.0);

self.hostWindow = [[ApptentivePassThroughWindow alloc] init];
self.previousKeyWindow = [UIApplication sharedApplication].keyWindow;

[self.hostWindow makeKeyAndVisible];
self.hostWindow.rootViewController = self;
Expand All @@ -121,7 +119,6 @@ - (IBAction)hide:(id)sender {
}
completion:^(BOOL finished) {
self.hostWindow.hidden = YES;
[self.previousKeyWindow makeKeyWindow];
self.hostWindow = nil;
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, nil);
}];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ + (instancetype)unreadMessageCountViewBadgeWithApptentiveHeart {
ApptentiveUnreadMessagesBadgeView *badge = [[self alloc] initWithFrame:CGRectMake(0, 0, 32.0, 32.0)];

UILabel *label = [self unreadMessageCountLabel];
label.textColor = [UIColor blackColor];
if (@available(iOS 13.0, *)) {
label.textColor = [UIColor labelColor];
} else {
label.textColor = [UIColor blackColor];
}
[label setCenter:CGPointMake(badge.frame.size.width / 2, badge.frame.size.height / 2)];
badge.label = label;
[badge addSubview:label];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import "ApptentiveInteraction.h"
#import "Apptentive_Private.h"
#import "ApptentiveBackend+Engagement.h"
#import "ApptentiveURLOpener.h"

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -25,34 +26,30 @@ + (void)load {
- (void)presentInteractionFromViewController:(nullable UIViewController *)viewController {
[super presentInteractionFromViewController:viewController];

BOOL openedURL = NO;
NSString *urlString = self.interaction.configuration[@"url"];
NSURL *url = [NSURL URLWithString:urlString];
if (url) {
BOOL attemptToOpenURL = [[UIApplication sharedApplication] canOpenURL:url];

// In iOS 9, `canOpenURL:` returns NO unless that URL scheme has been added to LSApplicationQueriesSchemes.
if (!attemptToOpenURL) {
attemptToOpenURL = YES;
}
void (^engageBlock)(BOOL) = ^void(BOOL success) {
NSDictionary *userInfo = @{ @"url": (urlString ?: [NSNull null]), @"success": @(success) };

if (attemptToOpenURL) {
openedURL = [[UIApplication sharedApplication] openURL:url];
if (!openedURL) {
[Apptentive.shared.backend engage:ATInteractionNavigateToLinkEventLabelNavigate fromInteraction:self.interaction fromViewController:nil userInfo:userInfo];
};

if (!url) {
ApptentiveLogError(ApptentiveLogTagInteractions, @"No URL was included in the NavigateToLink Interaction's configuration.");
engageBlock(NO);
} else if (![[UIApplication sharedApplication] canOpenURL:url]) {
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"No application can open the Interaction's URL (%@), or the %@ scheme is missing from Info.plist's LSApplicationQueriesSchemes value.", url, url.scheme);
engageBlock(NO);
} else {
[ApptentiveURLOpener openURL:url completionHandler:^(BOOL success) {
if (!success) {
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"Could not open URL %@.", url);
}
} else {
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"No application can open the Interaction's URL (%@), or the %@ scheme is missing from Info.plist's LSApplicationQueriesSchemes value.", url, url.scheme);
}
} else {
ApptentiveLogError(ApptentiveLogTagInteractions, @"No URL was included in the NavigateToLink Interaction's configuration.");
}

NSDictionary *userInfo = @{ @"url": (urlString ?: [NSNull null]),
@"success": @(openedURL),
};

[Apptentive.shared.backend engage:ATInteractionNavigateToLinkEventLabelNavigate fromInteraction:self.interaction fromViewController:nil userInfo:userInfo];
engageBlock(success);
}];
}
}

@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#import "ApptentiveUtilities.h"
#import "Apptentive_Private.h"
#import "UIAlertController+Apptentive.h"
#import "ApptentiveURLOpener.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -120,22 +121,17 @@ - (void)openAppStoreViaURL {
if ([self appID]) {
NSURL *url = [self URLForRatingApp];

BOOL attemptToOpenURL = [[UIApplication sharedApplication] canOpenURL:url];

// In iOS 9, `canOpenURL:` returns NO unless that URL scheme has been added to LSApplicationQueriesSchemes.
if (!attemptToOpenURL) {
attemptToOpenURL = YES;
}

if (attemptToOpenURL) {
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[Apptentive.shared.backend engage:ATInteractionAppStoreRatingEventLabelOpenAppStoreURL fromInteraction:self.interaction fromViewController:self.presentingViewController];

BOOL openedURL = [[UIApplication sharedApplication] openURL:url];
if (!openedURL) {
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"Could not open App Store URL: %@", url);
}
[ApptentiveURLOpener openURL:url completionHandler:^(BOOL success) {
if (!success) {
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"Could not open App Store URL: %@", url);
[self showUnableToOpenAppStoreDialog];
}
}];
} else {
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"No application can open the URL: %@", url);
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"No application can open the Interaction's URL (%@), or the %@ scheme is missing from Info.plist's LSApplicationQueriesSchemes value.", url, url.scheme);
[self showUnableToOpenAppStoreDialog];
}
} else {
Expand Down
4 changes: 4 additions & 0 deletions Apptentive/Apptentive/Engagement/Model/ApptentiveAppRelease.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@

@implementation ApptentiveAppRelease

+ (BOOL)supportsSecureCoding {
return YES;
}

- (instancetype)init {
self = [super init];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ extern NSString *NSStringFromApptentiveConversationState(ApptentiveConversationS
The `ApptentiveLegacyConversation` object is used to unarchive data for
migrating from older (<= 3.4.x) versions of the Apptentive SDK.
*/
@interface ApptentiveLegacyConversation : NSObject <NSCoding>
@interface ApptentiveLegacyConversation : NSObject <NSSecureCoding>


/**
Expand Down
Loading

0 comments on commit 23b7bc1

Please sign in to comment.