Picsart v24.6版本的 MD5 值为:21a61631d94e54da68d2ad9268b8b9d9
以下内容为反编译后的 a.java 源代码,内容仅作参考
package com.picsart.shopNew.buy_button;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.RemoteException;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.URLUtil;
import android.widget.FrameLayout;
import com.facebook.drawee.view.SimpleDraweeView;
import com.fyber.inneractive.sdk.external.InneractiveMediationNameConsts;
import com.google.android.gms.tasks.Tasks;
import com.picsart.imageloader.request.b;
import com.picsart.koin.PAKoinHolder;
import com.picsart.logger.PALog;
import com.picsart.shopNew.lib_shop.domain.ShopItem;
import com.picsart.shopNew.lib_shop.utils.ShopConstants$BuyButtonType;
import com.picsart.shopNew.shop_analytics.ShopAnalyticsObject;
import com.picsart.studio.R;
import com.picsart.studio.ads.SubscriptionService;
import com.picsart.studio.common.constants.EventParam;
import com.picsart.studio.common.constants.SourceParam;
import com.picsart.studio.common.crash.CrashWrapper;
import com.picsart.studio.permission.Permission;
import java.io.File;
import java.io.IOException;
import kotlin.jvm.internal.Intrinsics;
import myobfuscated.h4.k;
import myobfuscated.hi1.d;
import myobfuscated.ii1.j;
import myobfuscated.ik2.h;
import myobfuscated.ud0.o;
import myobfuscated.xz1.g;
public abstract class a implements myobfuscated.qd0.c {
public static final int r = 0;
public final Activity a;
public final ViewGroup b;
public final ShopItem c;
public final LayoutInflater d;
public final boolean f;
public final boolean g;
public C0611a h;
public c i;
public boolean j;
public ShopAnalyticsObject l;
public final h<myobfuscated.tr0.b> o;
public final h<myobfuscated.xy.a> p;
public final myobfuscated.y72.b q;
public View e = null;
public boolean k = true;
public String m = "default";
public final d n = new d();
public class C0611a {
public final ShopItem a;
public C0611a(ShopItem shopItem) {
this.a = shopItem;
}
}
public class b extends myobfuscated.hl2.a {
}
public interface c {
}
public a(Activity activity, FrameLayout frameLayout, ShopItem shopItem, boolean z, boolean z2) {
this.q = (myobfuscated.y72.b) PAKoinHolder.f(activity, myobfuscated.y72.b.class).getValue();
this.a = activity;
this.b = frameLayout;
this.c = shopItem;
this.d = LayoutInflater.from(activity.getApplicationContext());
this.f = z;
this.g = z2;
a(shopItem);
this.o = PAKoinHolder.f(activity, myobfuscated.tr0.b.class);
this.p = PAKoinHolder.f(activity, myobfuscated.xy.a.class);
}
public static a f(ShopConstants$BuyButtonType shopConstants$BuyButtonType, Activity activity, FrameLayout frameLayout, ShopItem shopItem, boolean z, boolean z2) {
if (frameLayout != null) {
frameLayout.setEnabled(true);
}
if (shopConstants$BuyButtonType == ShopConstants$BuyButtonType.PREVIEW || ShopConstants$BuyButtonType.LIST == shopConstants$BuyButtonType || ShopConstants$BuyButtonType.CATEGORY == shopConstants$BuyButtonType) {
return new a(activity, frameLayout, shopItem, z, z2);
}
return null;
}
public final void a(ShopItem shopItem) {
Activity activity = this.a;
if (activity == null || activity.isFinishing()) {
return;
}
if (!shopItem.isPurchased()) {
SubscriptionService.a aVar = SubscriptionService.e;
if (!aVar.a().f()) {
if (shopItem.f35data.price <= 0.0d) {
this.e = d();
return;
} else if (aVar.a().b() && shopItem.isShopItemSubscription()) {
this.e = h();
return;
} else {
this.e = g();
return;
}
}
}
if (!shopItem.isShopItemSubscription() && !shopItem.isPurchased() && !shopItem.f35data.isFree()) {
this.e = g();
} else if (shopItem.f35data.installed) {
this.e = i();
} else {
this.e = e();
}
}
public final void b(ShopItem shopItem) {
PALog.a("shop_buy_btn", "start download");
Activity activity = this.a;
if (activity == null || activity.isFinishing()) {
return;
}
if (!o.a(activity)) {
PALog.a(com.inmobi.commons.core.configs.a.d, "Network error occurred");
activity.runOnUiThread(new myobfuscated.ah0.c(this, 12));
} else if (!URLUtil.isValidUrl(shopItem.getDownloadUrl())) {
CrashWrapper.c("ShopBuyButtonController::downloadShopItem Invalid URL id =" + shopItem.id, null);
PALog.a(com.inmobi.commons.core.configs.a.d, "url is empty");
} else {
if (this.h == null) {
this.h = new C0611a(shopItem);
}
if (new g(activity, 0, null).h(Permission.STORAGE_PERMISSION, this.l.e(), true, new Object())) {
shopItem.f35data.installDate = System.currentTimeMillis();
String str = j.p(activity) + shopItem.f35data.shopItemUid;
File file = new File(str);
if (!file.exists()) {
try {
file.getParentFile().mkdirs();
file.createNewFile();
} catch (IOException unused) {
return;
}
}
myobfuscated.ci1.g gVar = new myobfuscated.ci1.g(this.o.getValue());
String url = shopItem.getDownloadUrl();
File file2 = new File(str);
myobfuscated.ci1.a onProgress = new myobfuscated.ci1.a(this, 0);
myobfuscated.ci1.b onSuccess = new myobfuscated.ci1.b(0, this, str);
myobfuscated.ci1.c onFailure = new myobfuscated.ci1.c(0);
Intrinsics.checkNotNullParameter(activity, "activity");
Intrinsics.checkNotNullParameter(url, "url");
Intrinsics.checkNotNullParameter(file2, "file");
Intrinsics.checkNotNullParameter(onProgress, "onProgress");
Intrinsics.checkNotNullParameter(onSuccess, "onSuccess");
Intrinsics.checkNotNullParameter(onFailure, "onFailure");
k kVar = activity instanceof k ? (k) activity : null;
if (kVar != null) {
kotlinx.coroutines.b.c(androidx.lifecycle.d.a(kVar), null, null, new ShopItemDownloader$download$1(gVar, url, file2, onProgress, onSuccess, onFailure, null), 3);
}
try {
C0611a c0611a = this.h;
if (a.this.a != null) {
Tasks.call(myobfuscated.td0.a.a, new myobfuscated.qw.c(c0611a, 4));
}
} catch (RemoteException unused2) {
}
}
}
}
public abstract View c();
public abstract View d();
public abstract View e();
public abstract View g();
@Override
public final myobfuscated.qp2.a getKoin() {
return PAKoinHolder.e(provideContext());
}
public View h() {
View inflate = this.d.inflate(R.layout.layout_shop_paid_button_for_subscription, this.b, false);
com.picsart.imageloader.b a = myobfuscated.sz0.a.a();
b.a k = com.appsflyer.internal.h.k((SimpleDraweeView) inflate.findViewById(R.id.shop_subscription_icon));
k.b = "https://cdn140.picsart.com/53139271650575456422.png";
((com.picsart.imageloader.c) a).a(k.a());
inflate.setOnClickListener(new myobfuscated.u91.a(this, 3));
return inflate;
}
public abstract View i();
public final void j(Activity activity) {
Bundle bundle = new Bundle();
bundle.putString("source", SourceParam.SHOP.getValue());
this.p.getValue().d((androidx.fragment.app.h) activity, bundle, InneractiveMediationNameConsts.OTHER);
}
public final void k() {
ShopAnalyticsObject shopAnalyticsObject;
ShopItem shopItem = this.c;
if (shopItem == null || shopItem.f35data == null || (shopAnalyticsObject = this.l) == null) {
return;
}
shopAnalyticsObject.b = shopItem;
shopAnalyticsObject.b(Boolean.valueOf(this.j), EventParam.ITEM_CLICKED.getName());
this.j = false;
this.l.b(Boolean.valueOf(this.k), EventParam.CARD_BUTTON.getName());
this.l.u(1, this.a);
}
public final void l() {
View view = this.e;
if (view == null) {
return;
}
if (view.getParent() != null) {
((ViewGroup) this.e.getParent()).removeView(this.e);
}
ViewGroup viewGroup = this.b;
if (viewGroup != null) {
viewGroup.removeAllViews();
viewGroup.addView(this.e);
}
}
@Override
public final Context provideContext() {
return myobfuscated.qd0.a.a();
}
}