Skip to content

Commit 98f7eb9

Browse files
authored
Merge pull request #220 from apptentive/branch_5.2.0
Release 5.2.0
2 parents 992ca13 + de29ac8 commit 98f7eb9

File tree

8 files changed

+45
-10
lines changed

8 files changed

+45
-10
lines changed

Apptentive/Apptentive.xcodeproj/project.pbxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -2382,7 +2382,7 @@
23822382
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
23832383
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
23842384
COPY_PHASE_STRIP = NO;
2385-
CURRENT_PROJECT_VERSION = 15;
2385+
CURRENT_PROJECT_VERSION = 16;
23862386
DEBUG_INFORMATION_FORMAT = dwarf;
23872387
ENABLE_STRICT_OBJC_MSGSEND = YES;
23882388
ENABLE_TESTABILITY = YES;
@@ -2440,7 +2440,7 @@
24402440
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
24412441
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
24422442
COPY_PHASE_STRIP = NO;
2443-
CURRENT_PROJECT_VERSION = 15;
2443+
CURRENT_PROJECT_VERSION = 16;
24442444
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
24452445
ENABLE_NS_ASSERTIONS = NO;
24462446
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -2472,7 +2472,7 @@
24722472
DEFINES_MODULE = YES;
24732473
DEVELOPMENT_TEAM = 86WML2UN43;
24742474
DYLIB_COMPATIBILITY_VERSION = 1;
2475-
DYLIB_CURRENT_VERSION = 15;
2475+
DYLIB_CURRENT_VERSION = 16;
24762476
DYLIB_INSTALL_NAME_BASE = "@rpath";
24772477
GCC_PREFIX_HEADER = "Apptentive/Misc/ApptentiveConnect-Prefix.pch";
24782478
GCC_PREPROCESSOR_DEFINITIONS = "APPTENTIVE_DEBUG=1";
@@ -2494,7 +2494,7 @@
24942494
DEFINES_MODULE = YES;
24952495
DEVELOPMENT_TEAM = 86WML2UN43;
24962496
DYLIB_COMPATIBILITY_VERSION = 1;
2497-
DYLIB_CURRENT_VERSION = 15;
2497+
DYLIB_CURRENT_VERSION = 16;
24982498
DYLIB_INSTALL_NAME_BASE = "@rpath";
24992499
GCC_PREFIX_HEADER = "Apptentive/Misc/ApptentiveConnect-Prefix.pch";
25002500
GCC_TREAT_WARNINGS_AS_ERRORS = YES;

Apptentive/Apptentive/Apptentive.h

+10-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.1.2"
23+
#define kApptentiveVersionString @"5.2.0"
2424

2525
/** The version number of the Apptentive API platform. */
2626
#define kApptentiveAPIVersionString @"9"
@@ -61,6 +61,9 @@ typedef NS_ENUM(NSInteger, ApptentiveAuthenticationFailureReason) {
6161
/** A block used to notify your app that an authenticated request failed to authenticate. */
6262
typedef void (^ApptentiveAuthenticationFailureCallback)(ApptentiveAuthenticationFailureReason reason, NSString *errorMessage);
6363

64+
/** A block used to interact with the default engagement flow. */
65+
typedef BOOL (^ApptentiveInteractionCallback)(NSString *eventName, NSDictionary * _Nullable customData);
66+
6467
@protocol ApptentiveDelegate
6568
, ApptentiveStyle;
6669

@@ -782,6 +785,12 @@ typedef NS_ENUM(NSUInteger, ApptentiveLogLevel) {
782785
*/
783786
@property (copy, nonatomic) ApptentiveAuthenticationFailureCallback authenticationFailureCallback;
784787

788+
/**
789+
A block that is called right before engaging an interaction. Return `NO` to cancel
790+
the engagement.
791+
*/
792+
@property (copy, nonatomic) ApptentiveInteractionCallback preInteractionCallback;
793+
785794
/**
786795
Updates the login token with the provided one. Used to refresh a token that has expired or may expire soon.
787796

Apptentive/Apptentive/Apptentive.m

+20
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,26 @@ - (void)engage:(NSString *)event withCustomData:(nullable NSDictionary *)customD
541541
};
542542
}
543543

544+
// first, we check if there's an engagement callback to inject
545+
if (self.preInteractionCallback) {
546+
BOOL canShowInteraction = [self.backend canShowInteractionForLocalEvent:event];
547+
if (!canShowInteraction) {
548+
if (wrappedCompletion) {
549+
wrappedCompletion(NO);
550+
}
551+
return;
552+
}
553+
554+
BOOL allowsInteraction = self.preInteractionCallback(event, customData);
555+
ApptentiveLogInfo(@"Engagement callback allows interaction for event '%@': %@", event, allowsInteraction ? @"YES" : @"NO");
556+
if (!allowsInteraction) {
557+
if (wrappedCompletion) {
558+
wrappedCompletion(NO);
559+
}
560+
return;
561+
}
562+
}
563+
544564
[self.backend engageLocalEvent:event userInfo:nil customData:customData extendedData:extendedData fromViewController:viewController completion:wrappedCompletion];
545565
}];
546566
}

Apptentive/Apptentive/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>5.1.2</string>
18+
<string>5.2.0</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

Apptentive/ApptentiveTests/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>5.1.2</string>
18+
<string>5.2.0</string>
1919
<key>CFBundleVersion</key>
2020
<string>1</string>
2121
</dict>

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2018-08-23 - v5.2.0
2+
3+
#### Improvements
4+
5+
* Added `preInteractionCallback` to intercept interactions flow.
6+
17
# 2018-07-05 - v5.1.2
28

39
#### Improvements

Example/Podfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- apptentive-ios (5.1.2)
2+
- apptentive-ios (5.2.0)
33

44
DEPENDENCIES:
55
- apptentive-ios (from `..`)
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
99
:path: ..
1010

1111
SPEC CHECKSUMS:
12-
apptentive-ios: 40ef4adae30fc945684ffd225df1db7748d93c86
12+
apptentive-ios: fafd22764202d97acc37f097d8460a56b704d767
1313

1414
PODFILE CHECKSUM: 89d2b5f4683b04482e89df6d46b268cc9ed1ef79
1515

apptentive-ios.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = 'apptentive-ios'
33
s.module_name = 'Apptentive'
4-
s.version = '5.1.2'
4+
s.version = '5.2.0'
55
s.license = 'BSD'
66
s.summary = 'Apptentive Customer Communications SDK.'
77
s.homepage = 'https://www.apptentive.com/'

0 commit comments

Comments
 (0)