Skip to content

Commit

Permalink
Merge branch 'master' into qadeployment
Browse files Browse the repository at this point in the history
  • Loading branch information
srupani committed Jun 27, 2018
2 parents 94604db + 79cde9e commit 7862b8a
Show file tree
Hide file tree
Showing 45 changed files with 1,465 additions and 1,381 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import <Messages/Messages.h>

API_AVAILABLE(ios(10.0))
@interface MessagesViewController : MSMessagesAppViewController

@end
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ - (void)didReceiveMemoryWarning {

#pragma mark - Conversation Handling

-(void)didBecomeActiveWithConversation:(MSConversation *)conversation {
-(void)didBecomeActiveWithConversation:(MSConversation *)conversation NS_AVAILABLE_IOS(10_0){
// Called when the extension is about to move from the inactive to active state.
// This will happen when the extension is about to present UI.

// Use this method to configure the extension and restore previously stored state.
}

-(void)willResignActiveWithConversation:(MSConversation *)conversation {
-(void)willResignActiveWithConversation:(MSConversation *)conversation NS_AVAILABLE_IOS(10_0){
// Called when the extension is about to move from the active to inactive state.
// This will happen when the user dissmises the extension, changes to a different
// conversation or quits Messages.
Expand Down
2 changes: 1 addition & 1 deletion Framework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>7.3.9</string>
<string>7.4.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
32 changes: 32 additions & 0 deletions Scripts/AppledocSettings.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>--project-name</key>
<string>mParticle Apple SDK</string>
<key>--logformat</key>
<string>1</string>
<key>--verbose</key>
<string>4</string>
<key>--input</key>
<array>
<string>../mParticle-Apple-SDK/mParticle.h</string>
<string>../mParticle-Apple-SDK/Event</string>
<string>../mParticle-Apple-SDK/Ecommerce</string>
<string>../mParticle-Apple-SDK/Identity</string>
<string>../mParticle-Apple-SDK/Consent</string>
<string>../mParticle-Apple-SDK/MPEnums.h</string>
<string>../mParticle-Apple-SDK/Segments</string>
</array>
<key>--output</key>
<string>Docs</string>
<key>--no-create-docset</key>
<true/>
<key>--create-html</key>
<true/>
<key>--company-id</key>
<string>com.mparticle</string>
<key>--project-company</key>
<string>mParticle</string>
</dict>
</plist>
314 changes: 145 additions & 169 deletions UnitTests/MPBackendControllerTests.mm

Large diffs are not rendered by default.

183 changes: 40 additions & 143 deletions UnitTests/MPKitContainerTests.m

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions UnitTests/MPMessageBuilderTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,61 @@ - (void)testBuildingMessage {
XCTAssertTrue([message isKindOfClass:[MPMessage class]], @"Returning the wrong kind of class instance.");
}

- (void)testEncodingandDecodingMessage {
NSDictionary *messageInfo = @{@"key1":@"value1",
@"key2":@"value2",
@"key3":@"value3"};

MPMessageBuilder *messageBuilder = [MPMessageBuilder newBuilderWithMessageType:MPMessageTypeEvent
session:self.session
messageInfo:messageInfo];

XCTAssertNotNil(messageBuilder, @"Message builder should not have been nil.");
XCTAssertEqualObjects(messageBuilder.messageType, @"e", @"Message type not being set properly.");
XCTAssertEqualObjects(messageBuilder.session, self.session, @"Message session differ from the one set.");

BOOL containsDictionary = NO;
NSArray *keys = [messageInfo allKeys];
for (NSString *key in keys) {
containsDictionary = [messageBuilder.messageInfo[key] isEqualToString:messageInfo[key]];

if (!containsDictionary) {
break;
}
}

XCTAssertTrue(containsDictionary, @"Message info dictionary is not contained in the message's dictionary.");

NSTimeInterval timestamp = messageBuilder.timestamp;
messageBuilder = [messageBuilder withTimestamp:[[NSDate date] timeIntervalSince1970]];
XCTAssertNotEqual(messageBuilder.timestamp, timestamp, @"Timestamp is not being updated.");

MPMessage *message = (MPMessage *)[messageBuilder build];
XCTAssertNotNil(message, @"MPMessage is not being built.");
XCTAssertTrue([message isKindOfClass:[MPMessage class]], @"Returning the wrong kind of class instance.");
XCTAssertNotNil(message.messageData, @"MPMessage has no data.");

messageBuilder = [MPMessageBuilder newBuilderWithMessageType:MPMessageTypeEvent
session:nil
messageInfo:messageInfo];

XCTAssertNotNil(messageBuilder, @"Message builder should not have been nil.");

message = (MPMessage *)[messageBuilder build];
XCTAssertTrue([message isKindOfClass:[MPMessage class]], @"Returning the wrong kind of class instance.");

NSData *messageData = [NSKeyedArchiver archivedDataWithRootObject:message];
MPMessage *messageFromData = [NSKeyedUnarchiver unarchiveObjectWithData:messageData];

XCTAssertEqualObjects(message.sessionId, messageFromData.sessionId);
XCTAssertEqualObjects(message.messageType, messageFromData.messageType);
XCTAssertEqualObjects(message.messageData, messageFromData.messageData);
XCTAssertEqual(message.timestamp, messageFromData.timestamp);
XCTAssertEqual(message.messageId, messageFromData.messageId);
XCTAssertEqualObjects(message.userId, messageFromData.userId);
XCTAssertEqual(message.uploadStatus, messageFromData.uploadStatus);
}

- (void)testBuildCommerceEventProduct {
MPProduct *product = [[MPProduct alloc] initWithName:@"DeLorean" sku:@"OutATime" quantity:@1 price:@4.32];
product.brand = @"DLC";
Expand Down
Loading

0 comments on commit 7862b8a

Please sign in to comment.