Files
rr3-apk/decompiled-community/sources/com/vungle/ads/NativeAd.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

427 lines
19 KiB
Java

package com.vungle.ads;
import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.vungle.ads.ServiceLocator;
import com.vungle.ads.internal.AdInternal;
import com.vungle.ads.internal.Constants;
import com.vungle.ads.internal.ImpressionTracker;
import com.vungle.ads.internal.executor.Executors;
import com.vungle.ads.internal.load.AdLoaderCallback;
import com.vungle.ads.internal.model.AdPayload;
import com.vungle.ads.internal.platform.Platform;
import com.vungle.ads.internal.presenter.AdEventListener;
import com.vungle.ads.internal.presenter.NativeAdPresenter;
import com.vungle.ads.internal.presenter.NativePresenterDelegate;
import com.vungle.ads.internal.protos.Sdk;
import com.vungle.ads.internal.ui.WatermarkView;
import com.vungle.ads.internal.ui.view.MediaView;
import com.vungle.ads.internal.util.ImageLoader;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.LazyThreadSafetyMode;
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class NativeAd extends BaseAd {
public static final int BOTTOM_LEFT = 2;
public static final int BOTTOM_RIGHT = 3;
public static final Companion Companion = new Companion(null);
public static final int TOP_LEFT = 0;
public static final int TOP_RIGHT = 1;
private MediaView adContentView;
private ImageView adIconView;
private int adOptionsPosition;
private NativeAdOptionsView adOptionsView;
private final NativeAd$adPlayCallback$1 adPlayCallback;
private FrameLayout adRootView;
private Collection<? extends View> clickableViews;
private final Lazy executors$delegate;
private final Lazy imageLoader$delegate;
private final Lazy impressionTracker$delegate;
private Map<String, String> nativeAdAssetMap;
private NativeAdPresenter presenter;
@Retention(RetentionPolicy.RUNTIME)
public @interface AdOptionsPosition {
}
@AdOptionsPosition
public static /* synthetic */ void getAdOptionsPosition$annotations() {
}
public final int getAdOptionsPosition() {
return this.adOptionsPosition;
}
public final void setAdOptionsPosition(int i) {
this.adOptionsPosition = i;
}
private NativeAd(final Context context, String str, AdConfig adConfig) {
super(context, str, adConfig);
Lazy lazy;
Lazy lazy2;
Lazy lazy3;
lazy = LazyKt__LazyJVMKt.lazy(new Function0() { // from class: com.vungle.ads.NativeAd$imageLoader$2
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public final ImageLoader invoke() {
Executors executors;
ImageLoader companion = ImageLoader.Companion.getInstance();
executors = NativeAd.this.getExecutors();
companion.init(executors.getIoExecutor());
return companion;
}
});
this.imageLoader$delegate = lazy;
ServiceLocator.Companion companion = ServiceLocator.Companion;
lazy2 = LazyKt__LazyJVMKt.lazy(LazyThreadSafetyMode.SYNCHRONIZED, new Function0() { // from class: com.vungle.ads.NativeAd$special$$inlined$inject$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
/* JADX WARN: Type inference failed for: r0v2, types: [com.vungle.ads.internal.executor.Executors, java.lang.Object] */
@Override // kotlin.jvm.functions.Function0
public final Executors invoke() {
return ServiceLocator.Companion.getInstance(context).getService(Executors.class);
}
});
this.executors$delegate = lazy2;
lazy3 = LazyKt__LazyJVMKt.lazy(new Function0() { // from class: com.vungle.ads.NativeAd$impressionTracker$2
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public final ImpressionTracker invoke() {
return new ImpressionTracker(context);
}
});
this.impressionTracker$delegate = lazy3;
this.adOptionsPosition = 1;
this.adOptionsView = new NativeAdOptionsView(context);
this.adPlayCallback = new NativeAd$adPlayCallback$1(this, str);
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public NativeAd(Context context, String placementId) {
this(context, placementId, new AdConfig());
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(placementId, "placementId");
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
@Override // com.vungle.ads.BaseAd
public NativeAdInternal constructAdInternal$vungle_ads_release(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
return new NativeAdInternal(context);
}
private final ImageLoader getImageLoader() {
return (ImageLoader) this.imageLoader$delegate.getValue();
}
/* JADX INFO: Access modifiers changed from: private */
public final Executors getExecutors() {
return (Executors) this.executors$delegate.getValue();
}
private final ImpressionTracker getImpressionTracker() {
return (ImpressionTracker) this.impressionTracker$delegate.getValue();
}
@Override // com.vungle.ads.BaseAd
public void onAdLoaded$vungle_ads_release(AdPayload advertisement) {
Intrinsics.checkNotNullParameter(advertisement, "advertisement");
super.onAdLoaded$vungle_ads_release(advertisement);
this.nativeAdAssetMap = advertisement.getMRAIDArgsInMap();
}
public final String getAppIcon() {
String str;
Map<String, String> map = this.nativeAdAssetMap;
return (map == null || (str = map.get(NativeAdInternal.TOKEN_APP_ICON)) == null) ? "" : str;
}
public final String getAdTitle() {
String str;
Map<String, String> map = this.nativeAdAssetMap;
return (map == null || (str = map.get(NativeAdInternal.TOKEN_APP_NAME)) == null) ? "" : str;
}
public final String getAdBodyText() {
String str;
Map<String, String> map = this.nativeAdAssetMap;
return (map == null || (str = map.get(NativeAdInternal.TOKEN_APP_DESCRIPTION)) == null) ? "" : str;
}
public final String getAdCallToActionText() {
String str;
Map<String, String> map = this.nativeAdAssetMap;
return (map == null || (str = map.get(NativeAdInternal.TOKEN_CTA_BUTTON_TEXT)) == null) ? "" : str;
}
public final Double getAdStarRating() {
String str;
Map<String, String> map = this.nativeAdAssetMap;
if (map == null || (str = map.get(NativeAdInternal.TOKEN_APP_RATING_VALUE)) == null) {
str = "";
}
if (TextUtils.isEmpty(str)) {
return null;
}
try {
return Double.valueOf(str);
} catch (Exception unused) {
return null;
}
}
public final String getAdSponsoredText() {
String str;
Map<String, String> map = this.nativeAdAssetMap;
return (map == null || (str = map.get(NativeAdInternal.TOKEN_SPONSORED_BY)) == null) ? "" : str;
}
public final boolean hasCallToAction() {
return getCtaUrl$vungle_ads_release().length() > 0;
}
public final String getPrivacyIconUrl$vungle_ads_release() {
String str;
Map<String, String> map = this.nativeAdAssetMap;
return (map == null || (str = map.get(NativeAdInternal.TOKEN_VUNGLE_PRIVACY_ICON_URL)) == null) ? "" : str;
}
public final String getPrivacyUrl$vungle_ads_release() {
String str;
Map<String, String> map = this.nativeAdAssetMap;
return (map == null || (str = map.get(NativeAdInternal.TOKEN_VUNGLE_PRIVACY_URL)) == null) ? "" : str;
}
public final String getCtaUrl$vungle_ads_release() {
String str;
Map<String, String> map = this.nativeAdAssetMap;
return (map == null || (str = map.get(NativeAdInternal.TOKEN_CTA_BUTTON_URL)) == null) ? "" : str;
}
private final String getMainImagePath() {
String str;
Map<String, String> map = this.nativeAdAssetMap;
return (map == null || (str = map.get(NativeAdInternal.TOKEN_MAIN_IMAGE)) == null) ? "" : str;
}
public final void unregisterView() {
if (getAdInternal$vungle_ads_release().getAdState() == AdInternal.AdState.FINISHED) {
return;
}
Collection<? extends View> collection = this.clickableViews;
if (collection != null) {
Iterator<T> it = collection.iterator();
while (it.hasNext()) {
((View) it.next()).setOnClickListener(null);
}
}
Map<String, String> map = this.nativeAdAssetMap;
if (map != null) {
map.clear();
}
getImpressionTracker().destroy();
MediaView mediaView = this.adContentView;
if (mediaView != null) {
mediaView.destroy();
}
this.adOptionsView.destroy();
NativeAdPresenter nativeAdPresenter = this.presenter;
if (nativeAdPresenter != null) {
nativeAdPresenter.detach();
}
}
public final void registerViewForInteraction(FrameLayout rootView, MediaView mediaView, ImageView imageView, Collection<? extends View> collection) {
Lazy lazy;
String str;
Intrinsics.checkNotNullParameter(rootView, "rootView");
Intrinsics.checkNotNullParameter(mediaView, "mediaView");
AnalyticsClient analyticsClient = AnalyticsClient.INSTANCE;
analyticsClient.logMetric$vungle_ads_release(new SingleValueMetric(Sdk.SDKMetric.SDKMetricType.PLAY_AD_API), (r13 & 2) != 0 ? null : getPlacementId(), (r13 & 4) != 0 ? null : getCreativeId(), (r13 & 8) != 0 ? null : getEventId(), (r13 & 16) != 0 ? null : null);
getResponseToShowMetric$vungle_ads_release().markEnd();
AnalyticsClient.logMetric$vungle_ads_release$default(analyticsClient, getResponseToShowMetric$vungle_ads_release(), getPlacementId(), getCreativeId(), getEventId(), (String) null, 16, (Object) null);
getShowToPresentMetric$vungle_ads_release().markStart();
getShowToFailMetric$vungle_ads_release().markStart();
VungleError canPlayAd = getAdInternal$vungle_ads_release().canPlayAd(true);
if (canPlayAd != null) {
if (getAdInternal$vungle_ads_release().isErrorTerminal$vungle_ads_release(canPlayAd.getCode())) {
getAdInternal$vungle_ads_release().setAdState(AdInternal.AdState.ERROR);
Map<String, String> map = this.nativeAdAssetMap;
if (map != null) {
map.clear();
}
}
BaseAdListener adListener = getAdListener();
if (adListener != null) {
adListener.onAdFailedToPlay(this, canPlayAd);
return;
}
return;
}
this.adRootView = rootView;
this.adContentView = mediaView;
this.adIconView = imageView;
this.clickableViews = collection;
ServiceLocator.Companion companion = ServiceLocator.Companion;
final Context context = getContext();
lazy = LazyKt__LazyJVMKt.lazy(LazyThreadSafetyMode.SYNCHRONIZED, new Function0() { // from class: com.vungle.ads.NativeAd$registerViewForInteraction$$inlined$inject$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
/* JADX WARN: Type inference failed for: r0v2, types: [com.vungle.ads.internal.platform.Platform, java.lang.Object] */
@Override // kotlin.jvm.functions.Function0
public final Platform invoke() {
return ServiceLocator.Companion.getInstance(context).getService(Platform.class);
}
});
Context context2 = getContext();
AdLoaderCallback adInternal$vungle_ads_release = getAdInternal$vungle_ads_release();
Intrinsics.checkNotNull(adInternal$vungle_ads_release, "null cannot be cast to non-null type com.vungle.ads.internal.presenter.NativePresenterDelegate");
this.presenter = new NativeAdPresenter(context2, (NativePresenterDelegate) adInternal$vungle_ads_release, getAdInternal$vungle_ads_release().getAdvertisement(), getExecutors().getJobExecutor(), m3813registerViewForInteraction$lambda1(lazy));
Map<String, String> map2 = this.nativeAdAssetMap;
if (map2 == null || (str = map2.get(NativeAdInternal.TOKEN_OM_SDK_DATA)) == null) {
str = "";
}
NativeAdPresenter nativeAdPresenter = this.presenter;
if (nativeAdPresenter != null) {
nativeAdPresenter.initOMTracker(str);
}
NativeAdPresenter nativeAdPresenter2 = this.presenter;
if (nativeAdPresenter2 != null) {
nativeAdPresenter2.startTracking(rootView);
}
NativeAdPresenter nativeAdPresenter3 = this.presenter;
if (nativeAdPresenter3 != null) {
nativeAdPresenter3.setEventListener(new AdEventListener(this.adPlayCallback, getAdInternal$vungle_ads_release().getPlacement()));
}
this.adOptionsView.setOnClickListener(new View.OnClickListener() { // from class: com.vungle.ads.NativeAd$$ExternalSyntheticLambda0
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
NativeAd.m3814registerViewForInteraction$lambda2(NativeAd.this, view);
}
});
if (collection == null) {
collection = CollectionsKt__CollectionsJVMKt.listOf(mediaView);
}
Iterator<T> it = collection.iterator();
while (it.hasNext()) {
((View) it.next()).setOnClickListener(new View.OnClickListener() { // from class: com.vungle.ads.NativeAd$$ExternalSyntheticLambda1
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
NativeAd.m3815registerViewForInteraction$lambda4$lambda3(NativeAd.this, view);
}
});
}
this.adOptionsView.renderTo(rootView, this.adOptionsPosition);
getImpressionTracker().addView(rootView, new ImpressionTracker.ImpressionListener() { // from class: com.vungle.ads.NativeAd$$ExternalSyntheticLambda2
@Override // com.vungle.ads.internal.ImpressionTracker.ImpressionListener
public final void onImpression(View view) {
NativeAd.m3816registerViewForInteraction$lambda5(NativeAd.this, view);
}
});
displayImage(getMainImagePath(), mediaView.getMainImage$vungle_ads_release());
displayImage(getAppIcon(), imageView);
displayImage(getPrivacyIconUrl$vungle_ads_release(), this.adOptionsView.getPrivacyIcon$vungle_ads_release());
String watermark$vungle_ads_release = getAdConfig().getWatermark$vungle_ads_release();
if (watermark$vungle_ads_release != null) {
Context context3 = rootView.getContext();
Intrinsics.checkNotNullExpressionValue(context3, "rootView.context");
WatermarkView watermarkView = new WatermarkView(context3, watermark$vungle_ads_release);
rootView.addView(watermarkView);
watermarkView.bringToFront();
}
NativeAdPresenter nativeAdPresenter4 = this.presenter;
if (nativeAdPresenter4 != null) {
nativeAdPresenter4.prepare();
}
}
/* renamed from: registerViewForInteraction$lambda-1, reason: not valid java name */
private static final Platform m3813registerViewForInteraction$lambda1(Lazy lazy) {
return (Platform) lazy.getValue();
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: registerViewForInteraction$lambda-2, reason: not valid java name */
public static final void m3814registerViewForInteraction$lambda2(NativeAd this$0, View view) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
NativeAdPresenter nativeAdPresenter = this$0.presenter;
if (nativeAdPresenter != null) {
nativeAdPresenter.processCommand("openPrivacy", this$0.getPrivacyUrl$vungle_ads_release());
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: registerViewForInteraction$lambda-4$lambda-3, reason: not valid java name */
public static final void m3815registerViewForInteraction$lambda4$lambda3(NativeAd this$0, View view) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
NativeAdPresenter nativeAdPresenter = this$0.presenter;
if (nativeAdPresenter != null) {
nativeAdPresenter.processCommand(NativeAdPresenter.DOWNLOAD, this$0.getCtaUrl$vungle_ads_release());
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: registerViewForInteraction$lambda-5, reason: not valid java name */
public static final void m3816registerViewForInteraction$lambda5(NativeAd this$0, View view) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
NativeAdPresenter nativeAdPresenter = this$0.presenter;
if (nativeAdPresenter != null) {
NativeAdPresenter.processCommand$default(nativeAdPresenter, "videoViewed", null, 2, null);
}
NativeAdPresenter nativeAdPresenter2 = this$0.presenter;
if (nativeAdPresenter2 != null) {
nativeAdPresenter2.processCommand("tpat", Constants.CHECKPOINT_0);
}
NativeAdPresenter nativeAdPresenter3 = this$0.presenter;
if (nativeAdPresenter3 != null) {
nativeAdPresenter3.onImpression();
}
}
public final void performCTA() {
NativeAdPresenter nativeAdPresenter = this.presenter;
if (nativeAdPresenter != null) {
nativeAdPresenter.processCommand(NativeAdPresenter.DOWNLOAD, getCtaUrl$vungle_ads_release());
}
}
private final void displayImage(String str, ImageView imageView) {
getImageLoader().displayImage(str, new NativeAd$displayImage$1(imageView));
}
}