Skip to content

Commit

Permalink
Update Version to 4.2.4.0.0.1 (#3)
Browse files Browse the repository at this point in the history
* [AUTO-GENERATED] Update version to 4.2.4.0.0.1

* [AUTO-GENERATED] Update copyright headers

* Fetch token as per HB-6918

* Make backwards compatible

* Cleanup

---------

Co-authored-by: runner <[email protected]>
Co-authored-by: Alex Rice <[email protected]>
  • Loading branch information
3 people authored Jan 17, 2024
1 parent fbe5b4d commit 4426ab3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
Note the first digit of every adapter version corresponds to the major version of the Chartboost Mediation SDK compatible with that adapter.
Adapters are compatible with any Chartboost Mediation SDK version within that major version.

### 4.2.4.0.0.1
- Call to fetch bidding token now includes placement format.
- This version of the adapter has been certified with BidMachine 2.4.0.0.

### 4.2.4.0.0.0
- This version of the adapter has been certified with BidMachine 2.4.0.0.
2 changes: 1 addition & 1 deletion ChartboostMediationAdapterBidMachine.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'ChartboostMediationAdapterBidMachine'
spec.version = '4.2.4.0.0.0'
spec.version = '4.2.4.0.0.1'
spec.license = { :type => 'MIT', :file => 'LICENSE.md' }
spec.homepage = 'https://github.com/ChartBoost/chartboost-mediation-ios-adapter-bidmachine'
spec.authors = { 'Chartboost' => 'https://www.chartboost.com/' }
Expand Down
45 changes: 36 additions & 9 deletions Source/BidMachineAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ChartboostMediationSDK
import Foundation
import UIKit
import BidMachine
import BidMachineApiCore // Needed for the PlacementFormat type

final class BidMachineAdapter: PartnerAdapter {
private let SOURCE_ID_KEY = "source_id"
Expand All @@ -17,7 +18,7 @@ final class BidMachineAdapter: PartnerAdapter {
/// The version of the adapter.
/// It should have either 5 or 6 digits separated by periods, where the first digit is Chartboost Mediation SDK's major version, the last digit is the adapter's build version, and intermediate digits are the partner SDK's version.
/// Format: `<Chartboost Mediation major version>.<Partner major version>.<Partner minor version>.<Partner patch version>.<Partner build version>.<Adapter build version>` where `.<Partner build version>` is optional.
let adapterVersion = "4.2.4.0.0.0"
let adapterVersion = "4.2.4.0.0.1"

/// The partner's unique identifier.
let partnerIdentifier = "bidmachine"
Expand Down Expand Up @@ -72,14 +73,39 @@ final class BidMachineAdapter: PartnerAdapter {
/// - parameter completion: Closure to be performed with the fetched info.
func fetchBidderInformation(request: PreBidRequest, completion: @escaping ([String : String]?) -> Void) {
log(.fetchBidderInfoStarted(request))
guard let token = BidMachineSdk.shared.token else {
let error = error(.prebidFailureInvalidArgument, description: "No bidding token provided by BidMachine SDK")
log(.fetchBidderInfoFailed(request, error: error))
completion(nil)
return
let placementFormat: BidMachineApiCore.PlacementFormat
switch request.format {
case .banner:
placementFormat = .banner
case .interstitial:
placementFormat = .interstitial
case .rewarded:
placementFormat = .rewarded
default:
// Not using the `.adaptiveBanner` or `.rewardedInterstitial` cases directly to maintain
// backward compatibility with Chartboost Mediation 4.0
if request.format.rawValue == "adaptive_banner" {
placementFormat = .banner
} else if request.format.rawValue == "rewarded_interstitial" {
placementFormat = .interstitial
} else {
let error = error(.prebidFailureInvalidArgument, description: "Unsupported ad format")
log(.fetchBidderInfoFailed(request, error: error))
completion(nil)
return
}
}

BidMachineSdk.shared.token(with: placementFormat) { [self] token in
guard let token else {
let error = error(.prebidFailureInvalidArgument, description: "No bidding token provided by BidMachine SDK")
log(.fetchBidderInfoFailed(request, error: error))
completion(nil)
return
}
log(.fetchBidderInfoSucceeded(request))
completion(["token": token])
}
log(.fetchBidderInfoSucceeded(request))
completion(["token": token])
}

/// Indicates if GDPR applies or not and the user's GDPR consent status.
Expand Down Expand Up @@ -142,7 +168,8 @@ final class BidMachineAdapter: PartnerAdapter {
case .banner:
return BidMachineAdapterBannerAd(adapter: self, request: request, delegate: delegate)
default:
// Not using the `.adaptiveBanner` case directly to maintain backward compatibility with Chartboost Mediation 4.0
// Not using the `.adaptiveBanner` or `.rewardedInterstitial cases directly to maintain
// backward compatibility with Chartboost Mediation 4.0
if request.format.rawValue == "adaptive_banner" {
return BidMachineAdapterBannerAd(adapter: self, request: request, delegate: delegate)
} else if request.format.rawValue == "rewarded_interstitial" {
Expand Down

0 comments on commit 4426ab3

Please sign in to comment.