diff --git a/Cartfile b/Cartfile index 6d021dd..91adcfb 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ -github "tealium/tealium-swift" +github "tealium/tealium-swift" ~> 2.1 github "ContentSquare/CS_iOS_SDK" diff --git a/Cartfile.resolved b/Cartfile.resolved deleted file mode 100644 index 4e25e4d..0000000 --- a/Cartfile.resolved +++ /dev/null @@ -1,3 +0,0 @@ -binary "https://tags.tiqcdn.com/dle/tealiummobile/tealium-ios-carthage/tealium-carthage-plcrashreporter.json" "1.3.6" -github "ContentSquare/CS_iOS_SDK" "v3.0.0" -github "tealium/tealium-swift" "1.9.1" diff --git a/Objective-C/ContentsquareCommand.swift b/Objective-C/ContentsquareCommand.swift deleted file mode 100644 index 6f31bc8..0000000 --- a/Objective-C/ContentsquareCommand.swift +++ /dev/null @@ -1,79 +0,0 @@ -// -// ContentsquareRemoteCommand.swift -// TealiumContentsquare -// -// Created by Jonathan Wong on 3/6/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. -// - -import Foundation -#if COCOAPODS -import TealiumSwift -#else -import TealiumCore -import TealiumTagManagement -import TealiumRemoteCommands -#endif - -public class ContentsquareCommand { - - let contentsquareTracker: - ContentsquareTrackable - - public init(contentsquareTracker: - ContentsquareTrackable) { - self.contentsquareTracker = - contentsquareTracker - } - - public func remoteCommand() -> TealiumRemoteCommand { - return TealiumRemoteCommand(commandId: "contentsquare", - description: "Contentsquare Remote Command") { response in - let payload = response.payload() - guard let command = payload[Contentsquare.Commands.commandKey] as? String else { - return - } - - let commands = command.split(separator: ",") - let formatted = commands.map { command in - return command.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) - } - - self.parseCommands(formatted, payload: payload) - } - } - - func parseCommands(_ commands: [String], payload: [String: Any]) { - commands.forEach { command in - let lowercasedCommand = command.lowercased() - switch lowercasedCommand { - case Contentsquare.Commands.sendScreenView: - guard let screenName = payload[Contentsquare.ScreenView.screenName] as? String else { return } - contentsquareTracker.sendScreenView(screenName: screenName) - case Contentsquare.Commands.sendTransaction: - guard let options = payload[Contentsquare.TransactionProperties.transaction] as? [String: Any] else { - print("Contentsquare.TransactionProperties.transaction key is missing.") - return - } - guard let price: Double = options[Contentsquare.TransactionProperties.price] as? Double, - let currency: String = options[Contentsquare.TransactionProperties.currency] as? String else { return } - let transactionId: String? = options[Contentsquare.TransactionProperties.transactionId] as? String - contentsquareTracker.sendTransaction(price: price, currency: currency, transactionId: transactionId) - case Contentsquare.Commands.sendDynamicVar: - guard let dynamicVar = payload[Contentsquare.DynamicVar.dynamicVar] as? [String: Any] else { return } - contentsquareTracker.sendDynamicVar(dynamicVar: dynamicVar) - case Contentsquare.Commands.stopTracking: - contentsquareTracker.stopTracking() - case Contentsquare.Commands.resumeTracking: - contentsquareTracker.resumeTracking() - case Contentsquare.Commands.forgetMe: - contentsquareTracker.forgetMe() - case Contentsquare.Commands.optIn: - contentsquareTracker.optIn() - case Contentsquare.Commands.optOut: - contentsquareTracker.optOut() - default: break - } - } - } -} diff --git a/Objective-C/ContentsquareConstants.swift b/Objective-C/ContentsquareConstants.swift deleted file mode 100644 index 8b7a73f..0000000 --- a/Objective-C/ContentsquareConstants.swift +++ /dev/null @@ -1,42 +0,0 @@ -// -// ContentsquareConstants.swift -// TealiumContentsquare -// -// Created by Jonathan Wong on 3/4/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. -// - -extension ContentsquareCommand { - enum Contentsquare { - - enum Commands { - static let commandKey = "command_name" - static let separator = "," - - static let sendScreenView = "sendscreenview" - static let sendTransaction = "sendtransaction" - static let sendDynamicVar = "senddynamicvar" - static let stopTracking = "stoptracking" - static let resumeTracking = "resumetracking" - static let forgetMe = "forgetme" - static let optIn = "optin" - static let optOut = "optout" - - } - - enum ScreenView { - static let screenName = "screen_name" - } - - enum TransactionProperties { - static let transaction = "transaction" - static let price = "price" // required - static let currency = "currency" // required - static let transactionId = "transaction_id" // optional - } - - enum DynamicVar { - static let dynamicVar = "dynamic_var" - } - } -} diff --git a/Objective-C/ContentsquareTrackable.swift b/Objective-C/ContentsquareTrackable.swift deleted file mode 100644 index 31c4f04..0000000 --- a/Objective-C/ContentsquareTrackable.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// ContentsquareTrackable.swift -// TealiumContentsquare -// -// Created by Jonathan Wong on 3/6/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. -// - -import Foundation - -public protocol ContentsquareTrackable { - func sendScreenView(screenName: String) - - func sendTransaction(price: Double, currency: String, transactionId: String?) - - func sendDynamicVar(dynamicVar: [String: Any]) - - func stopTracking() - func resumeTracking() - func forgetMe() - func optIn() - func optOut() - -} diff --git a/Sources/ContentsquareConstants.swift b/Sources/ContentsquareConstants.swift index 9bee84f..f233436 100644 --- a/Sources/ContentsquareConstants.swift +++ b/Sources/ContentsquareConstants.swift @@ -3,25 +3,26 @@ // TealiumContentsquare // // Created by Jonathan Wong on 3/4/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. +// Copyright © 2020 Tealium. All rights reserved. // extension ContentsquareRemoteCommand { enum Contentsquare { - enum Commands { - static let commandKey = "command_name" - static let separator: Character = "," - - static let sendScreenView = "sendscreenview" - static let sendTransaction = "sendtransaction" - static let sendDynamicVar = "senddynamicvar" - static let stopTracking = "stoptracking" - static let resumeTracking = "resumetracking" - static let forgetMe = "forgetme" - static let optIn = "optin" - static let optOut = "optout" - + static let commandId = "contentsquare" + static let description = "Contentsquare Remote Command" + static let commandKey = "command_name" + static let separator: Character = "," + + enum Commands: String { + case sendScreenView = "sendscreenview" + case sendTransaction = "sendtransaction" + case sendDynamicVar = "senddynamicvar" + case stopTracking = "stoptracking" + case resumeTracking = "resumetracking" + case forgetMe = "forgetme" + case optIn = "optin" + case optOut = "optout" } enum ScreenView { @@ -29,6 +30,7 @@ extension ContentsquareRemoteCommand { } enum TransactionProperties { + static let purchase = "purchase" static let transaction = "transaction" static let price = "price" // required static let currency = "currency" // required diff --git a/Objective-C/ContentsquareTracker.swift b/Sources/ContentsquareInstance.swift similarity index 92% rename from Objective-C/ContentsquareTracker.swift rename to Sources/ContentsquareInstance.swift index b9c1612..688e93d 100644 --- a/Objective-C/ContentsquareTracker.swift +++ b/Sources/ContentsquareInstance.swift @@ -1,15 +1,26 @@ // -// ContentsquareTracker.swift +// ContentsquareInstance.swift // TealiumContentsquare // // Created by Jonathan Wong on 3/6/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. +// Copyright © 2020 Tealium. All rights reserved. // import Foundation import ContentsquareModule -public class ContentsquareTracker: ContentsquareTrackable { +public protocol ContentsquareCommand { + func sendScreenView(screenName: String) + func sendTransaction(price: Double, currency: String, transactionId: String?) + func sendDynamicVar(dynamicVar: [String: Any]) + func stopTracking() + func resumeTracking() + func forgetMe() + func optIn() + func optOut() +} + +public class ContentsquareInstance: ContentsquareCommand { public init() {} @@ -29,19 +40,11 @@ public class ContentsquareTracker: ContentsquareTrackable { public func sendDynamicVar(dynamicVar: [String: Any]) { dynamicVar.forEach { key, value in if let value = value as? String { - do { - let dynamicVar = try DynamicVar(key: key, value: value) - Contentsquare.send(dynamicVar: dynamicVar) - } catch { - print("Error with dynamic variable key: \(key), value: \(value), error: \(error)") - } + let dynamicVar = DynamicVar(key: key, value: value) + Contentsquare.send(dynamicVar: dynamicVar) } else if let value = value as? UInt32 { - do { - let dynamicVar = try DynamicVar(key: key, value: value) - Contentsquare.send(dynamicVar: dynamicVar) - } catch { - print("Error with dynamic variable key: \(key), value: \(value), error: \(error)") - } + let dynamicVar = DynamicVar(key: key, value: value) + Contentsquare.send(dynamicVar: dynamicVar) } else { print("Incorrect format of value: \(value). Value should be String or UInt32.") } diff --git a/Sources/ContentsquareRemoteCommand.swift b/Sources/ContentsquareRemoteCommand.swift index 483ef81..986184c 100644 --- a/Sources/ContentsquareRemoteCommand.swift +++ b/Sources/ContentsquareRemoteCommand.swift @@ -3,7 +3,7 @@ // TealiumContentsquare // // Created by Jonathan Wong on 3/6/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. +// Copyright © 2020 Tealium. All rights reserved. // import Foundation @@ -15,63 +15,65 @@ import TealiumTagManagement import TealiumRemoteCommands #endif -public class ContentsquareRemoteCommand { +public class ContentsquareRemoteCommand: RemoteCommand { - let contentsquareTracker: - ContentsquareTrackable + var contentsquareInstance: ContentsquareCommand? - public init(contentsquareTracker: - ContentsquareTrackable) { - self.contentsquareTracker = - contentsquareTracker + public init(contentsquareInstance: ContentsquareCommand = ContentsquareInstance(), type: RemoteCommandType = .webview) { + self.contentsquareInstance = contentsquareInstance + weak var weakSelf: ContentsquareRemoteCommand? + super.init(commandId: Contentsquare.commandId, + description: Contentsquare.description, + type: type, + completion: { response in + guard let payload = response.payload else { + return + } + weakSelf?.processRemoteCommand(with: payload) + }) + weakSelf = self } - public func remoteCommand() -> TealiumRemoteCommand { - return TealiumRemoteCommand(commandId: "contentsquare", - description: "Contentsquare Remote Command") { response in - let payload = response.payload() - guard let command = payload[Contentsquare.Commands.commandKey] as? String else { - return - } - - let commands = command.split(separator: Contentsquare.Commands.separator) - let formatted = commands.map { command in - return command.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) - } - - self.parseCommands(formatted, payload: payload) + func processRemoteCommand(with payload: [String: Any]) { + guard let contentsquareInstance = contentsquareInstance, + let command = payload[Contentsquare.commandKey] as? String else { + return } - } - - func parseCommands(_ commands: [String], payload: [String: Any]) { - commands.forEach { command in - let lowercasedCommand = command.lowercased() - switch lowercasedCommand { - case Contentsquare.Commands.sendScreenView: + let commands = command.split(separator: Contentsquare.separator) + let contentsquareCommands = commands.map { command in + return command.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) + } + + contentsquareCommands.forEach { + let command = Contentsquare.Commands(rawValue: $0.lowercased()) + switch command { + case .sendScreenView: guard let screenName = payload[Contentsquare.ScreenView.screenName] as? String else { return } - contentsquareTracker.sendScreenView(screenName: screenName) - case Contentsquare.Commands.sendTransaction: - guard let options = payload[Contentsquare.TransactionProperties.transaction] as? [String: Any] else { - print("Contentsquare.TransactionProperties.transaction key is missing.") - return + contentsquareInstance.sendScreenView(screenName: screenName) + case .sendTransaction: + var options = [String: Any]() + if let transaction = payload[Contentsquare.TransactionProperties.transaction] as? [String: Any] { + options = transaction + } else if let purchase = payload[Contentsquare.TransactionProperties.purchase] as? [String: Any] { + options = purchase } guard let price: Double = options[Contentsquare.TransactionProperties.price] as? Double, let currency: String = options[Contentsquare.TransactionProperties.currency] as? String else { return } let transactionId: String? = options[Contentsquare.TransactionProperties.transactionId] as? String - contentsquareTracker.sendTransaction(price: price, currency: currency, transactionId: transactionId) - case Contentsquare.Commands.sendDynamicVar: + contentsquareInstance.sendTransaction(price: price, currency: currency, transactionId: transactionId) + case .sendDynamicVar: guard let dynamicVar = payload[Contentsquare.DynamicVar.dynamicVar] as? [String: Any] else { return } - contentsquareTracker.sendDynamicVar(dynamicVar: dynamicVar) - case Contentsquare.Commands.stopTracking: - contentsquareTracker.stopTracking() - case Contentsquare.Commands.resumeTracking: - contentsquareTracker.resumeTracking() - case Contentsquare.Commands.forgetMe: - contentsquareTracker.forgetMe() - case Contentsquare.Commands.optIn: - contentsquareTracker.optIn() - case Contentsquare.Commands.optOut: - contentsquareTracker.optOut() + contentsquareInstance.sendDynamicVar(dynamicVar: dynamicVar) + case .stopTracking: + contentsquareInstance.stopTracking() + case .resumeTracking: + contentsquareInstance.resumeTracking() + case .forgetMe: + contentsquareInstance.forgetMe() + case .optIn: + contentsquareInstance.optIn() + case .optOut: + contentsquareInstance.optOut() default: break } } diff --git a/Sources/ContentsquareTrackable.swift b/Sources/ContentsquareTrackable.swift deleted file mode 100644 index 31c4f04..0000000 --- a/Sources/ContentsquareTrackable.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// ContentsquareTrackable.swift -// TealiumContentsquare -// -// Created by Jonathan Wong on 3/6/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. -// - -import Foundation - -public protocol ContentsquareTrackable { - func sendScreenView(screenName: String) - - func sendTransaction(price: Double, currency: String, transactionId: String?) - - func sendDynamicVar(dynamicVar: [String: Any]) - - func stopTracking() - func resumeTracking() - func forgetMe() - func optIn() - func optOut() - -} diff --git a/Sources/ContentsquareTracker.swift b/Sources/ContentsquareTracker.swift deleted file mode 100644 index b9c1612..0000000 --- a/Sources/ContentsquareTracker.swift +++ /dev/null @@ -1,438 +0,0 @@ -// -// ContentsquareTracker.swift -// TealiumContentsquare -// -// Created by Jonathan Wong on 3/6/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. -// - -import Foundation -import ContentsquareModule - -public class ContentsquareTracker: ContentsquareTrackable { - - public init() {} - - public func sendScreenView(screenName: String) { - Contentsquare.send(screenViewWithName: screenName) - } - - public func sendTransaction(price: Double, currency: String, transactionId: String?) { - guard let currency = CurrencyWrapper(rawValue: currency.lowercased())?.currency() else { - print("Error with currency value.") - return - } - let transaction = CustomerTransaction(id: transactionId, value: Float(price), currency: currency) - Contentsquare.send(transaction: transaction) - } - - public func sendDynamicVar(dynamicVar: [String: Any]) { - dynamicVar.forEach { key, value in - if let value = value as? String { - do { - let dynamicVar = try DynamicVar(key: key, value: value) - Contentsquare.send(dynamicVar: dynamicVar) - } catch { - print("Error with dynamic variable key: \(key), value: \(value), error: \(error)") - } - } else if let value = value as? UInt32 { - do { - let dynamicVar = try DynamicVar(key: key, value: value) - Contentsquare.send(dynamicVar: dynamicVar) - } catch { - print("Error with dynamic variable key: \(key), value: \(value), error: \(error)") - } - } else { - print("Incorrect format of value: \(value). Value should be String or UInt32.") - } - } - } - - public func stopTracking() { - Contentsquare.stopTracking() - } - - public func resumeTracking() { - Contentsquare.resumeTracking() - } - - public func forgetMe() { - Contentsquare.forgetMe() - } - - public func optIn() { - Contentsquare.optIn() - } - - public func optOut() { - Contentsquare.optOut() - } -} - -/// Maps to Contentsquare's Currency type -public enum CurrencyWrapper: String, Codable { - case mop - case bmd - case kes - case bnd - case iqd - case sdg - case zmw - case xts - case top - case xsu - case svc - case ils - case dzd - case nad - case mxv - case sos - case cad - case sek - case hkd - case zwl - case egp - case clp - case cuc - case lyd - case rsd - case cou - case cve - case khr - case gyd - case mkd - case tmt - case ugx - case kgs - case ves - case ssp - case npr - case sbd - case xpf - case aud - case bhd - case mwk - case mxn - case nio - case lsl - case xxx - case zar - case aoa - case gmd - case gip - case mvr - case kwd - case pln - case mga - case uah - case huf - case rub - case vnd - case lak - case rwf - case syp - case xag - case mur - case wst - case xpd - case gbp - case etb - case isk - case cdf - case usd - case tjs - case cup - case bgn - case eur - case cny - case cop - case gnf - case bbd - case xua - case chw - case xcd - case lrd - case pen - case pkr - case pyg - case lkr - case ron - case uzs - case nzd - case idr - case ern - case czk - case jod - case awg - case irr - case tzs - case brl - case ngn - case che - case chf - case bdt - case thb - case xdr - case mad - case gel - case fkp - case azn - case pab - case twd - case aed - case htg - case xbd - case lbp - case amd - case php - case xpt - case inr - case bwp - case myr - case mnt - case srd - case sll - case uyu - case bam - case bif - case bov - case jmd - case omr - case uyw - case bzd - case nok - case kmf - case kpw - case scr - case jpy - case xof - case shp - case sgd - case dkk - case uyi - case yer - case ang - case ttd - case xbb - case xbc - case fjd - case dop - case byn - case kzt - case xba - case szl - case sar - case gtq - case pgk - case ars - case btn - case afn - case djf - case mdl - case ghs - case qar - case `try` - case mmk - case xaf - case vuv - case xau - case clf - case hrk - case bob - case krw - case bsd - case all - case mru - case hnl - case stn - case usn - case mzn - case tnd - case crc - case kyd - - func currency() -> Currency { - switch self { - case .mop: return .mop - case .bmd: return .bmd - case .kes: return .kes - case .bnd: return .bnd - case .iqd: return .iqd - case .sdg: return .sdg - case .zmw: return .zmw - case .xts: return .xts - case .top: return .top - case .xsu: return .xsu - case .svc: return .svc - case .ils: return .ils - case .dzd: return .dzd - case .nad: return .nad - case .mxv: return .mxv - case .sos: return .sos - case .cad: return .cad - case .sek: return .sek - case .hkd: return .hkd - case .zwl: return .zwl - case .egp: return .egp - case .clp: return .clp - case .cuc: return .cuc - case .lyd: return .lyd - case .rsd: return .rsd - case .cou: return .cou - case .cve: return .cve - case .khr: return .khr - case .gyd: return .gyd - case .mkd: return .mkd - case .tmt: return .tmt - case .ugx: return .ugx - case .kgs: return .kgs - case .ves: return .ves - case .ssp: return .ssp - case .npr: return .npr - case .sbd: return .sbd - case .xpf: return .xpf - case .aud: return .aud - case .bhd: return .bhd - case .mwk: return .mwk - case .mxn: return .mxn - case .nio: return .nio - case .lsl: return .lsl - case .xxx: return .xxx - case .zar: return .zar - case .aoa: return .aoa - case .gmd: return .gmd - case .gip: return .gip - case .mvr: return .mvr - case .kwd: return .kwd - case .pln: return .pln - case .mga: return .mga - case .uah: return .uah - case .huf: return .huf - case .rub: return .rub - case .vnd: return .vnd - case .lak: return .lak - case .rwf: return .rwf - case .syp: return .syp - case .xag: return .xag - case .mur: return .mur - case .wst: return .wst - case .xpd: return .xpd - case .gbp: return .gbp - case .etb: return .etb - case .isk: return .isk - case .cdf: return .cdf - case .usd: return .usd - case .tjs: return .tjs - case .cup: return .cup - case .bgn: return .bgn - case .eur: return .eur - case .cny: return .cny - case .cop: return .cop - case .gnf: return .gnf - case .bbd: return .bbd - case .xua: return .xua - case .chw: return .chw - case .xcd: return .xcd - case .lrd: return .lrd - case .pen: return .pen - case .pkr: return .pkr - case .pyg: return .pyg - case .lkr: return .lkr - case .ron: return .ron - case .uzs: return .uzs - case .nzd: return .nzd - case .idr: return .idr - case .ern: return .ern - case .czk: return .czk - case .jod: return .jod - case .awg: return .awg - case .irr: return .irr - case .tzs: return .tzs - case .brl: return .brl - case .ngn: return .ngn - case .che: return .che - case .chf: return .chf - case .bdt: return .bdt - case .thb: return .thb - case .xdr: return .xdr - case .mad: return .mad - case .gel: return .gel - case .fkp: return .fkp - case .azn: return .azn - case .pab: return .pab - case .twd: return .twd - case .aed: return .aed - case .htg: return .htg - case .xbd: return .xbd - case .lbp: return .lbp - case .amd: return .amd - case .php: return .php - case .xpt: return .xpt - case .inr: return .inr - case .bwp: return .bwp - case .myr: return .myr - case .mnt: return .mnt - case .srd: return .srd - case .sll: return .sll - case .uyu: return .uyu - case .bam: return .bam - case .bif: return .bif - case .bov: return .bov - case .jmd: return .jmd - case .omr: return .omr - case .uyw: return .uyw - case .bzd: return .bzd - case .nok: return .nok - case .kmf: return .kmf - case .kpw: return .kpw - case .scr: return .scr - case .jpy: return .jpy - case .xof: return .xof - case .shp: return .shp - case .sgd: return .sgd - case .dkk: return .dkk - case .uyi: return .uyi - case .yer: return .yer - case .ang: return .ang - case .ttd: return .ttd - case .xbb: return .xbb - case .xbc: return .xbc - case .fjd: return .fjd - case .dop: return .dop - case .byn: return .byn - case .kzt: return .kzt - case .xba: return .xba - case .szl: return .szl - case .sar: return .sar - case .gtq: return .gtq - case .pgk: return .pgk - case .ars: return .ars - case .btn: return .btn - case .afn: return .afn - case .djf: return .djf - case .mdl: return .mdl - case .ghs: return .ghs - case .qar: return .qar - case .`try`: return .`try` - case .mmk: return .mmk - case .xaf: return .xaf - case .vuv: return .vuv - case .xau: return .xau - case .clf: return .clf - case .hrk: return .hrk - case .bob: return .bob - case .krw: return .krw - case .bsd: return .bsd - case .all: return .all - case .mru: return .mru - case .hnl: return .hnl - case .stn: return .stn - case .usn: return .usn - case .mzn: return .mzn - case .tnd: return .tnd - case .crc: return .crc - case .kyd: return .kyd - } - - } -} diff --git a/TealiumContentsquare.podspec b/TealiumContentsquare.podspec index a65bc28..9df2199 100644 --- a/TealiumContentsquare.podspec +++ b/TealiumContentsquare.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # s.name = "TealiumContentsquare" s.module_name = "TealiumContentsquare" - s.version = "1.0.0" + s.version = "2.0.0" s.summary = "Tealium Swift and Contentsquare integration" s.description = <<-DESC Tealium's integration with Contentsquare for iOS. @@ -22,7 +22,11 @@ Pod::Spec.new do |s| # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # s.swift_version = "5.1" s.platform = :ios, "10.0" - s.ios.deployment_target = "10.0" + s.ios.deployment_target = "10.0" + + # ――― Excluded Archs ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } + s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # s.source = { :git => "https://github.com/Tealium/tealium-ios-contentsquare-remote-command.git", :tag => "#{s.version}" } @@ -31,10 +35,9 @@ Pod::Spec.new do |s| s.ios.source_files = "Sources/*.{swift}" # ――― Dependencies ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # - s.ios.dependency 'tealium-swift/Core' - s.ios.dependency 'tealium-swift/TealiumRemoteCommands' - s.ios.dependency 'tealium-swift/TealiumDelegate' - s.ios.dependency 'tealium-swift/TealiumTagManagement' + s.ios.dependency 'tealium-swift/Core', '~> 2.1' + s.ios.dependency 'tealium-swift/RemoteCommands', '~> 2.1' + s.ios.dependency 'tealium-swift/TagManagement', '~> 2.1' s.ios.dependency 'CS_iOS_SDK' end diff --git a/TealiumContentsquare.xcodeproj/project.pbxproj b/TealiumContentsquare.xcodeproj/project.pbxproj index 375e3ee..8a41151 100644 --- a/TealiumContentsquare.xcodeproj/project.pbxproj +++ b/TealiumContentsquare.xcodeproj/project.pbxproj @@ -7,19 +7,21 @@ objects = { /* Begin PBXBuildFile section */ - 4B4B6E73241B28920084E720 /* ContentsquareTrackerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B4B6E72241B28920084E720 /* ContentsquareTrackerTests.swift */; }; - 4BE613FA2412F81F00C4B1EB /* ContentsquareRemoteCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BE613F92412F81F00C4B1EB /* ContentsquareRemoteCommand.swift */; }; - 4BE613FC2412F87E00C4B1EB /* ContentsquareTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BE613FB2412F87E00C4B1EB /* ContentsquareTracker.swift */; }; - 4BE613FE2412F88A00C4B1EB /* ContentsquareTrackable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BE613FD2412F88A00C4B1EB /* ContentsquareTrackable.swift */; }; + 4B4B6E73241B28920084E720 /* ContentsquareInstanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B4B6E72241B28920084E720 /* ContentsquareInstanceTests.swift */; }; 4BE614022412FF7800C4B1EB /* TealiumTagManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BE614012412FF7700C4B1EB /* TealiumTagManagement.framework */; platformFilter = ios; }; 4BE614042412FF7B00C4B1EB /* TealiumRemoteCommands.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BE614032412FF7B00C4B1EB /* TealiumRemoteCommands.framework */; platformFilter = ios; }; - 4BE614062412FF8300C4B1EB /* TealiumDelegate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BE614052412FF8300C4B1EB /* TealiumDelegate.framework */; platformFilter = ios; }; 4BE614082412FF8700C4B1EB /* TealiumCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BE614072412FF8700C4B1EB /* TealiumCore.framework */; platformFilter = ios; }; 4BE6140A2413001100C4B1EB /* ContentsquareModule.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BE614092413001100C4B1EB /* ContentsquareModule.framework */; platformFilter = ios; }; 4BEB130F241046820060D075 /* TealiumContentsquare.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BEB1305241046820060D075 /* TealiumContentsquare.framework */; platformFilter = ios; }; - 4BEB1314241046820060D075 /* MockContentsquareTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEB1313241046820060D075 /* MockContentsquareTracker.swift */; }; + 4BEB1314241046820060D075 /* MockContentsquareInstance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEB1313241046820060D075 /* MockContentsquareInstance.swift */; }; 4BEB1316241046820060D075 /* TealiumContentsquare.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BEB1308241046820060D075 /* TealiumContentsquare.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4BEB132024104EDF0060D075 /* ContentsquareConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEB131F24104EDF0060D075 /* ContentsquareConstants.swift */; }; + CFE092162537AF74005E09AB /* ContentsquareConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFE092142537AF74005E09AB /* ContentsquareConstants.swift */; }; + CFE092172537AF74005E09AB /* ContentsquareRemoteCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFE092152537AF74005E09AB /* ContentsquareRemoteCommand.swift */; }; + CFE0921A2537AFC8005E09AB /* ContentsquareInstance.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFE092192537AFC8005E09AB /* ContentsquareInstance.swift */; }; + CFEF6CE12527DCF900902EC6 /* TealiumRemoteCommands.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BE614032412FF7B00C4B1EB /* TealiumRemoteCommands.framework */; }; + CFEF6CE62527DD4400902EC6 /* TealiumRemoteCommands.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BE614032412FF7B00C4B1EB /* TealiumRemoteCommands.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + CFEF6CE92527DD7900902EC6 /* TealiumCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BE614072412FF8700C4B1EB /* TealiumCore.framework */; }; + CFEF6CEA2527DD7F00902EC6 /* TealiumCore.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BE614072412FF8700C4B1EB /* TealiumCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -32,11 +34,22 @@ }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + CFEF6CE42527DD3500902EC6 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + CFEF6CEA2527DD7F00902EC6 /* TealiumCore.framework in CopyFiles */, + CFEF6CE62527DD4400902EC6 /* TealiumRemoteCommands.framework in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ - 4B4B6E72241B28920084E720 /* ContentsquareTrackerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentsquareTrackerTests.swift; sourceTree = ""; }; - 4BE613F92412F81F00C4B1EB /* ContentsquareRemoteCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentsquareRemoteCommand.swift; sourceTree = ""; }; - 4BE613FB2412F87E00C4B1EB /* ContentsquareTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentsquareTracker.swift; sourceTree = ""; }; - 4BE613FD2412F88A00C4B1EB /* ContentsquareTrackable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentsquareTrackable.swift; sourceTree = ""; }; + 4B4B6E72241B28920084E720 /* ContentsquareInstanceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentsquareInstanceTests.swift; sourceTree = ""; }; 4BE614012412FF7700C4B1EB /* TealiumTagManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TealiumTagManagement.framework; path = Carthage/Build/iOS/TealiumTagManagement.framework; sourceTree = ""; }; 4BE614032412FF7B00C4B1EB /* TealiumRemoteCommands.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TealiumRemoteCommands.framework; path = Carthage/Build/iOS/TealiumRemoteCommands.framework; sourceTree = ""; }; 4BE614052412FF8300C4B1EB /* TealiumDelegate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TealiumDelegate.framework; path = Carthage/Build/iOS/TealiumDelegate.framework; sourceTree = ""; }; @@ -46,9 +59,11 @@ 4BEB1308241046820060D075 /* TealiumContentsquare.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TealiumContentsquare.h; sourceTree = ""; }; 4BEB1309241046820060D075 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4BEB130E241046820060D075 /* TealiumContentsquareTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TealiumContentsquareTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 4BEB1313241046820060D075 /* MockContentsquareTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockContentsquareTracker.swift; sourceTree = ""; }; + 4BEB1313241046820060D075 /* MockContentsquareInstance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockContentsquareInstance.swift; sourceTree = ""; }; 4BEB1315241046820060D075 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 4BEB131F24104EDF0060D075 /* ContentsquareConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentsquareConstants.swift; sourceTree = ""; }; + CFE092142537AF74005E09AB /* ContentsquareConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentsquareConstants.swift; sourceTree = ""; }; + CFE092152537AF74005E09AB /* ContentsquareRemoteCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentsquareRemoteCommand.swift; sourceTree = ""; }; + CFE092192537AFC8005E09AB /* ContentsquareInstance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentsquareInstance.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -57,7 +72,6 @@ buildActionMask = 2147483647; files = ( 4BE614022412FF7800C4B1EB /* TealiumTagManagement.framework in Frameworks */, - 4BE614062412FF8300C4B1EB /* TealiumDelegate.framework in Frameworks */, 4BE614042412FF7B00C4B1EB /* TealiumRemoteCommands.framework in Frameworks */, 4BE614082412FF8700C4B1EB /* TealiumCore.framework in Frameworks */, 4BE6140A2413001100C4B1EB /* ContentsquareModule.framework in Frameworks */, @@ -68,6 +82,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + CFEF6CE92527DD7900902EC6 /* TealiumCore.framework in Frameworks */, + CFEF6CE12527DCF900902EC6 /* TealiumRemoteCommands.framework in Frameworks */, 4BEB130F241046820060D075 /* TealiumContentsquare.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -109,10 +125,9 @@ 4BEB1307241046820060D075 /* Sources */ = { isa = PBXGroup; children = ( - 4BEB131F24104EDF0060D075 /* ContentsquareConstants.swift */, - 4BE613F92412F81F00C4B1EB /* ContentsquareRemoteCommand.swift */, - 4BE613FD2412F88A00C4B1EB /* ContentsquareTrackable.swift */, - 4BE613FB2412F87E00C4B1EB /* ContentsquareTracker.swift */, + CFE092142537AF74005E09AB /* ContentsquareConstants.swift */, + CFE092152537AF74005E09AB /* ContentsquareRemoteCommand.swift */, + CFE092192537AFC8005E09AB /* ContentsquareInstance.swift */, 4BEB1308241046820060D075 /* TealiumContentsquare.h */, 4BEB1309241046820060D075 /* Info.plist */, ); @@ -122,8 +137,8 @@ 4BEB1312241046820060D075 /* Tests */ = { isa = PBXGroup; children = ( - 4BEB1313241046820060D075 /* MockContentsquareTracker.swift */, - 4B4B6E72241B28920084E720 /* ContentsquareTrackerTests.swift */, + 4BEB1313241046820060D075 /* MockContentsquareInstance.swift */, + 4B4B6E72241B28920084E720 /* ContentsquareInstanceTests.swift */, 4BEB1315241046820060D075 /* Info.plist */, ); path = Tests; @@ -169,7 +184,7 @@ 4BEB130A241046820060D075 /* Sources */, 4BEB130B241046820060D075 /* Frameworks */, 4BEB130C241046820060D075 /* Resources */, - 4B4B6E71241B26C50084E720 /* Carthage */, + CFEF6CE42527DD3500902EC6 /* CopyFiles */, ); buildRules = ( ); @@ -193,7 +208,7 @@ TargetAttributes = { 4BEB1304241046820060D075 = { CreatedOnToolsVersion = 11.2.1; - LastSwiftMigration = 1120; + LastSwiftMigration = 1200; }; 4BEB130D241046820060D075 = { CreatedOnToolsVersion = 11.2.1; @@ -237,26 +252,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 4B4B6E71241B26C50084E720 /* Carthage */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - TealiumCore.framework, - TealiumRemoteCommands.framework, - ); - name = Carthage; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "#exec \"${SRCROOT}/scripts/copy-carthage-frameworks.sh\"\n"; - }; 4BE613FF2412F95500C4B1EB /* Carthage */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -266,7 +261,6 @@ ); inputPaths = ( "$(SRCROOT)/Carthage/Build/iOS/TealiumTagManagement.framework", - "$(SRCROOT)/Carthage/Build/iOS/TealiumDelegate.framework", "$(SRCROOT)/Carthage/Build/iOS/TealiumRemoteCommands.framework", "$(SRCROOT)/Carthage/Build/iOS/TealiumCore.framework", "$(SRCROOT)/Carthage/Build/iOS/ContentsquareModule.framework", @@ -287,10 +281,9 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4BE613FE2412F88A00C4B1EB /* ContentsquareTrackable.swift in Sources */, - 4BE613FA2412F81F00C4B1EB /* ContentsquareRemoteCommand.swift in Sources */, - 4BEB132024104EDF0060D075 /* ContentsquareConstants.swift in Sources */, - 4BE613FC2412F87E00C4B1EB /* ContentsquareTracker.swift in Sources */, + CFE092172537AF74005E09AB /* ContentsquareRemoteCommand.swift in Sources */, + CFE0921A2537AFC8005E09AB /* ContentsquareInstance.swift in Sources */, + CFE092162537AF74005E09AB /* ContentsquareConstants.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -298,8 +291,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4BEB1314241046820060D075 /* MockContentsquareTracker.swift in Sources */, - 4B4B6E73241B28920084E720 /* ContentsquareTrackerTests.swift in Sources */, + 4BEB1314241046820060D075 /* MockContentsquareInstance.swift in Sources */, + 4B4B6E73241B28920084E720 /* ContentsquareInstanceTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -451,6 +444,7 @@ ); INFOPLIST_FILE = Sources/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -481,6 +475,7 @@ ); INFOPLIST_FILE = Sources/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -500,6 +495,10 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = XC939GDC9P; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -519,6 +518,10 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = XC939GDC9P; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/TealiumContentsquareExample/Podfile b/TealiumContentsquareExample/Podfile index 079bf31..d6d699c 100644 --- a/TealiumContentsquareExample/Podfile +++ b/TealiumContentsquareExample/Podfile @@ -6,6 +6,6 @@ target 'TealiumContentsquareExample' do use_frameworks! # Pods for TealiumContentsquareExample - pod "tealium-swift", "~> 1.9" pod "TealiumContentsquare", :path => "../" + end diff --git a/TealiumContentsquareExample/Podfile.lock b/TealiumContentsquareExample/Podfile.lock index 83d6f73..746ac40 100644 --- a/TealiumContentsquareExample/Podfile.lock +++ b/TealiumContentsquareExample/Podfile.lock @@ -1,44 +1,33 @@ PODS: - - CS_iOS_SDK (3.0.0) - - tealium-swift (1.9.1): - - tealium-swift/TealiumFull (= 1.9.1) - - tealium-swift/Core (1.9.4) - - tealium-swift/TealiumDelegate (1.9.4): + - CS_iOS_SDK (3.2.1) + - tealium-swift/Core (2.1.0) + - tealium-swift/RemoteCommands (2.1.0): - tealium-swift/Core - - tealium-swift/TealiumFull (1.9.1): - - TealiumCrashReporter - - tealium-swift/TealiumRemoteCommands (1.9.4): + - tealium-swift/TagManagement (2.1.0): - tealium-swift/Core - - tealium-swift/TealiumTagManagement (1.9.4): - - tealium-swift/Core - - TealiumContentsquare (1.0.0): + - TealiumContentsquare (2.0.0): - CS_iOS_SDK - - tealium-swift/Core - - tealium-swift/TealiumDelegate - - tealium-swift/TealiumRemoteCommands - - tealium-swift/TealiumTagManagement - - TealiumCrashReporter (1.3.5) + - tealium-swift/Core (~> 2.1) + - tealium-swift/RemoteCommands (~> 2.1) + - tealium-swift/TagManagement (~> 2.1) DEPENDENCIES: - - tealium-swift (~> 1.9) - TealiumContentsquare (from `../`) SPEC REPOS: trunk: - CS_iOS_SDK - tealium-swift - - TealiumCrashReporter EXTERNAL SOURCES: TealiumContentsquare: :path: "../" SPEC CHECKSUMS: - CS_iOS_SDK: b80d4df95751c8fb8d7b1babf0e0390a701bfef9 - tealium-swift: c478175eadd99de290a65c5c2cc38a7bb86ac28c - TealiumContentsquare: 2245c0fba1a4c584f0c14a8330429df3bc53f904 - TealiumCrashReporter: 74fbdd3703a65740c04e983cd0b360c673199b53 + CS_iOS_SDK: d4ab9a1fd87e8254ce888724cb56256362fe0c1a + tealium-swift: a670c2c6f3e7e5d775d9507387e8858a8541e526 + TealiumContentsquare: 25672334d89d7201f9aee4825c5304c475ae30e9 -PODFILE CHECKSUM: 5961879c2fd9a2d65d83dfe34f2e8c8c10f67415 +PODFILE CHECKSUM: 484e8e2d3515241393ce3d9ae9ded5e340792e49 -COCOAPODS: 1.9.0 +COCOAPODS: 1.10.0 diff --git a/TealiumContentsquareExample/TealiumContentsquareExample.xcodeproj/project.pbxproj b/TealiumContentsquareExample/TealiumContentsquareExample.xcodeproj/project.pbxproj index 52951d6..b3c1048 100644 --- a/TealiumContentsquareExample/TealiumContentsquareExample.xcodeproj/project.pbxproj +++ b/TealiumContentsquareExample/TealiumContentsquareExample.xcodeproj/project.pbxproj @@ -21,6 +21,7 @@ 4B4F33F02416F42D009C41B8 /* ScreenView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B4F33EF2416F42D009C41B8 /* ScreenView.swift */; }; 4B4F33F32416F957009C41B8 /* TransactionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B4F33F22416F957009C41B8 /* TransactionView.swift */; }; 4B9781EA2419573C0021B638 /* DynamicVarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B9781E92419573C0021B638 /* DynamicVarView.swift */; }; + CFEF6CF62527DFCA00902EC6 /* contentsquare.json in Resources */ = {isa = PBXBuildFile; fileRef = CFEF6CF22527DFCA00902EC6 /* contentsquare.json */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -41,6 +42,7 @@ 4B4F33F22416F957009C41B8 /* TransactionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionView.swift; sourceTree = ""; }; 4B9781E92419573C0021B638 /* DynamicVarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DynamicVarView.swift; sourceTree = ""; }; 91A882ADFA088997BE0E233A /* Pods-TealiumContentsquareExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TealiumContentsquareExample.release.xcconfig"; path = "Target Support Files/Pods-TealiumContentsquareExample/Pods-TealiumContentsquareExample.release.xcconfig"; sourceTree = ""; }; + CFEF6CF22527DFCA00902EC6 /* contentsquare.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = contentsquare.json; sourceTree = ""; }; DE37BE8EAF8C7792D28D9949 /* Pods_TealiumContentsquareExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_TealiumContentsquareExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -99,6 +101,7 @@ 4B4F33D92416D946009C41B8 /* SceneDelegate.swift */, 4B4F33DB2416D946009C41B8 /* ContentView.swift */, 4B4F33ED2416DE70009C41B8 /* TealiumHelper.swift */, + CFEF6CF22527DFCA00902EC6 /* contentsquare.json */, 4B4F33DD2416D948009C41B8 /* Assets.xcassets */, 4B4F33E22416D948009C41B8 /* LaunchScreen.storyboard */, 4B4F33E52416D948009C41B8 /* Info.plist */, @@ -190,6 +193,7 @@ files = ( 4B4F33E42416D948009C41B8 /* LaunchScreen.storyboard in Resources */, 4B4F33E12416D948009C41B8 /* Preview Assets.xcassets in Resources */, + CFEF6CF62527DFCA00902EC6 /* contentsquare.json in Resources */, 4B4F33DE2416D948009C41B8 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/TealiumContentsquareExample/TealiumContentsquareExample/AppDelegate.swift b/TealiumContentsquareExample/TealiumContentsquareExample/AppDelegate.swift index 9bc0e32..2d2a215 100644 --- a/TealiumContentsquareExample/TealiumContentsquareExample/AppDelegate.swift +++ b/TealiumContentsquareExample/TealiumContentsquareExample/AppDelegate.swift @@ -3,7 +3,7 @@ // TealiumContentsquareExample // // Created by Jonathan Wong on 3/9/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. +// Copyright © 2020 Tealium. All rights reserved. // import UIKit diff --git a/TealiumContentsquareExample/TealiumContentsquareExample/ContentView.swift b/TealiumContentsquareExample/TealiumContentsquareExample/ContentView.swift index 21fdc92..a831ece 100644 --- a/TealiumContentsquareExample/TealiumContentsquareExample/ContentView.swift +++ b/TealiumContentsquareExample/TealiumContentsquareExample/ContentView.swift @@ -3,7 +3,7 @@ // TealiumContentsquareExample // // Created by Jonathan Wong on 3/9/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. +// Copyright © 2020 Tealium. All rights reserved. // import SwiftUI diff --git a/TealiumContentsquareExample/TealiumContentsquareExample/SceneDelegate.swift b/TealiumContentsquareExample/TealiumContentsquareExample/SceneDelegate.swift index d931190..78280fe 100644 --- a/TealiumContentsquareExample/TealiumContentsquareExample/SceneDelegate.swift +++ b/TealiumContentsquareExample/TealiumContentsquareExample/SceneDelegate.swift @@ -3,7 +3,7 @@ // TealiumContentsquareExample // // Created by Jonathan Wong on 3/9/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. +// Copyright © 2020 Tealium. All rights reserved. // import UIKit diff --git a/TealiumContentsquareExample/TealiumContentsquareExample/TealiumHelper.swift b/TealiumContentsquareExample/TealiumContentsquareExample/TealiumHelper.swift index 3dc1947..1e0f78c 100644 --- a/TealiumContentsquareExample/TealiumContentsquareExample/TealiumHelper.swift +++ b/TealiumContentsquareExample/TealiumContentsquareExample/TealiumHelper.swift @@ -3,51 +3,62 @@ // BrazeRemoteCommand // // Created by Jonathan Wong on 5/29/19. -// Copyright © 2019 Jonathan Wong. All rights reserved. +// Copyright © 2019 Tealium. All rights reserved. // import Foundation import TealiumSwift import TealiumContentsquare +enum TealiumConfiguration { + static let account = "tealiummobile" + static let profile = "contentsquare-dev" + static let environment = "qa" +} + class TealiumHelper { - + static let shared = TealiumHelper() - let config = TealiumConfig(account: "tealiummobile", - profile: "contentsquare-dev", - environment: "qa", - datasource: nil) - + + let config = TealiumConfig(account: TealiumConfiguration.account, + profile: TealiumConfiguration.profile, + environment: TealiumConfiguration.environment) + var tealium: Tealium? + static var universalData = [String: Any]() + // JSON Remote Command + let contentsquareRemoteCommand = ContentsquareRemoteCommand(type: .remote(url: "https://tags.tiqcdn.com/dle/tealiummobile/demo/contentsquare.json")) + private init() { - let list = TealiumModulesList(isWhitelist: false, - moduleNames: ["autotracking", "collect", "consentmanager"]) - config.modulesList = list - config.logLevel = .verbose - config.shouldUseRemotePublishSettings = true + config.shouldUseRemotePublishSettings = false config.batchingEnabled = false + config.remoteAPIEnabled = true + config.logLevel = .info + config.dispatchers = [Dispatchers.TagManagement, Dispatchers.RemoteCommands] - tealium = Tealium(config: config) { responses in - guard let remoteCommands = self.tealium?.remoteCommands() else { - return - } - let contentsquareTracker = ContentsquareTracker() - let contentsquareCommand = ContentsquareRemoteCommand(contentsquareTracker: contentsquareTracker) - let contentsquareRemoteCommand = contentsquareCommand.remoteCommand() - remoteCommands.add(contentsquareRemoteCommand) - } + config.addRemoteCommand(contentsquareRemoteCommand) + + tealium = Tealium(config: config) } - + + class func start() { _ = TealiumHelper.shared } - + + class func trackView(title: String, data: [String: Any]?) { + let tealiumView = TealiumView(title, dataLayer: data) + TealiumHelper.shared.tealium?.track(tealiumView) + } + class func track(title: String, data: [String: Any]?) { if let data = data { universalData = universalData.merging(data) { _, new in new } } - TealiumHelper.shared.tealium?.track(title: title, data: universalData, completion: nil) + let tealiumEvent = TealiumEvent(title, dataLayer: universalData) + TealiumHelper.shared.tealium?.track(tealiumEvent) } + } diff --git a/TealiumContentsquareExample/TealiumContentsquareExample/Views/ButtonViewModifier.swift b/TealiumContentsquareExample/TealiumContentsquareExample/Views/ButtonViewModifier.swift index ba3826d..8d8ec4b 100644 --- a/TealiumContentsquareExample/TealiumContentsquareExample/Views/ButtonViewModifier.swift +++ b/TealiumContentsquareExample/TealiumContentsquareExample/Views/ButtonViewModifier.swift @@ -3,7 +3,7 @@ // TealiumContentsquareExample // // Created by Jonathan Wong on 3/12/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. +// Copyright © 2020 Tealium. All rights reserved. // import SwiftUI diff --git a/TealiumContentsquareExample/TealiumContentsquareExample/Views/DynamicItemVarView.swift b/TealiumContentsquareExample/TealiumContentsquareExample/Views/DynamicItemVarView.swift index b1c9e27..2392b44 100644 --- a/TealiumContentsquareExample/TealiumContentsquareExample/Views/DynamicItemVarView.swift +++ b/TealiumContentsquareExample/TealiumContentsquareExample/Views/DynamicItemVarView.swift @@ -3,7 +3,7 @@ // TealiumContentsquareExample // // Created by Jonathan Wong on 3/11/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. +// Copyright © 2020 Tealium. All rights reserved. // import SwiftUI diff --git a/TealiumContentsquareExample/TealiumContentsquareExample/Views/DynamicVarView.swift b/TealiumContentsquareExample/TealiumContentsquareExample/Views/DynamicVarView.swift index 64601ab..177203d 100644 --- a/TealiumContentsquareExample/TealiumContentsquareExample/Views/DynamicVarView.swift +++ b/TealiumContentsquareExample/TealiumContentsquareExample/Views/DynamicVarView.swift @@ -3,7 +3,7 @@ // TealiumContentsquareExample // // Created by Jonathan Wong on 3/11/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. +// Copyright © 2020 Tealium. All rights reserved. // import SwiftUI diff --git a/TealiumContentsquareExample/TealiumContentsquareExample/Views/MiscellaneousView.swift b/TealiumContentsquareExample/TealiumContentsquareExample/Views/MiscellaneousView.swift index 221914c..c179b65 100644 --- a/TealiumContentsquareExample/TealiumContentsquareExample/Views/MiscellaneousView.swift +++ b/TealiumContentsquareExample/TealiumContentsquareExample/Views/MiscellaneousView.swift @@ -3,7 +3,7 @@ // TealiumContentsquareExample // // Created by Jonathan Wong on 3/12/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. +// Copyright © 2020 Tealium. All rights reserved. // import SwiftUI diff --git a/TealiumContentsquareExample/TealiumContentsquareExample/Views/ScreenView.swift b/TealiumContentsquareExample/TealiumContentsquareExample/Views/ScreenView.swift index 4118799..596880c 100644 --- a/TealiumContentsquareExample/TealiumContentsquareExample/Views/ScreenView.swift +++ b/TealiumContentsquareExample/TealiumContentsquareExample/Views/ScreenView.swift @@ -3,7 +3,7 @@ // TealiumContentsquareExample // // Created by Jonathan Wong on 3/9/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. +// Copyright © 2020 Tealium. All rights reserved. // import SwiftUI diff --git a/TealiumContentsquareExample/TealiumContentsquareExample/Views/TransactionView.swift b/TealiumContentsquareExample/TealiumContentsquareExample/Views/TransactionView.swift index 7b163cd..79883b1 100644 --- a/TealiumContentsquareExample/TealiumContentsquareExample/Views/TransactionView.swift +++ b/TealiumContentsquareExample/TealiumContentsquareExample/Views/TransactionView.swift @@ -3,7 +3,7 @@ // TealiumContentsquareExample // // Created by Jonathan Wong on 3/9/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. +// Copyright © 2020 Tealium. All rights reserved. // import SwiftUI @@ -37,16 +37,12 @@ struct TransactionView: View { extension TransactionView { func trackTransactionView(price: Double, id: String?) { guard let id = id else { - TealiumHelper.track(title: "transaction", data: - ["transaction": ["price": price, - "currency": "EUR" - ]]) + TealiumHelper.track(title: "transaction", + data: ["price": price, "currency": "EUR"]) return } - TealiumHelper.track(title: "transaction", data: - ["transaction": ["price": price, - "currency": 1, - "transaction_id": id]]) + TealiumHelper.track(title: "transaction", + data: ["price": price,"currency": "USD","transaction_id": id]) } } diff --git a/TealiumContentsquareExample/TealiumContentsquareExample/contentsquare.json b/TealiumContentsquareExample/TealiumContentsquareExample/contentsquare.json new file mode 100644 index 0000000..4feccf4 --- /dev/null +++ b/TealiumContentsquareExample/TealiumContentsquareExample/contentsquare.json @@ -0,0 +1,21 @@ +{ + "config": {}, + "mappings": { + "screen": "screen_name", + "dynamic_var": "dynamic_var", + "price": "purchase.price", + "currency": "purchase.currency", + "transaction_id": "purchase.transaction_id" + }, + "commands": { + "screen_title": "sendscreenview", + "dynamic_var": "senddynamicvar", + "transaction": "sendtransaction", + "stop_tracking": "stoptracking", + "resume_tracking": "resumetracking", + "forget_me": "forgetme", + "opt_in": "optin", + "opt_out": "optout" + } +} + diff --git a/Tests/ContentsquareInstanceTests.swift b/Tests/ContentsquareInstanceTests.swift new file mode 100644 index 0000000..7e7ed7f --- /dev/null +++ b/Tests/ContentsquareInstanceTests.swift @@ -0,0 +1,83 @@ +// +// ContentsquareInstanceTests.swift +// TealiumContentsquareTests +// +// Created by Jonathan Wong on 3/12/20. +// Copyright © 2020 Tealium. All rights reserved. +// + +import XCTest +@testable import TealiumContentsquare +#if COCOAPODS +#else + import TealiumRemoteCommands +#endif + +class ContentsquareInstanceTests: XCTestCase { + + let contentsquareInstance = MockContentsquareInstance() + var contentsquareCommand: ContentsquareRemoteCommand! + + override func setUp() { + contentsquareCommand = ContentsquareRemoteCommand(contentsquareInstance: contentsquareInstance) + } + + func testScreenViewCalledWithKey() { + contentsquareCommand.processRemoteCommand(with: ["command_name": "sendscreenview", "screen_name": "home"]) + XCTAssertEqual(1, contentsquareInstance.sendScreenViewCallCount) + } + + func testScreenViewNotCalledWitouthKey() { + contentsquareCommand.processRemoteCommand(with: ["command_name": "sendscreenview", "not_screen_name": "home"]) + XCTAssertEqual(0, contentsquareInstance.sendScreenViewCallCount) + } + + func testTransactionCalledWithKey() { + contentsquareCommand.processRemoteCommand(with: ["command_name": "sendtransaction", "transaction": ["price": 1.99, + "currency": "USD"]]) + XCTAssertEqual(1, contentsquareInstance.sendTransactionCallCount) + } + + func testTransactionCalledWithKeyJSON() { + contentsquareCommand.processRemoteCommand(with: ["command_name": "sendtransaction", "purchase": ["price": 1.99, + "currency": "USD"]]) + XCTAssertEqual(1, contentsquareInstance.sendTransactionCallCount) + } + + func testTransactionNotCalledWithoutKey() { + contentsquareCommand.processRemoteCommand(with: ["command_name": "sendtransaction", "not_transaction": ["price": 1.99, + "currency": Int(1)]]) + XCTAssertEqual(0, contentsquareInstance.sendTransactionCallCount) + } + + func testTransactionCalledWithIdKey() { + contentsquareCommand.processRemoteCommand(with: ["command_name": "sendtransaction", "transaction": ["price": 1.99, + "currency": "CAD", + "id": "123"]]) + XCTAssertEqual(1, contentsquareInstance.sendTransactionCallCount) + } + + func testTransactionNotCalledWithoutPriceKey() { + contentsquareCommand.processRemoteCommand(with: ["command_name": "sendtransaction", "not_transaction": ["not_price": 1.99, + "currency": Int(1)]]) + XCTAssertEqual(0, contentsquareInstance.sendTransactionCallCount) + } + + func testTransactionNotCalledWithoutCurrencyKey() { + contentsquareCommand.processRemoteCommand(with: ["command_name": "sendtransaction", "not_transaction": ["price": 1.99, + "not_currency": Int(1)]]) + XCTAssertEqual(0, contentsquareInstance.sendTransactionCallCount) + } + + func testDynamicVarCalledWithKey() { + contentsquareCommand.processRemoteCommand(with: ["command_name": "senddynamicvar", "dynamic_var": ["not_price": 1.99, + "currency": Int(1)]]) + XCTAssertEqual(0, contentsquareInstance.sendTransactionCallCount) + } + + func testDynamicVarNotCalledWithoutKey() { + contentsquareCommand.processRemoteCommand(with: ["command_name": "senddynamicvar", "not_dynamic_var": ["price": 1.99, + "not_currency": Int(1)]]) + XCTAssertEqual(0, contentsquareInstance.sendTransactionCallCount) + } +} diff --git a/Tests/ContentsquareTrackerTests.swift b/Tests/ContentsquareTrackerTests.swift deleted file mode 100644 index 0fa0daa..0000000 --- a/Tests/ContentsquareTrackerTests.swift +++ /dev/null @@ -1,83 +0,0 @@ -// -// ContentsquareTrackerTests.swift -// TealiumContentsquareTests -// -// Created by Jonathan Wong on 3/12/20. -// Copyright © 2020 Jonathan Wong. All rights reserved. -// - -import XCTest -@testable import TealiumContentsquare -#if COCOAPODS -#else - import TealiumRemoteCommands -#endif - -class ContentsquareTrackerTests: XCTestCase { - - let contentsquareTracker = MockContentsquareTracker() - var contentsquareCommand: ContentsquareRemoteCommand! - var remoteCommand: TealiumRemoteCommand! - - override func setUp() { - contentsquareCommand = ContentsquareRemoteCommand(contentsquareTracker: contentsquareTracker) - remoteCommand = contentsquareCommand.remoteCommand() - } - - override func tearDown() { - - } - - func testScreenViewCalledWithKey() { - contentsquareCommand.parseCommands(["sendscreenview"], payload: ["screen_name": "home"]) - XCTAssertEqual(1, contentsquareTracker.sendScreenViewCallCount) - } - - func testScreenViewNotCalledWitouthKey() { - contentsquareCommand.parseCommands(["sendscreenview"], payload: ["not_screen_name": "home"]) - XCTAssertEqual(0, contentsquareTracker.sendScreenViewCallCount) - } - - func testTransactionCalledWithKey() { - contentsquareCommand.parseCommands(["sendtransaction"], payload: ["transaction": ["price": 1.99, - "currency": "USD"]]) - XCTAssertEqual(1, contentsquareTracker.sendTransactionCallCount) - } - - func testTransactionNotCalledWithoutKey() { - contentsquareCommand.parseCommands(["sendtransaction"], payload: ["not_transaction": ["price": 1.99, - "currency": Int(1)]]) - XCTAssertEqual(0, contentsquareTracker.sendTransactionCallCount) - } - - func testTransactionCalledWithIdKey() { - contentsquareCommand.parseCommands(["sendtransaction"], payload: ["transaction": ["price": 1.99, - "currency": "CAD", - "id": "123"]]) - XCTAssertEqual(1, contentsquareTracker.sendTransactionCallCount) - } - - func testTransactionNotCalledWithoutPriceKey() { - contentsquareCommand.parseCommands(["sendtransaction"], payload: ["not_transaction": ["not_price": 1.99, - "currency": Int(1)]]) - XCTAssertEqual(0, contentsquareTracker.sendTransactionCallCount) - } - - func testTransactionNotCalledWithoutCurrencyKey() { - contentsquareCommand.parseCommands(["sendtransaction"], payload: ["not_transaction": ["price": 1.99, - "not_currency": Int(1)]]) - XCTAssertEqual(0, contentsquareTracker.sendTransactionCallCount) - } - - func testDynamicVarCalledWithKey() { - contentsquareCommand.parseCommands(["senddynamicvar"], payload: ["dynamic_var": ["not_price": 1.99, - "currency": Int(1)]]) - XCTAssertEqual(0, contentsquareTracker.sendTransactionCallCount) - } - - func testDynamicVarNotCalledWithoutKey() { - contentsquareCommand.parseCommands(["senddynamicvar"], payload: ["not_dynamic_var": ["price": 1.99, - "not_currency": Int(1)]]) - XCTAssertEqual(0, contentsquareTracker.sendTransactionCallCount) - } -} diff --git a/Tests/MockContentsquareTracker.swift b/Tests/MockContentsquareInstance.swift similarity index 79% rename from Tests/MockContentsquareTracker.swift rename to Tests/MockContentsquareInstance.swift index 7b961b3..cca0bc7 100644 --- a/Tests/MockContentsquareTracker.swift +++ b/Tests/MockContentsquareInstance.swift @@ -1,15 +1,15 @@ -//// -//// TealiumContentsquareTests.swift -//// TealiumContentsquareTests -//// -//// Created by Jonathan Wong on 3/4/20. -//// Copyright © 2020 Jonathan Wong. All rights reserved. -//// // +// TealiumContentsquareTests.swift +// TealiumContentsquareTests +// +// Created by Jonathan Wong on 3/4/20. +// Copyright © 2020 Tealium. All rights reserved. +// + import XCTest @testable import TealiumContentsquare -class MockContentsquareTracker: ContentsquareTrackable { +class MockContentsquareInstance: ContentsquareCommand { var sendScreenViewCallCount = 0 var sendTransactionCallCount = 0