Skip to content

Commit

Permalink
Add getter for click URL (#1084)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlenaPostindustria authored Jan 10, 2025
1 parent 110f6d2 commit 5012008
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions PrebidMobile/AdUnits/Native/NativeAd.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ public class NativeAd: NSObject, CacheExpiryDelegate {
return dataObjects(of: .ctaText).first?.value
}

/// Returns landing URL of the clickable link.
@objc public var clickURL: String? {
nativeAdMarkup?.link?.url
}
/// Creates a `NativeAd` instance from the given cache ID.
/// - Parameter cacheId: The cache ID to retrieve the bid response.
/// - Returns: A `NativeAd` instance if successful, otherwise `nil`.
Expand Down
2 changes: 1 addition & 1 deletion PrebidMobileTests/NativeUnitTests/NativeAdTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class NativeAdTests: XCTestCase {
}

func testNativeAd() {

let cacheId = CacheManager.shared.save(content: nativeAdString)
let nativeAd = NativeAd.create(cacheId: cacheId!)

Expand All @@ -36,6 +35,7 @@ class NativeAdTests: XCTestCase {
XCTAssertEqual(nativeAd!.nativeAdMarkup!.link!.url, "https://www.testUrl.com/")
XCTAssertEqual(nativeAd!.nativeAdMarkup!.link!.clicktrackers, ["https://testUrl.com/events/click/root/url"])
XCTAssertEqual(nativeAd!.nativeAdMarkup!.eventtrackers!.first!.url, "https://testUrl.com/events/tracker/impression")
XCTAssertEqual(nativeAd!.clickURL, "https://www.testUrl.com/")
}

func testArrayGetters() {
Expand Down

0 comments on commit 5012008

Please sign in to comment.