Skip to content

Commit

Permalink
squash commit of develop_pre_signing_and_merge_commit_rules
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-dydx committed Aug 21, 2024
1 parent d142961 commit 904694a
Show file tree
Hide file tree
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.
937 changes: 937 additions & 0 deletions AmplitudeInjections/AmplitudeInjections.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

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 AmplitudeInjections/AmplitudeInjections/AmplitudeInjections.h
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>


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)
}
}
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.
}
}

}
Loading

0 comments on commit 904694a

Please sign in to comment.