From 66392a2fb243acc71fdd9c50ad061338ae1c590f Mon Sep 17 00:00:00 2001 From: Frank Schmitt Date: Tue, 14 Apr 2020 10:43:49 -0700 Subject: [PATCH] Apptentive IOS SDK 5.2.10 --- .../Apptentive.xcodeproj/project.pbxproj | 8 +-- Apptentive/Apptentive/Apptentive.h | 20 ++++++- Apptentive/Apptentive/Apptentive.m | 35 ++++++++---- Apptentive/Apptentive/Apptentive.storyboard | 56 ++++++++++++------- Apptentive/Apptentive/Info.plist | 2 +- .../ApptentiveSurveyViewController.m | 26 +++++++++ .../ApptentiveSurveyViewModel.h | 2 + .../ApptentiveSurveyViewModel.m | 52 +++++++++++++++++ .../ApptentiveTests/ApptentiveSurveyTests.m | 29 ++++++++++ Apptentive/ApptentiveTests/Info.plist | 2 +- CHANGELOG.md | 6 ++ Example/Podfile.lock | 4 +- apptentive-ios.podspec | 2 +- 13 files changed, 201 insertions(+), 43 deletions(-) diff --git a/Apptentive/Apptentive.xcodeproj/project.pbxproj b/Apptentive/Apptentive.xcodeproj/project.pbxproj index cb5ecb62c..2aaefcdab 100644 --- a/Apptentive/Apptentive.xcodeproj/project.pbxproj +++ b/Apptentive/Apptentive.xcodeproj/project.pbxproj @@ -2405,7 +2405,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 37; + CURRENT_PROJECT_VERSION = 38; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -2463,7 +2463,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 37; + CURRENT_PROJECT_VERSION = 38; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -2495,7 +2495,7 @@ DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 86WML2UN43; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 37; + DYLIB_CURRENT_VERSION = 38; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREFIX_HEADER = "Apptentive/Misc/ApptentiveConnect-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = "APPTENTIVE_DEBUG=1"; @@ -2515,7 +2515,7 @@ DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 86WML2UN43; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 37; + DYLIB_CURRENT_VERSION = 38; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREFIX_HEADER = "Apptentive/Misc/ApptentiveConnect-Prefix.pch"; INFOPLIST_FILE = Apptentive/Info.plist; diff --git a/Apptentive/Apptentive/Apptentive.h b/Apptentive/Apptentive/Apptentive.h index dbb24ac26..0603a91c0 100644 --- a/Apptentive/Apptentive/Apptentive.h +++ b/Apptentive/Apptentive/Apptentive.h @@ -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.9" +#define kApptentiveVersionString @"5.2.10" /** The version number of the Apptentive API platform. */ #define kApptentiveAPIVersionString @"9" @@ -84,7 +84,7 @@ extern NSNotificationName const ApptentiveSurveySentNotification; extern NSNotificationName const ApptentiveMessageSentNotification; /** Notification user info key whose value indicates whether the message was sent by the user or using a sendAttachment method. */ -extern NSString * const ApptentiveSentByUserKey; +extern NSString *const ApptentiveSentByUserKey; /** Error domain for the Apptentive SDK */ extern NSString *const ApptentiveErrorDomain; @@ -127,6 +127,16 @@ typedef NS_ENUM(NSUInteger, ApptentiveLogLevel) { ApptentiveLogLevelVerbose = 6 }; +@interface TermsAndConditions : NSObject + +@property (nullable, strong, nonatomic, readonly) NSString *bodyText; +@property (nullable, strong, nonatomic, readonly) NSString *linkText; +@property (nullable, strong, nonatomic, readonly) NSURL *linkURL; + +- (instancetype)initWithBodyText:(nullable NSString *)bodyText linkText:(nullable NSString *)linkText linkURL:(nullable NSURL *)linkURL; + +@end + /** An `ApptentiveConfiguration` instance is used to pass configuration parameters into the `-registerWithConfiguration:` method. @@ -164,6 +174,9 @@ typedef NS_ENUM(NSUInteger, ApptentiveLogLevel) { /** If set, shows a button in Surveys and Message Center that presents information about Apptentive including a link to our privacy policy. */ @property (assign, nonatomic) BOOL showInfoButton; +/** If set, shows a valid combination of terms & conditions and/or a link with an optional text mask, below the submit button in Surveys. */ +@property (copy, nonatomic, nullable) TermsAndConditions* surveyTermsAndConditions; + /** Returns an instance of the `ApptentiveConfiguration` class initialized with the specified parameters. @@ -246,6 +259,9 @@ typedef NS_ENUM(NSUInteger, ApptentiveLogLevel) { @property (readonly, nonatomic) BOOL showInfoButton; +@property (copy, nonatomic, nullable, readonly) TermsAndConditions* surveyTermsAndConditions; + + /** An object conforming to the `ApptentiveDelegate` protocol. If a `nil` value is passed for the view controller into methods such as `-engage:fromViewController`, the SDK will request a view controller from the delegate from which to present an interaction. diff --git a/Apptentive/Apptentive/Apptentive.m b/Apptentive/Apptentive/Apptentive.m index 944470211..d964ffccb 100644 --- a/Apptentive/Apptentive/Apptentive.m +++ b/Apptentive/Apptentive/Apptentive.m @@ -55,6 +55,27 @@ static Apptentive *_sharedInstance; static Apptentive *_nullInstance; +@implementation TermsAndConditions + +- (instancetype)initWithBodyText:(nullable NSString *)bodyText linkText:(nullable NSString *)linkText linkURL:(nullable NSURL *)linkURL { + + self = [super init]; + + if (self) { + _bodyText = bodyText; + _linkText = linkText; + _linkURL = linkURL; + } + + return self; +} + +- (id)copyWithZone:(nullable NSZone *)zone { + return [[[self class] alloc] initWithBodyText: [self.bodyText copy] linkText: [self.linkText copy] linkURL: [self.linkURL copy]]; +} + +@end + @implementation ApptentiveConfiguration @@ -145,7 +166,9 @@ - (id)initWithConfiguration:(ApptentiveConfiguration *)configuration { _appID = configuration.appID; _showInfoButton = configuration.showInfoButton; - + + _surveyTermsAndConditions = configuration.surveyTermsAndConditions; + setShouldSanitizeApptentiveLogMessages(configuration.shouldSanitizeLogMessages); _backend = [[ApptentiveBackend alloc] initWithApptentiveKey:_apptentiveKey @@ -1074,16 +1097,6 @@ @implementation ApptentiveNavigationController // Container to allow customization of Apptentive UI using UIAppearance -- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self) { - if (!([UINavigationBar appearance].barTintColor || [UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[ApptentiveNavigationController class]]].barTintColor)) { - [UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[ApptentiveNavigationController class]]].barTintColor = [UIColor whiteColor]; - } - } - return self; -} - - (void)presentAnimated:(BOOL)animated completion:(void (^__nullable)(void))completion { self.apptentiveAlertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.apptentiveAlertWindow.rootViewController = [[UIViewController alloc] init]; diff --git a/Apptentive/Apptentive/Apptentive.storyboard b/Apptentive/Apptentive/Apptentive.storyboard index 68cee7fe9..511537c05 100644 --- a/Apptentive/Apptentive/Apptentive.storyboard +++ b/Apptentive/Apptentive/Apptentive.storyboard @@ -1,14 +1,14 @@ - + - + - + @@ -1132,7 +1132,6 @@ Your feedback is hosted by Apptentive and is subject to both Apptentive’s priv - @@ -1204,7 +1203,7 @@ Your feedback is hosted by Apptentive and is subject to both Apptentive’s priv - + @@ -1632,13 +1633,13 @@ Lines