From 860c3faecc3726d82cfd9b69f8884ec7b3dc2e2f Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Mon, 15 Jul 2024 15:10:01 -0500 Subject: [PATCH 01/11] Made custom logger. --- PrebidMobile/Logging/Log.swift | 76 ++++++++++++++++--- .../RenderingTests/Tests/LogTest.swift | 75 ++++++++++++++++++ 2 files changed, 139 insertions(+), 12 deletions(-) diff --git a/PrebidMobile/Logging/Log.swift b/PrebidMobile/Logging/Log.swift index 739007856..080d10689 100644 --- a/PrebidMobile/Logging/Log.swift +++ b/PrebidMobile/Logging/Log.swift @@ -19,7 +19,7 @@ import Foundation public class Log: NSObject { // MARK: - Public properties - + public static var customLogger: PrebidLogger? = nil public static var dateFormat = "yyyy-MM-dd hh:mm:ssSSS" public static var dateFormatter: DateFormatter { let formatter = DateFormatter() @@ -33,38 +33,70 @@ public class Log: NSObject { public static var logToFile = false public static func error(_ object: Any, filename: String = #file, line: Int = #line, function: String = #function) { - log(object, logLevel: .error, filename: filename, line: line, function: function) + if (customLogger == nil) { + log(object, logLevel: .error, filename: filename, line: line, function: function) + } else { + customLogger?.error(object, filename: filename, line: line, function: function) + } } public static func info(_ object: Any, filename: String = #file, line: Int = #line, function: String = #function) { - log(object, logLevel: .info, filename: filename, line: line, function: function) + if (customLogger == nil) { + log(object, logLevel: .info, filename: filename, line: line, function: function) + } else { + customLogger?.info(object, filename: filename, line: line, function: function) + } } public static func debug(_ object: Any, filename: String = #file, line: Int = #line, function: String = #function) { - log(object, logLevel: .debug, filename: filename, line: line, function: function) + if (customLogger == nil) { + log(object, logLevel: .debug, filename: filename, line: line, function: function) + } else { + customLogger?.debug(object, filename: filename, line: line, function: function) + } } public static func verbose(_ object: Any, filename: String = #file, line: Int = #line, function: String = #function) { - log(object, logLevel: .verbose, filename: filename, line: line, function: function) + if (customLogger == nil) { + log(object, logLevel: .verbose, filename: filename, line: line, function: function) + } else { + customLogger?.verbose(object, filename: filename, line: line, function: function) + } } public static func warn(_ object: Any, filename: String = #file, line: Int = #line, function: String = #function) { - log(object, logLevel: .warn, filename: filename, line: line, function: function) + if (customLogger == nil) { + log(object, logLevel: .warn, filename: filename, line: line, function: function) + } else { + customLogger?.warn(object, filename: filename, line: line, function: function) + } } public static func severe(_ object: Any, filename: String = #file, line: Int = #line, function: String = #function) { - log(object, logLevel: .severe, filename: filename, line: line, function: function) + if (customLogger == nil) { + log(object, logLevel: .severe, filename: filename, line: line, function: function) + } else { + customLogger?.severe(object, filename: filename, line: line, function: function) + } } public static func whereAmI(filename: String = #file, line: Int = #line, function: String = #function) { - log("", logLevel: .info, filename: filename, line: line, function: function) + if (customLogger == nil) { + log("", logLevel: .info, filename: filename, line: line, function: function) + } else { + customLogger?.whereAmI(filename: filename, line: line, function: function) + } } static func log(_ object: Any, logLevel: LogLevel, filename: String, line: Int, function: String) { - if isLoggingEnabled(for: logLevel) { - let finalMessage = "\(sdkName): \(Date().toString()) \(logLevel.stringValue)[\(sourceFileName(filePath: filename))]:\(line) \(function) -> \(object)" - print(finalMessage) - serialWriteToLog(finalMessage) + if (customLogger == nil) { + if isLoggingEnabled(for: logLevel) { + let finalMessage = "\(sdkName): \(Date().toString()) \(logLevel.stringValue)[\(sourceFileName(filePath: filename))]:\(line) \(function) -> \(object)" + print(finalMessage) + serialWriteToLog(finalMessage) + } + } else { + customLogger?.log(object, logLevel: logLevel, filename: filename, line: line, function: function) } } @@ -186,3 +218,23 @@ func print(_ object: Any) { Swift.print(object) #endif } + +public protocol PrebidLogger { + + func error(_ object: Any, filename: String, line: Int, function: String) + + func info(_ object: Any, filename: String, line: Int, function: String) + + func debug(_ object: Any, filename: String, line: Int, function: String) + + func verbose(_ object: Any, filename: String, line: Int, function: String) + + func warn(_ object: Any, filename: String, line: Int, function: String) + + func severe(_ object: Any, filename: String, line: Int, function: String) + + func whereAmI(filename: String, line: Int, function: String) + + func log(_ object: Any, logLevel: LogLevel, filename: String, line: Int, function: String) + +} diff --git a/PrebidMobileTests/RenderingTests/Tests/LogTest.swift b/PrebidMobileTests/RenderingTests/Tests/LogTest.swift index cb55737b3..201d0dfce 100644 --- a/PrebidMobileTests/RenderingTests/Tests/LogTest.swift +++ b/PrebidMobileTests/RenderingTests/Tests/LogTest.swift @@ -107,6 +107,34 @@ class LogTest: XCTestCase { checkLogAndClean(level: .severe) } + func testAllKindsWithCustom() { + // Test: default params + + logToFile = .init() + + Log.customLogger = CustomTestLogger() + + Log.error(message) + let log = Log.getLogFileAsString() ?? "" + XCTAssert(log.contains("TESTLOG")) + checkLogAndClean(level: .error) + + Log.info(message) + checkLogAndClean(level: .info) + + Log.debug(message) + checkLogAndClean(level: .debug) + + Log.verbose(message) + checkLogAndClean(level: .verbose) + + Log.warn(message) + checkLogAndClean(level: .warn) + + Log.severe(message) + checkLogAndClean(level: .severe) + } + func testWhereAmI() { logToFile = .init() @@ -116,6 +144,16 @@ class LogTest: XCTestCase { XCTAssertTrue(log.contains(LogLevel.info.stringValue)) } + func testWhereAmICustom() { + logToFile = .init() + Log.customLogger = CustomTestLogger() + + Log.whereAmI() + + let log = Log.getLogFileAsString() ?? "" + XCTAssertTrue(log.contains("WHEREAMI")) + } + func testLogLevel() { logToFile = .init() @@ -151,4 +189,41 @@ class LogTest: XCTestCase { logToFile = nil logToFile = .init() } + + class CustomTestLogger: PrebidLogger { + func error(_ object: Any, filename: String, line: Int, function: String) { + log(object, logLevel: .error, filename: filename, line: line, function: function) + } + + func info(_ object: Any, filename: String, line: Int, function: String) { + log(object, logLevel: .info, filename: filename, line: line, function: function) + } + + func debug(_ object: Any, filename: String, line: Int, function: String) { + log(object, logLevel: .debug, filename: filename, line: line, function: function) + } + + func verbose(_ object: Any, filename: String, line: Int, function: String) { + log(object, logLevel: .verbose, filename: filename, line: line, function: function) + } + + func warn(_ object: Any, filename: String, line: Int, function: String) { + log(object, logLevel: .warn, filename: filename, line: line, function: function) + } + + func severe(_ object: Any, filename: String, line: Int, function: String) { + log(object, logLevel: .severe, filename: filename, line: line, function: function) + } + + func whereAmI(filename: String, line: Int, function: String) { + log("WHEREAMI", logLevel: .info, filename: filename, line: line, function: function) + } + + func log(_ object: Any, logLevel: PrebidMobile.LogLevel, filename: String, line: Int, function: String) { + let finalMessage = "\(logLevel.stringValue) \(object): TESTLOG" + print(finalMessage) + Log.serialWriteToLog(finalMessage) + } + + } } From ae9b45b2fe2529784c976728eec3596b8ddb8477 Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Mon, 15 Jul 2024 15:11:30 -0500 Subject: [PATCH 02/11] Forgot to set to nil afterwards. --- PrebidMobileTests/RenderingTests/Tests/LogTest.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PrebidMobileTests/RenderingTests/Tests/LogTest.swift b/PrebidMobileTests/RenderingTests/Tests/LogTest.swift index 201d0dfce..9cb467104 100644 --- a/PrebidMobileTests/RenderingTests/Tests/LogTest.swift +++ b/PrebidMobileTests/RenderingTests/Tests/LogTest.swift @@ -133,6 +133,7 @@ class LogTest: XCTestCase { Log.severe(message) checkLogAndClean(level: .severe) + Log.customLogger = nil } func testWhereAmI() { @@ -152,6 +153,7 @@ class LogTest: XCTestCase { let log = Log.getLogFileAsString() ?? "" XCTAssertTrue(log.contains("WHEREAMI")) + Log.customLogger = nil } func testLogLevel() { From ff5c0d0dd365a5a8e483fc75ed6d2e59f7ea4beb Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Tue, 16 Jul 2024 10:25:02 -0500 Subject: [PATCH 03/11] Support latest GMA SDK version --- .../Sources/PrebidAdMobMediationBaseAdapter.swift | 2 +- .../PrebidMobileGAMEventHandlers/Sources/GAMUtils.swift | 2 +- .../ConfigurationAndTargeting/PrebidGAMVersionChecker.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobMediationBaseAdapter.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobMediationBaseAdapter.swift index 1da332a11..f34a9b5d2 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobMediationBaseAdapter.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobMediationBaseAdapter.swift @@ -41,7 +41,7 @@ public class PrebidAdMobMediationBaseAdapter: NSObject, GADMediationAdapter { // Added for tests static func latestTestedGMAVersion() -> GADVersionNumber { - return GADVersionNumber(majorVersion: 11, minorVersion: 6, patchVersion: 0) + return GADVersionNumber(majorVersion: 11, minorVersion: 7, patchVersion: 0) } required public override init() { diff --git a/EventHandlers/PrebidMobileGAMEventHandlers/Sources/GAMUtils.swift b/EventHandlers/PrebidMobileGAMEventHandlers/Sources/GAMUtils.swift index 189e28681..e24076d36 100644 --- a/EventHandlers/PrebidMobileGAMEventHandlers/Sources/GAMUtils.swift +++ b/EventHandlers/PrebidMobileGAMEventHandlers/Sources/GAMUtils.swift @@ -59,7 +59,7 @@ public class GAMUtils: NSObject { // Added for tests static func latestTestedGMAVersion() -> GADVersionNumber { - return GADVersionNumber(majorVersion: 11, minorVersion: 6, patchVersion: 0) + return GADVersionNumber(majorVersion: 11, minorVersion: 7, patchVersion: 0) } // MARK: Private Methods diff --git a/PrebidMobile/ConfigurationAndTargeting/PrebidGAMVersionChecker.swift b/PrebidMobile/ConfigurationAndTargeting/PrebidGAMVersionChecker.swift index ca61da7d5..72057aedc 100644 --- a/PrebidMobile/ConfigurationAndTargeting/PrebidGAMVersionChecker.swift +++ b/PrebidMobile/ConfigurationAndTargeting/PrebidGAMVersionChecker.swift @@ -18,7 +18,7 @@ import Foundation class PrebidGAMVersionChecker { var latestTestedGMAVersion: (Int, Int, Int) { - (11, 6, 0) + (11, 7, 0) } var currentGMAVersion: (Int, Int, Int)? From 6a7833c7f0267502c206126c4aa90c5fd9be6456 Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Thu, 25 Jul 2024 10:45:55 -0500 Subject: [PATCH 04/11] Fixing customLogger Implementation --- PrebidMobile/Logging/Log.swift | 68 +++++++------------ PrebidMobile/Logging/SDKConsoleLogger.swift | 44 ++++++++++++ .../RenderingTests/Tests/LogTest.swift | 8 +-- 3 files changed, 72 insertions(+), 48 deletions(-) create mode 100644 PrebidMobile/Logging/SDKConsoleLogger.swift diff --git a/PrebidMobile/Logging/Log.swift b/PrebidMobile/Logging/Log.swift index 080d10689..6abc66ec4 100644 --- a/PrebidMobile/Logging/Log.swift +++ b/PrebidMobile/Logging/Log.swift @@ -19,7 +19,7 @@ import Foundation public class Log: NSObject { // MARK: - Public properties - public static var customLogger: PrebidLogger? = nil + public static var logger: PrebidLogger? = SDKConsoleLogger() public static var dateFormat = "yyyy-MM-dd hh:mm:ssSSS" public static var dateFormatter: DateFormatter { let formatter = DateFormatter() @@ -29,75 +29,55 @@ public class Log: NSObject { return formatter } + public static func setCustomLogger(customLogger: PrebidLogger?) { + logger = customLogger + } + public static var logLevel: LogLevel = .debug public static var logToFile = false public static func error(_ object: Any, filename: String = #file, line: Int = #line, function: String = #function) { - if (customLogger == nil) { - log(object, logLevel: .error, filename: filename, line: line, function: function) - } else { - customLogger?.error(object, filename: filename, line: line, function: function) - } + log(object, logLevel: .error, filename: filename, line: line, function: function) + logger?.error(object, filename: filename, line: line, function: function) } public static func info(_ object: Any, filename: String = #file, line: Int = #line, function: String = #function) { - if (customLogger == nil) { - log(object, logLevel: .info, filename: filename, line: line, function: function) - } else { - customLogger?.info(object, filename: filename, line: line, function: function) - } + log(object, logLevel: .info, filename: filename, line: line, function: function) + logger?.info(object, filename: filename, line: line, function: function) } public static func debug(_ object: Any, filename: String = #file, line: Int = #line, function: String = #function) { - if (customLogger == nil) { - log(object, logLevel: .debug, filename: filename, line: line, function: function) - } else { - customLogger?.debug(object, filename: filename, line: line, function: function) - } + log(object, logLevel: .debug, filename: filename, line: line, function: function) + logger?.debug(object, filename: filename, line: line, function: function) } public static func verbose(_ object: Any, filename: String = #file, line: Int = #line, function: String = #function) { - if (customLogger == nil) { - log(object, logLevel: .verbose, filename: filename, line: line, function: function) - } else { - customLogger?.verbose(object, filename: filename, line: line, function: function) - } + log(object, logLevel: .verbose, filename: filename, line: line, function: function) + logger?.verbose(object, filename: filename, line: line, function: function) } public static func warn(_ object: Any, filename: String = #file, line: Int = #line, function: String = #function) { - if (customLogger == nil) { - log(object, logLevel: .warn, filename: filename, line: line, function: function) - } else { - customLogger?.warn(object, filename: filename, line: line, function: function) - } + log(object, logLevel: .warn, filename: filename, line: line, function: function) + logger?.warn(object, filename: filename, line: line, function: function) } public static func severe(_ object: Any, filename: String = #file, line: Int = #line, function: String = #function) { - if (customLogger == nil) { - log(object, logLevel: .severe, filename: filename, line: line, function: function) - } else { - customLogger?.severe(object, filename: filename, line: line, function: function) - } + log(object, logLevel: .severe, filename: filename, line: line, function: function) + logger?.severe(object, filename: filename, line: line, function: function) } public static func whereAmI(filename: String = #file, line: Int = #line, function: String = #function) { - if (customLogger == nil) { - log("", logLevel: .info, filename: filename, line: line, function: function) - } else { - customLogger?.whereAmI(filename: filename, line: line, function: function) - } + log("", logLevel: .info, filename: filename, line: line, function: function) + logger?.whereAmI(filename: filename, line: line, function: function) } static func log(_ object: Any, logLevel: LogLevel, filename: String, line: Int, function: String) { - if (customLogger == nil) { - if isLoggingEnabled(for: logLevel) { - let finalMessage = "\(sdkName): \(Date().toString()) \(logLevel.stringValue)[\(sourceFileName(filePath: filename))]:\(line) \(function) -> \(object)" - print(finalMessage) - serialWriteToLog(finalMessage) - } - } else { - customLogger?.log(object, logLevel: logLevel, filename: filename, line: line, function: function) + if isLoggingEnabled(for: logLevel) { + let finalMessage = "\(sdkName): \(Date().toString()) \(logLevel.stringValue)[\(sourceFileName(filePath: filename))]:\(line) \(function) -> \(object)" + print(finalMessage) + serialWriteToLog(finalMessage) } + logger?.log(object, logLevel: logLevel, filename: filename, line: line, function: function) } public static func serialWriteToLog(_ message: String) { diff --git a/PrebidMobile/Logging/SDKConsoleLogger.swift b/PrebidMobile/Logging/SDKConsoleLogger.swift new file mode 100644 index 000000000..2b89b1e4d --- /dev/null +++ b/PrebidMobile/Logging/SDKConsoleLogger.swift @@ -0,0 +1,44 @@ +// +// SDKConsoleLogger.swift +// PrebidMobile +// +// Created by Jono Sligh on 7/25/24. +// Copyright © 2024 AppNexus. All rights reserved. +// + +import Foundation + +public class SDKConsoleLogger: PrebidLogger { + + public func error(_ object: Any, filename: String, line: Int, function: String) { + + } + + public func info(_ object: Any, filename: String, line: Int, function: String) { + + } + + public func debug(_ object: Any, filename: String, line: Int, function: String) { + + } + + public func verbose(_ object: Any, filename: String, line: Int, function: String) { + + } + + public func warn(_ object: Any, filename: String, line: Int, function: String) { + + } + + public func severe(_ object: Any, filename: String, line: Int, function: String) { + + } + + public func whereAmI(filename: String, line: Int, function: String) { + + } + + public func log(_ object: Any, logLevel: LogLevel, filename: String, line: Int, function: String) { + + } +} diff --git a/PrebidMobileTests/RenderingTests/Tests/LogTest.swift b/PrebidMobileTests/RenderingTests/Tests/LogTest.swift index 9cb467104..e2c238326 100644 --- a/PrebidMobileTests/RenderingTests/Tests/LogTest.swift +++ b/PrebidMobileTests/RenderingTests/Tests/LogTest.swift @@ -112,7 +112,7 @@ class LogTest: XCTestCase { logToFile = .init() - Log.customLogger = CustomTestLogger() + Log.setCustomLogger(customLogger: CustomTestLogger()) Log.error(message) let log = Log.getLogFileAsString() ?? "" @@ -133,7 +133,7 @@ class LogTest: XCTestCase { Log.severe(message) checkLogAndClean(level: .severe) - Log.customLogger = nil + Log.setCustomLogger(customLogger: nil) } func testWhereAmI() { @@ -147,13 +147,13 @@ class LogTest: XCTestCase { func testWhereAmICustom() { logToFile = .init() - Log.customLogger = CustomTestLogger() + Log.setCustomLogger(customLogger: CustomTestLogger()) Log.whereAmI() let log = Log.getLogFileAsString() ?? "" XCTAssertTrue(log.contains("WHEREAMI")) - Log.customLogger = nil + Log.setCustomLogger(customLogger: nil) } func testLogLevel() { From bb7639404afe0fbc506f29f256bd2e083635813f Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Fri, 26 Jul 2024 09:21:38 -0500 Subject: [PATCH 05/11] Fixing issues. --- PrebidMobile.xcodeproj/project.pbxproj | 4 ++++ PrebidMobile/Logging/SDKConsoleLogger.swift | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/PrebidMobile.xcodeproj/project.pbxproj b/PrebidMobile.xcodeproj/project.pbxproj index c859a4954..46be61d57 100644 --- a/PrebidMobile.xcodeproj/project.pbxproj +++ b/PrebidMobile.xcodeproj/project.pbxproj @@ -771,6 +771,7 @@ 9720387C2358771600F8025A /* NativeRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9720387B2358771600F8025A /* NativeRequestTests.swift */; }; 9743CB84235F1CDB002E2CAA /* NativeAssetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9743CB83235F1CDB002E2CAA /* NativeAssetTests.swift */; }; 9743CB86235F264B002E2CAA /* NativeEventTrackerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9743CB85235F264B002E2CAA /* NativeEventTrackerTests.swift */; }; + F91B60A92C52A73500DA9796 /* SDKConsoleLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F91B60A82C52A73500DA9796 /* SDKConsoleLogger.swift */; }; FA5AD5E42271FA4100C8F274 /* ConstantsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA5AD5E32271FA4100C8F274 /* ConstantsTest.swift */; }; FA9D7F2722E8A83D006FCBEF /* AdViewUtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA9D7F2622E8A83D006FCBEF /* AdViewUtilsTests.swift */; }; FAA29904242D1C27002ACBF2 /* TargetingObjCTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FAA29903242D1C27002ACBF2 /* TargetingObjCTests.m */; }; @@ -1654,6 +1655,7 @@ 97826AA621FB4F1B001E2C05 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; 9791778F2201AF4700E624CE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 979177962201AF5F00E624CE /* DispatcherTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DispatcherTests.swift; sourceTree = ""; }; + F91B60A82C52A73500DA9796 /* SDKConsoleLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDKConsoleLogger.swift; sourceTree = ""; }; FA4A88432497A99D00FDCBB6 /* Swizzling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Swizzling.swift; sourceTree = ""; }; FA5AD5E32271FA4100C8F274 /* ConstantsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstantsTest.swift; sourceTree = ""; }; FA85F9B4264946FC00B8BE72 /* TestUtils.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TestUtils.xcodeproj; path = ../tools/TestUtils/TestUtils.xcodeproj; sourceTree = ""; }; @@ -1878,6 +1880,7 @@ FAEE4CE2262DC2B200AD9966 /* Log.swift */, 531CF21827E8FC1B005E5ABE /* LogLevel.swift */, 53F096C927E917D40058C94C /* Log+Extensions.h */, + F91B60A82C52A73500DA9796 /* SDKConsoleLogger.swift */, ); path = Logging; sourceTree = ""; @@ -4205,6 +4208,7 @@ 5BC3792F271F1D0000444D5E /* PBMDeviceAccessManager.m in Sources */, 5BC37A6E271F1D0000444D5E /* PBMORTBBidResponse.m in Sources */, 5BC37ACE271F1D0100444D5E /* PBMGeoLocationParameterBuilder.m in Sources */, + F91B60A92C52A73500DA9796 /* SDKConsoleLogger.swift in Sources */, 5BC37A8C271F1D0000444D5E /* BaseInterstitialAdUnitProtocol.swift in Sources */, 5BC3797A271F1D0000444D5E /* PBMVastRequester.m in Sources */, 53322AA3282D45EE0049229D /* PrebidServerEventTracker.swift in Sources */, diff --git a/PrebidMobile/Logging/SDKConsoleLogger.swift b/PrebidMobile/Logging/SDKConsoleLogger.swift index 2b89b1e4d..713da5cd3 100644 --- a/PrebidMobile/Logging/SDKConsoleLogger.swift +++ b/PrebidMobile/Logging/SDKConsoleLogger.swift @@ -8,7 +8,8 @@ import Foundation -public class SDKConsoleLogger: PrebidLogger { +@objc(PBMSDKConsoleLogger) @objcMembers +public class SDKConsoleLogger: NSObject, PrebidLogger { public func error(_ object: Any, filename: String, line: Int, function: String) { From bb768f8d7aef8801ec0467ca00ae7e4fa758e31c Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Mon, 5 Aug 2024 12:28:41 -0500 Subject: [PATCH 06/11] Included log function in other functions. --- PrebidMobile/Logging/SDKConsoleLogger.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PrebidMobile/Logging/SDKConsoleLogger.swift b/PrebidMobile/Logging/SDKConsoleLogger.swift index 713da5cd3..63f412444 100644 --- a/PrebidMobile/Logging/SDKConsoleLogger.swift +++ b/PrebidMobile/Logging/SDKConsoleLogger.swift @@ -12,27 +12,27 @@ import Foundation public class SDKConsoleLogger: NSObject, PrebidLogger { public func error(_ object: Any, filename: String, line: Int, function: String) { - + log(object, logLevel: .error, filename: filename, line: line, function: function) } public func info(_ object: Any, filename: String, line: Int, function: String) { - + log(object, logLevel: .info, filename: filename, line: line, function: function) } public func debug(_ object: Any, filename: String, line: Int, function: String) { - + log(object, logLevel: .debug, filename: filename, line: line, function: function) } public func verbose(_ object: Any, filename: String, line: Int, function: String) { - + log(object, logLevel: .verbose, filename: filename, line: line, function: function) } public func warn(_ object: Any, filename: String, line: Int, function: String) { - + log(object, logLevel: .warn, filename: filename, line: line, function: function) } public func severe(_ object: Any, filename: String, line: Int, function: String) { - + log(object, logLevel: .severe, filename: filename, line: line, function: function) } public func whereAmI(filename: String, line: Int, function: String) { From 6936d4bf282f0071f5974ba1f1c6c52dbb0eea6e Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Fri, 23 Aug 2024 08:31:51 -0500 Subject: [PATCH 07/11] Trying to fix build errors. --- PrebidMobile.xcodeproj/project.pbxproj | 6 +++--- PrebidMobile/Logging/SDKConsoleLogger.swift | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/PrebidMobile.xcodeproj/project.pbxproj b/PrebidMobile.xcodeproj/project.pbxproj index 71ad52728..5f30ebeee 100644 --- a/PrebidMobile.xcodeproj/project.pbxproj +++ b/PrebidMobile.xcodeproj/project.pbxproj @@ -775,12 +775,12 @@ 9720387C2358771600F8025A /* NativeRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9720387B2358771600F8025A /* NativeRequestTests.swift */; }; 9743CB84235F1CDB002E2CAA /* NativeAssetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9743CB83235F1CDB002E2CAA /* NativeAssetTests.swift */; }; 9743CB86235F264B002E2CAA /* NativeEventTrackerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9743CB85235F264B002E2CAA /* NativeEventTrackerTests.swift */; }; - F91B60A92C52A73500DA9796 /* SDKConsoleLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F91B60A82C52A73500DA9796 /* SDKConsoleLogger.swift */; }; A908694229E05EAF00B37479 /* PrebidMobilePluginRegister.swift in Sources */ = {isa = PBXBuildFile; fileRef = A908694129E05EAF00B37479 /* PrebidMobilePluginRegister.swift */; }; A908694429E05ED500B37479 /* PrebidMobilePluginRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = A908694329E05ED500B37479 /* PrebidMobilePluginRenderer.swift */; }; A908694629E05F7900B37479 /* PrebidRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = A908694529E05F7900B37479 /* PrebidRenderer.swift */; }; A9750D7A2ABB9A300066E4E6 /* PluginEventListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9750D792ABB9A300066E4E6 /* PluginEventListener.swift */; }; A9A3396B2AC57193006AD0E7 /* PBMAdViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A3396A2AC57193006AD0E7 /* PBMAdViewDelegate.swift */; }; + F9F0999B2C78C668007DB464 /* SDKConsoleLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F91B60A82C52A73500DA9796 /* SDKConsoleLogger.swift */; }; FA5AD5E42271FA4100C8F274 /* ConstantsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA5AD5E32271FA4100C8F274 /* ConstantsTest.swift */; }; FA9D7F2722E8A83D006FCBEF /* AdViewUtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA9D7F2622E8A83D006FCBEF /* AdViewUtilsTests.swift */; }; FAA29904242D1C27002ACBF2 /* TargetingObjCTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FAA29903242D1C27002ACBF2 /* TargetingObjCTests.m */; }; @@ -1668,12 +1668,12 @@ 97826AA621FB4F1B001E2C05 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; 9791778F2201AF4700E624CE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 979177962201AF5F00E624CE /* DispatcherTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DispatcherTests.swift; sourceTree = ""; }; - F91B60A82C52A73500DA9796 /* SDKConsoleLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDKConsoleLogger.swift; sourceTree = ""; }; A908694129E05EAF00B37479 /* PrebidMobilePluginRegister.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidMobilePluginRegister.swift; sourceTree = ""; }; A908694329E05ED500B37479 /* PrebidMobilePluginRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidMobilePluginRenderer.swift; sourceTree = ""; }; A908694529E05F7900B37479 /* PrebidRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidRenderer.swift; sourceTree = ""; }; A9750D792ABB9A300066E4E6 /* PluginEventListener.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PluginEventListener.swift; sourceTree = ""; }; A9A3396A2AC57193006AD0E7 /* PBMAdViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PBMAdViewDelegate.swift; sourceTree = ""; }; + F91B60A82C52A73500DA9796 /* SDKConsoleLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDKConsoleLogger.swift; sourceTree = ""; }; FA4A88432497A99D00FDCBB6 /* Swizzling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Swizzling.swift; sourceTree = ""; }; FA5AD5E32271FA4100C8F274 /* ConstantsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstantsTest.swift; sourceTree = ""; }; FA85F9B4264946FC00B8BE72 /* TestUtils.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TestUtils.xcodeproj; path = ../tools/TestUtils/TestUtils.xcodeproj; sourceTree = ""; }; @@ -3988,6 +3988,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + F9F0999B2C78C668007DB464 /* SDKConsoleLogger.swift in Sources */, 5BC37AB1271F1D0000444D5E /* DemandResponseInfo.swift in Sources */, 5BC37AAE271F1D0000444D5E /* BannerEventHandlerStandalone.swift in Sources */, 5BC378DF271F1CFF00444D5E /* PBMORTBApp.m in Sources */, @@ -4251,7 +4252,6 @@ 5BC3792F271F1D0000444D5E /* PBMDeviceAccessManager.m in Sources */, 5BC37A6E271F1D0000444D5E /* PBMORTBBidResponse.m in Sources */, 5BC37ACE271F1D0100444D5E /* PBMGeoLocationParameterBuilder.m in Sources */, - F91B60A92C52A73500DA9796 /* SDKConsoleLogger.swift in Sources */, 5BC37A8C271F1D0000444D5E /* BaseInterstitialAdUnitProtocol.swift in Sources */, 5BC3797A271F1D0000444D5E /* PBMVastRequester.m in Sources */, 53322AA3282D45EE0049229D /* PrebidServerEventTracker.swift in Sources */, diff --git a/PrebidMobile/Logging/SDKConsoleLogger.swift b/PrebidMobile/Logging/SDKConsoleLogger.swift index 63f412444..acc96d8ca 100644 --- a/PrebidMobile/Logging/SDKConsoleLogger.swift +++ b/PrebidMobile/Logging/SDKConsoleLogger.swift @@ -8,7 +8,6 @@ import Foundation -@objc(PBMSDKConsoleLogger) @objcMembers public class SDKConsoleLogger: NSObject, PrebidLogger { public func error(_ object: Any, filename: String, line: Int, function: String) { From e5734d473360d2c855690668439ac9685af86fc7 Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Fri, 23 Aug 2024 08:39:47 -0500 Subject: [PATCH 08/11] Does this fix it? --- PrebidMobile/Logging/SDKConsoleLogger.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PrebidMobile/Logging/SDKConsoleLogger.swift b/PrebidMobile/Logging/SDKConsoleLogger.swift index acc96d8ca..0be95678f 100644 --- a/PrebidMobile/Logging/SDKConsoleLogger.swift +++ b/PrebidMobile/Logging/SDKConsoleLogger.swift @@ -8,7 +8,7 @@ import Foundation -public class SDKConsoleLogger: NSObject, PrebidLogger { +@objc public class SDKConsoleLogger: NSObject, PrebidLogger { public func error(_ object: Any, filename: String, line: Int, function: String) { log(object, logLevel: .error, filename: filename, line: line, function: function) From cb3fbf5fb8e83d5e25e3880a372863388b2b5b02 Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Fri, 23 Aug 2024 08:57:25 -0500 Subject: [PATCH 09/11] More testing. --- PrebidMobile.xcodeproj/project.pbxproj | 10 ++++++---- PrebidMobile/Logging/SDKConsoleLogger.swift | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/PrebidMobile.xcodeproj/project.pbxproj b/PrebidMobile.xcodeproj/project.pbxproj index 5f30ebeee..fd3736614 100644 --- a/PrebidMobile.xcodeproj/project.pbxproj +++ b/PrebidMobile.xcodeproj/project.pbxproj @@ -780,7 +780,8 @@ A908694629E05F7900B37479 /* PrebidRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = A908694529E05F7900B37479 /* PrebidRenderer.swift */; }; A9750D7A2ABB9A300066E4E6 /* PluginEventListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9750D792ABB9A300066E4E6 /* PluginEventListener.swift */; }; A9A3396B2AC57193006AD0E7 /* PBMAdViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A3396A2AC57193006AD0E7 /* PBMAdViewDelegate.swift */; }; - F9F0999B2C78C668007DB464 /* SDKConsoleLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F91B60A82C52A73500DA9796 /* SDKConsoleLogger.swift */; }; + F9F0999D2C78CC8A007DB464 /* SDKConsoleLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9F0999C2C78CC8A007DB464 /* SDKConsoleLogger.swift */; }; + F9F0999E2C78CC8A007DB464 /* SDKConsoleLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9F0999C2C78CC8A007DB464 /* SDKConsoleLogger.swift */; }; FA5AD5E42271FA4100C8F274 /* ConstantsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA5AD5E32271FA4100C8F274 /* ConstantsTest.swift */; }; FA9D7F2722E8A83D006FCBEF /* AdViewUtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA9D7F2622E8A83D006FCBEF /* AdViewUtilsTests.swift */; }; FAA29904242D1C27002ACBF2 /* TargetingObjCTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FAA29903242D1C27002ACBF2 /* TargetingObjCTests.m */; }; @@ -1673,7 +1674,7 @@ A908694529E05F7900B37479 /* PrebidRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidRenderer.swift; sourceTree = ""; }; A9750D792ABB9A300066E4E6 /* PluginEventListener.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PluginEventListener.swift; sourceTree = ""; }; A9A3396A2AC57193006AD0E7 /* PBMAdViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PBMAdViewDelegate.swift; sourceTree = ""; }; - F91B60A82C52A73500DA9796 /* SDKConsoleLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDKConsoleLogger.swift; sourceTree = ""; }; + F9F0999C2C78CC8A007DB464 /* SDKConsoleLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDKConsoleLogger.swift; sourceTree = ""; }; FA4A88432497A99D00FDCBB6 /* Swizzling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Swizzling.swift; sourceTree = ""; }; FA5AD5E32271FA4100C8F274 /* ConstantsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstantsTest.swift; sourceTree = ""; }; FA85F9B4264946FC00B8BE72 /* TestUtils.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TestUtils.xcodeproj; path = ../tools/TestUtils/TestUtils.xcodeproj; sourceTree = ""; }; @@ -1898,7 +1899,7 @@ FAEE4CE2262DC2B200AD9966 /* Log.swift */, 531CF21827E8FC1B005E5ABE /* LogLevel.swift */, 53F096C927E917D40058C94C /* Log+Extensions.h */, - F91B60A82C52A73500DA9796 /* SDKConsoleLogger.swift */, + F9F0999C2C78CC8A007DB464 /* SDKConsoleLogger.swift */, ); path = Logging; sourceTree = ""; @@ -3860,6 +3861,7 @@ 925D5D702737B74E00A8A2B5 /* PBMTouchForwardingViewTest.swift in Sources */, FAA299122434C769002ACBF2 /* UtilsObjCTests.m in Sources */, 925D5E7A2737F62500A8A2B5 /* VideoFileTypeTest.swift in Sources */, + F9F0999E2C78CC8A007DB464 /* SDKConsoleLogger.swift in Sources */, 925D5DB12737C54500A8A2B5 /* MockAdLoader.swift in Sources */, 925D5D742737B7FB00A8A2B5 /* UserConsentManagerTest.swift in Sources */, 922AFD2E2737260900732C53 /* PBMDeepLinkPlusHelperTest.swift in Sources */, @@ -3988,7 +3990,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - F9F0999B2C78C668007DB464 /* SDKConsoleLogger.swift in Sources */, 5BC37AB1271F1D0000444D5E /* DemandResponseInfo.swift in Sources */, 5BC37AAE271F1D0000444D5E /* BannerEventHandlerStandalone.swift in Sources */, 5BC378DF271F1CFF00444D5E /* PBMORTBApp.m in Sources */, @@ -4239,6 +4240,7 @@ 53C925022990FB30009E6F94 /* String+Extensions.swift in Sources */, 53A368E92AB2E38200A03B3E /* BidInfo.swift in Sources */, 799109FB28F99C2B004837B4 /* PBMORTBAppExt.m in Sources */, + F9F0999D2C78CC8A007DB464 /* SDKConsoleLogger.swift in Sources */, 925A641627317A39009E72F9 /* HiddenWebViewManager.swift in Sources */, 5BC3796C271F1D0000444D5E /* PBMVastCreativeLinear.m in Sources */, 928E5A7027F0F743000ADA1A /* ContextSubType.swift in Sources */, diff --git a/PrebidMobile/Logging/SDKConsoleLogger.swift b/PrebidMobile/Logging/SDKConsoleLogger.swift index 0be95678f..bc331d01b 100644 --- a/PrebidMobile/Logging/SDKConsoleLogger.swift +++ b/PrebidMobile/Logging/SDKConsoleLogger.swift @@ -1,10 +1,17 @@ -// -// SDKConsoleLogger.swift -// PrebidMobile -// -// Created by Jono Sligh on 7/25/24. -// Copyright © 2024 AppNexus. All rights reserved. -// +/*   Copyright 2018-2024 Prebid.org, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ import Foundation From 9b55c549cf32067bf70293086c3339822a288e00 Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Tue, 3 Sep 2024 09:37:46 -0500 Subject: [PATCH 10/11] Fixed broken build --- .../InternalTestApp.xcodeproj/project.pbxproj | 6 -- .../Utilities/SampleCustomRenderer.swift | 83 ------------------- PrebidMobile.xcodeproj/project.pbxproj | 4 + .../SampleCustomRenderer.swift | 2 +- .../TestUtils.xcodeproj/project.pbxproj | 12 --- 5 files changed, 5 insertions(+), 102 deletions(-) delete mode 100644 InternalTestApp/PrebidMobileDemoRendering/Utilities/SampleCustomRenderer.swift rename {tools/TestUtils/TestUtils/SamplePluginRegister => PrebidMobile/PrebidMobileRendering/PluginRenderer}/SampleCustomRenderer.swift (99%) diff --git a/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj b/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj index f923c4532..d2cf1fe9b 100644 --- a/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj +++ b/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj @@ -27,8 +27,6 @@ 34FC0CF624ADD5640045553E /* PrebidGAMRewardedController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34FC0CF524ADD5640045553E /* PrebidGAMRewardedController.swift */; }; 3C28C9D82C35713B00D0A7DB /* CustomRendererInterstitialController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C28C9D72C35713B00D0A7DB /* CustomRendererInterstitialController.swift */; }; 3C28C9D92C35713B00D0A7DB /* CustomRendererInterstitialController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C28C9D72C35713B00D0A7DB /* CustomRendererInterstitialController.swift */; }; - 3C28C9DB2C357E3500D0A7DB /* SampleCustomRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C28C9DA2C357E3500D0A7DB /* SampleCustomRenderer.swift */; }; - 3C28C9DC2C357E3500D0A7DB /* SampleCustomRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C28C9DA2C357E3500D0A7DB /* SampleCustomRenderer.swift */; }; 3CC4A3E92C11F96800B97128 /* CustomRendererBannerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CC4A3E82C11F96800B97128 /* CustomRendererBannerController.swift */; }; 3CC4A3EA2C11F96800B97128 /* CustomRendererBannerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CC4A3E82C11F96800B97128 /* CustomRendererBannerController.swift */; }; 457FD34BA45C3840CC31A8F5 /* Pods_InternalTestApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C11D97034E668BBFDD0DDCA /* Pods_InternalTestApp.framework */; }; @@ -381,7 +379,6 @@ 35F94D131F93F85D00CF46DB /* InternalTestAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InternalTestAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 35F94D171F93F85D00CF46DB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 3C28C9D72C35713B00D0A7DB /* CustomRendererInterstitialController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomRendererInterstitialController.swift; sourceTree = ""; }; - 3C28C9DA2C357E3500D0A7DB /* SampleCustomRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleCustomRenderer.swift; sourceTree = ""; }; 3CC4A3E82C11F96800B97128 /* CustomRendererBannerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomRendererBannerController.swift; sourceTree = ""; }; 530E722B292FACB20025B44D /* UIImageView+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImageView+Extensions.swift"; sourceTree = ""; }; 5397BD132936185400ABDA22 /* PrebidOriginalAPIDisplayBannerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidOriginalAPIDisplayBannerController.swift; sourceTree = ""; }; @@ -847,7 +844,6 @@ 34B10A2F255017DE00B5FE09 /* ThreadCheckingButton.swift */, 34C25816255D69E1000A4A73 /* EventReportContainer.swift */, 530E722B292FACB20025B44D /* UIImageView+Extensions.swift */, - 3C28C9DA2C357E3500D0A7DB /* SampleCustomRenderer.swift */, ); path = Utilities; sourceTree = ""; @@ -1577,7 +1573,6 @@ 53ED2FE829798104007D13EE /* PrebidBannerController.swift in Sources */, 53ED2FE929798104007D13EE /* PrebidBannerConfigurationController.swift in Sources */, 53ED2FEA29798104007D13EE /* TestCase.swift in Sources */, - 3C28C9DC2C357E3500D0A7DB /* SampleCustomRenderer.swift in Sources */, 53ED2FEB29798104007D13EE /* PrebidAdMobNativeViewController.swift in Sources */, 53ED2FEC29798104007D13EE /* PrebidInterstitialController.swift in Sources */, 53ED2FED29798104007D13EE /* PrebidOriginalAPIDisplayInterstitialController.swift in Sources */, @@ -1674,7 +1669,6 @@ 3493022224740BEE004A6086 /* PrebidBannerController.swift in Sources */, 5BDB85DA2739794900A529F6 /* PrebidBannerConfigurationController.swift in Sources */, 5B3EEDE52101FB8800BAA0C4 /* TestCase.swift in Sources */, - 3C28C9DB2C357E3500D0A7DB /* SampleCustomRenderer.swift in Sources */, 92C475122796FF8400C26E27 /* PrebidAdMobNativeViewController.swift in Sources */, 34FC0CF424ADD3A80045553E /* PrebidInterstitialController.swift in Sources */, 5397BD26293760F500ABDA22 /* PrebidOriginalAPIDisplayInterstitialController.swift in Sources */, diff --git a/InternalTestApp/PrebidMobileDemoRendering/Utilities/SampleCustomRenderer.swift b/InternalTestApp/PrebidMobileDemoRendering/Utilities/SampleCustomRenderer.swift deleted file mode 100644 index 5fd7d86b3..000000000 --- a/InternalTestApp/PrebidMobileDemoRendering/Utilities/SampleCustomRenderer.swift +++ /dev/null @@ -1,83 +0,0 @@ -/*   Copyright 2018-2021 Prebid.org, Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -import Foundation -import PrebidMobile -import UIKit - -public class SampleCustomRenderer: NSObject, PrebidMobilePluginRenderer { - - public let name = "SampleCustomRenderer" - - public let version = "1.0.0" - - public var data: [AnyHashable: Any]? = nil - - private var adViewManager: PBMAdViewManager? - - public func isSupportRendering(for format: AdFormat?) -> Bool { - AdFormat.allCases.contains(where: { $0 == format }) - } - - public func setupBid(_ bid: Bid, adConfiguration: AdUnitConfig, connection: PrebidServerConnectionProtocol) { - - } - - public func createBannerAdView(with frame: CGRect, bid: Bid, adConfiguration: AdUnitConfig, - connection: PrebidServerConnectionProtocol, adViewDelegate: (any PBMAdViewDelegate)?) { - DispatchQueue.main.async { - if let window = UIApplication.shared.windows.first(where: { $0.isKeyWindow }), - let rootView = window.rootViewController?.view { - if let prebidBannerView = self.findPrebidBannerView(in: rootView) { - print("Found PrebidBannerView: \(prebidBannerView)") - - let label = UILabel() - label.text = "Prebid SDK - Custom Renderer" - label.textAlignment = .center - label.textColor = .black - label.backgroundColor = .yellow - label.translatesAutoresizingMaskIntoConstraints = false - - prebidBannerView.addSubview(label) - - NSLayoutConstraint.activate([ - label.centerXAnchor.constraint(equalTo: prebidBannerView.centerXAnchor), - label.centerYAnchor.constraint(equalTo: prebidBannerView.centerYAnchor), - label.widthAnchor.constraint(equalTo: prebidBannerView.widthAnchor), - label.heightAnchor.constraint(equalTo: prebidBannerView.heightAnchor) - ]) - - } else { - print("PrebidBannerView not found.") - } - } - } - } - - private func findPrebidBannerView(in view: UIView) -> UIView? { - if view.accessibilityIdentifier == "PrebidBannerView" { - return view - } - for subview in view.subviews { - if let foundView = findPrebidBannerView(in: subview) { - return foundView - } - } - return nil - } - - public func createInterstitialController(bid: Bid, adConfiguration: AdUnitConfig, connection: PrebidServerConnectionProtocol, - adViewManagerDelegate adViewDelegate: InterstitialController?, videoControlsConfig: VideoControlsConfiguration?) { - } -} diff --git a/PrebidMobile.xcodeproj/project.pbxproj b/PrebidMobile.xcodeproj/project.pbxproj index ce63f7648..23bc8fcba 100644 --- a/PrebidMobile.xcodeproj/project.pbxproj +++ b/PrebidMobile.xcodeproj/project.pbxproj @@ -780,6 +780,7 @@ A908694629E05F7900B37479 /* PrebidRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = A908694529E05F7900B37479 /* PrebidRenderer.swift */; }; A9750D7A2ABB9A300066E4E6 /* PluginEventListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9750D792ABB9A300066E4E6 /* PluginEventListener.swift */; }; A9A3396B2AC57193006AD0E7 /* PBMAdViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A3396A2AC57193006AD0E7 /* PBMAdViewDelegate.swift */; }; + F95DA2072C87567D0068A2BB /* SampleCustomRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F95DA2062C87567D0068A2BB /* SampleCustomRenderer.swift */; }; FA5AD5E42271FA4100C8F274 /* ConstantsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA5AD5E32271FA4100C8F274 /* ConstantsTest.swift */; }; FA9D7F2722E8A83D006FCBEF /* AdViewUtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA9D7F2622E8A83D006FCBEF /* AdViewUtilsTests.swift */; }; FAA29904242D1C27002ACBF2 /* TargetingObjCTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FAA29903242D1C27002ACBF2 /* TargetingObjCTests.m */; }; @@ -1672,6 +1673,7 @@ A908694529E05F7900B37479 /* PrebidRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidRenderer.swift; sourceTree = ""; }; A9750D792ABB9A300066E4E6 /* PluginEventListener.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PluginEventListener.swift; sourceTree = ""; }; A9A3396A2AC57193006AD0E7 /* PBMAdViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PBMAdViewDelegate.swift; sourceTree = ""; }; + F95DA2062C87567D0068A2BB /* SampleCustomRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SampleCustomRenderer.swift; sourceTree = ""; }; FA4A88432497A99D00FDCBB6 /* Swizzling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Swizzling.swift; sourceTree = ""; }; FA5AD5E32271FA4100C8F274 /* ConstantsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstantsTest.swift; sourceTree = ""; }; FA85F9B4264946FC00B8BE72 /* TestUtils.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TestUtils.xcodeproj; path = ../tools/TestUtils/TestUtils.xcodeproj; sourceTree = ""; }; @@ -3184,6 +3186,7 @@ A908694029E05E8D00B37479 /* PluginRenderer */ = { isa = PBXGroup; children = ( + F95DA2062C87567D0068A2BB /* SampleCustomRenderer.swift */, A908694129E05EAF00B37479 /* PrebidMobilePluginRegister.swift */, A908694329E05ED500B37479 /* PrebidMobilePluginRenderer.swift */, A9750D792ABB9A300066E4E6 /* PluginEventListener.swift */, @@ -4154,6 +4157,7 @@ 537B6518283372FD008AE9D1 /* PathBuilder.swift in Sources */, FAEE4D1A262DC2B200AD9966 /* NativeAd.swift in Sources */, 5BC37A1B271F1D0000444D5E /* Prebid.swift in Sources */, + F95DA2072C87567D0068A2BB /* SampleCustomRenderer.swift in Sources */, 5BC379A8271F1D0000444D5E /* PBMModalViewController.m in Sources */, 5BC37AC3271F1D0100444D5E /* PBMURLComponents.m in Sources */, 5BC378D3271F1CFF00444D5E /* PBMORTBAbstract.m in Sources */, diff --git a/tools/TestUtils/TestUtils/SamplePluginRegister/SampleCustomRenderer.swift b/PrebidMobile/PrebidMobileRendering/PluginRenderer/SampleCustomRenderer.swift similarity index 99% rename from tools/TestUtils/TestUtils/SamplePluginRegister/SampleCustomRenderer.swift rename to PrebidMobile/PrebidMobileRendering/PluginRenderer/SampleCustomRenderer.swift index f27d68dbd..8ff5a684e 100644 --- a/tools/TestUtils/TestUtils/SamplePluginRegister/SampleCustomRenderer.swift +++ b/PrebidMobile/PrebidMobileRendering/PluginRenderer/SampleCustomRenderer.swift @@ -12,8 +12,8 @@  See the License for the specific language governing permissions and  limitations under the License.  */ + import Foundation -import PrebidMobile import UIKit public class SampleCustomRenderer: NSObject, PrebidMobilePluginRenderer { diff --git a/tools/TestUtils/TestUtils.xcodeproj/project.pbxproj b/tools/TestUtils/TestUtils.xcodeproj/project.pbxproj index 2663a5f43..a9dcc57c2 100644 --- a/tools/TestUtils/TestUtils.xcodeproj/project.pbxproj +++ b/tools/TestUtils/TestUtils.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 3CD0ADF12C51274A006CDA6B /* SampleCustomRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CD0ADF02C51274A006CDA6B /* SampleCustomRenderer.swift */; }; 53AB8AB22851D9EF00837C70 /* OMSDK-Static_Prebidorg.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53AB8AB12851D9EF00837C70 /* OMSDK-Static_Prebidorg.xcframework */; }; 53AB8AB32851D9EF00837C70 /* OMSDK-Static_Prebidorg.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 53AB8AB12851D9EF00837C70 /* OMSDK-Static_Prebidorg.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 92C0CEA027BD411E00C480EB /* emptyResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = 92C0CE9F27BD411E00C480EB /* emptyResponse.json */; }; @@ -61,7 +60,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 3CD0ADF02C51274A006CDA6B /* SampleCustomRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleCustomRenderer.swift; sourceTree = ""; }; 537B669C283DFCCD008AE9D1 /* OMSDK_Prebidorg.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = OMSDK_Prebidorg.xcframework; path = ../../Frameworks/OMSDK_Prebidorg.xcframework; sourceTree = ""; }; 53AB8AB12851D9EF00837C70 /* OMSDK-Static_Prebidorg.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = "OMSDK-Static_Prebidorg.xcframework"; path = "../../Frameworks/OMSDK-Static_Prebidorg.xcframework"; sourceTree = ""; }; 92C0CE9F27BD411E00C480EB /* emptyResponse.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = emptyResponse.json; sourceTree = ""; }; @@ -114,14 +112,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 3CD0ADEF2C5126FD006CDA6B /* SamplePluginRegister */ = { - isa = PBXGroup; - children = ( - 3CD0ADF02C51274A006CDA6B /* SampleCustomRenderer.swift */, - ); - path = SamplePluginRegister; - sourceTree = ""; - }; 537B669B283DFCCD008AE9D1 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -151,7 +141,6 @@ FA9E5E0F2649420C0049B214 /* TestUtils */ = { isa = PBXGroup; children = ( - 3CD0ADEF2C5126FD006CDA6B /* SamplePluginRegister */, FAC853582649462E009DC0F3 /* Category */, FAC8536726494646009DC0F3 /* Responses */, FAC8537B26494647009DC0F3 /* Stubbing */, @@ -322,7 +311,6 @@ buildActionMask = 2147483647; files = ( FAC8535B2649462E009DC0F3 /* NSURLRequest+HTTPBodyTesting.m in Sources */, - 3CD0ADF12C51274A006CDA6B /* SampleCustomRenderer.swift in Sources */, FAC8539926494647009DC0F3 /* PBHTTPStubbingManager.m in Sources */, FAC8539A26494647009DC0F3 /* PBURLConnectionStub+NSURLSessionConfiguration.m in Sources */, FAC853652649463A009DC0F3 /* PBTestGlobal.m in Sources */, From f534dcf335f307cc088ab168c715e7de7c5e7db6 Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Tue, 3 Sep 2024 11:48:55 -0500 Subject: [PATCH 11/11] Fixed --- PrebidMobile.xcodeproj/project.pbxproj | 1 - 1 file changed, 1 deletion(-) diff --git a/PrebidMobile.xcodeproj/project.pbxproj b/PrebidMobile.xcodeproj/project.pbxproj index 358face71..8d1394f8b 100644 --- a/PrebidMobile.xcodeproj/project.pbxproj +++ b/PrebidMobile.xcodeproj/project.pbxproj @@ -781,7 +781,6 @@ A9750D7A2ABB9A300066E4E6 /* PluginEventListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9750D792ABB9A300066E4E6 /* PluginEventListener.swift */; }; A9A3396B2AC57193006AD0E7 /* PBMAdViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A3396A2AC57193006AD0E7 /* PBMAdViewDelegate.swift */; }; F9F0999D2C78CC8A007DB464 /* SDKConsoleLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9F0999C2C78CC8A007DB464 /* SDKConsoleLogger.swift */; }; - F9F0999E2C78CC8A007DB464 /* SDKConsoleLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9F0999C2C78CC8A007DB464 /* SDKConsoleLogger.swift */; }; F95DA2072C87567D0068A2BB /* SampleCustomRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F95DA2062C87567D0068A2BB /* SampleCustomRenderer.swift */; }; FA5AD5E42271FA4100C8F274 /* ConstantsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA5AD5E32271FA4100C8F274 /* ConstantsTest.swift */; }; FA9D7F2722E8A83D006FCBEF /* AdViewUtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA9D7F2622E8A83D006FCBEF /* AdViewUtilsTests.swift */; };