-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arbitrary ORTB request configuration changes #1064
Conversation
super.init() | ||
} | ||
|
||
public static func enrich( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change the signature of this method due to it's resposibility.
public static func merge(
sdkORTB: [String: Any],
globalORTB: String?,
impORTB: String?
) -> [String: Any] {
///
|
||
if var globalORTBDict = ArbitraryGlobalORTBHelper(ortb: globalORTB).getValidatedORTBDict() { | ||
let existingImpDict = resultORTB["imp"] as? [[String: Any]] | ||
resultORTB["imp"] = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this function better?
In line 35, we added the "imp" object. In line 40, we are removing it.
I believe the algorithm can be more convenient.
|
||
struct ProtectedFields { | ||
|
||
static var deviceProps: [String] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just curious: why is it var
?
Because of this: https://forums.swift.org/t/static-var-vs-static-let/59215 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it seems like a more memory-efficient solution.
resultORTB["imp"] = existingImps?.map { $0.deepMerging(with: impORTBDict) } ?? [impORTBDict] | ||
} | ||
|
||
if var globalORTBDict = ArbitraryGlobalORTBHelper(ortb: globalORTB).getValidatedORTBDict() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to apply getValidatedORTBDict only once when the publisher sets the respective property?
XCTAssertNil(result) | ||
} | ||
|
||
func testGlobalORTBHelper_ValidJSON_RemoveProtectedFields() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need some tests that checks the correct work and combinations of setGlobalORTBConfig
and setImpressionORTBConfig
.
It's ok if it will be integration tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already added some tests in ArbitraryORTBServiceTests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/// Sets the global-level OpenRTB configuration string. | ||
/// | ||
/// - Parameter ortbObject: The global-level OpenRTB configuration string to set. Can be `nil` to clear the configuration. | ||
public func setGlobalORTBConfig(_ ortbConfig: String?) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an example of how this method is used in the demo apps.
Let's set:
ext.myext.test = 1
displaymanager
= Googledisplaymanagerver
= $CurrentGMASDKVersion
/// Sets the impression-level OpenRTB configuration string for the ad unit. | ||
/// | ||
/// - Parameter ortbObject: The impression-level OpenRTB configuration string to set. Can be `nil` to clear the configuration. | ||
public func setImpressionORTBConfig(_ ortbConfig: String?) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an example of how this method is used in the demo apps.
Let's set:
imp.bidfloor=10
imp.banner.battr
= [1,2,3,4]
a5a337f
to
8a29e20
Compare
PrebidMobile/AdUnits/AdUnit.swift
Outdated
public func setOrtbConfig(_ ortbObject: String?) { | ||
adUnitConfig.ortbConfig = ortbObject | ||
/// - Parameter ortbObject: The impression-level OpenRTB configuration string to set. Can be `nil` to clear the configuration. | ||
public func setImpressionORTBConfig(_ ortbConfig: String?) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, rename to setImpORTBConfig
8a29e20
to
26ed749
Compare
@OlenaPostindustria, please update the branch one more time to solve the conflicts. |
26ed749
to
182a5b4
Compare
#1017