Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ingestion_metadata field #410

Merged
merged 1 commit into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Amplitude.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@
3EF6090327267C9800133703 /* AMPMiddleware.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EF6090127267C9800133703 /* AMPMiddleware.m */; };
3EF6090427267C9800133703 /* AMPMiddleware.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EF6090127267C9800133703 /* AMPMiddleware.m */; };
3EF6090527267C9800133703 /* AMPMiddleware.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EF6090127267C9800133703 /* AMPMiddleware.m */; };
582516E228C048D600ECAD0D /* AMPIngestionMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 582516E128C048D600ECAD0D /* AMPIngestionMetadata.h */; settings = {ATTRIBUTES = (Public, ); }; };
582516E328C048D600ECAD0D /* AMPIngestionMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 582516E128C048D600ECAD0D /* AMPIngestionMetadata.h */; settings = {ATTRIBUTES = (Public, ); }; };
582516E428C048D600ECAD0D /* AMPIngestionMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 582516E128C048D600ECAD0D /* AMPIngestionMetadata.h */; settings = {ATTRIBUTES = (Public, ); }; };
582516E528C048D600ECAD0D /* AMPIngestionMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 582516E128C048D600ECAD0D /* AMPIngestionMetadata.h */; settings = {ATTRIBUTES = (Public, ); }; };
582516E728C048E700ECAD0D /* AMPIngestionMetadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 582516E628C048E700ECAD0D /* AMPIngestionMetadata.m */; };
582516E828C048E700ECAD0D /* AMPIngestionMetadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 582516E628C048E700ECAD0D /* AMPIngestionMetadata.m */; };
582516E928C048E700ECAD0D /* AMPIngestionMetadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 582516E628C048E700ECAD0D /* AMPIngestionMetadata.m */; };
582516EA28C048E700ECAD0D /* AMPIngestionMetadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 582516E628C048E700ECAD0D /* AMPIngestionMetadata.m */; };
582516F028C075D100ECAD0D /* IngestionMetadataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 582516EB28C075C300ECAD0D /* IngestionMetadataTests.m */; };
582516F128C075D200ECAD0D /* IngestionMetadataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 582516EB28C075C300ECAD0D /* IngestionMetadataTests.m */; };
582516F228C075D300ECAD0D /* IngestionMetadataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 582516EB28C075C300ECAD0D /* IngestionMetadataTests.m */; };
58E4B1BC287F62C3007AC408 /* AmazonRootCA1.cer in Resources */ = {isa = PBXBuildFile; fileRef = 58E4B1BB287F62C3007AC408 /* AmazonRootCA1.cer */; };
58E4B1BD287F62C3007AC408 /* AmazonRootCA1.cer in Resources */ = {isa = PBXBuildFile; fileRef = 58E4B1BB287F62C3007AC408 /* AmazonRootCA1.cer */; };
58E4B1BE287F62C3007AC408 /* AmazonRootCA1.cer in Resources */ = {isa = PBXBuildFile; fileRef = 58E4B1BB287F62C3007AC408 /* AmazonRootCA1.cer */; };
Expand Down Expand Up @@ -332,6 +343,9 @@
3EF6090127267C9800133703 /* AMPMiddleware.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AMPMiddleware.m; sourceTree = "<group>"; };
3F7002FB71B21CB2ABA065F1 /* Pods-shared-Amplitude_macOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-shared-Amplitude_macOSTests.debug.xcconfig"; path = "Target Support Files/Pods-shared-Amplitude_macOSTests/Pods-shared-Amplitude_macOSTests.debug.xcconfig"; sourceTree = "<group>"; };
4D8EA610D8DF8BD11DB40E7A /* Pods-shared-Amplitude_tvOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-shared-Amplitude_tvOSTests.debug.xcconfig"; path = "Target Support Files/Pods-shared-Amplitude_tvOSTests/Pods-shared-Amplitude_tvOSTests.debug.xcconfig"; sourceTree = "<group>"; };
582516E128C048D600ECAD0D /* AMPIngestionMetadata.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AMPIngestionMetadata.h; sourceTree = "<group>"; };
582516E628C048E700ECAD0D /* AMPIngestionMetadata.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AMPIngestionMetadata.m; sourceTree = "<group>"; };
582516EB28C075C300ECAD0D /* IngestionMetadataTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IngestionMetadataTests.m; sourceTree = "<group>"; };
58E4B1BB287F62C3007AC408 /* AmazonRootCA1.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = AmazonRootCA1.cer; sourceTree = "<group>"; };
6C55E7B2C7CB09D0EDC07910 /* Pods-shared-Amplitude_iOSTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-shared-Amplitude_iOSTests.release.xcconfig"; path = "Target Support Files/Pods-shared-Amplitude_iOSTests/Pods-shared-Amplitude_iOSTests.release.xcconfig"; sourceTree = "<group>"; };
70CE71E7AEFA4FE3E4F565AD /* Pods-shared-Amplitude_iOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-shared-Amplitude_iOSTests.debug.xcconfig"; path = "Target Support Files/Pods-shared-Amplitude_iOSTests/Pods-shared-Amplitude_iOSTests.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -487,6 +501,7 @@
3EF608E92726244300133703 /* AMPMiddlewareRunner.h */,
3EF608EE2726256800133703 /* AMPMiddlewareRunner.m */,
3EF6090127267C9800133703 /* AMPMiddleware.m */,
582516E628C048E700ECAD0D /* AMPIngestionMetadata.m */,
);
path = Amplitude;
sourceTree = "<group>";
Expand Down Expand Up @@ -527,6 +542,7 @@
3EF608DC27211AC000133703 /* ServerZoneUtilTests.m */,
3EF608E027211F8A00133703 /* ConfigManagerTests.m */,
3EF608FD272666E300133703 /* MiddlewareRunnerTests.m */,
582516EB28C075C300ECAD0D /* IngestionMetadataTests.m */,
);
path = Tests;
sourceTree = "<group>";
Expand All @@ -548,6 +564,7 @@
1279F8E925244D78003DCE07 /* AMPTrackingOptions.h */,
3EF608C82720E74D00133703 /* AMPServerZone.h */,
3EF608E42724BFB700133703 /* AMPMiddleware.h */,
582516E128C048D600ECAD0D /* AMPIngestionMetadata.h */,
);
path = Public;
sourceTree = "<group>";
Expand Down Expand Up @@ -626,6 +643,7 @@
1279F92025244E8E003DCE07 /* AMPDatabaseHelper.h in Headers */,
1279F91725244E8E003DCE07 /* AMPConfigManager.h in Headers */,
1279F91625244E8E003DCE07 /* AMPUtils.h in Headers */,
582516E328C048D600ECAD0D /* AMPIngestionMetadata.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -654,6 +672,7 @@
1279F90225244E8D003DCE07 /* AMPDatabaseHelper.h in Headers */,
1279F8F925244E8D003DCE07 /* AMPConfigManager.h in Headers */,
1279F8F825244E8D003DCE07 /* AMPUtils.h in Headers */,
582516E228C048D600ECAD0D /* AMPIngestionMetadata.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -682,6 +701,7 @@
1279F93E25244E8F003DCE07 /* AMPDatabaseHelper.h in Headers */,
1279F93525244E8F003DCE07 /* AMPConfigManager.h in Headers */,
1279F93425244E8F003DCE07 /* AMPUtils.h in Headers */,
582516E428C048D600ECAD0D /* AMPIngestionMetadata.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -710,6 +730,7 @@
759E93A725FBF44500BF7C3D /* AMPDatabaseHelper.h in Headers */,
759E93A525FBF44500BF7C3D /* AMPConfigManager.h in Headers */,
759E93B125FBF44500BF7C3D /* AMPUtils.h in Headers */,
582516E528C048D600ECAD0D /* AMPIngestionMetadata.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1054,6 +1075,7 @@
files = (
759E941125FBFE7800BF7C3D /* AMPBackgroundNotifier.m in Sources */,
1279FA6F2525949D003DCE07 /* ISPCertificatePinning.m in Sources */,
582516E828C048E700ECAD0D /* AMPIngestionMetadata.m in Sources */,
3EF608F02726256800133703 /* AMPMiddlewareRunner.m in Sources */,
1279F91A25244E8E003DCE07 /* AMPUtils.m in Sources */,
3EF6090327267C9800133703 /* AMPMiddleware.m in Sources */,
Expand Down Expand Up @@ -1092,6 +1114,7 @@
3EF608E227211F8A00133703 /* ConfigManagerTests.m in Sources */,
12C973C2241244F000E9CDDB /* TrackingOptionsTest.m in Sources */,
3EF608DE27211AC000133703 /* ServerZoneUtilTests.m in Sources */,
582516F128C075D200ECAD0D /* IngestionMetadataTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -1101,6 +1124,7 @@
files = (
759E941925FBFE7900BF7C3D /* AMPBackgroundNotifier.m in Sources */,
1279F8FE25244E8D003DCE07 /* AMPRevenue.m in Sources */,
582516E728C048E700ECAD0D /* AMPIngestionMetadata.m in Sources */,
1279F90825244E8D003DCE07 /* AMPDatabaseHelper.m in Sources */,
3EF608D82720F64500133703 /* AMPServerZoneUtil.m in Sources */,
3E2411EC26F9A46500793829 /* AMPPlan.m in Sources */,
Expand Down Expand Up @@ -1139,6 +1163,7 @@
3EF608E127211F8A00133703 /* ConfigManagerTests.m in Sources */,
12C973BF241244EF00E9CDDB /* TrackingOptionsTest.m in Sources */,
3EF608DD27211AC000133703 /* ServerZoneUtilTests.m in Sources */,
582516F028C075D100ECAD0D /* IngestionMetadataTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -1148,6 +1173,7 @@
files = (
759E940925FBFE7700BF7C3D /* AMPBackgroundNotifier.m in Sources */,
1279FA702525949D003DCE07 /* ISPCertificatePinning.m in Sources */,
582516E928C048E700ECAD0D /* AMPIngestionMetadata.m in Sources */,
3EF608F12726256800133703 /* AMPMiddlewareRunner.m in Sources */,
1279F93825244E8F003DCE07 /* AMPUtils.m in Sources */,
3EF6090427267C9800133703 /* AMPMiddleware.m in Sources */,
Expand Down Expand Up @@ -1177,6 +1203,7 @@
12C973B3241244BF00E9CDDB /* AMPDatabaseHelperTests.m in Sources */,
58E4B1C2287F6FD7007AC408 /* SSLPinningTests.m in Sources */,
12C973AB241244AF00E9CDDB /* Amplitude+Test.m in Sources */,
582516F228C075D300ECAD0D /* IngestionMetadataTests.m in Sources */,
12C973B4241244BF00E9CDDB /* RevenueTests.m in Sources */,
3EF608E327211F8A00133703 /* ConfigManagerTests.m in Sources */,
12C973C7241244F100E9CDDB /* BaseTestCase.m in Sources */,
Expand All @@ -1194,6 +1221,7 @@
files = (
759E93DD25FBF6F700BF7C3D /* AMPBackgroundNotifier.m in Sources */,
759E939025FBF3DC00BF7C3D /* AMPConfigManager.m in Sources */,
582516EA28C048E700ECAD0D /* AMPIngestionMetadata.m in Sources */,
3EF608F22726256800133703 /* AMPMiddlewareRunner.m in Sources */,
759E939125FBF3DC00BF7C3D /* AMPConstants.m in Sources */,
759E939225FBF3DC00BF7C3D /* AMPDatabaseHelper.m in Sources */,
Expand Down
1 change: 1 addition & 0 deletions Framework/AmplitudeFramework.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#import <Amplitude/AMPTrackingOptions.h>
#import <Amplitude/Amplitude+SSLPinning.h>
#import <Amplitude/AMPPlan.h>
#import <Amplitude/AMPIngestionMetadata.h>
#import <Amplitude/AMPMiddleware.h>
#import <Amplitude/AMPServerZone.h>

Expand Down
4 changes: 4 additions & 0 deletions Sources/Amplitude/AMPConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,7 @@ extern NSString *const AMP_PLAN_BRANCH;
extern NSString *const AMP_PLAN_SOURCE;
extern NSString *const AMP_PLAN_VERSION;
extern NSString *const AMP_PLAN_VERSION_ID;

// Ingestion Metadata
extern NSString *const AMP_INGESTION_METADATA_SOURCE_NAME;
extern NSString *const AMP_INGESTION_METADATA_SOURCE_VERSION;
3 changes: 3 additions & 0 deletions Sources/Amplitude/AMPConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,6 @@
NSString *const AMP_PLAN_SOURCE = @"source";
NSString *const AMP_PLAN_VERSION = @"version";
NSString *const AMP_PLAN_VERSION_ID = @"versionId";

NSString *const AMP_INGESTION_METADATA_SOURCE_NAME = @"source_name";
NSString *const AMP_INGESTION_METADATA_SOURCE_VERSION = @"source_version";
76 changes: 76 additions & 0 deletions Sources/Amplitude/AMPIngestionMetadata.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//
// AMPIngestionMetadata.m
// Copyright (c) 2022 Amplitude Inc. (https://amplitude.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

#ifndef AMPLITUDE_LOG
#if AMPLITUDE_DEBUG
# define AMPLITUDE_LOG(fmt, ...) NSLog(fmt, ##__VA_ARGS__)
#else
# define AMPLITUDE_LOG(...)
#endif
#endif

#import "AMPIngestionMetadata.h"
#import "AMPConstants.h"
#import "AMPUtils.h"

@implementation AMPIngestionMetadata

/*
* Create an AMPIngestionMetadata object
*/
+ (instancetype)ingestionMetadata {
return [[self alloc] init];
}

- (AMPIngestionMetadata *)setSourceName:(NSString *)sourceName {
if ([AMPUtils isEmptyString:sourceName]) {
AMPLITUDE_LOG(@"Invalid empty sourceName");
return self;
}

_sourceName = sourceName;
return self;
}

- (AMPIngestionMetadata *)setSourceVersion:(NSString *)sourceVersion {
if ([AMPUtils isEmptyString:sourceVersion]) {
AMPLITUDE_LOG(@"Invalid empty sourceVersion");
return self;
}

_sourceVersion = sourceVersion;
return self;
}

- (NSDictionary *)toNSDictionary {
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
if (_sourceName) {
[dict setValue:_sourceName forKey:AMP_INGESTION_METADATA_SOURCE_NAME];
}
if (_sourceVersion) {
[dict setValue:_sourceVersion forKey:AMP_INGESTION_METADATA_SOURCE_VERSION];
}
return dict;
}

@end
10 changes: 10 additions & 0 deletions Sources/Amplitude/Amplitude.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#import "AMPRevenue.h"
#import "AMPTrackingOptions.h"
#import "AMPPlan.h"
#import "AMPIngestionMetadata.h"
#import "AMPServerZone.h"
#import "AMPServerZoneUtil.h"
#import "AMPMiddleware.h"
Expand Down Expand Up @@ -140,6 +141,7 @@ @implementation Amplitude {
NSString *_serverUrl;
NSString *_token;
AMPPlan *_plan;
AMPIngestionMetadata *_ingestionMetadata;
AMPServerZone _serverZone;
AMPMiddlewareRunner *_middlewareRunner;
}
Expand Down Expand Up @@ -718,6 +720,10 @@ - (void)annotateEvent:(NSMutableDictionary *)event {
[event setValue:[_plan toNSDictionary] forKey:@"plan"];
}

if (_ingestionMetadata) {
[event setValue:[_ingestionMetadata toNSDictionary] forKey:@"ingestion_metadata"];
}

NSMutableDictionary *apiProperties = [event valueForKey:@"api_properties"];

if ([_appliedTrackingOptions shouldTrackIDFA]) {
Expand Down Expand Up @@ -1494,6 +1500,10 @@ - (void)setPlan:(AMPPlan *)plan {
_plan = plan;
}

- (void)setIngestionMetadata:(AMPIngestionMetadata *)ingestionMetadata {
_ingestionMetadata = ingestionMetadata;
}

- (void)setServerZone:(AMPServerZone)serverZone {
[self setServerZone:serverZone updateServerUrl:YES];
}
Expand Down
39 changes: 39 additions & 0 deletions Sources/Amplitude/Public/AMPIngestionMetadata.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// AMPIngestionMetadata.h
// Copyright (c) 2022 Amplitude Inc. (https://amplitude.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <Foundation/Foundation.h>

@interface AMPIngestionMetadata : NSObject

@property (nonatomic, strong, readonly) NSString *sourceName;

@property (nonatomic, strong, readonly) NSString *sourceVersion;

+ (instancetype)ingestionMetadata;

- (AMPIngestionMetadata *)setSourceName:(NSString *)sourceName;

- (AMPIngestionMetadata *)setSourceVersion:(NSString *)sourceVersion;

- (NSDictionary *)toNSDictionary;

@end
3 changes: 3 additions & 0 deletions Sources/Amplitude/Public/Amplitude.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#import "AMPRevenue.h"
#import "AMPTrackingOptions.h"
#import "AMPPlan.h"
#import "AMPIngestionMetadata.h"
#import "AMPServerZone.h"
#import "AMPMiddleware.h"

Expand Down Expand Up @@ -656,6 +657,8 @@ typedef void (^AMPInitCompletionBlock)(void);

- (void)setPlan:(AMPPlan *)plan;

- (void)setIngestionMetadata:(AMPIngestionMetadata *)ingestionMetadata;

/**
* Set Amplitude Server Zone, switch to zone related configuration, including dynamic configuration and server url.
* To send data to Amplitude's EU servers, you need to configure the serverZone to EU like [client setServerZone:EU]
Expand Down
18 changes: 18 additions & 0 deletions Tests/AmplitudeTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#import "AMPUtils.h"
#import "AMPTrackingOptions.h"
#import "AMPPlan.h"
#import "AMPIngestionMetadata.h"
#import "AMPServerZone.h"

@interface Amplitude (Tests)
Expand Down Expand Up @@ -1109,6 +1110,23 @@ - (void)testSetPlan {
XCTAssertEqualObjects(versionId, planValue[@"versionId"]);
}

- (void)testSetIngestionMetadata {
Amplitude *client = [Amplitude instanceWithName:@"ingestion_metadata"];
[client initializeApiKey:@"ingestion_metadata"];
NSString *sourceName = @"ampli";
NSString *sourceVersion = @"2.0.0";

AMPIngestionMetadata *ingestionMetadata = [[[AMPIngestionMetadata ingestionMetadata] setSourceName:sourceName] setSourceVersion:sourceVersion];
[client setIngestionMetadata:ingestionMetadata];
[client logEvent:@"test"];
[client flushQueue];
NSDictionary *event = [client getLastEventFromInstanceName:@"ingestion_metadata"];

NSDictionary *ingestionMetadataValue = event[@"ingestion_metadata"];
XCTAssertEqualObjects(sourceName, ingestionMetadataValue[@"source_name"]);
XCTAssertEqualObjects(sourceVersion, ingestionMetadataValue[@"source_version"]);
}

- (void)testSetServerZone {
Amplitude *client = [Amplitude instanceWithName:@"eu_zone"];
XCTAssertEqualObjects(kAMPEventLogUrl, [client valueForKey:@"serverUrl"]);
Expand Down
Loading