Skip to content

Commit fceb515

Browse files
authored
Merge pull request #211 from apptentive/branch_5.0.3
Release 5.0.3
2 parents f24baf2 + b53d1b1 commit fceb515

13 files changed

+238
-220
lines changed

Apptentive/Apptentive.xcodeproj/project.pbxproj

+6-6
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 = 1;
2308+
CURRENT_PROJECT_VERSION = 3;
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 = 1;
2364+
CURRENT_PROJECT_VERSION = 3;
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 = 1;
2396+
DYLIB_CURRENT_VERSION = 3;
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 = 1;
2418+
DYLIB_CURRENT_VERSION = 3;
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 = 1;
2469+
DYLIB_CURRENT_VERSION = 3;
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 = 1;
2488+
DYLIB_CURRENT_VERSION = 3;
24892489
DYLIB_INSTALL_NAME_BASE = "@rpath";
24902490
INFOPLIST_FILE = ApptentiveDebugging/Info.plist;
24912491
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.2"
23+
#define kApptentiveVersionString @"5.0.3"
2424

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

Apptentive/Apptentive/Engagement/Model/ApptentiveConversation.h

+5
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ extern NSString *NSStringFromApptentiveConversationState(ApptentiveConversationS
117117
*/
118118
@property (readonly, nonatomic) NSDictionary *userInfo;
119119

120+
/**
121+
Returns true if conversation data is consistent.
122+
*/
123+
@property (readonly, nonatomic, getter=isConsistent) BOOL consistent;
124+
120125
/**
121126
The delegate for the conversation.
122127
*/

Apptentive/Apptentive/Engagement/Model/ApptentiveConversation.m

+40-13
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,6 @@ - (void)encodeWithCoder:(NSCoder *)coder {
146146
[coder encodeObject:@1 forKey:ArchiveVersionKey];
147147
}
148148

149-
- (void)setToken:(NSString *)token conversationID:(NSString *)conversationID personID:(NSString *)personID deviceID:(NSString *)deviceID {
150-
[self setConversationIdentifier:conversationID JWT:token];
151-
self.person.identifier = personID;
152-
self.device.identifier = deviceID;
153-
}
154-
155-
- (void)setConversationIdentifier:(NSString *)identifier JWT:(NSString *)JWT {
156-
_identifier = [identifier copy];
157-
_token = [JWT copy];
158-
}
159-
160149
- (void)checkForDiffs {
161150
ApptentiveAppRelease *currentAppRelease = [[ApptentiveAppRelease alloc] initWithCurrentAppRelease];
162151
[currentAppRelease copyNonholonomicValuesFrom:self.appRelease];
@@ -365,6 +354,46 @@ - (BOOL)hasActiveState {
365354
return _state == ApptentiveConversationStateAnonymous || _state == ApptentiveConversationStateLoggedIn;
366355
}
367356

357+
- (BOOL)isConsistent {
358+
if (self.state == ApptentiveConversationStateUndefined) {
359+
ApptentiveLogError(ApptentiveLogTagConversation, @"Conversation state is undefined.");
360+
return NO;
361+
}
362+
363+
if (self.directoryName.length == 0) {
364+
ApptentiveLogError(ApptentiveLogTagConversation, @"Conversation directory name is empty.");
365+
return NO;
366+
}
367+
368+
if (self.state == ApptentiveConversationStateAnonymous || self.state == ApptentiveConversationStateLoggedIn) {
369+
if (self.identifier.length == 0) {
370+
ApptentiveLogError(ApptentiveLogTagConversation, @"Conversation identifier is nil or empty for state %@.", NSStringFromApptentiveConversationState(self.state));
371+
372+
return NO;
373+
}
374+
375+
if (self.token.length == 0) {
376+
ApptentiveLogError(ApptentiveLogTagConversation, @"Conversation auth token is nil or empty for state %@.", NSStringFromApptentiveConversationState(self.state));
377+
378+
return NO;
379+
}
380+
}
381+
382+
if (self.state == ApptentiveConversationStateLoggedIn) {
383+
if (self.userId.length == 0) {
384+
ApptentiveLogError(ApptentiveLogTagConversation, @"Conversation userId is nil or empty for logged-in conversation.");
385+
return NO;
386+
}
387+
388+
if (self.encryptionKey.length == 0) {
389+
ApptentiveLogError(ApptentiveLogTagConversation, @"Conversation encryption key is nil or empty for logged-in conversation.");
390+
return NO;
391+
}
392+
}
393+
394+
return YES;
395+
}
396+
368397
+ (void)deleteMigratedData {
369398
[ApptentiveAppRelease deleteMigratedData];
370399
[ApptentiveSDK deleteMigratedData];
@@ -487,8 +516,6 @@ @implementation ApptentiveMutableConversation
487516
@dynamic lastMessageID;
488517
@dynamic directoryName;
489518

490-
// FIXME: remove these methods
491-
492519
- (void)setToken:(NSString *)token conversationID:(NSString *)conversationID personID:(NSString *)personID deviceID:(NSString *)deviceID {
493520
[self setConversationIdentifier:conversationID JWT:token];
494521
self.person.identifier = personID;

Apptentive/Apptentive/Engagement/Model/ApptentiveConversationManager.m

+6-3
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ - (nullable ApptentiveConversation *)loadConversationFromMetadataItem:(Apptentiv
258258
}
259259

260260
ApptentiveConversation *conversation = [NSKeyedUnarchiver unarchiveObjectWithData:conversationData];
261-
ApptentiveAssertNotNil(conversation, @"Failed to load conversation");
262261
if (conversation == nil) {
262+
ApptentiveLogError(ApptentiveLogTagConversation, @"Unable to load conversation from archive.");
263263
return nil;
264264
}
265265

@@ -270,8 +270,11 @@ - (nullable ApptentiveConversation *)loadConversationFromMetadataItem:(Apptentiv
270270
mutableConversation.encryptionKey = item.encryptionKey;
271271
mutableConversation.userId = item.userId;
272272
mutableConversation.token = item.JWT;
273-
274-
// TODO: check data consistency
273+
274+
if (!mutableConversation.isConsistent) {
275+
ApptentiveLogError(ApptentiveLogTagConversation, @"Conversation data is inconsistent.");
276+
return nil;
277+
}
275278

276279
return mutableConversation;
277280
}

Apptentive/Apptentive/Engagement/Model/ApptentiveConversationMetadataItem.m

+6
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ - (BOOL)isConsistent {
8888

8989
return NO;
9090
}
91+
92+
if (self.JWT.length == 0) {
93+
ApptentiveLogError(ApptentiveLogTagConversation, @"Conversation auth token is empty for state %@.", NSStringFromApptentiveConversationState(self.state));
94+
95+
return NO;
96+
}
9197
}
9298

9399
if (self.state == ApptentiveConversationStateLoggedIn) {

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

Apptentive/Apptentive/Misc/ApptentiveLogMonitor.m

+7-5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
extern NSNotificationName _Nonnull const ApptentiveManifestRawDataDidReceiveNotification;
2323
extern NSString *_Nonnull const ApptentiveManifestRawDataKey;
2424

25+
extern NSString *ApptentiveLocalizedString(NSString *key, NSString *comment);
26+
2527
static NSString *const KeyEmailRecipients = @"emailRecipients";
2628
static NSString *const KeyLogLevel = @"logLevel";
2729

@@ -156,8 +158,8 @@ - (void)showReportUI {
156158
UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
157159

158160
// create alert controller with "Send", "Continue" and "Discard" actions
159-
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Apptentive" message:@"Troubleshooting mode" preferredStyle:UIAlertControllerStyleActionSheet];
160-
[alertController addAction:[UIAlertAction actionWithTitle:@"Send Report"
161+
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:ApptentiveLocalizedString(@"Apptentive", @"Apptentive") message:ApptentiveLocalizedString(@"Troubleshooting mode", @"Troubleshooting mode") preferredStyle:UIAlertControllerStyleActionSheet];
162+
[alertController addAction:[UIAlertAction actionWithTitle:ApptentiveLocalizedString(@"Send Report", @"Send Report")
161163
style:UIAlertActionStyleDefault
162164
handler:^(UIAlertAction *_Nonnull action) {
163165
window.hidden = YES;
@@ -169,12 +171,12 @@ - (void)showReportUI {
169171
};
170172
[self stop];
171173
}]];
172-
[alertController addAction:[UIAlertAction actionWithTitle:@"Continue"
174+
[alertController addAction:[UIAlertAction actionWithTitle:ApptentiveLocalizedString(@"Continue", @"Continue")
173175
style:UIAlertActionStyleCancel
174176
handler:^(UIAlertAction *_Nonnull action) {
175177
window.hidden = YES;
176178
}]];
177-
[alertController addAction:[UIAlertAction actionWithTitle:@"Discard Report"
179+
[alertController addAction:[UIAlertAction actionWithTitle:ApptentiveLocalizedString(@"Discard Report", @"Discard Report")
178180
style:UIAlertActionStyleDestructive
179181
handler:^(UIAlertAction *_Nonnull action) {
180182
window.hidden = YES;
@@ -392,7 +394,7 @@ - (void)sendReportWithAttachedFiles:(NSArray<NSString *> *)files {
392394
if (![MFMailComposeViewController canSendMail]) {
393395
#pragma clang diagnostic push
394396
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
395-
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Apptentive Log Monitor" message:@"Unable to send email" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
397+
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:ApptentiveLocalizedString(@"Apptentive Log Monitor", @"Apptentive Log Monitor") message:ApptentiveLocalizedString(@"Unable to send email", @"Unable to send email") delegate:nil cancelButtonTitle:ApptentiveLocalizedString(@"OK", @"OK") otherButtonTitles:nil];
396398
[alertView show];
397399
#pragma clang diagnostic pop
398400

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.0</string>
18+
<string>5.0.3</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>1.0</string>
18+
<string>5.0.3</string>
1919
<key>CFBundleVersion</key>
2020
<string>1</string>
2121
</dict>

0 commit comments

Comments
 (0)