Skip to content

Commit cec2002

Browse files
authored
Merge pull request #214 from apptentive/branch_5.0.4
Release 5.0.4
2 parents fceb515 + cc04b30 commit cec2002

File tree

9 files changed

+44
-20
lines changed

9 files changed

+44
-20
lines changed

Apptentive/Apptentive.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,7 +2305,7 @@
23052305
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
23062306
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
23072307
COPY_PHASE_STRIP = NO;
2308-
CURRENT_PROJECT_VERSION = 3;
2308+
CURRENT_PROJECT_VERSION = 9;
23092309
DEBUG_INFORMATION_FORMAT = dwarf;
23102310
ENABLE_STRICT_OBJC_MSGSEND = YES;
23112311
ENABLE_TESTABILITY = YES;
@@ -2361,7 +2361,7 @@
23612361
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
23622362
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
23632363
COPY_PHASE_STRIP = NO;
2364-
CURRENT_PROJECT_VERSION = 3;
2364+
CURRENT_PROJECT_VERSION = 9;
23652365
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
23662366
ENABLE_NS_ASSERTIONS = NO;
23672367
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -2393,7 +2393,7 @@
23932393
DEFINES_MODULE = YES;
23942394
DEVELOPMENT_TEAM = 86WML2UN43;
23952395
DYLIB_COMPATIBILITY_VERSION = 1;
2396-
DYLIB_CURRENT_VERSION = 3;
2396+
DYLIB_CURRENT_VERSION = 9;
23972397
DYLIB_INSTALL_NAME_BASE = "@rpath";
23982398
GCC_PREFIX_HEADER = "Apptentive/Misc/ApptentiveConnect-Prefix.pch";
23992399
GCC_PREPROCESSOR_DEFINITIONS = "APPTENTIVE_DEBUG=1";
@@ -2415,7 +2415,7 @@
24152415
DEFINES_MODULE = YES;
24162416
DEVELOPMENT_TEAM = 86WML2UN43;
24172417
DYLIB_COMPATIBILITY_VERSION = 1;
2418-
DYLIB_CURRENT_VERSION = 3;
2418+
DYLIB_CURRENT_VERSION = 9;
24192419
DYLIB_INSTALL_NAME_BASE = "@rpath";
24202420
GCC_PREFIX_HEADER = "Apptentive/Misc/ApptentiveConnect-Prefix.pch";
24212421
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
@@ -2466,7 +2466,7 @@
24662466
DEFINES_MODULE = YES;
24672467
DEVELOPMENT_TEAM = 86WML2UN43;
24682468
DYLIB_COMPATIBILITY_VERSION = 1;
2469-
DYLIB_CURRENT_VERSION = 3;
2469+
DYLIB_CURRENT_VERSION = 9;
24702470
DYLIB_INSTALL_NAME_BASE = "@rpath";
24712471
INFOPLIST_FILE = ApptentiveDebugging/Info.plist;
24722472
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -2485,7 +2485,7 @@
24852485
DEFINES_MODULE = YES;
24862486
DEVELOPMENT_TEAM = 86WML2UN43;
24872487
DYLIB_COMPATIBILITY_VERSION = 1;
2488-
DYLIB_CURRENT_VERSION = 3;
2488+
DYLIB_CURRENT_VERSION = 9;
24892489
DYLIB_INSTALL_NAME_BASE = "@rpath";
24902490
INFOPLIST_FILE = ApptentiveDebugging/Info.plist;
24912491
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";

Apptentive/Apptentive/Apptentive.h

Lines changed: 1 addition & 1 deletion
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.0.3"
23+
#define kApptentiveVersionString @"5.0.4"
2424

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

Apptentive/Apptentive/Engagement/Model/ApptentiveConversationManager.m

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
static NSInteger ApptentiveInternalInconsistency = -201;
4949
static NSInteger ApptentiveAlreadyLoggedInErrorCode = -202;
5050
static NSInteger ApptentiveInBackgroundErrorCode = -203;
51+
static NSInteger ApptentiveLoginRequestInProcessErrorCode = -204;
5152

5253
NSString *const ApptentiveConversationStateDidChangeNotification = @"ApptentiveConversationStateDidChangeNotification";
5354
NSString *const ApptentiveConversationStateDidChangeNotificationKeyConversation = @"conversation";
@@ -295,6 +296,12 @@ - (void)createMessageManagerForConversation:(ApptentiveConversation *)conversati
295296
- (void)endActiveConversation {
296297
ApptentiveAssertOperationQueue(self.operationQueue);
297298

299+
if (self.loginRequestOperation != nil) {
300+
ApptentiveLogInfo(ApptentiveLogTagConversation, @"Cancelling login request due to logout");
301+
[self.loginRequestOperation cancel];
302+
self.loginRequestOperation = nil;
303+
}
304+
298305
if (self.activeConversation != nil) {
299306
ApptentiveMutableConversation *conversation = [self.activeConversation mutableCopy];
300307

@@ -470,13 +477,18 @@ - (BOOL)saveMetadata {
470477
- (void)logInWithToken:(NSString *)token completion:(void (^)(BOOL, NSError *_Nonnull))completion {
471478
ApptentiveAssertOperationQueue(self.operationQueue);
472479

473-
self.loginCompletionBlock = [completion copy];
474-
475-
[self requestLoggedInConversationWithToken:token];
480+
[self requestLoggedInConversationWithToken:token completion:completion];
476481
}
477482

478-
- (void)requestLoggedInConversationWithToken:(NSString *)token {
483+
- (void)requestLoggedInConversationWithToken:(NSString *)token completion:(void (^)(BOOL, NSError *_Nonnull))completion {
479484
[self.operationQueue dispatchAsync:^{
485+
self.loginCompletionBlock = [completion copy];
486+
487+
if (self.loginRequestOperation != nil) {
488+
[self failLoginWithErrorCode:ApptentiveLoginRequestInProcessErrorCode failureReason:@"Login request already in process."];
489+
return;
490+
}
491+
480492
if (!Apptentive.shared.backend.foreground) {
481493
[self failLoginWithErrorCode:ApptentiveInBackgroundErrorCode failureReason:@"App is in background state"];
482494
return;
@@ -583,8 +595,14 @@ - (void)failLoginWithErrorCode:(NSInteger)errorCode failureReason:(NSString *)fo
583595
}
584596

585597
- (void)completeLoginSuccess:(BOOL)success error:(nullable NSError *)error {
586-
self.loginCompletionBlock(success, error);
587-
self.loginCompletionBlock = nil;
598+
ApptentiveAssertNotNil(self.loginCompletionBlock, @"Login completion block was nil");
599+
600+
if (_loginCompletionBlock != nil) {
601+
self.loginCompletionBlock(success, error);
602+
self.loginCompletionBlock = nil;
603+
} else {
604+
ApptentiveLogError(ApptentiveLogTagConversation, @"Unexpectedly found nil login completion block");
605+
}
588606
}
589607

590608
#pragma mark - ApptentiveConversationDelegate

Apptentive/Apptentive/Info.plist

Lines changed: 1 addition & 1 deletion
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.0.3</string>
18+
<string>5.0.4</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

Apptentive/ApptentiveDebugging/Info.plist

Lines changed: 1 addition & 1 deletion
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.0.3</string>
18+
<string>5.0.4</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

Apptentive/ApptentiveTests/Info.plist

Lines changed: 1 addition & 1 deletion
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.0.3</string>
18+
<string>5.0.4</string>
1919
<key>CFBundleVersion</key>
2020
<string>1</string>
2121
</dict>

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2018-05-04 - v5.0.4
2+
3+
#### Bugs Fixed
4+
5+
- Fixed a race condition where two login operations could overlap, potentially causing a crash.
6+
17
# 2018-03-07 - v5.0.3
28

39
#### Bugs Fixed

Example/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- apptentive-ios (5.0.3)
2+
- apptentive-ios (5.0.4)
33

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

1111
SPEC CHECKSUMS:
12-
apptentive-ios: ad55e169a5ad1d1b999f4f9e996948a2227c1bce
12+
apptentive-ios: a309254660710639ca9110b1f8d3c072b4cf6e7f
1313

1414
PODFILE CHECKSUM: fb7822acbd17e9b6c60d2db75808647cc370b6a0
1515

16-
COCOAPODS: 1.3.1
16+
COCOAPODS: 1.4.0

apptentive-ios.podspec

Lines changed: 1 addition & 1 deletion
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.0.3'
4+
s.version = '5.0.4'
55
s.license = 'BSD'
66
s.summary = 'Apptentive Customer Communications SDK.'
77
s.homepage = 'https://www.apptentive.com/'

0 commit comments

Comments
 (0)