Skip to content

Commit

Permalink
fix for breaking xcode 11 in the latest release (#329)
Browse files Browse the repository at this point in the history
* fix for breaking xcode 11 in the latest release

* fix unit tests
  • Loading branch information
ppuviarasu authored Oct 8, 2020
1 parent 9ed2674 commit 8699b88
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Example/PrebidDemo/PrebidDemoSwift/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import PrebidMobile
import CoreLocation
import GoogleMobileAds
import MoPub
#if canImport(AppTrackingTransparency)
import AppTrackingTransparency
#endif

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand Down Expand Up @@ -49,10 +51,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
coreLocation?.requestWhenInUseAuthorization()

//requestIDFA()
#if canImport(AppTrackingTransparency)
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in
})
}
#endif

return true
}
Expand Down
7 changes: 5 additions & 2 deletions Source/RequestBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import CoreTelephony
import CoreLocation
import WebKit
import AdSupport
#if canImport(AppTrackingTransparency)
import AppTrackingTransparency

#endif
class RequestBuilder: NSObject {
/**
* The class is created as a singleton object & used
Expand Down Expand Up @@ -495,10 +496,12 @@ class RequestBuilder: NSObject {

deviceExtPrebid["interstitial"] = deviceExtPrebidInstlDict
deviceExt["prebid"] = deviceExtPrebid


#if canImport(AppTrackingTransparency)
if #available(iOS 14, *) {
deviceExt["atts"] = ATTrackingManager.trackingAuthorizationStatus.rawValue
}
#endif

return deviceExt
}
Expand Down
10 changes: 8 additions & 2 deletions Tests/FetchingLogictests/RequestBuilderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import XCTest
import CoreTelephony
import CoreLocation
import AdSupport
#if canImport(AppTrackingTransparency)
import AppTrackingTransparency
#endif
import WebKit
@testable import PrebidMobile

Expand Down Expand Up @@ -1401,16 +1403,20 @@ class RequestBuilderTests: XCTestCase, CLLocationManagerDelegate {
XCTAssertEqual(RequestBuilder.DeviceUUID(), ifa)

let deviceExt = device["ext"] as? [String: Any]

#if canImport(AppTrackingTransparency)
if #available(iOS 14, *) {

let atts = deviceExt!["atts"] as! Int
XCTAssertEqual(Int(ATTrackingManager.trackingAuthorizationStatus.rawValue), atts)
} else {

let lmtAd: Bool = !ASIdentifierManager.shared().isAdvertisingTrackingEnabled
XCTAssertEqual(NSNumber(value: lmtAd).intValue, device["lmt"] as! Int)
}
#else
let lmtAd: Bool = !ASIdentifierManager.shared().isAdvertisingTrackingEnabled
XCTAssertEqual(NSNumber(value: lmtAd).intValue, device["lmt"] as! Int)
#endif


XCTAssertEqual(UIScreen.main.scale, device["pxratio"] as! CGFloat)
}
Expand Down

0 comments on commit 8699b88

Please sign in to comment.