Skip to content

Commit 00bb088

Browse files
authored
Merge pull request #215 from apptentive/rc/5.0.4
Release 5.0.4
2 parents 96a5f6e + cec2002 commit 00bb088

File tree

9 files changed

+44
-20
lines changed

9 files changed

+44
-20
lines changed

Apptentive/Apptentive.xcodeproj/project.pbxproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -2306,7 +2306,7 @@
23062306
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
23072307
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
23082308
COPY_PHASE_STRIP = NO;
2309-
CURRENT_PROJECT_VERSION = 3;
2309+
CURRENT_PROJECT_VERSION = 9;
23102310
DEBUG_INFORMATION_FORMAT = dwarf;
23112311
ENABLE_STRICT_OBJC_MSGSEND = YES;
23122312
ENABLE_TESTABILITY = YES;
@@ -2363,7 +2363,7 @@
23632363
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
23642364
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
23652365
COPY_PHASE_STRIP = NO;
2366-
CURRENT_PROJECT_VERSION = 3;
2366+
CURRENT_PROJECT_VERSION = 9;
23672367
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
23682368
ENABLE_NS_ASSERTIONS = NO;
23692369
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -2395,7 +2395,7 @@
23952395
DEFINES_MODULE = YES;
23962396
DEVELOPMENT_TEAM = 86WML2UN43;
23972397
DYLIB_COMPATIBILITY_VERSION = 1;
2398-
DYLIB_CURRENT_VERSION = 3;
2398+
DYLIB_CURRENT_VERSION = 9;
23992399
DYLIB_INSTALL_NAME_BASE = "@rpath";
24002400
GCC_PREFIX_HEADER = "Apptentive/Misc/ApptentiveConnect-Prefix.pch";
24012401
GCC_PREPROCESSOR_DEFINITIONS = "APPTENTIVE_DEBUG=1";
@@ -2417,7 +2417,7 @@
24172417
DEFINES_MODULE = YES;
24182418
DEVELOPMENT_TEAM = 86WML2UN43;
24192419
DYLIB_COMPATIBILITY_VERSION = 1;
2420-
DYLIB_CURRENT_VERSION = 3;
2420+
DYLIB_CURRENT_VERSION = 9;
24212421
DYLIB_INSTALL_NAME_BASE = "@rpath";
24222422
GCC_PREFIX_HEADER = "Apptentive/Misc/ApptentiveConnect-Prefix.pch";
24232423
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
@@ -2468,7 +2468,7 @@
24682468
DEFINES_MODULE = YES;
24692469
DEVELOPMENT_TEAM = 86WML2UN43;
24702470
DYLIB_COMPATIBILITY_VERSION = 1;
2471-
DYLIB_CURRENT_VERSION = 3;
2471+
DYLIB_CURRENT_VERSION = 9;
24722472
DYLIB_INSTALL_NAME_BASE = "@rpath";
24732473
INFOPLIST_FILE = ApptentiveDebugging/Info.plist;
24742474
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -2487,7 +2487,7 @@
24872487
DEFINES_MODULE = YES;
24882488
DEVELOPMENT_TEAM = 86WML2UN43;
24892489
DYLIB_COMPATIBILITY_VERSION = 1;
2490-
DYLIB_CURRENT_VERSION = 3;
2490+
DYLIB_CURRENT_VERSION = 9;
24912491
DYLIB_INSTALL_NAME_BASE = "@rpath";
24922492
INFOPLIST_FILE = ApptentiveDebugging/Info.plist;
24932493
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";

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.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

+24-6
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

+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.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

+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.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

+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.0.3</string>
18+
<string>5.0.4</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-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

+3-3
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

+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.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)