Skip to content

Commit

Permalink
Merge pull request #4 from walmartlabs-wmusiphone/e2e/updateToLatestR…
Browse files Browse the repository at this point in the history
…elease

Updating mParircle-apple-sdk to 7.3.9
  • Loading branch information
Sohil authored Jun 1, 2018
2 parents 3526e9b + 1891a29 commit c7f3e60
Show file tree
Hide file tree
Showing 46 changed files with 994 additions and 161 deletions.
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.6</string>
<string>7.3.9</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@

# mParticle Apple SDK

Hello! This is the public repository of the unified mParticle Apple SDK built for the iOS and tvOS platforms.
This is the mParticle Apple SDK for iOS and tvOS.

At mParticle our mission is straightforward: make it really easy for apps and app services to connect and take ownership of your 1st party data. Like most app owners, you end up implementing and maintaining numerous SDKs ranging from analytics, attribution, push notification, remarketing, monetization, etc. However, embedding multiple 3rd party libraries creates a number of unintended consequences and hidden costs.

The mParticle platform addresses all these problems. We support an ever growing number of integrations with services and SDKs, including developer tools, analytics, attribution, messaging, advertising, and more. mParticle has been designed to be the central hub connecting all these services – check [our site](https://www.mparticle.com), or hit us at <[email protected]> to learn more.
At mParticle our mission is straightforward: make it really easy for apps and app services to connect and allow you to take ownership of your 1st party data.
Like most app owners, you end up implementing and maintaining numerous SDKs ranging from analytics, attribution, push notification, remarketing,
monetization, etc. However, embedding multiple 3rd party libraries creates a number of unintended consequences and hidden costs.

The mParticle platform addresses all these problems. We support an ever growing number of integrations with services and SDKs, including developer
tools, analytics, attribution, messaging, advertising, and more. mParticle has been designed to be the central hub connecting all these services –
read the [docs](https://docs.mparticle.com/developers/sdk/ios/) or contact us at <[email protected]> to learn more.

## Overview

This document will help you:

* Obtain the mParticle SDK via [CocoaPods](https://cocoapods.org/?q=mparticle) or via [Carthage](https://github.com/Carthage/Carthage)
* Extend the mParticle SDK with [*Kits*](#currently-supported-kits)
* Install the mParticle SDK using [CocoaPods](https://cocoapods.org/?q=mparticle) or [Carthage](https://github.com/Carthage/Carthage)
* Add any desired [kits](#currently-supported-kits)
* Initialize the mParticle SDK

The mParticle SDK is composed of the _core_ library and a series of _kit_ libraries that depend on the core. With each integration with a partner we strive to implement as many features as possible in the server-to-server layer, however some times a deeper integration to work side-by-side with a 3rd party SDK comes with greater benefits to our clients. We use the term **Kit** to describe such integrations.

The core SDK takes care of initializing the kits depending on what you've configured in [your app's dashboard](https://app.mparticle.com), so you just have to decide which kits you may use prior to submission to the App Store. You can easily include all of the kits, none of the kits, or individual kits – the choice is yours.


## Get the SDK

The mParticle-Apple-SDK is available via [CocoaPods](https://cocoapods.org/?q=mparticle) or via [Carthage](https://github.com/Carthage/Carthage). Follow the instructions below based on your preference.
Expand Down Expand Up @@ -101,6 +99,8 @@ In this case, only the _Branch Metrics_ kit would be integrated; all other kits

#### Currently Supported Kits

Several integrations require additional client-side add-on libraries called "kits." Some kits embed other SDKs, others just contain a bit of additional functionality. Kits are designed to feel just like server-side integrations; you enable, disable, filter, sample, and otherwise tweak kits completely from the mParticle platform UI. The Core SDK will detect kits at runtime, but you need to add them as dependencies to your app.

Kit | CocoaPods | Carthage
----|:---------:|:-------:
[Adjust](https://github.com/mparticle-integrations/mparticle-apple-integration-adjust) | ✓ | ✓
Expand Down Expand Up @@ -232,8 +232,8 @@ Just by initializing the SDK you'll be set up to track user installs, engagement

## Support

Questions? Have an issue? Consult the [Troubleshooting](https://github.com/mParticle/mparticle-apple-sdk/wiki/Troubleshooting) page or contact our **Customer Success** team at <[email protected]>.
Questions? Have an issue? Read the [docs](https://docs.mparticle.com/developers/sdk/ios/) or contact our **Customer Success** team at <[email protected]>.

## License

The mParticle-Apple-SDK is available under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). See the LICENSE file for more info.
Apache 2.0
45 changes: 45 additions & 0 deletions UnitTests/MPConsentKitFilterTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#import <XCTest/XCTest.h>
#import "MPConsentKitFilter.h"

@interface MPConsentKitFilterTests : XCTestCase

@end

@implementation MPConsentKitFilterTests

- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}

- (void)testProperties {
MPConsentKitFilter *filter = [[MPConsentKitFilter alloc] init];

XCTAssertFalse(filter.shouldIncludeOnMatch);
XCTAssertNil(filter.filterItems);

filter.shouldIncludeOnMatch = YES;
XCTAssertTrue(filter.shouldIncludeOnMatch);

filter.shouldIncludeOnMatch = NO;
XCTAssertFalse(filter.shouldIncludeOnMatch);

MPConsentKitFilterItem *item = [[MPConsentKitFilterItem alloc] init];

filter.filterItems = [NSMutableArray arrayWithObject:item];

NSArray *items = filter.filterItems;
XCTAssertEqual(items.count, 1);

MPConsentKitFilterItem *returnedItem = items[0];
XCTAssertEqual(returnedItem, item);
XCTAssertFalse(returnedItem.consented);

}

@end
17 changes: 17 additions & 0 deletions UnitTests/MPConsentSerializationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#import "MPConsentSerialization.h"
#import "MPConsentState.h"
#import "MPGDPRConsent.h"
#import "MPConsentKitFilter.h"

static NSTimeInterval epsilon = 0.05;

Expand Down Expand Up @@ -132,4 +133,20 @@ - (void)testFromString {
XCTAssertEqualObjects(gdprState.hardwareId, @"foo-hardware-id-1");
}

- (void)testFilterFromDictionary {
NSDictionary *configDictionary = @{@"i":@YES, @"v":@[@{@"c":@YES,@"h":@48278946},@{@"c":@YES,@"h":@1556641}]};
MPConsentKitFilter *filter = [MPConsentSerialization filterFromDictionary:configDictionary];
XCTAssertTrue(filter.shouldIncludeOnMatch);
NSArray<MPConsentKitFilterItem *> *filterItems = filter.filterItems;
XCTAssertEqual(filterItems.count, 2);
MPConsentKitFilterItem *firstItem = filterItems[0];
MPConsentKitFilterItem *secondItem = filterItems[1];
XCTAssertNotNil(firstItem);
XCTAssertNotNil(secondItem);
XCTAssertTrue(firstItem.consented);
XCTAssertTrue(secondItem.consented);
XCTAssertEqual(firstItem.javascriptHash, 48278946);
XCTAssertEqual(secondItem.javascriptHash, 1556641);
}

@end
38 changes: 36 additions & 2 deletions UnitTests/MPIUserDefaultsTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,46 @@ - (void)setUp {
}

- (void)tearDown {
[[MPIUserDefaults standardUserDefaults] deleteConfiguration];
[[MPIUserDefaults standardUserDefaults] synchronize];
[[MPIUserDefaults standardUserDefaults] resetDefaults];

[super tearDown];
}

- (void)testUserIDsInUserDefaults {
MPIUserDefaults *userDefaults = [MPIUserDefaults standardUserDefaults];

[userDefaults setMPObject:[NSDate date] forKey:@"lud" userId:@1];
[userDefaults setMPObject:[NSDate date] forKey:@"lud" userId:[NSNumber numberWithLongLong:INT64_MAX]];
[userDefaults setMPObject:[NSDate date] forKey:@"lud" userId:[NSNumber numberWithLongLong:INT64_MIN]];
[userDefaults synchronize];

NSArray<NSNumber *> *array = [userDefaults userIDsInUserDefaults];

XCTAssert([array containsObject:@1]);
XCTAssert([array containsObject:[NSNumber numberWithLongLong:INT64_MAX]]);
XCTAssert([array containsObject:[NSNumber numberWithLongLong:INT64_MIN]]);
}

- (void)testResetDefaults {
MPIUserDefaults *userDefaults = [MPIUserDefaults standardUserDefaults];

[userDefaults setMPObject:[NSDate date] forKey:@"lud" userId:@1];
[userDefaults setMPObject:[NSDate date] forKey:@"lud" userId:[NSNumber numberWithLongLong:INT64_MAX]];
[userDefaults setMPObject:[NSDate date] forKey:@"lud" userId:[NSNumber numberWithLongLong:INT64_MIN]];

[[NSUserDefaults standardUserDefaults] setObject:@"userSetting" forKey:@"userKey"];

[userDefaults resetDefaults];

NSArray<NSNumber *> *array = [userDefaults userIDsInUserDefaults];

XCTAssert(![array containsObject:@1]);
XCTAssert(![array containsObject:[NSNumber numberWithLongLong:INT64_MAX]]);
XCTAssert(![array containsObject:[NSNumber numberWithLongLong:INT64_MIN]]);

XCTAssert([[NSUserDefaults standardUserDefaults] objectForKey:@"userKey"]);
}

- (void)testValidConfiguration {
XCTAssertEqualObjects(self.initialResponseConfiguration, [[MPIUserDefaults standardUserDefaults] getConfiguration]);
}
Expand Down
33 changes: 33 additions & 0 deletions UnitTests/MPIdentityTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@
#import <XCTest/XCTest.h>
#import "mParticle.h"
#import "MPIdentityDTO.h"
#import "MPNetworkCommunication.h"
#if TARGET_OS_IOS == 1
#import "OCMock.h"
#endif

@interface MPIdentityTests : XCTestCase

@end

@interface MPNetworkCommunication ()
- (void)modifyWithIdentityChanges:(NSArray *)identityChanges blockOtherRequests:(BOOL)blockOtherRequests completion:(nullable MPIdentityApiManagerModifyCallback)completion;
- (void)identityApiRequestWithURL:(NSURL*)url identityRequest:(MPIdentityHTTPBaseRequest *_Nonnull)identityRequest blockOtherRequests: (BOOL) blockOtherRequests completion:(nullable MPIdentityApiManagerCallback)completion;
@end

#pragma mark - MPStateMachine category

@interface MPIdentityHTTPIdentities(Tests)
Expand Down Expand Up @@ -44,4 +53,28 @@ - (void)testConstructIdentityApiRequest {
XCTAssertEqual(@"other id 4", httpIdentities.other4);
}

#if TARGET_OS_IOS == 1

- (void)testNoEmptyModifyRequests {
MPNetworkCommunication *network = [[MPNetworkCommunication alloc] init];

id partialMock = OCMPartialMock(network);

[[[partialMock reject] ignoringNonObjectArgs] identityApiRequestWithURL:[OCMArg any] identityRequest:[OCMArg any] blockOtherRequests:[OCMArg any] completion:[OCMArg any]];

[partialMock modifyWithIdentityChanges:nil blockOtherRequests:YES completion:^(MPIdentityHTTPModifySuccessResponse * _Nullable httpResponse, NSError * _Nullable error) {
XCTAssertNil(error);
XCTAssertNotNil(httpResponse);
XCTAssert([httpResponse isKindOfClass:[MPIdentityHTTPModifySuccessResponse class]]);
}];

[partialMock modifyWithIdentityChanges:@[] blockOtherRequests:YES completion:^(MPIdentityHTTPModifySuccessResponse * _Nullable httpResponse, NSError * _Nullable error) {
XCTAssertNil(error);
XCTAssertNotNil(httpResponse);
XCTAssert([httpResponse isKindOfClass:[MPIdentityHTTPModifySuccessResponse class]]);
}];
}

#endif

@end
3 changes: 2 additions & 1 deletion UnitTests/MPKitAPITests.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ - (void)setUp {
}

- (void)tearDown {
[[MPIUserDefaults standardUserDefaults] resetDefaults];

[super tearDown];
}

Expand Down Expand Up @@ -173,7 +175,6 @@ - (void)testUserIdentities {

XCTAssertNil(email, @"Kit api is not filtering user identities");
XCTAssertEqualObjects(customerId, @"12345", @"Kit api is filtering user identities when it shouldn't");

}

@synthesize started;
Expand Down
Loading

0 comments on commit c7f3e60

Please sign in to comment.