Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 5.2.9 #258

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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,16 @@ - (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);
}
}];
} 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
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
27 changes: 23 additions & 4 deletions Apptentive/Apptentive/Engagement/Model/ApptentiveConversation.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#import "ApptentiveSDK.h"
#import "ApptentiveUtilities.h"
#import "ApptentiveVersion.h"
#import "ApptentiveUnarchiver.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -87,6 +88,10 @@ @interface ApptentiveConversation ()

@implementation ApptentiveConversation

+ (BOOL)supportsSecureCoding {
return YES;
}

- (instancetype)initWithState:(ApptentiveConversationState)state {
self = [super init];
if (self) {
Expand Down Expand Up @@ -122,8 +127,10 @@ - (nullable instancetype)initWithCoder:(NSCoder *)coder {
_identifier = [coder decodeObjectOfClass:[NSString class] forKey:IdentifierKey];
_localIdentifier = [coder decodeObjectOfClass:[NSString class] forKey:LocalIdentifierKey] ?: [[NSUUID UUID] UUIDString];
_directoryName = [coder decodeObjectOfClass:[NSString class] forKey:DirectoryNameKey];
_lastSentDevice = [coder decodeObjectOfClass:[NSDictionary class] forKey:LastSentDeviceKey];
_lastSentPerson = [coder decodeObjectOfClass:[NSDictionary class] forKey:LastSentPersonKey];

NSSet *allowedClasses = [NSSet setWithArray:@[[NSDictionary class], [NSString class]]];
_lastSentDevice = [coder decodeObjectOfClasses:allowedClasses forKey:LastSentDeviceKey];
_lastSentPerson = [coder decodeObjectOfClasses:allowedClasses forKey:LastSentPersonKey];
}
return self;
}
Expand Down Expand Up @@ -302,7 +309,7 @@ - (instancetype)initAndMigrate {
[NSKeyedUnarchiver setClass:[ApptentiveLegacyConversation class] forClassName:@"ApptentiveConversation"];
[NSKeyedUnarchiver setClass:[ApptentiveLegacyConversation class] forClassName:@"ATConversation"];

ApptentiveLegacyConversation *legacyConversation = (ApptentiveLegacyConversation *)[NSKeyedUnarchiver unarchiveObjectWithData:legacyConversationData];
ApptentiveLegacyConversation *legacyConversation = [ApptentiveUnarchiver unarchivedObjectOfClass:[ApptentiveLegacyConversation class] fromData:legacyConversationData];

[NSKeyedUnarchiver setClass:[self class] forClassName:@"ApptentiveConversation"];

Expand All @@ -329,7 +336,7 @@ - (instancetype)initAndMigrate {
NSData *lastSentPersondata = [[NSUserDefaults standardUserDefaults] dataForKey:ATPersonLastUpdateValuePreferenceKey];

if (lastSentPersondata != nil) {
NSDictionary *person = [NSKeyedUnarchiver unarchiveObjectWithData:lastSentPersondata];
NSDictionary *person = [ApptentiveUnarchiver unarchivedObjectOfClass:[NSDictionary class] fromData:lastSentPersondata];
if ([person isKindOfClass:[NSDictionary class]]) {
_lastSentPerson = person[@"person"];
} else {
Expand Down Expand Up @@ -487,6 +494,10 @@ - (id)mutableCopy {

@implementation ApptentiveLegacyConversation

+ (BOOL)supportsSecureCoding {
return YES;
}

+ (void)load {
[NSKeyedUnarchiver setClass:self forClassName:@"ATConversation"];
}
Expand Down Expand Up @@ -543,6 +554,14 @@ @implementation ApptentiveMutableConversation
@dynamic directoryName;
@dynamic sessionIdentifier;

+ (BOOL)supportsSecureCoding {
return YES;
}

- (nullable instancetype)initWithCoder:(NSCoder *)coder {
return [super initWithCoder:coder];
}

- (void)setToken:(NSString *)token conversationID:(NSString *)conversationID personID:(NSString *)personID deviceID:(NSString *)deviceID {
[self setConversationIdentifier:conversationID JWT:token];
self.person.identifier = personID;
Expand Down
Loading