Skip to content

Commit 978b403

Browse files
authored
Merge pull request #224 from apptentive/branch_5.2.2
Release 5.2.2
2 parents 839aff0 + 972ae84 commit 978b403

38 files changed

+217
-163
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 = 19;
2385+
CURRENT_PROJECT_VERSION = 20;
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 = 19;
2443+
CURRENT_PROJECT_VERSION = 20;
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 = 19;
2475+
DYLIB_CURRENT_VERSION = 20;
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 = 19;
2497+
DYLIB_CURRENT_VERSION = 20;
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

+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.2.1"
23+
#define kApptentiveVersionString @"5.2.2"
2424

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

Apptentive/Apptentive/Apptentive.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ - (id)initWithConfiguration:(ApptentiveConfiguration *)configuration {
129129
ApptentiveLogSetLevel(configuration.logLevel);
130130

131131
// we need to initialize dispatch queue before we start log monitor
132-
_operationQueue = [ApptentiveDispatchQueue createQueueWithName:@"Apptentive Main Queue" concurrencyType:ApptentiveDispatchQueueConcurrencyTypeSerial];
132+
_operationQueue = [ApptentiveDispatchQueue createQueueWithName:@"Apptentive Main Queue" concurrencyType:ApptentiveDispatchQueueConcurrencyTypeSerial qualityOfService:NSQualityOfServiceUserInitiated];
133133

134134
// start log writer
135135
ApptentiveStartLogMonitor([ApptentiveUtilities cacheDirectoryPath:@"com.apptentive.logs"]);

Apptentive/Apptentive/Engagement/Model/ApptentiveConversation.h

+10
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ extern NSString *NSStringFromApptentiveConversationState(ApptentiveConversationS
111111
*/
112112
@property (readonly, nonatomic) NSDate *currentTime;
113113

114+
115+
/**
116+
Uniquely identifies the current session, i.e. period between launch and exit.
117+
This should not be persisted.
118+
*/
119+
@property (readonly, nullable, nonatomic) NSString *sessionIdentifier;
120+
121+
- (void)startSession;
122+
- (void)endSession;
123+
114124
/**
115125
Freeform key-value data used for things `NSUserDefaults` would typically be
116126
used for in an app.

Apptentive/Apptentive/Engagement/Model/ApptentiveConversation.m

+11
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ @interface ApptentiveConversation ()
8080
@property (strong, nonatomic) NSDictionary *lastSentPerson;
8181
@property (strong, nonatomic) NSDictionary *lastSentDevice;
8282
@property (strong, nonatomic) NSString *directoryName;
83+
@property (strong, nullable, nonatomic) NSString *sessionIdentifier;
8384

8485
@end
8586

@@ -410,6 +411,14 @@ - (BOOL)isConsistent {
410411
return YES;
411412
}
412413

414+
- (void)startSession {
415+
_sessionIdentifier = [NSUUID.UUID.UUIDString stringByReplacingOccurrencesOfString:@"-" withString:@""];
416+
}
417+
418+
- (void)endSession {
419+
_sessionIdentifier = nil;
420+
}
421+
413422
+ (void)deleteMigratedData {
414423
[ApptentiveAppRelease deleteMigratedData];
415424
[ApptentiveSDK deleteMigratedData];
@@ -468,6 +477,7 @@ - (id)mutableCopy {
468477
result.lastMessageID = self.lastMessageID;
469478
result.delegate = self.delegate;
470479
result.directoryName = self.directoryName;
480+
result.sessionIdentifier = self.sessionIdentifier;
471481
return result;
472482
}
473483

@@ -531,6 +541,7 @@ @implementation ApptentiveMutableConversation
531541
@dynamic encryptionKey;
532542
@dynamic lastMessageID;
533543
@dynamic directoryName;
544+
@dynamic sessionIdentifier;
534545

535546
- (void)setToken:(NSString *)token conversationID:(NSString *)conversationID personID:(NSString *)personID deviceID:(NSString *)deviceID {
536547
[self setConversationIdentifier:conversationID JWT:token];

Apptentive/Apptentive/Engagement/Model/ApptentiveConversationManager.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ extern NSString *const ApptentiveConversationStateDidChangeNotificationKeyConver
3535

3636
@property (readonly, strong, nonatomic) ApptentiveEngagementManifest *manifest;
3737

38-
@property (readonly, strong, nonatomic) NSManagedObjectContext *parentManagedObjectContext;
38+
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
3939

40-
- (instancetype)initWithStoragePath:(NSString *)storagePath operationQueue:(ApptentiveDispatchQueue *)operationQueue client:(ApptentiveClient *)client parentManagedObjectContext:(NSManagedObjectContext *)parentManagedObjectContext;
40+
- (instancetype)initWithStoragePath:(NSString *)storagePath operationQueue:(ApptentiveDispatchQueue *)operationQueue client:(ApptentiveClient *)client managedObjectContext:(NSManagedObjectContext *)managedObjectContext;
4141

4242
/**
4343
* Attempts to load an active conversation.

Apptentive/Apptentive/Engagement/Model/ApptentiveConversationManager.m

+6-6
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ @implementation ApptentiveConversationManager
7575

7676
@synthesize activeConversation = _activeConversation;
7777

78-
- (instancetype)initWithStoragePath:(NSString *)storagePath operationQueue:(ApptentiveDispatchQueue *)operationQueue client:(ApptentiveClient *)client parentManagedObjectContext:(NSManagedObjectContext *)parentManagedObjectContext {
78+
- (instancetype)initWithStoragePath:(NSString *)storagePath operationQueue:(ApptentiveDispatchQueue *)operationQueue client:(ApptentiveClient *)client managedObjectContext:(NSManagedObjectContext *)managedObjectContext {
7979
self = [super init];
8080

8181
if (self) {
8282
_storagePath = storagePath;
8383
_operationQueue = operationQueue;
8484
_client = client;
85-
_parentManagedObjectContext = parentManagedObjectContext;
85+
_managedObjectContext = managedObjectContext;
8686
}
8787

8888
return self;
@@ -305,7 +305,7 @@ - (void)endActiveConversation {
305305

306306
ApptentiveLogoutPayload *payload = [[ApptentiveLogoutPayload alloc] init];
307307

308-
[ApptentiveSerialRequest enqueuePayload:payload forConversation:conversation usingAuthToken:conversation.token inContext:self.parentManagedObjectContext];
308+
[ApptentiveSerialRequest enqueuePayload:payload forConversation:conversation usingAuthToken:conversation.token inContext:self.managedObjectContext];
309309

310310
[self.delegate processQueuedRecords];
311311

@@ -652,7 +652,7 @@ - (void)conversationAppReleaseOrSDKDidChange:(ApptentiveConversation *)conversat
652652

653653
ApptentiveSDKAppReleasePayload *payload = [[ApptentiveSDKAppReleasePayload alloc] initWithConversation:conversation];
654654

655-
[ApptentiveSerialRequest enqueuePayload:payload forConversation:conversation usingAuthToken:conversation.token inContext:self.parentManagedObjectContext];
655+
[ApptentiveSerialRequest enqueuePayload:payload forConversation:conversation usingAuthToken:conversation.token inContext:self.managedObjectContext];
656656

657657
[self.delegate processQueuedRecords];
658658

@@ -666,7 +666,7 @@ - (void)conversation:(ApptentiveConversation *)conversation personDidChange:(NSD
666666

667667
ApptentivePersonPayload *payload = [[ApptentivePersonPayload alloc] initWithPersonDiffs:diffs];
668668

669-
[ApptentiveSerialRequest enqueuePayload:payload forConversation:conversation usingAuthToken:conversation.token inContext:self.parentManagedObjectContext];
669+
[ApptentiveSerialRequest enqueuePayload:payload forConversation:conversation usingAuthToken:conversation.token inContext:self.managedObjectContext];
670670

671671
[self saveConversation:conversation];
672672

@@ -678,7 +678,7 @@ - (void)conversation:(ApptentiveConversation *)conversation deviceDidChange:(NSD
678678

679679
ApptentiveDevicePayload *payload = [[ApptentiveDevicePayload alloc] initWithDeviceDiffs:diffs];
680680

681-
[ApptentiveSerialRequest enqueuePayload:payload forConversation:conversation usingAuthToken:conversation.token inContext:self.parentManagedObjectContext];
681+
[ApptentiveSerialRequest enqueuePayload:payload forConversation:conversation usingAuthToken:conversation.token inContext:self.managedObjectContext];
682682

683683
[self saveConversation:conversation];
684684

Apptentive/Apptentive/Engagement/Persistence/ApptentiveBackend+Engagement.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ - (void)conversation:(ApptentiveConversation *)conversation addMetricWithName:(N
206206
return;
207207
}
208208

209-
ApptentiveEventPayload *payload = [[ApptentiveEventPayload alloc] initWithLabel:name creationDate:[NSDate date]];
209+
ApptentiveEventPayload *payload = [[ApptentiveEventPayload alloc] initWithLabel:name creationDate:[NSDate date] sessionIdentifier:conversation.sessionIdentifier];
210210
payload.interactionIdentifier = fromInteraction.identifier;
211211
payload.userInfo = userInfo;
212212
payload.customData = customData;

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.2.1</string>
18+
<string>5.2.2</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

Apptentive/Apptentive/Message Center/Model/ApptentiveMessage.m

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
static NSString *const AutomatedKey = @"automated";
2323
static NSString *const CustomDataKey = @"customData";
2424
static NSString *const InboundKey = @"inboundKey";
25+
static NSString *const SessionIdentifier = @"sessionIdentifier";
2526

2627

2728
@interface ApptentiveMessage ()

Apptentive/Apptentive/Message Center/Model/ApptentiveMessageManager.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ - (void)enqueueMessageForSending:(ApptentiveMessage *)message {
342342
NSString *previousLocalIdentifier = message.localIdentifier;
343343
ApptentiveConversation *conversation = Apptentive.shared.backend.conversationManager.activeConversation;
344344

345-
ApptentiveMessagePayload *payload = [[ApptentiveMessagePayload alloc] initWithMessage:message];
345+
ApptentiveMessagePayload *payload = [[ApptentiveMessagePayload alloc] initWithMessage:message sessionIdentifier:conversation.sessionIdentifier];
346346

347347
[ApptentiveSerialRequest enqueuePayload:payload forConversation:conversation usingAuthToken:conversation.token inContext:Apptentive.shared.backend.managedObjectContext];
348348

Apptentive/Apptentive/Misc/ApptentiveAsyncLogWriter.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ @interface ApptentiveAsyncLogWriter ()
2727
@implementation ApptentiveAsyncLogWriter
2828

2929
- (instancetype)initWithDestDir:(NSString *)destDir historySize:(NSUInteger)historySize {
30-
return [self initWithDestDir:destDir historySize:historySize queue:[ApptentiveDispatchQueue createQueueWithName:@"Log Queue" concurrencyType:ApptentiveDispatchQueueConcurrencyTypeSerial]];
30+
return [self initWithDestDir:destDir historySize:historySize queue:[ApptentiveDispatchQueue createQueueWithName:@"Log Queue" concurrencyType:ApptentiveDispatchQueueConcurrencyTypeSerial qualityOfService:NSQualityOfServiceBackground]];
3131
}
3232
- (instancetype)initWithDestDir:(NSString *)destDir historySize:(NSUInteger)historySize queue:(ApptentiveDispatchQueue *)queue {
3333
APPTENTIVE_CHECK_INIT_NOT_EMPTY_ARG(destDir)

Apptentive/Apptentive/Misc/ApptentiveDispatchQueue.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,10 @@ extern NSString * _Nullable ApptentiveGetCurrentThreadName(void);
2929
*/
3030
+ (instancetype)main;
3131

32-
/**
33-
@return a global concurrent dispatch queue associated with a background thread.
34-
*/
35-
+ (instancetype)background;
36-
3732
/**
3833
Creates a background queue with a specified name and concurrency type
3934
*/
40-
+ (nullable instancetype)createQueueWithName:(NSString *)name concurrencyType:(ApptentiveDispatchQueueConcurrencyType)type;
35+
+ (nullable instancetype)createQueueWithName:(NSString *)name concurrencyType:(ApptentiveDispatchQueueConcurrencyType)type qualityOfService:(NSQualityOfService)qualityOfService;
4136

4237
- (void)dispatchAsync:(void (^)(void))task;
4338

Apptentive/Apptentive/Misc/ApptentiveDispatchQueue.m

+2-7
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,19 @@ @implementation ApptentiveDispatchQueue
6363
+ (void)initialize {
6464
if ([self class] == [ApptentiveDispatchQueue class]) {
6565
_mainQueue = [[ApptentiveGCDDispatchQueue alloc] initWithQueue:NSOperationQueue.mainQueue];
66-
67-
_backgroundQueue = [self createQueueWithName:@"Apptentive Background Queue" concurrencyType:ApptentiveDispatchQueueConcurrencyTypeConcurrent];
6866
}
6967
}
7068

7169
+ (instancetype)main {
7270
return _mainQueue;
7371
}
7472

75-
+ (instancetype)background {
76-
return _backgroundQueue;
77-
}
78-
79-
+ (nullable instancetype)createQueueWithName:(NSString *)name concurrencyType:(ApptentiveDispatchQueueConcurrencyType)type {
73+
+ (nullable instancetype)createQueueWithName:(NSString *)name concurrencyType:(ApptentiveDispatchQueueConcurrencyType)type qualityOfService:(NSQualityOfService)qualityOfService {
8074
if (type == ApptentiveDispatchQueueConcurrencyTypeSerial) {
8175
NSOperationQueue *queue = [NSOperationQueue new];
8276
queue.name = name;
8377
queue.maxConcurrentOperationCount = 1;
78+
queue.qualityOfService = qualityOfService;
8479
return [[ApptentiveGCDDispatchQueue alloc] initWithQueue:queue];
8580
}
8681

Apptentive/Apptentive/Model/ApptentiveLegacyEvent.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ + (void)enqueueUnsentEventsInContext:(NSManagedObjectContext *)context forConver
3838

3939
for (ApptentiveLegacyEvent *event in unsentEvents) {
4040
NSDate *creationDate = [NSDate dateWithTimeIntervalSince1970:event.clientCreationTime.doubleValue];
41-
ApptentiveEventPayload *payload = [[ApptentiveEventPayload alloc] initWithLabel:event.label creationDate:creationDate];
41+
ApptentiveEventPayload *payload = [[ApptentiveEventPayload alloc] initWithLabel:event.label creationDate:creationDate sessionIdentifier:nil];
4242
ApptentiveAssertNotNil(payload, @"Failed to create an event payload");
4343

4444
// Add custom data, interaction identifier, and extended data

Apptentive/Apptentive/Model/ApptentiveLegacyMessage.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ + (void)enqueueUnsentMessagesInContext:(NSManagedObjectContext *)context forConv
9494
message.state = ApptentiveMessageStateHidden;
9595
}
9696

97-
ApptentiveMessagePayload *payload = [[ApptentiveMessagePayload alloc] initWithMessage:message];
97+
ApptentiveMessagePayload *payload = [[ApptentiveMessagePayload alloc] initWithMessage:message sessionIdentifier:nil];
9898
ApptentiveAssertNotNil(payload, @"Failed to create a message payload");
9999

100100
if (payload != nil) {

Apptentive/Apptentive/Model/ApptentiveLegacySurveyResponse.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ + (void)enqueueUnsentSurveyResponsesInContext:(NSManagedObjectContext *)context
4040
NSDictionary *JSON = response.apiJSON[@"survey"];
4141

4242
NSDate *creationDate = [NSDate dateWithTimeIntervalSince1970:[JSON[@"client_created_at"] doubleValue]];
43-
ApptentiveSurveyResponsePayload *payload = [[ApptentiveSurveyResponsePayload alloc] initWithAnswers:JSON[@"answers"] identifier:JSON[@"id"] creationDate:creationDate];
43+
ApptentiveSurveyResponsePayload *payload = [[ApptentiveSurveyResponsePayload alloc] initWithAnswers:JSON[@"answers"] identifier:JSON[@"id"] creationDate:creationDate sessionIdentifier:nil];
4444
ApptentiveAssertNotNil(payload, @"Failed to create a survey response payload");
4545

4646
if (payload != nil) {

Apptentive/Apptentive/Networking/ApptentivePayloadSender.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ typedef NS_ENUM(NSInteger, ApptentiveQueueStatus) {
3838
Instructs the client to read any pending request information from Core Data and
3939
create an `ApptentiveSerialRequestOperation` instance for each of them. These
4040
operations are then enqueued, followed by an operation that saves the private
41-
context to its parent, and saves the parent context to disk.
41+
context to disk.
4242
4343
@param context The managed object context in which to look for pending network payloads.
4444
*/

0 commit comments

Comments
 (0)