Skip to content
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

Merged
merged 11 commits into from
Dec 19, 2024

Conversation

OlenaPostindustria
Copy link
Collaborator

@OlenaPostindustria OlenaPostindustria marked this pull request as ready for review November 25, 2024 08:07
super.init()
}

public static func enrich(
Copy link
Contributor

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
Copy link
Contributor

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] {
Copy link
Contributor

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 ?

Copy link
Collaborator Author

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() {
Copy link
Contributor

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() {
Copy link
Contributor

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.

Copy link
Collaborator Author

@OlenaPostindustria OlenaPostindustria Dec 2, 2024

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.

Copy link
Contributor

@YuriyVelichkoPI YuriyVelichkoPI left a 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?) {
Copy link
Contributor

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 = Google
  • displaymanagerver = $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?) {
Copy link
Contributor

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]

@OlenaPostindustria OlenaPostindustria force-pushed the 1017/arbitrary-ortb-request branch from a5a337f to 8a29e20 Compare December 5, 2024 08:10
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?) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, rename to setImpORTBConfig

@YuriyVelichkoPI
Copy link
Contributor

@OlenaPostindustria, please update the branch one more time to solve the conflicts.

@OlenaPostindustria OlenaPostindustria force-pushed the 1017/arbitrary-ortb-request branch from 26ed749 to 182a5b4 Compare December 11, 2024 08:31
@YuriyVelichkoPI YuriyVelichkoPI merged commit 0d6d691 into master Dec 19, 2024
4 checks passed
@YuriyVelichkoPI YuriyVelichkoPI deleted the 1017/arbitrary-ortb-request branch December 19, 2024 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants