Skip to content

fix(google-mobile-ads): adLoader #626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions packages/google-mobile-ads/nativead/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { ManagerRequestOptions, RequestOptions, AdEventListener } from '..';
import { NativeAdEventListener, NativeAdViewBase, MediaViewBase, mediaContentProperty, stretchProperty, MediaAspectRatio, AdChoicesPlacement, VideoStatus, NativeAdEventType } from './common';
import { IMediaContent, IMuteThisAdReason, INativeAd, INativeAdImage, IVideoController, NativeAdOptions, UnconfirmedClickListener, INativeAdLoader } from '.';

declare const AdLoaderAdType;

export { AdChoicesPlacement, AdEventType, VideoStatus, MediaAspectRatio, NativeAdEventType };

export class NativeAdView extends NativeAdViewBase implements AddChildFromBuilder {
Expand Down Expand Up @@ -262,7 +260,7 @@ export class NativeAdLoader implements INativeAdLoader {
options.push(numberOfAds);
}

this._native = GADAdLoader.alloc().initWithAdUnitIDRootViewControllerAdTypesOptions(this._adUnitId, topViewController(), [TNSGA.AdLoaderAdTypeToString(AdLoaderAdType.Native)], options);
this._native = GADAdLoader.alloc().initWithAdUnitIDRootViewControllerAdTypesOptions(this._adUnitId, topViewController(), [TNSGA.AdLoaderAdTypeToString(NSCAdLoaderAdType.Native)], options);
this._native.delegate = this._delegate;

if (arg) {
Expand Down
19 changes: 10 additions & 9 deletions packages/google-mobile-ads/platforms/ios/src/TNSGA.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,21 @@ public class TNSGA:NSObject {
}


@objc(AdLoaderAdType)
public enum AdLoaderAdType: Int, RawRepresentable {
@objc(NSCAdLoaderAdType)
public enum NSCAdLoaderAdType: Int, RawRepresentable {
case CustomNative
case GAMBanner
case Native
public typealias RawValue = String

public init?(rawValue: String) {
switch rawValue {
case AdLoaderAdType.CustomNative.rawValue:

case AdLoaderAdType.customNative.rawValue:
self = .CustomNative
case AdLoaderAdType.GAMBanner.rawValue:
case AdLoaderAdType.adManagerBanner.rawValue:
self = .GAMBanner
case AdLoaderAdType.Native.rawValue:
case AdLoaderAdType.native.rawValue:
self = .Native
default:
return nil
Expand All @@ -61,16 +62,16 @@ public class TNSGA:NSObject {
public var rawValue: RawValue {
switch self {
case .CustomNative:
return AdLoaderAdType.CustomNative.rawValue
return AdLoaderAdType.customNative.rawValue
case .GAMBanner:
return AdLoaderAdType.GAMBanner.rawValue
return AdLoaderAdType.adManagerBanner.rawValue
case .Native:
return AdLoaderAdType.Native.rawValue
return AdLoaderAdType.native.rawValue
}
}
}

public static func AdLoaderAdTypeToString(_ type: AdLoaderAdType) -> String {
public static func AdLoaderAdTypeToString(_ type: NSCAdLoaderAdType) -> String {
return type.rawValue
}

Expand Down
4 changes: 2 additions & 2 deletions packages/google-mobile-ads/typings/objc!TNSGA.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare const enum NSCGABannersSize {
Invalid = 7,
}

declare const enum AdLoaderAdType {
declare const enum NSCAdLoaderAdType {
CustomNative = 0,

GAMBanner = 1,
Expand All @@ -39,7 +39,7 @@ declare class TNSGA extends NSObject {

static createInlineAdaptiveBanner(width: number, maxHeight: number, orientation: Orientation): GADAdSize;

static AdLoaderAdTypeToString(type: AdLoaderAdType): string;
static AdLoaderAdTypeToString(type: NSCAdLoaderAdType): string;

static new(): TNSGA; // inherited from NSObject

Expand Down