Skip to content

Commit

Permalink
Landscape rendering improvements and stabilization
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevenNefta committed Mar 21, 2024
1 parent fe4a4eb commit 22f0215
Show file tree
Hide file tree
Showing 30 changed files with 6,396 additions and 3,846 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
51 changes: 26 additions & 25 deletions Assets/NeftaCustomAdapter/Plugins/iOS/ALNeftaMediationAdapter.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Tomaz Treven on 09/11/2023.
//

#import <ALNeftaMediationAdapter.h>
#import "ALNeftaMediationAdapter.h"
#import <AppLovinSDK/MAAdapterDelegate.h>

@interface ALNeftaMediationAdapter ()
Expand All @@ -17,6 +17,8 @@ @implementation ALNeftaMediationAdapter
static NeftaPlugin_iOS *_plugin;
static NSMutableDictionary<NSString *, id<MAAdapterDelegate>> *_listeners;

NSString* _placementId;

- (void)initializeWithParameters:(id<MAAdapterInitializationParameters>)parameters completionHandler:(void (^)(MAAdapterInitializationStatus, NSString *_Nullable))completionHandler {
if (_plugin != nil) {
completionHandler(MAAdapterInitializationStatusInitializedSuccess, nil);
Expand All @@ -43,8 +45,9 @@ - (void)initializeWithParameters:(id<MAAdapterInitializationParameters>)paramete
id<MAAdapterDelegate> listener = _listeners[placement._id];
if (placement._type == TypesBanner) {
dispatch_async(dispatch_get_main_queue(), ^{
[_plugin ShowMainWithId: placement._id];
[((id<MAAdViewAdapterDelegate>)listener) didLoadAdForAdView: [_plugin GetViewForPlacement: placement]];
placement._isManualPosition = true;
UIView *v = [_plugin GetViewForPlacement: placement show: true];
[((id<MAAdViewAdapterDelegate>)listener) didLoadAdForAdView: v];
});
} else if (placement._type == TypesInterstitial) {
[((id<MAInterstitialAdapterDelegate>)listener) didLoadInterstitialAd];
Expand Down Expand Up @@ -103,60 +106,58 @@ - (NSString *)SDKVersion {
}

- (NSString *)adapterVersion {
return @"1.1.4";
return @"1.1.5";
}

- (void)destroy {
[_plugin Close];
if (_placementId != nil) {
[_plugin CloseWithId: _placementId];
_placementId = nil;
}
}

- (void)loadAdViewAdForParameters:(id<MAAdapterResponseParameters>)parameters adFormat:(MAAdFormat *)adFormat andNotify:(id<MAAdViewAdapterDelegate>)delegate {
NSString* placementId = parameters.thirdPartyAdPlacementIdentifier;
_listeners[placementId] = delegate;

NSString *pid = parameters.thirdPartyAdPlacementIdentifier;
_listeners[pid] = delegate;
[ALNeftaMediationAdapter ApplyRenderer: parameters];

[_plugin LoadWithId: placementId];
[_plugin LoadWithId: pid];
}

- (void)loadInterstitialAdForParameters:(id<MAAdapterResponseParameters>)parameters andNotify:(id<MAInterstitialAdapterDelegate>)delegate {
NSString* placementId = parameters.thirdPartyAdPlacementIdentifier;
_listeners[placementId] = delegate;

NSString *pid = parameters.thirdPartyAdPlacementIdentifier;
_listeners[pid] = delegate;
[ALNeftaMediationAdapter ApplyRenderer: parameters];

[_plugin LoadWithId: placementId];
[_plugin LoadWithId: pid];
}

- (void)showInterstitialAdForParameters:(id<MAAdapterResponseParameters>)parameters andNotify:(id<MAInterstitialAdapterDelegate>)delegate {
NSString* placementId = parameters.thirdPartyAdPlacementIdentifier;

if (![_plugin IsReadyWithId: placementId]) {
_placementId = parameters.thirdPartyAdPlacementIdentifier;
if (![_plugin IsReadyWithId: _placementId]) {
[delegate didFailToDisplayInterstitialAdWithError: MAAdapterError.adNotReady];
return;
}

[_plugin ShowWithId: placementId];
[_plugin ShowWithId: _placementId];
}

- (void)loadRewardedAdForParameters:(id<MAAdapterResponseParameters>)parameters andNotify:(id<MARewardedAdapterDelegate>)delegate {
NSString* placementId = parameters.thirdPartyAdPlacementIdentifier;

NSString *pid = parameters.thirdPartyAdPlacementIdentifier;
[ALNeftaMediationAdapter ApplyRenderer: parameters];

_listeners[placementId] = delegate;
[_plugin LoadWithId: placementId];
_listeners[pid] = delegate;
[_plugin LoadWithId: pid];
}

- (void)showRewardedAdForParameters:(id<MAAdapterResponseParameters>)parameters andNotify:(id<MARewardedAdapterDelegate>)delegate {
NSString* placementId = parameters.thirdPartyAdPlacementIdentifier;

if (![_plugin IsReadyWithId: placementId]) {
_placementId = parameters.thirdPartyAdPlacementIdentifier;
if (![_plugin IsReadyWithId: _placementId]) {
[delegate didFailToLoadRewardedAdWithError: MAAdapterError.adNotReady];
return;
}

[_plugin ShowWithId: placementId];
[_plugin ShowWithId: _placementId];
}

+ (void)ApplyRenderer:(id<MAAdapterResponseParameters>)parameters {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,41 @@
<dict>
<key>BinaryPath</key>
<string>NeftaSDK.framework/NeftaSDK</string>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>NeftaSDK.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>NeftaSDK.framework/NeftaSDK</string>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>NeftaSDK.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>Version</key>
<string>3.2.4</string>
<string>3.2.5</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, copy) void (^ _Nullable OnLog)
- (void)CloseWithId:(NSString * _Nonnull)id;
- (void)Mute:(BOOL)mute;
- (NSString * _Nonnull)ShowNuid SWIFT_WARN_UNUSED_RESULT;
- (UIView * _Nullable)GetViewForPlacement:(Placement * _Nonnull)placement SWIFT_WARN_UNUSED_RESULT;
- (UIView * _Nullable)GetViewForPlacement:(Placement * _Nonnull)placement show:(BOOL)show SWIFT_WARN_UNUSED_RESULT;
@end

@class UIViewController;
Expand All @@ -488,9 +488,8 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, strong) NeftaPlugin_iOS * _Nul
+ (void)EnableLogging:(BOOL)enable;
+ (NeftaPlugin_iOS * _Nonnull)InitWithAppId:(NSString * _Nullable)appId SWIFT_WARN_UNUSED_RESULT;
- (void)PrepareRendererWithViewController:(UIViewController * _Nonnull)viewController;
- (void)PrepareRendererWithView:(UIView * _Nonnull)view;
- (void)Mute:(BOOL)mute;
- (UIView * _Nullable)GetViewForPlacement:(Placement * _Nonnull)placement SWIFT_WARN_UNUSED_RESULT;
- (UIView * _Nullable)GetViewForPlacement:(Placement * _Nonnull)placement show:(BOOL)show SWIFT_WARN_UNUSED_RESULT;
@end


Expand All @@ -509,6 +508,7 @@ SWIFT_CLASS("_TtC8NeftaSDK9Placement")
@property (nonatomic) NSUInteger _showTime;
@property (nonatomic) NSUInteger _timeSinceFailedLoad;
@property (nonatomic) BOOL _isHidden;
@property (nonatomic) BOOL _isManualPosition;
- (BOOL)IsBidding SWIFT_WARN_UNUSED_RESULT;
- (BOOL)IsLoading SWIFT_WARN_UNUSED_RESULT;
- (BOOL)IsShowing SWIFT_WARN_UNUSED_RESULT;
Expand Down Expand Up @@ -547,6 +547,7 @@ SWIFT_CLASS("_TtC8NeftaSDK13WebController")
- (nonnull instancetype)initWithFrame:(CGRect)frame SWIFT_UNAVAILABLE;
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder SWIFT_UNAVAILABLE;
- (void)layoutSubviews;
- (void)didMoveToSuperview;
- (void)webView:(WKWebView * _Nonnull)webView didFailNavigation:(WKNavigation * _Null_unspecified)navigation withError:(NSError * _Nonnull)error;
- (void)webView:(WKWebView * _Nonnull)webView didFailProvisionalNavigation:(WKNavigation * _Null_unspecified)navigation withError:(NSError * _Nonnull)error;
- (void)webView:(WKWebView * _Nonnull)webView didFinishNavigation:(WKNavigation * _Null_unspecified)navigation;
Expand Down

0 comments on commit 22f0215

Please sign in to comment.