Skip to content

Commit

Permalink
Merge branch 'master' of github.com:segment-integrations/analytics-io…
Browse files Browse the repository at this point in the history
…s-integration-amplitude
  • Loading branch information
Brandon Sneed committed May 5, 2021
2 parents defa93d + 57902db commit 0f6e872
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 33 deletions.
26 changes: 13 additions & 13 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PODS:
- Amplitude (7.0.1)
- Analytics (4.1.3)
- Amplitude (8.3.0)
- Analytics (4.1.4)
- Expecta (1.0.6)
- OCHamcrest (7.2.0)
- OCMockito (5.1.3):
- OCHamcrest (~> 7.0)
- Segment-Amplitude (3.3.0):
- Amplitude (~> 7.0.1)
- OCHamcrest (8.0.0)
- OCMockito (6.0.0):
- OCHamcrest (~> 8.0)
- Segment-Amplitude (3.3.1):
- Amplitude (~> 8.0)
- Analytics
- Specta (1.0.7)

Expand All @@ -30,14 +30,14 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
Amplitude: 31a9038dca905b78294418ed277da9c2e07658ad
Analytics: 4c01e3e19d4be86705bad6581a1c2aa5a15a9d22
Amplitude: 5627b4574e36d789a75c1656ba39b3278edf1ade
Analytics: 7bdc735c456434b4eaa2eacdcf122bb03d51ede7
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
OCHamcrest: 8097ab14ab9366f44cd66638aa589fea3840d779
OCMockito: 677cbb4a18fd492b5a4fb10144dada4de5ddb877
Segment-Amplitude: 65c094a8c43d2c4275a3b93dade8d16cb0e1bf63
OCHamcrest: a613690381f1dac7637c18962c10dbe8feca4bb5
OCMockito: 780f04370226f81a9d972c97d1203864ef609f5b
Segment-Amplitude: 00d7c0f80398966afa5aef254d939bbbd607c46e
Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66

PODFILE CHECKSUM: 166e86977ca5ed7a88d476e1f295a6953c3274c0

COCOAPODS: 1.10.0
COCOAPODS: 1.10.1
2 changes: 2 additions & 0 deletions Example/Segment-Amplitude.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,12 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Segment-Amplitude_Example/Pods-Segment-Amplitude_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Amplitude/Amplitude.framework",
"${BUILT_PRODUCTS_DIR}/Analytics/Segment.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Amplitude.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Segment.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down
19 changes: 0 additions & 19 deletions Pod/Classes/SEGAmplitudeIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -138,27 +138,8 @@ - (void)realTrack:(NSString *)event properties:(NSDictionary *)properties integr
// Track revenue. If revenue is not present fallback on total
NSNumber *revenueOrTotal = [SEGAmplitudeIntegration extractRevenueOrTotal:properties withRevenueKey:@"revenue" andTotalKey:@"total"];
if (revenueOrTotal) {
[self trackRevenue:properties andRevenueOrTotal:revenueOrTotal];
}
}

- (void)trackRevenue:(NSDictionary *)properties andRevenueOrTotal:(NSNumber *)revenueOrTotal
{
// Use logRevenueV2 with revenue properties.
if ([(NSNumber *)self.settings[@"useLogRevenueV2"] boolValue]) {
[self trackLogRevenueV2:properties andRevenueOrTotal:revenueOrTotal];
return;
}

// fallback to logRevenue v1
NSString *productId = properties[@"productId"] ?: properties[@"product_id"] ?: nil;
NSNumber *quantity = properties[@"quantity"] ?: [NSNumber numberWithInt:1];
id receipt = properties[@"receipt"] ?: nil;
[self.amplitude logRevenue:productId
quantity:[quantity integerValue]
price:revenueOrTotal
receipt:receipt];
SEGLog(@"[Amplitude logRevenue:%@ quantity:%d price:%@ receipt:%@];", productId, [quantity integerValue], revenueOrTotal, receipt);
}

- (void)trackLogRevenueV2:(NSDictionary *)properties andRevenueOrTotal:(NSNumber *)revenueOrTotal
Expand Down
2 changes: 1 addition & 1 deletion Segment-Amplitude.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ Pod::Spec.new do |s|
s.source_files = 'Pod/Classes/**/*'

s.dependency 'Analytics'
s.dependency 'Amplitude', '~> 7.0.1'
s.dependency 'Amplitude', '~> 8.0'
end

0 comments on commit 0f6e872

Please sign in to comment.