From 7fbb492fb24c8ece0b8f46af9d262f86d589f44d Mon Sep 17 00:00:00 2001 From: Suyeol Jeon Date: Sat, 2 Dec 2017 03:33:18 +0900 Subject: [PATCH] Add Amplitude support --- Package.swift | 3 +++ Podfile | 5 +++++ Podfile.lock | 5 ++++- README.md | 1 + Sources/UmbrellaAmplitude/AmplitudeProvider.swift | 13 +++++++++++++ .../AmplitudeProviderTests.swift | 14 ++++++++++++++ 6 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 Sources/UmbrellaAmplitude/AmplitudeProvider.swift create mode 100644 Tests/UmbrellaAmplitudeTests/AmplitudeProviderTests.swift diff --git a/Package.swift b/Package.swift index 21a1db1..efd8ac2 100644 --- a/Package.swift +++ b/Package.swift @@ -6,6 +6,7 @@ let package = Package( name: "Umbrella", products: [ .library(name: "Umbrella", targets: ["Umbrella"]), + .library(name: "UmbrellaAmplitude", targets: ["UmbrellaAmplitude"]), .library(name: "UmbrellaAnswers", targets: ["UmbrellaAnswers"]), .library(name: "UmbrellaAppboy", targets: ["UmbrellaAppboy"]), .library(name: "UmbrellaAppsFlyer", targets: ["UmbrellaAppsFlyer"]), @@ -16,6 +17,7 @@ let package = Package( ], targets: [ .target(name: "Umbrella"), + .target(name: "UmbrellaAmplitude", dependencies: ["Umbrella"]), .target(name: "UmbrellaAnswers", dependencies: ["Umbrella"]), .target(name: "UmbrellaAppboy", dependencies: ["Umbrella"]), .target(name: "UmbrellaAppsFlyer", dependencies: ["Umbrella"]), @@ -23,6 +25,7 @@ let package = Package( .target(name: "UmbrellaFlurry", dependencies: ["Umbrella"]), .target(name: "UmbrellaLocalytics", dependencies: ["Umbrella"]), .target(name: "UmbrellaMixpanel", dependencies: ["Umbrella"]), + .testTarget(name: "UmbrellaAmplitudeTests", dependencies: ["UmbrellaAmplitude"]), .testTarget(name: "UmbrellaAnswersTests", dependencies: ["UmbrellaAnswers"]), .testTarget(name: "UmbrellaAppboyTests", dependencies: ["UmbrellaAppboy"]), .testTarget(name: "UmbrellaAppsFlyerTests", dependencies: ["UmbrellaAppsFlyer"]), diff --git a/Podfile b/Podfile index 7790c78..bba4a00 100644 --- a/Podfile +++ b/Podfile @@ -1,6 +1,11 @@ use_frameworks! inhibit_all_warnings! +target 'UmbrellaAmplitudeTests' do + platform :ios, '8.0' + pod 'Amplitude-iOS' +end + target 'UmbrellaAnswersTests' do platform :ios, '8.0' pod 'Answers' diff --git a/Podfile.lock b/Podfile.lock index 9b89d1d..a17ff9f 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,4 +1,5 @@ PODS: + - Amplitude-iOS (4.0.4) - Answers (1.3.4): - Fabric (~> 1.6.3) - Appboy-iOS-SDK (3.0.0): @@ -35,6 +36,7 @@ PODS: - SDWebImage/Core DEPENDENCIES: + - Amplitude-iOS - Answers - Appboy-iOS-SDK - AppsFlyerFramework @@ -44,6 +46,7 @@ DEPENDENCIES: - Mixpanel SPEC CHECKSUMS: + Amplitude-iOS: 2ad4d7270c99186236c1272a3a9425463b1ae1a7 Answers: 6a4d22973d8550808630a55f526055c9eb6d39a2 Appboy-iOS-SDK: b78abfe6915d4a62634e5e9581ce3a6fc13ef353 AppsFlyerFramework: ece902d4233177d4e9db1429c7a5df5fad8e9f07 @@ -59,6 +62,6 @@ SPEC CHECKSUMS: Mixpanel: 9b33e5de998cd42597767f67e2b8fcd1d158c71d SDWebImage: 0e435c14e402a6730315a0fb79f95e68654d55a4 -PODFILE CHECKSUM: 36988e53c5e56be55a41f802ffa3c350ad504748 +PODFILE CHECKSUM: 27e47646f9da8c60f83deba571e7d9a924c84a33 COCOAPODS: 1.3.1 diff --git a/README.md b/README.md index 2c4e685..259885c 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ analytics.log(.signup(username: "devxoul")) There are several built-in providers. +* AmplitudeProvider ([Amplitude-iOS](https://cocoapods.org/pods/Amplitude-iOS)) * AnswersProvider ([Answers](https://cocoapods.org/pods/Answers)) * AppboyProvider ([Appboy-iOS-SDK](http://cocoapods.org/pods/Appboy-iOS-SDK)) * AppsFlyerProvider ([AppsFlyerFramework](http://cocoapods.org/pods/AppsFlyerFramework)) diff --git a/Sources/UmbrellaAmplitude/AmplitudeProvider.swift b/Sources/UmbrellaAmplitude/AmplitudeProvider.swift new file mode 100644 index 0000000..674c19e --- /dev/null +++ b/Sources/UmbrellaAmplitude/AmplitudeProvider.swift @@ -0,0 +1,13 @@ +import Foundation + +#if !COCOAPODS +import Umbrella +#endif + +open class AmplitudeProvider: RuntimeProviderType { + open let className: String = "Amplitude" + open let selectorName: String = "logEvent:withEventProperties:" + + public init() { + } +} diff --git a/Tests/UmbrellaAmplitudeTests/AmplitudeProviderTests.swift b/Tests/UmbrellaAmplitudeTests/AmplitudeProviderTests.swift new file mode 100644 index 0000000..f6bfd7c --- /dev/null +++ b/Tests/UmbrellaAmplitudeTests/AmplitudeProviderTests.swift @@ -0,0 +1,14 @@ +import XCTest +import Umbrella +import UmbrellaAmplitude +import Amplitude_iOS + +final class AmplitudeProviderTests: XCTestCase { + func testAmplitudeProvider() { + let provider = AmplitudeProvider() + XCTAssertTrue(provider.cls === Amplitude.self) + XCTAssertNil(provider.instance) + XCTAssertEqual(provider.selector, #selector(Amplitude.logEvent(_:withEventProperties:))) + XCTAssertTrue(provider.responds) + } +}