Skip to content

Commit

Permalink
fixed on device orientation change handler
Browse files Browse the repository at this point in the history
removed debug code
refactored api field in bid request
  • Loading branch information
Valeriu Popa committed Dec 28, 2023
1 parent bab9f5f commit 661beac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
9 changes: 6 additions & 3 deletions CriteoPublisherSdk/Sources/MRAID/CRMRAIDHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,12 @@ fileprivate extension CRMRAIDHandler {
}

@objc func deviceOrientationDidChange() {
setCurrentPosition()
setMaxSize()
setScreen(size: UIScreen.main.bounds.size)
DispatchQueue.main.async { [weak self] in
guard let self else { return }
self.setCurrentPosition()
self.setMaxSize()
self.setScreen(size: UIScreen.main.bounds.size)
}
}

func unregisterDeviceOrientationListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private extension MRAIDResizeContainerView {
let closeAreaView = UIView()
closeAreaView.translatesAutoresizingMaskIntoConstraints = false
container.addSubview(closeAreaView)
closeAreaView.backgroundColor = .red
closeAreaView.backgroundColor = .clear
let safeAreaLayout = container.safeAreaLayoutGuide

/// set the dimension of the close area
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,10 @@ - (NSArray *)slotsWithCdbRequest:(CR_CdbRequest *)cdbRequest config:(CR_Config *
slotDict[CR_ApiQueryKeys.bidSlotsIsRewarded] = @(YES);
}

NSNumber *mraidAPIVersion = [self mraidAPI:config];
if (config.isMRAIDGlobalEnabled &&
(adUnit.adUnitType == CRAdUnitTypeBanner ||
adUnit.adUnitType == CRAdUnitTypeInterstitial) &&
mraidAPIVersion) {
if (config.isMRAIDGlobalEnabled && (adUnit.adUnitType == CRAdUnitTypeBanner ||
adUnit.adUnitType == CRAdUnitTypeInterstitial)) {
NSMutableDictionary *mraidDict = [NSMutableDictionary new];
mraidDict[CR_ApiQueryKeys.api] = [NSArray arrayWithObject:mraidAPIVersion];
mraidDict[CR_ApiQueryKeys.api] = [self mraidAPI:config];
slotDict[CR_ApiQueryKeys.banner] = mraidDict;
}

Expand All @@ -173,14 +170,15 @@ - (NSArray *)slotsWithCdbRequest:(CR_CdbRequest *)cdbRequest config:(CR_Config *
return slots;
}

- (NSNumber *)mraidAPI:(CR_Config *)config {
- (NSArray *)mraidAPI:(CR_Config *)config {
NSMutableArray *mraidVersions = [NSMutableArray new];
if (config.isMraidEnabled) {
return @(3);
[mraidVersions addObject:@(3)];
}
if (config.isMraid2Enabled) {
return @(5);
[mraidVersions addObject:@(5)];
}
return NULL;
return mraidVersions;
}

- (NSArray *)slotsWithCdbRequest:(CR_CdbRequest *)cdbRequest {
Expand Down

0 comments on commit 661beac

Please sign in to comment.