-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
squash commit of develop_pre_signing_and_merge_commit_rules
- Loading branch information
Showing
5,131 changed files
with
997,779 additions
and
12 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
937 changes: 937 additions & 0 deletions
937
AmplitudeInjections/AmplitudeInjections.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
...eInjections/AmplitudeInjections/AmplitudeInjections.docc/AmplitudeInjections.md
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,13 @@ | ||
# ``AmplitudeInjections`` | ||
|
||
<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@--> | ||
|
||
## Overview | ||
|
||
<!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@--> | ||
|
||
## Topics | ||
|
||
### <!--@START_MENU_TOKEN@-->Group<!--@END_MENU_TOKEN@--> | ||
|
||
- <!--@START_MENU_TOKEN@-->``Symbol``<!--@END_MENU_TOKEN@--> |
18 changes: 18 additions & 0 deletions
18
AmplitudeInjections/AmplitudeInjections/AmplitudeInjections.h
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,18 @@ | ||
// | ||
// AmplitudeInjections.h | ||
// AmplitudeInjections | ||
// | ||
// Created by John Huang on 4/19/22. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
//! Project version number for AmplitudeInjections. | ||
FOUNDATION_EXPORT double AmplitudeInjectionsVersionNumber; | ||
|
||
//! Project version string for AmplitudeInjections. | ||
FOUNDATION_EXPORT const unsigned char AmplitudeInjectionsVersionString[]; | ||
|
||
// In this header, you should import all the public headers of your framework using statements like #import <AmplitudeInjections/PublicHeader.h> | ||
|
||
|
52 changes: 52 additions & 0 deletions
52
AmplitudeInjections/AmplitudeInjections/_Tracking/AmplitudeTracking.swift
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,52 @@ | ||
// | ||
// AmplitudeTracking.swift | ||
// AmplitudeInjections | ||
// | ||
// Created by John Huang on 4/19/22. | ||
// | ||
|
||
import AmplitudeSwift | ||
import PlatformParticles | ||
import Utilities | ||
|
||
open class AmplitudeTracking: TransformerTracker { | ||
|
||
private let amplitude: Amplitude | ||
|
||
public init(_ apiKey: String) { | ||
self.amplitude = Amplitude.init(configuration: .init(apiKey: apiKey)) | ||
super.init() | ||
} | ||
|
||
override open func log(event: String, data: [String: Any]?, revenue: NSNumber?) { | ||
if !excluded { | ||
var data = data | ||
if let revenue = revenue { | ||
if data == nil { | ||
data = [String: Any]() | ||
} | ||
data?["$revenue"] = revenue | ||
} | ||
Console.shared.log("analytics log | Amplitude: logging event \(event) with data: \((data ?? [:]).description)") | ||
let event = BaseEvent(eventType: event, eventProperties: data) | ||
amplitude.track(event: event) | ||
} | ||
} | ||
|
||
override public func setUserId(_ userId: String?) { | ||
Console.shared.log("analytics log | Amplitude: User ID set to: `\(userId ?? "nil")`") | ||
amplitude.setUserId(userId: userId) | ||
} | ||
|
||
// https://amplitude.com/docs/sdks/analytics/ios/ios-swift-sdk#identify | ||
override public func setValue(_ value: Any?, forUserProperty userProperty: String) { | ||
Console.shared.log("analytics log | Amplitude: User Property `\(userProperty)` set to: \(value ?? "nil")") | ||
let identify = Identify() | ||
if value != nil { | ||
identify.set(property: userProperty, value: value) | ||
} else { | ||
identify.unset(property: userProperty) | ||
} | ||
amplitude.identify(identify: identify) | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
AmplitudeInjections/AmplitudeInjectionsTests/AmplitudeInjectionsTests.swift
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,36 @@ | ||
// | ||
// AmplitudeInjectionsTests.swift | ||
// AmplitudeInjectionsTests | ||
// | ||
// Created by John Huang on 4/19/22. | ||
// | ||
|
||
import XCTest | ||
@testable import AmplitudeInjections | ||
|
||
class AmplitudeInjectionsTests: XCTestCase { | ||
|
||
override func setUpWithError() throws { | ||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
} | ||
|
||
func testExample() throws { | ||
// This is an example of a functional test case. | ||
// Use XCTAssert and related functions to verify your tests produce the correct results. | ||
// Any test you write for XCTest can be annotated as throws and async. | ||
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. | ||
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. | ||
} | ||
|
||
func testPerformanceExample() throws { | ||
// This is an example of a performance test case. | ||
self.measure { | ||
// Put the code you want to measure the time of here. | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.