-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes compile issues w/ latest Amplitude-iOS
- Loading branch information
Brandon Sneed
committed
Sep 23, 2020
1 parent
0dc24b1
commit 746f500
Showing
10 changed files
with
138 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// TestSetupBlock.m | ||
// Segment-Amplitude_Tests | ||
// | ||
// Created by Brandon Sneed on 9/23/20. | ||
// Copyright © 2020 Prateek Srivastava. All rights reserved. | ||
// | ||
|
||
#import <XCTest/XCTest.h> | ||
|
||
#import "SEGAmplitudeIntegrationFactory.h" | ||
|
||
@interface TestSetupBlock : XCTestCase | ||
|
||
@end | ||
|
||
@implementation TestSetupBlock | ||
|
||
- (void)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. | ||
} | ||
|
||
- (void)testSetupBlockCalled { | ||
__block Amplitude *amp = nil; | ||
|
||
SEGAmplitudeIntegrationFactory *factory = [SEGAmplitudeIntegrationFactory instanceWithSetupBlock:^(Amplitude *amplitude) { | ||
amp = amplitude; | ||
amplitude.adSupportBlock = ^NSString * _Nonnull{ | ||
return @"1234"; | ||
}; | ||
amplitude.locationInfoBlock = ^NSDictionary * _Nullable{ | ||
return @{ | ||
@"lat" : @37.7, | ||
@"lng" : @122.4 | ||
}; | ||
}; | ||
}]; | ||
|
||
SEGAnalytics *analytics = [[SEGAnalytics alloc] init]; | ||
SEGAmplitudeIntegration *integration = [factory createWithSettings:@{} forAnalytics:analytics]; | ||
|
||
XCTAssertTrue(amp != nil); | ||
XCTAssertTrue(amp.adSupportBlock != nil); | ||
XCTAssertTrue(amp.locationInfoBlock != nil); | ||
|
||
NSString *idfa = amp.adSupportBlock(); | ||
NSDictionary *location = amp.locationInfoBlock(); | ||
|
||
XCTAssertTrue([idfa isEqualToString:@"1234"]); | ||
XCTAssertTrue([[location objectForKey:@"lat"] isEqual:@37.7]); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,33 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <Analytics/Analytics.h> | ||
|
||
#import "SEGAmplitudeIntegration.h" | ||
|
||
|
||
@interface SEGAmplitudeIntegrationFactory : NSObject <SEGIntegrationFactory> | ||
|
||
+ (instancetype)instance; | ||
|
||
/** | ||
This method can be used to set Amplitude's adSupportBlock and locationInfoBlock. | ||
Example: | ||
SEGAmplitudeIntegrationFactory *factory = [SEGAmplitudeIntegrationFactory instanceWithSetupBlock:^{ | ||
amplitude.adSupportBlock = ^{ | ||
return [[ASIdentifierManager sharedManager] advertisingIdentifier]; | ||
}; | ||
amplitude.locationInfoBlock = ^{ | ||
return @{ | ||
@"lat" : @37.7, | ||
@"lng" : @122.4 | ||
}; | ||
}; | ||
}]; | ||
... | ||
[analyticsConfiguration use:factory]; | ||
*/ | ||
+ (instancetype)instanceWithSetupBlock:(SEGAmplitudeSetupBlock)setupBlock; | ||
|
||
@end |
Oops, something went wrong.