Skip to content

Commit c0dccd2

Browse files
authored
Merge pull request #232 from apptentive/branch_5.2.4
Release 5.2.4
2 parents 2ed5687 + a17088c commit c0dccd2

27 files changed

+121
-155
lines changed

.travis.yml

-6
This file was deleted.

Apptentive/Apptentive.xcodeproj/project.pbxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -2394,7 +2394,7 @@
23942394
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
23952395
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
23962396
COPY_PHASE_STRIP = NO;
2397-
CURRENT_PROJECT_VERSION = 23;
2397+
CURRENT_PROJECT_VERSION = 24;
23982398
DEBUG_INFORMATION_FORMAT = dwarf;
23992399
ENABLE_STRICT_OBJC_MSGSEND = YES;
24002400
ENABLE_TESTABILITY = YES;
@@ -2452,7 +2452,7 @@
24522452
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
24532453
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
24542454
COPY_PHASE_STRIP = NO;
2455-
CURRENT_PROJECT_VERSION = 23;
2455+
CURRENT_PROJECT_VERSION = 24;
24562456
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
24572457
ENABLE_NS_ASSERTIONS = NO;
24582458
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -2484,7 +2484,7 @@
24842484
DEFINES_MODULE = YES;
24852485
DEVELOPMENT_TEAM = 86WML2UN43;
24862486
DYLIB_COMPATIBILITY_VERSION = 1;
2487-
DYLIB_CURRENT_VERSION = 23;
2487+
DYLIB_CURRENT_VERSION = 24;
24882488
DYLIB_INSTALL_NAME_BASE = "@rpath";
24892489
GCC_PREFIX_HEADER = "Apptentive/Misc/ApptentiveConnect-Prefix.pch";
24902490
GCC_PREPROCESSOR_DEFINITIONS = "APPTENTIVE_DEBUG=1";
@@ -2506,7 +2506,7 @@
25062506
DEFINES_MODULE = YES;
25072507
DEVELOPMENT_TEAM = 86WML2UN43;
25082508
DYLIB_COMPATIBILITY_VERSION = 1;
2509-
DYLIB_CURRENT_VERSION = 23;
2509+
DYLIB_CURRENT_VERSION = 24;
25102510
DYLIB_INSTALL_NAME_BASE = "@rpath";
25112511
GCC_PREFIX_HEADER = "Apptentive/Misc/ApptentiveConnect-Prefix.pch";
25122512
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.3"
23+
#define kApptentiveVersionString @"5.2.4"
2424

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

Apptentive/Apptentive/Apptentive.m

+4-1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ - (void)sendAttachmentText:(NSString *)text {
229229
}
230230

231231
ApptentiveMessage *message = [[ApptentiveMessage alloc] initWithBody:text attachments:nil automated:NO customData:nil creationDate:[NSDate date]];
232+
message.hidden = YES;
232233
ApptentiveAssertNotNil(message, @"Message is nil");
233234

234235
if (message != nil) {
@@ -268,6 +269,7 @@ - (void)sendAttachmentImage:(UIImage *)image {
268269
ApptentiveAssertNotNil(attachment, @"Attachment is nil");
269270
if (attachment != nil) {
270271
ApptentiveMessage *message = [[ApptentiveMessage alloc] initWithBody:nil attachments:@[attachment] automated:NO customData:nil creationDate:[NSDate date]];
272+
message.hidden = YES;
271273
ApptentiveAssertNotNil(message, @"Message is nil");
272274

273275
if (message != nil) {
@@ -308,8 +310,9 @@ - (void)sendAttachmentFile:(NSData *)fileData withMimeType:(NSString *)mimeType
308310

309311
if (attachment != nil) {
310312
ApptentiveMessage *message = [[ApptentiveMessage alloc] initWithBody:nil attachments:@[attachment] automated:NO customData:nil creationDate:[NSDate date]];
311-
313+
message.hidden = YES;
312314
ApptentiveAssertNotNil(message, @"Message is nil");
315+
313316
if (message != nil) {
314317
if (self.messageManager) {
315318
[self.messageManager enqueueMessageForSending:message];

Apptentive/Apptentive/Apptentive.storyboard

+26-39
Large diffs are not rendered by default.

Apptentive/Apptentive/Engagement/Model/ApptentiveAppRelease.h

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ NS_ASSUME_NONNULL_BEGIN
2424
*/
2525
@property (readonly, strong, nonatomic) NSString *type;
2626

27+
28+
/**
29+
The bundle identifier of the app, e.g. com.example.MyApp
30+
*/
31+
@property (readonly, strong, nonatomic) NSString *bundleIdentifier;
32+
2733
/**
2834
The version object corresponding to the value of the
2935
`CFBundleShortVersionString` key in the application's `Info.plist` file.

Apptentive/Apptentive/Engagement/Model/ApptentiveAppRelease.m

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
NS_ASSUME_NONNULL_BEGIN
1313

1414
static NSString *const TypeKey = @"type";
15+
static NSString *const BundleIdentifierKey = @"bundleIdentifier";
1516
static NSString *const VersionKey = @"version";
1617
static NSString *const BuildKey = @"build";
1718
static NSString *const HasAppStoreReceiptKey = @"hasAppStoreReceipt";
@@ -62,6 +63,7 @@ - (instancetype)initWithCurrentAppRelease {
6263

6364
if (self) {
6465
_type = @"ios";
66+
_bundleIdentifier = NSBundle.mainBundle.infoDictionary[@"CFBundleIdentifier"];
6567
_version = [[ApptentiveVersion alloc] initWithString:[NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"]];
6668
_build = [[ApptentiveVersion alloc] initWithString:[NSBundle mainBundle].infoDictionary[(NSString *)kCFBundleVersionKey]];
6769
_hasAppStoreReceipt = [NSData dataWithContentsOfURL:[NSBundle mainBundle].appStoreReceiptURL] != nil;
@@ -89,6 +91,7 @@ - (nullable instancetype)initWithCoder:(NSCoder *)coder {
8991

9092
if (self) {
9193
_type = [coder decodeObjectOfClass:[NSString class] forKey:TypeKey];
94+
_bundleIdentifier = [coder decodeObjectOfClass:[NSString class] forKey:BundleIdentifierKey];
9295
_version = [coder decodeObjectOfClass:[ApptentiveVersion class] forKey:VersionKey];
9396
_build = [coder decodeObjectOfClass:[ApptentiveVersion class] forKey:BuildKey];
9497
_hasAppStoreReceipt = [coder decodeBoolForKey:HasAppStoreReceiptKey];
@@ -119,6 +122,7 @@ - (void)encodeWithCoder:(NSCoder *)coder {
119122
[super encodeWithCoder:coder];
120123

121124
[coder encodeObject:self.type forKey:TypeKey];
125+
[coder encodeObject:self.bundleIdentifier forKey:BundleIdentifierKey];
122126
[coder encodeObject:self.version forKey:VersionKey];
123127
[coder encodeObject:self.build forKey:BuildKey];
124128
[coder encodeBool:self.hasAppStoreReceipt forKey:HasAppStoreReceiptKey];
@@ -235,6 +239,7 @@ - (NSNumber *)boxedOverridingStyles {
235239
+ (NSDictionary *)JSONKeyPathMapping {
236240
return @{
237241
@"type": NSStringFromSelector(@selector(type)),
242+
@"cf_bundle_identifier": NSStringFromSelector(@selector(bundleIdentifier)),
238243
@"cf_bundle_short_version_string": NSStringFromSelector(@selector(versionString)),
239244
@"cf_bundle_version": NSStringFromSelector(@selector(buildString)),
240245
@"app_store_receipt": NSStringFromSelector(@selector(appStoreReceiptDictionary)),

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

Apptentive/Apptentive/Message Center/ApptentiveMessageCenterViewModel.h

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ typedef NS_ENUM(NSInteger, ATMessageCenterMessageStatus) {
7676
@property (readonly, nonatomic) NSString *profileInitialEmailPlaceholder;
7777
@property (readonly, nonatomic) NSString *profileInitialSkipButtonTitle;
7878
@property (readonly, nonatomic) NSString *profileInitialSaveButtonTitle;
79-
@property (readonly, nonatomic) NSString *profileInitialEmailExplanation;
8079

8180
@property (readonly, nonatomic) NSString *profileEditTitle;
8281
@property (readonly, nonatomic) NSString *profileEditNamePlaceholder;

Apptentive/Apptentive/Message Center/ApptentiveMessageCenterViewModel.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,6 @@ - (NSString *)profileInitialSaveButtonTitle {
213213
return self.interaction.configuration[@"profile"][@"initial"][@"save_button"];
214214
}
215215

216-
- (NSString *)profileInitialEmailExplanation {
217-
return self.interaction.configuration[@"profile"][@"initial"][@"email_explanation"];
218-
}
219-
220216
#pragma mark - Profile (Edit)
221217

222218
- (NSString *)profileEditTitle {
@@ -300,6 +296,10 @@ - (nullable NSDate *)dateOfMessageGroupAtIndex:(NSInteger)index {
300296
- (ATMessageCenterMessageStatus)statusOfMessageAtIndexPath:(NSIndexPath *)indexPath {
301297
ApptentiveMessage *message = [self messageAtIndexPath:indexPath];
302298

299+
if (message.hidden) {
300+
return ATMessageCenterMessageStatusHidden;
301+
}
302+
303303
switch (message.state) {
304304
case ApptentiveMessageStateFailedToSend:
305305
return ATMessageCenterMessageStatusFailed;

Apptentive/Apptentive/Message Center/Controllers/ApptentiveMessageCenterViewController.m

+1-9
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,6 @@ - (void)configureView {
289289
self.profileView.containerView.backgroundColor = [self.viewModel.styleSheet colorForStyle:ApptentiveColorBackground];
290290
self.profileView.titleLabel.text = self.viewModel.profileInitialTitle;
291291
self.profileView.titleLabel.textColor = [self.viewModel.styleSheet colorForStyle:ApptentiveTextStyleButton];
292-
self.profileView.requiredLabel.text = self.viewModel.profileInitialEmailExplanation;
293-
self.profileView.requiredLabel.textColor = [self.viewModel.styleSheet colorForStyle:ApptentiveTextStyleSurveyInstructions];
294292
[self.profileView.saveButton setTitle:self.viewModel.profileInitialSaveButtonTitle forState:UIControlStateNormal];
295293
[self.profileView.skipButton setTitle:self.viewModel.profileInitialSkipButtonTitle forState:UIControlStateNormal];
296294
self.profileView.skipButton.hidden = self.viewModel.profileRequired;
@@ -306,14 +304,11 @@ - (void)configureView {
306304

307305
if (self.viewModel.profileRequired && [self shouldShowProfileViewBeforeComposing:YES]) {
308306
self.profileView.skipButton.hidden = YES;
309-
self.profileView.mode = ATMessageCenterProfileModeCompact;
310307

311308
self.composeButtonItem.enabled = NO;
312309
self.neuMessageButtonItem.enabled = NO;
313-
} else {
314-
self.profileView.mode = ATMessageCenterProfileModeFull;
315310
}
316-
} else {
311+
} else {
317312
self.navigationItem.leftBarButtonItem = nil;
318313
}
319314
}
@@ -743,8 +738,6 @@ - (IBAction)clear:(UIButton *)sender {
743738
}
744739

745740
- (IBAction)showWho:(id)sender {
746-
self.profileView.mode = ATMessageCenterProfileModeFull;
747-
748741
self.profileView.skipButton.hidden = NO;
749742
self.profileView.titleLabel.text = self.viewModel.profileEditTitle;
750743

@@ -1254,7 +1247,6 @@ - (void)updateHeaderFooterTextSize:(nullable NSNotification *)notification {
12541247
self.profileView.titleLabel.font = [self.viewModel.styleSheet fontForStyle:ApptentiveTextStyleButton];
12551248
self.profileView.saveButton.titleLabel.font = [self.viewModel.styleSheet fontForStyle:ApptentiveTextStyleDoneButton];
12561249
self.profileView.skipButton.titleLabel.font = [self.viewModel.styleSheet fontForStyle:ApptentiveTextStyleButton];
1257-
self.profileView.requiredLabel.font = [self.viewModel.styleSheet fontForStyle:ApptentiveTextStyleSurveyInstructions];
12581250
self.profileView.nameField.font = [self.viewModel.styleSheet fontForStyle:ApptentiveTextStyleTextInput];
12591251
self.profileView.emailField.font = [self.viewModel.styleSheet fontForStyle:ApptentiveTextStyleTextInput];
12601252
}

Apptentive/Apptentive/Message Center/Model/ApptentiveAttachment.m

+8-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,14 @@ - (nullable instancetype)initWithData:(NSData *)data contentType:(NSString *)con
9898
_attachmentDirectoryPath = attachmentDirectoryPath;
9999

100100
NSURL *URL = [self permanentLocation];
101-
[data writeToURL:URL atomically:YES];
101+
NSError *error = nil;
102+
BOOL success = [data writeToURL:URL options:NSDataWritingAtomic | NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication error:&error];
103+
104+
if (!success) {
105+
ApptentiveLogError(ApptentiveLogTagMessages, @"Failed to write attachment to path");
106+
return nil;
107+
}
108+
102109
_filename = URL.lastPathComponent;
103110
_size = [data length];
104111
}

Apptentive/Apptentive/Message Center/Model/ApptentiveMessage.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ typedef NS_ENUM(NSInteger, ApptentiveMessageState) {
2121
ApptentiveMessageStateSent,
2222
ApptentiveMessageStateFailedToSend,
2323
ApptentiveMessageStateUnread,
24-
ApptentiveMessageStateRead,
25-
ApptentiveMessageStateHidden
24+
ApptentiveMessageStateRead
2625
};
2726

2827

@@ -38,6 +37,7 @@ typedef NS_ENUM(NSInteger, ApptentiveMessageState) {
3837
@property (readonly, nonatomic) BOOL automated;
3938
@property (readonly, nullable, nonatomic) NSDictionary *customData;
4039
@property (readonly, nonatomic) BOOL inbound;
40+
@property (assign, nonatomic) BOOL hidden;
4141

4242
- (nullable instancetype)initWithJSON:(NSDictionary *)JSON;
4343
- (nullable instancetype)initWithBody:(nullable NSString *)body attachments:(nullable NSArray *)attachments automated:(BOOL)automated customData:(NSDictionary *_Nullable)customData creationDate:(NSDate *)creationDate;

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

+9-6
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,17 @@ - (nullable instancetype)initWithJSON:(NSDictionary *)JSON {
8282
_inbound = YES;
8383
}
8484

85+
8586
if ([JSON[@"hidden"] isKindOfClass:[NSNumber class]] && [JSON[@"hidden"] boolValue]) {
86-
_state = ApptentiveMessageStateHidden;
87+
_hidden = YES;
8788
} else {
88-
if (_inbound) {
89-
_state = ApptentiveMessageStateSent;
90-
} else {
91-
_state = ApptentiveMessageStateUnread;
92-
}
89+
_hidden = NO;
90+
}
91+
92+
if (_inbound) {
93+
_state = ApptentiveMessageStateSent;
94+
} else {
95+
_state = ApptentiveMessageStateUnread;
9396
}
9497

9598
_identifier = ApptentiveDictionaryGetString(JSON, @"id");

Apptentive/Apptentive/Message Center/Views/ApptentiveMessageCenterProfileView.h

-7
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,15 @@
1010

1111
NS_ASSUME_NONNULL_BEGIN
1212

13-
typedef NS_ENUM(NSInteger, ATMessageCenterProfileMode) {
14-
ATMessageCenterProfileModeCompact = 1,
15-
ATMessageCenterProfileModeFull
16-
};
17-
1813

1914
@interface ApptentiveMessageCenterProfileView : UIView
2015

21-
@property (assign, nonatomic) ATMessageCenterProfileMode mode;
2216
@property (weak, nonatomic) IBOutlet UIView *containerView;
2317
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
2418
@property (weak, nonatomic) IBOutlet UITextField *nameField;
2519
@property (weak, nonatomic) IBOutlet UITextField *emailField;
2620
@property (weak, nonatomic) IBOutlet UIButton *skipButton;
2721
@property (weak, nonatomic) IBOutlet UIButton *saveButton;
28-
@property (weak, nonatomic) IBOutlet UILabel *requiredLabel;
2922
@property (strong, nonatomic) UIColor *borderColor;
3023

3124
@end

Apptentive/Apptentive/Message Center/Views/ApptentiveMessageCenterProfileView.m

+3-65
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ @interface ApptentiveMessageCenterProfileView ()
2525
@property (strong, nonatomic) NSArray *portraitFullConstraints;
2626
@property (strong, nonatomic) NSArray *landscapeFullConstraints;
2727

28-
@property (strong, nonatomic) NSArray *portraitCompactConstraints;
29-
@property (strong, nonatomic) NSArray *landscapeCompactConstraints;
30-
3128
@property (strong, nonatomic) NSArray *baseConstraints;
3229

3330
@end
@@ -42,14 +39,12 @@ - (void)awakeFromNib {
4239
self.buttonBar.layer.borderWidth = borderWidth;
4340

4441
self.portraitFullConstraints = @[self.nameTrailingConstraint, self.emailLeadingConstraint, self.nameVerticalSpaceToEmail];
45-
self.portraitCompactConstraints = @[self.nameTrailingConstraint, self.emailLeadingConstraint];
4642

4743
self.nameHorizontalSpaceToEmail = [NSLayoutConstraint constraintWithItem:self.nameField attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self.emailField attribute:NSLayoutAttributeLeading multiplier:1.0 constant:-8.0];
4844
NSLayoutConstraint *nameEmailTopAlignment = [NSLayoutConstraint constraintWithItem:self.nameField attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.emailField attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0];
4945
NSLayoutConstraint *nameEmailBottomAlignment = [NSLayoutConstraint constraintWithItem:self.nameField attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.emailField attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0];
5046

5147
self.landscapeFullConstraints = @[self.nameHorizontalSpaceToEmail, nameEmailTopAlignment, nameEmailBottomAlignment];
52-
self.landscapeCompactConstraints = @[self.emailLeadingConstraint, nameEmailTopAlignment, nameEmailBottomAlignment];
5348

5449
// Find constraints common to both modes/orientations
5550
NSMutableSet *baseConstraintSet = [NSMutableSet setWithArray:self.containerView.constraints];
@@ -60,11 +55,7 @@ - (void)awakeFromNib {
6055
}
6156

6257
- (BOOL)becomeFirstResponder {
63-
if (self.mode == ATMessageCenterProfileModeFull) {
64-
return [self.nameField becomeFirstResponder];
65-
} else {
66-
return [self.emailField becomeFirstResponder];
67-
}
58+
return [self.nameField becomeFirstResponder];
6859
}
6960

7061
- (void)setBorderColor:(UIColor *)borderColor {
@@ -79,65 +70,12 @@ - (void)traitCollectionDidChange:(nullable UITraitCollection *)previousTraitColl
7970

8071
// Deactivate all, then selectively re-activate
8172
[NSLayoutConstraint deactivateConstraints:self.portraitFullConstraints];
82-
[NSLayoutConstraint deactivateConstraints:self.portraitCompactConstraints];
8373
[NSLayoutConstraint deactivateConstraints:self.landscapeFullConstraints];
84-
[NSLayoutConstraint deactivateConstraints:self.landscapeCompactConstraints];
8574

8675
if (self.traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact) {
87-
switch (self.mode) {
88-
case ATMessageCenterProfileModeFull:
89-
[NSLayoutConstraint activateConstraints:self.landscapeFullConstraints];
90-
break;
91-
92-
case ATMessageCenterProfileModeCompact:
93-
[NSLayoutConstraint activateConstraints:self.landscapeCompactConstraints];
94-
break;
95-
}
76+
[NSLayoutConstraint activateConstraints:self.landscapeFullConstraints];
9677
} else {
97-
switch (self.mode) {
98-
case ATMessageCenterProfileModeFull:
99-
[NSLayoutConstraint activateConstraints:self.portraitFullConstraints];
100-
break;
101-
102-
case ATMessageCenterProfileModeCompact:
103-
[NSLayoutConstraint activateConstraints:self.portraitCompactConstraints];
104-
break;
105-
}
106-
}
107-
}
108-
109-
- (void)setMode:(ATMessageCenterProfileMode)mode {
110-
if (_mode != mode) {
111-
_mode = mode;
112-
113-
CGFloat nameFieldAlpha;
114-
115-
if (mode == ATMessageCenterProfileModeCompact) {
116-
self.requiredLabel.hidden = NO;
117-
nameFieldAlpha = 0;
118-
self.emailVerticalSpaceToButtonBar.constant = 37.0;
119-
} else {
120-
self.nameField.hidden = NO;
121-
nameFieldAlpha = 1;
122-
self.emailVerticalSpaceToButtonBar.constant = 16.0;
123-
}
124-
125-
[self traitCollectionDidChange:self.traitCollection];
126-
127-
[UIView animateWithDuration:0.25
128-
animations:^{
129-
self.nameField.alpha = nameFieldAlpha;
130-
self.requiredLabel.alpha = 1.0 - nameFieldAlpha;
131-
132-
[self layoutIfNeeded];
133-
}
134-
completion:^(BOOL finished) {
135-
if (nameFieldAlpha == 0) {
136-
self.nameField.hidden = YES;
137-
} else {
138-
self.requiredLabel.hidden = YES;
139-
}
140-
}];
78+
[NSLayoutConstraint activateConstraints:self.portraitFullConstraints];
14179
}
14280
}
14381

0 commit comments

Comments
 (0)