Skip to content

Commit 1be5242

Browse files
authored
Merge pull request #261 from apptentive/branch_5.2.9
Release 5.2.9
2 parents bff5c14 + 23b7bc1 commit 1be5242

File tree

69 files changed

+834
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+834
-302
lines changed

.travis.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: objective-c
2+
osx_image: xcode11
3+
xcode_project: Apptentive/Apptentive.xcodeproj
4+
xcode_scheme: Apptentive
5+
xcode_destination: platform=iOS Simulator,OS=13.0,name=iPhone 11
6+
notifications:
7+
slack:
8+
secure: "dg4pLEaCPh1xcb7c6nKEAbyG0YKxkiKk3LrPknLEvTY1wleD/+yG3yLqhNPkm9wirqlxSn5Hh0A/ukm8gvMsb98v/IuslXCLmBYE5jJ0OC41+Ou0UIYcIRREbCsoH5EVwetPGbpC9gA89yrtO1JO/6a9UEBRDibRjHe7ZPj6q70="

Apptentive/Apptentive.xcodeproj/project.pbxproj

+44-16
Large diffs are not rendered by default.

Apptentive/Apptentive.xcodeproj/xcshareddata/xcschemes/Apptentive.xcscheme

+13-15
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,17 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
codeCoverageEnabled = "YES"
30-
shouldUseLaunchSchemeArgsEnv = "YES">
29+
shouldUseLaunchSchemeArgsEnv = "YES"
30+
codeCoverageEnabled = "YES">
31+
<MacroExpansion>
32+
<BuildableReference
33+
BuildableIdentifier = "primary"
34+
BlueprintIdentifier = "01A2CF901E49062700C2103A"
35+
BuildableName = "Apptentive.framework"
36+
BlueprintName = "Apptentive"
37+
ReferencedContainer = "container:Apptentive.xcodeproj">
38+
</BuildableReference>
39+
</MacroExpansion>
3140
<Testables>
3241
<TestableReference
3342
skipped = "NO">
@@ -40,22 +49,13 @@
4049
</BuildableReference>
4150
</TestableReference>
4251
</Testables>
43-
<MacroExpansion>
44-
<BuildableReference
45-
BuildableIdentifier = "primary"
46-
BlueprintIdentifier = "01A2CF901E49062700C2103A"
47-
BuildableName = "Apptentive.framework"
48-
BlueprintName = "Apptentive"
49-
ReferencedContainer = "container:Apptentive.xcodeproj">
50-
</BuildableReference>
51-
</MacroExpansion>
52-
<AdditionalOptions>
53-
</AdditionalOptions>
5452
</TestAction>
5553
<LaunchAction
5654
buildConfiguration = "Debug"
5755
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5856
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57+
enableThreadSanitizer = "YES"
58+
enableUBSanitizer = "YES"
5959
launchStyle = "0"
6060
useCustomWorkingDirectory = "NO"
6161
ignoresPersistentStateOnLaunch = "NO"
@@ -71,8 +71,6 @@
7171
ReferencedContainer = "container:Apptentive.xcodeproj">
7272
</BuildableReference>
7373
</MacroExpansion>
74-
<AdditionalOptions>
75-
</AdditionalOptions>
7674
</LaunchAction>
7775
<ProfileAction
7876
buildConfiguration = "Release"

Apptentive/Apptentive/Apptentive.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ FOUNDATION_EXPORT double ApptentiveVersionNumber;
2020
FOUNDATION_EXPORT const unsigned char ApptentiveVersionString[];
2121

2222
/** The version number of the Apptentive SDK. */
23-
#define kApptentiveVersionString @"5.2.8"
23+
#define kApptentiveVersionString @"5.2.9"
2424

2525
/** The version number of the Apptentive API platform. */
2626
#define kApptentiveAPIVersionString @"9"

Apptentive/Apptentive/Apptentive.m

+19-11
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,8 @@ - (BOOL)didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHan
782782
return (apptentivePayload != nil);
783783
}
784784

785+
#pragma clang diagnostic push
786+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
785787
- (BOOL)didReceiveLocalNotification:(UILocalNotification *)notification fromViewController:(UIViewController *)viewController {
786788
if ([self presentMessageCenterIfNeededForUserInfo:notification.userInfo fromViewController:viewController]) {
787789
ApptentiveLogInfo(ApptentiveLogTagPush, @"Apptentive local notification received.");
@@ -793,6 +795,7 @@ - (BOOL)didReceiveLocalNotification:(UILocalNotification *)notification fromView
793795
return NO;
794796
}
795797
}
798+
#pragma clang diagnostic pop
796799

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

879882
return;
880883
}
881-
}
884+
} else {
885+
#pragma clang diagnostic push
886+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
887+
if ([[UIApplication sharedApplication].delegate respondsToSelector:@selector(application:didReceiveLocalNotification:)]) {
888+
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
889+
localNotification.alertTitle = title;
890+
localNotification.alertBody = body;
891+
localNotification.userInfo = apptentiveUserInfo;
892+
localNotification.soundName = [soundName isEqualToString:@"default"] ? UILocalNotificationDefaultSoundName : soundName;
882893

883-
if ([[UIApplication sharedApplication].delegate respondsToSelector:@selector(application:didReceiveLocalNotification:)]) {
884-
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
885-
localNotification.alertTitle = title;
886-
localNotification.alertBody = body;
887-
localNotification.userInfo = apptentiveUserInfo;
888-
localNotification.soundName = [soundName isEqualToString:@"default"] ? UILocalNotificationDefaultSoundName : soundName;
894+
[[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];
889895

890-
[[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];
891-
} else {
892-
ApptentiveLogError(ApptentiveLogTagPush, @"Your app is not properly configured to accept Apptentive Message Center push notifications.");
893-
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.");
896+
return;
897+
}
898+
#pragma clang diagnostic pop
894899
}
900+
901+
ApptentiveLogError(ApptentiveLogTagPush, @"Your app is not properly configured to accept Apptentive Message Center push notifications.");
902+
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.");
895903
}
896904

897905
#pragma mark - UNUserNotificationCenterDelegate methods

Apptentive/Apptentive/ApptentiveStyleSheet.m

+12-10
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,8 @@ - (instancetype)init {
338338
_sizeAdjustment = 1.0;
339339

340340
if (@available(iOS 13.0, *)) {
341-
#ifdef __IPHONE_13_0
342341
_secondaryColor = [UIColor secondaryLabelColor];
343342
_failureColor = [UIColor systemRedColor];
344-
#else
345-
_secondaryColor = [UIColor colorWithRed:118.0 / 255.0 green:118.0 / 255.0 blue:122.0 / 255.0 alpha:1.0];
346-
_failureColor = [UIColor colorWithRed:218.0 / 255.0 green:53.0 / 255.0 blue:71.0 / 255.0 alpha:1.0];
347-
#endif
348343
} else {
349344
_secondaryColor = [UIColor colorWithRed:118.0 / 255.0 green:118.0 / 255.0 blue:122.0 / 255.0 alpha:1.0];
350345
_failureColor = [UIColor colorWithRed:218.0 / 255.0 green:53.0 / 255.0 blue:71.0 / 255.0 alpha:1.0];
@@ -459,25 +454,32 @@ - (UIColor *)appearanceColorForClass:(Class)klass property:(SEL)propertySelector
459454

460455
- (void)inheritDefaultColors {
461456
if (@available(iOS 13.0, *)) {
462-
#ifdef __IPHONE_13_0
463457
_primaryColor = self.primaryColor ?: [UIColor labelColor];
464458
_separatorColor = self.separatorColor ?: [UIColor separatorColor];
465459
_backgroundColor = self.backgroundColor ?: [UIColor systemBackgroundColor];
466460
_collectionBackgroundColor = self.collectionBackgroundColor ?: [UIColor systemGroupedBackgroundColor];
467461
_placeholderColor = self.placeholderColor ?: [UIColor placeholderTextColor];
468-
#else
469-
[self inheritAppearanceColors];
470-
#endif
471462
} else {
472463
[self inheritAppearanceColors];
473464
}
474465
}
475466

476467
- (void)inheritAppearanceColors {
468+
UIColor *tableViewBackgroundColor;
469+
470+
if (@available(iOS 13.0, *)) {
471+
tableViewBackgroundColor = UIColor.systemGroupedBackgroundColor;
472+
} else {
473+
#pragma clang diagnostic push
474+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
475+
tableViewBackgroundColor = UIColor.groupTableViewBackgroundColor;
476+
#pragma clang diagnostic pop
477+
}
478+
477479
_primaryColor = self.primaryColor ?: [self appearanceColorForClass:[UILabel class] property:@selector(textColor) default:[UIColor blackColor]];
478480
_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]];
479481
_backgroundColor = self.backgroundColor ?: [self appearanceColorForClass:[UITableViewCell class] property:@selector(backgroundColor) default:[UIColor whiteColor]];
480-
_collectionBackgroundColor = self.collectionBackgroundColor ?: [self appearanceColorForClass:[UITableView class] property:@selector(backgroundColor) default:[UIColor groupTableViewBackgroundColor]];
482+
_collectionBackgroundColor = self.collectionBackgroundColor ?: [self appearanceColorForClass:[UITableView class] property:@selector(backgroundColor) default:tableViewBackgroundColor];
481483
_placeholderColor = self.placeholderColor ?: [UIColor colorWithRed:0 green:0 blue:25.0 / 255.0 alpha:56.0 / 255.0];
482484
}
483485

Apptentive/Apptentive/Custom Views/ApptentiveHUDViewController.m

-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ @interface ApptentiveHUDViewController ()
1616

1717
@property (strong, nonatomic) IBOutlet UIView *HUDView;
1818
@property (nullable, strong, nonatomic) UIWindow *hostWindow;
19-
@property (strong, nonatomic) UIWindow *previousKeyWindow;
2019
@property (strong, nonatomic) NSTimer *hideTimer;
2120
@property (strong, nonatomic) UIGestureRecognizer *tapGestureRecognizer;
2221

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

9897
self.hostWindow = [[ApptentivePassThroughWindow alloc] init];
99-
self.previousKeyWindow = [UIApplication sharedApplication].keyWindow;
10098

10199
[self.hostWindow makeKeyAndVisible];
102100
self.hostWindow.rootViewController = self;
@@ -121,7 +119,6 @@ - (IBAction)hide:(id)sender {
121119
}
122120
completion:^(BOOL finished) {
123121
self.hostWindow.hidden = YES;
124-
[self.previousKeyWindow makeKeyWindow];
125122
self.hostWindow = nil;
126123
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, nil);
127124
}];

Apptentive/Apptentive/Custom Views/ApptentiveUnreadMessagesBadgeView.m

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ + (instancetype)unreadMessageCountViewBadgeWithApptentiveHeart {
2525
ApptentiveUnreadMessagesBadgeView *badge = [[self alloc] initWithFrame:CGRectMake(0, 0, 32.0, 32.0)];
2626

2727
UILabel *label = [self unreadMessageCountLabel];
28-
label.textColor = [UIColor blackColor];
28+
if (@available(iOS 13.0, *)) {
29+
label.textColor = [UIColor labelColor];
30+
} else {
31+
label.textColor = [UIColor blackColor];
32+
}
2933
[label setCenter:CGPointMake(badge.frame.size.width / 2, badge.frame.size.height / 2)];
3034
badge.label = label;
3135
[badge addSubview:label];

Apptentive/Apptentive/Engagement/Interactions/Notes/ApptentiveInteractionNavigateToLink.m

+18-21
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#import "ApptentiveInteraction.h"
1111
#import "Apptentive_Private.h"
1212
#import "ApptentiveBackend+Engagement.h"
13+
#import "ApptentiveURLOpener.h"
1314

1415
NS_ASSUME_NONNULL_BEGIN
1516

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

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

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

39-
if (attemptToOpenURL) {
40-
openedURL = [[UIApplication sharedApplication] openURL:url];
41-
if (!openedURL) {
35+
[Apptentive.shared.backend engage:ATInteractionNavigateToLinkEventLabelNavigate fromInteraction:self.interaction fromViewController:nil userInfo:userInfo];
36+
};
37+
38+
if (!url) {
39+
ApptentiveLogError(ApptentiveLogTagInteractions, @"No URL was included in the NavigateToLink Interaction's configuration.");
40+
engageBlock(NO);
41+
} else if (![[UIApplication sharedApplication] canOpenURL:url]) {
42+
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"No application can open the Interaction's URL (%@), or the %@ scheme is missing from Info.plist's LSApplicationQueriesSchemes value.", url, url.scheme);
43+
engageBlock(NO);
44+
} else {
45+
[ApptentiveURLOpener openURL:url completionHandler:^(BOOL success) {
46+
if (!success) {
4247
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"Could not open URL %@.", url);
4348
}
44-
} else {
45-
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"No application can open the Interaction's URL (%@), or the %@ scheme is missing from Info.plist's LSApplicationQueriesSchemes value.", url, url.scheme);
46-
}
47-
} else {
48-
ApptentiveLogError(ApptentiveLogTagInteractions, @"No URL was included in the NavigateToLink Interaction's configuration.");
49-
}
5049

51-
NSDictionary *userInfo = @{ @"url": (urlString ?: [NSNull null]),
52-
@"success": @(openedURL),
53-
};
54-
55-
[Apptentive.shared.backend engage:ATInteractionNavigateToLinkEventLabelNavigate fromInteraction:self.interaction fromViewController:nil userInfo:userInfo];
50+
engageBlock(success);
51+
}];
52+
}
5653
}
5754

5855
@end

Apptentive/Apptentive/Engagement/Interactions/Rating Flow/ApptentiveInteractionAppStoreController.m

+9-13
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#import "ApptentiveUtilities.h"
1414
#import "Apptentive_Private.h"
1515
#import "UIAlertController+Apptentive.h"
16+
#import "ApptentiveURLOpener.h"
1617

1718
NS_ASSUME_NONNULL_BEGIN
1819

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

123-
BOOL attemptToOpenURL = [[UIApplication sharedApplication] canOpenURL:url];
124-
125-
// In iOS 9, `canOpenURL:` returns NO unless that URL scheme has been added to LSApplicationQueriesSchemes.
126-
if (!attemptToOpenURL) {
127-
attemptToOpenURL = YES;
128-
}
129-
130-
if (attemptToOpenURL) {
124+
if ([[UIApplication sharedApplication] canOpenURL:url]) {
131125
[Apptentive.shared.backend engage:ATInteractionAppStoreRatingEventLabelOpenAppStoreURL fromInteraction:self.interaction fromViewController:self.presentingViewController];
132126

133-
BOOL openedURL = [[UIApplication sharedApplication] openURL:url];
134-
if (!openedURL) {
135-
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"Could not open App Store URL: %@", url);
136-
}
127+
[ApptentiveURLOpener openURL:url completionHandler:^(BOOL success) {
128+
if (!success) {
129+
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"Could not open App Store URL: %@", url);
130+
[self showUnableToOpenAppStoreDialog];
131+
}
132+
}];
137133
} else {
138-
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"No application can open the URL: %@", url);
134+
ApptentiveLogWarning(ApptentiveLogTagInteractions, @"No application can open the Interaction's URL (%@), or the %@ scheme is missing from Info.plist's LSApplicationQueriesSchemes value.", url, url.scheme);
139135
[self showUnableToOpenAppStoreDialog];
140136
}
141137
} else {

Apptentive/Apptentive/Engagement/Model/ApptentiveAppRelease.m

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343

4444
@implementation ApptentiveAppRelease
4545

46+
+ (BOOL)supportsSecureCoding {
47+
return YES;
48+
}
49+
4650
- (instancetype)init {
4751
self = [super init];
4852

Apptentive/Apptentive/Engagement/Model/ApptentiveConversation.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ extern NSString *NSStringFromApptentiveConversationState(ApptentiveConversationS
255255
The `ApptentiveLegacyConversation` object is used to unarchive data for
256256
migrating from older (<= 3.4.x) versions of the Apptentive SDK.
257257
*/
258-
@interface ApptentiveLegacyConversation : NSObject <NSCoding>
258+
@interface ApptentiveLegacyConversation : NSObject <NSSecureCoding>
259259

260260

261261
/**

0 commit comments

Comments
 (0)