Skip to content

Commit

Permalink
HyprMX/6.4.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins committed May 13, 2024
1 parent 948cd72 commit 4e158ac
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 146 deletions.
6 changes: 3 additions & 3 deletions HyprMX/AppLovinMediationHyprMXAdapter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Pod::Spec.new do |s|

s.authors = 'AppLovin Corporation'
s.name = 'AppLovinMediationHyprMXAdapter'
s.version = '6.3.0.1.1'
s.platform = :ios, '11.0'
s.version = '6.4.0.0.0'
s.platform = :ios, '12.0'
s.summary = 'HyprMX adapter used for mediation with the AppLovin MAX SDK'
s.homepage = "https://github.com/CocoaPods/Specs/search?o=desc&q=#{s.name}&s=indexed"
s.license =
Expand All @@ -26,7 +26,7 @@ s.source =

s.vendored_frameworks = "#{s.name}-#{s.version}/#{s.name}.xcframework"

s.dependency 'HyprMX', '= 6.3.0.1'
s.dependency 'HyprMX', '= 6.4.0'
s.dependency 'AppLovinSDK', '>= 12.0.0'
s.swift_version = '5.0'

Expand Down
6 changes: 6 additions & 0 deletions HyprMX/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 6.4.0.0.0
* Certified with HyprMX SDK 6.4.0.
* Update to use new initialization and delegate APIs.
* Updated minimum Xcode requirement to 15.0.
* Updated the minimum required iOS version to 12.0 to match HyprMX SDK.

## 6.3.0.1.1
* Added Privacy Manifest defining use of UserDefaults.
* Remove deprecated callbacks `didStartRewardedAdVideo` and `didCompleteRewardedAdVideo`.
Expand Down
8 changes: 2 additions & 6 deletions HyprMX/HyprMXAdapter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
6A47612D2ACF65EB00A5DE5E /* HyprMXAdapter+Interstitial.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A47612C2ACF65EB00A5DE5E /* HyprMXAdapter+Interstitial.swift */; };
6A4C04782AD0B9E900327C63 /* HyprMXAdapter+Rewarded.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A4C04772AD0B9E900327C63 /* HyprMXAdapter+Rewarded.swift */; };
6A4C047A2AD0BAEB00327C63 /* HyprMXAdapter+AdView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A4C04792AD0BAEB00327C63 /* HyprMXAdapter+AdView.swift */; };
6A4DFE5C2ADA06E300AC2D22 /* Error+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A4DFE5B2ADA06E300AC2D22 /* Error+Extensions.swift */; };
6A561CE0219BB5A600E3749A /* AppLovinSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D31B64D219BA4E600875D92 /* AppLovinSDK.framework */; };
6A645F092ABCF8F900A3C420 /* HyprMXAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A645F082ABCF8F900A3C420 /* HyprMXAdapter.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -51,7 +50,6 @@
6A47612C2ACF65EB00A5DE5E /* HyprMXAdapter+Interstitial.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HyprMXAdapter+Interstitial.swift"; sourceTree = "<group>"; };
6A4C04772AD0B9E900327C63 /* HyprMXAdapter+Rewarded.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HyprMXAdapter+Rewarded.swift"; sourceTree = "<group>"; };
6A4C04792AD0BAEB00327C63 /* HyprMXAdapter+AdView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HyprMXAdapter+AdView.swift"; sourceTree = "<group>"; };
6A4DFE5B2ADA06E300AC2D22 /* Error+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Error+Extensions.swift"; sourceTree = "<group>"; };
6A561CE5219BB5A600E3749A /* libHyprMXAdapter.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libHyprMXAdapter.a; sourceTree = BUILT_PRODUCTS_DIR; };
6A5A633A21C0875E00B755D7 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = "<group>"; };
6A645F082ABCF8F900A3C420 /* HyprMXAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HyprMXAdapter.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -131,7 +129,6 @@
6A4C04792AD0BAEB00327C63 /* HyprMXAdapter+AdView.swift */,
6A47612C2ACF65EB00A5DE5E /* HyprMXAdapter+Interstitial.swift */,
6A4C04772AD0B9E900327C63 /* HyprMXAdapter+Rewarded.swift */,
6A4DFE5B2ADA06E300AC2D22 /* Error+Extensions.swift */,
);
path = HyprMXAdapter;
sourceTree = "<group>";
Expand Down Expand Up @@ -230,7 +227,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6A4DFE5C2ADA06E300AC2D22 /* Error+Extensions.swift in Sources */,
6A4C047A2AD0BAEB00327C63 /* HyprMXAdapter+AdView.swift in Sources */,
6A4C04782AD0B9E900327C63 /* HyprMXAdapter+Rewarded.swift in Sources */,
6A47612D2ACF65EB00A5DE5E /* HyprMXAdapter+Interstitial.swift in Sources */,
Expand Down Expand Up @@ -365,7 +361,7 @@
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = X8JXXK4FF5;
FRAMEWORK_SEARCH_PATHS = "$(inherited)/**";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -389,7 +385,7 @@
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = X8JXXK4FF5;
FRAMEWORK_SEARCH_PATHS = "$(inherited)/**";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
37 changes: 19 additions & 18 deletions HyprMX/HyprMXAdapter/HyprMXAdapter+AdView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,35 @@ extension HyprMXAdapter: MAAdViewAdapter
updatePrivacyStates(for: parameters)

adViewDelegate = .init(adapter: self, delegate: delegate, adFormat: adFormat, parameters: parameters)
adView = .init(placementName: placementId, adSize: adFormat.hyprMXAdSize)
adView?.placementDelegate = adViewDelegate

let adView = HyprMXBannerView(placementName: placementId, adSize: adFormat.hyprMXAdSize)
adView.placementDelegate = adViewDelegate

self.adView = adView

adView?.loadAd()
adView.loadAd() { success in

guard success else
{
self.log(adEvent: .loadFailed(error: .noFill), id: placementId, adFormat: adFormat)
delegate.didFailToLoadAdViewAdWithError(.noFill)
return
}

self.log(adEvent: .loaded, id: placementId, adFormat: adFormat)
delegate.didLoadAd(forAdView: adView)
}
}
}

final class HyprMXAdViewAdapterDelegate: AdViewAdapterDelegate<HyprMXAdapter>, HyprMXBannerDelegate
{
func adDidLoad(_ bannerView: HyprMXBannerView)
func adImpression(_ bannerView: HyprMXBannerView)
{
log(adEvent: .loaded, id: bannerView.placementName)
delegate?.didLoadAd(forAdView: bannerView)
log(adEvent: .displayed, id: bannerView.placementName)
delegate?.didDisplayAdViewAd()
}

func adFailed(toLoad bannerView: HyprMXBannerView, error: Error)
{
let adapterError = error.hyprMXAdapterError
log(adEvent: .loadFailed(error: adapterError), id: bannerView.placementName)
delegate?.didFailToLoadAdViewAdWithError(adapterError)
}

func adWasClicked(_ bannerView: HyprMXBannerView)
{
log(adEvent: .clicked, id: bannerView.placementName)
Expand All @@ -60,11 +66,6 @@ final class HyprMXAdViewAdapterDelegate: AdViewAdapterDelegate<HyprMXAdapter>, H
log(adEvent: .collapsed, id: bannerView.placementName)
delegate?.didCollapseAdViewAd()
}

func adWillLeaveApplication(_ bannerView: HyprMXBannerView)
{
log(adEvent: .willLeaveApplication, id: bannerView.placementName)
}
}

fileprivate extension MAAdFormat
Expand Down
65 changes: 37 additions & 28 deletions HyprMX/HyprMXAdapter/HyprMXAdapter+Interstitial.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,61 +31,70 @@ extension HyprMXAdapter: MAInterstitialAdapter

interstitialAd = placement
interstitialDelegate = .init(adapter: self, delegate: delegate, parameters: parameters)

loadFullscreenAd(for: placement, parameters: parameters, delegate: interstitialDelegate)

let completionHandler: (Bool) -> () = { success in

guard success else
{
self.log(adEvent: .loadFailed(error: .noFill), id: placementId, adFormat: .interstitial)
delegate.didFailToLoadInterstitialAdWithError(.noFill)
return
}

self.log(adEvent: .loaded, id: placementId, adFormat: .interstitial)
delegate.didLoadInterstitialAd()
}

if parameters.isBidding
{
placement.loadAd(withBidResponse: parameters.bidResponse, completion: completionHandler)
}
else
{
placement.loadAd(completion: completionHandler)
}
}

public func showInterstitialAd(for parameters: MAAdapterResponseParameters, andNotify delegate: MAInterstitialAdapterDelegate)
{
log(adEvent: .showing, id: parameters.thirdPartyAdPlacementIdentifier, adFormat: .interstitial)

guard let interstitialAd, interstitialAd.isAdAvailable() else
guard let interstitialAd, interstitialAd.isAdAvailable else
{
log(adEvent: .notReady, id: parameters.thirdPartyAdPlacementIdentifier, adFormat: .interstitial)
delegate.didFailToDisplayInterstitialAdWithError(.adNotReady)
return
}

interstitialAd.showAd(from: presentingViewController(for: parameters))
interstitialAd.showAd(from: presentingViewController(for: parameters), delegate: interstitialDelegate)
}
}

final class HyprMXInterstitialAdapterDelegate: InterstitialAdapterDelegate<HyprMXAdapter>, HyprMXPlacementDelegate
final class HyprMXInterstitialAdapterDelegate: InterstitialAdapterDelegate<HyprMXAdapter>, HyprMXPlacementShowDelegate
{
func adAvailable(for placement: HyprMXPlacement)
{
log(adEvent: .loaded, id: placement.placementName)
delegate?.didLoadInterstitialAd()
}

func adNotAvailable(for placement: HyprMXPlacement)
{
let adapterError = MAAdapterError.noFill
log(adEvent: .loadFailed(error: adapterError), id: placement.placementName)
delegate?.didFailToLoadInterstitialAdWithError(adapterError)
}

func adExpired(for placement: HyprMXPlacement)
func adWillStart(placement: HyprMXPlacement)
{
log(adEvent: .expired, id: placement.placementName)
log(adEvent: .willShow, id: placement.placementName)
}

func adWillStart(for placement: HyprMXPlacement)
func adImpression(placement: HyprMXPlacement)
{
log(adEvent: .displayed, id: placement.placementName)
delegate?.didDisplayInterstitialAd()
}

func adDidClose(for placement: HyprMXPlacement, didFinishAd finished: Bool)
func adDisplay(error: NSError, placement: HyprMXPlacement)
{
log(adEvent: .hidden, id: placement.placementName, appending: "didFinishAd \(finished)")
delegate?.didHideInterstitialAd()
let adapterError = MAAdapterError(adapterError: .adDisplayFailedError,
mediatedNetworkErrorCode: error.code,
mediatedNetworkErrorMessage: error.localizedDescription)
log(adEvent: .displayFailed(error: adapterError), id: placement.placementName)
delegate?.didFailToDisplayInterstitialAdWithError(adapterError)
}

func adDisplayError(_ error: Error, placement: HyprMXPlacement)
func adDidClose(placement: HyprMXPlacement, finished: Bool)
{
let adapterError = error.hyprMXAdapterError
log(adEvent: .displayFailed(error: adapterError), id: placement.placementName)
delegate?.didFailToDisplayInterstitialAdWithError(adapterError)
log(adEvent: .hidden, id: placement.placementName, appending: "didFinishAd \(finished)")
delegate?.didHideInterstitialAd()
}
}
69 changes: 39 additions & 30 deletions HyprMX/HyprMXAdapter/HyprMXAdapter+Rewarded.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,51 +32,73 @@ extension HyprMXAdapter: MARewardedAdapter
rewardedAd = placement
rewardedDelegate = .init(adapter: self, delegate: delegate, parameters: parameters)

loadFullscreenAd(for: placement, parameters: parameters, delegate: rewardedDelegate)
let completionHandler: (Bool) -> () = { success in

guard success else
{
self.log(adEvent: .loadFailed(error: .noFill), id: placementId, adFormat: .rewarded)
delegate.didFailToLoadRewardedAdWithError(.noFill)
return
}

self.log(adEvent: .loaded, id: placementId, adFormat: .rewarded)
delegate.didLoadRewardedAd()
}

if parameters.isBidding
{
placement.loadAd(withBidResponse: parameters.bidResponse, completion: completionHandler)
}
else
{
placement.loadAd(completion: completionHandler)
}
}

func showRewardedAd(for parameters: MAAdapterResponseParameters, andNotify delegate: MARewardedAdapterDelegate)
{
log(adEvent: .showing, id: parameters.thirdPartyAdPlacementIdentifier, adFormat: .rewarded)

guard let rewardedAd, rewardedAd.isAdAvailable() else
guard let rewardedAd, rewardedAd.isAdAvailable else
{
log(adEvent: .notReady, id: parameters.thirdPartyAdPlacementIdentifier, adFormat: .rewarded)
delegate.didFailToDisplayRewardedAdWithError(.adNotReady)
return
}

rewardedAd.showAd(from: presentingViewController(for: parameters))
rewardedAd.showAd(from: presentingViewController(for: parameters), delegate: rewardedDelegate)
}
}

final class HyprMXRewardedAdapterDelegate: RewardedAdapterDelegate<HyprMXAdapter>, HyprMXPlacementDelegate
final class HyprMXRewardedAdapterDelegate: RewardedAdapterDelegate<HyprMXAdapter>, HyprMXPlacementShowDelegate
{
func adAvailable(for placement: HyprMXPlacement)
func adWillStart(placement: HyprMXPlacement)
{
log(adEvent: .loaded, id: placement.placementName)
delegate?.didLoadRewardedAd()
log(adEvent: .willShow, id: placement.placementName)
}

func adNotAvailable(for placement: HyprMXPlacement)
func adImpression(placement: HyprMXPlacement)
{
let adapterError = MAAdapterError.noFill
log(adEvent: .loadFailed(error: adapterError), id: placement.placementName)
delegate?.didFailToLoadRewardedAdWithError(adapterError)
log(adEvent: .displayed, id: placement.placementName)
delegate?.didDisplayRewardedAd()
}

func adExpired(for placement: HyprMXPlacement)
func adDisplay(error: NSError, placement: HyprMXPlacement)
{
log(adEvent: .expired, id: placement.placementName)
let adapterError = MAAdapterError(adapterError: .adDisplayFailedError,
mediatedNetworkErrorCode: error.code,
mediatedNetworkErrorMessage: error.localizedDescription)
log(adEvent: .displayFailed(error: adapterError), id: placement.placementName)
delegate?.didFailToDisplayRewardedAdWithError(adapterError)
}

func adWillStart(for placement: HyprMXPlacement)
func adDidReward(placement: HyprMXPlacement, rewardName: String?, rewardValue: Int)
{
log(adEvent: .displayed, id: placement.placementName)
delegate?.didDisplayRewardedAd()
log(adEvent: .grantedReward, id: placement.placementName, appending: "Reward: \(rewardValue) \(rewardName ?? "")")
setGrantedReward()
}

func adDidClose(for placement: HyprMXPlacement, didFinishAd finished: Bool)
func adDidClose(placement: HyprMXPlacement, finished: Bool)
{
if hasGrantedReward || adapter.shouldAlwaysRewardUser
{
Expand All @@ -88,17 +110,4 @@ final class HyprMXRewardedAdapterDelegate: RewardedAdapterDelegate<HyprMXAdapter
log(adEvent: .hidden, id: placement.placementName, appending: "didFinishAd: \(finished)")
delegate?.didHideRewardedAd()
}

func adDisplayError(_ error: Error, placement: HyprMXPlacement)
{
let adapterError = error.hyprMXAdapterError
log(adEvent: .displayFailed(error: adapterError), id: placement.placementName)
delegate?.didFailToDisplayRewardedAdWithError(adapterError)
}

func adDidReward(for placement: HyprMXPlacement, rewardName: String?, rewardValue: Int)
{
log(adEvent: .grantedReward, id: placement.placementName, appending: "Reward: \(rewardValue) \(rewardName ?? "")")
setGrantedReward()
}
}
Loading

0 comments on commit 4e158ac

Please sign in to comment.