正在查看: BetterTogether v3.0.0 应用的 SubscriptionPlansActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: BetterTogether v3.0.0 应用的 SubscriptionPlansActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.bettertogether.subscription;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import cd.z0;
import cf.g;
import cl.b;
import com.adapty.Adapty;
import com.adapty.errors.AdaptyError;
import com.adapty.models.AdaptyPaywall;
import com.adapty.models.AdaptyPaywallProduct;
import com.adapty.models.AdaptyProfile;
import com.adapty.models.AdaptyProfile$AccessLevel;
import com.adapty.models.AdaptyProfile$NonSubscription;
import com.adapty.models.AdaptyPurchasedInfo;
import com.adapty.models.AdaptySubscriptionUpdateParameters;
import com.adapty.ui.AdaptyUI;
import com.adapty.ui.listeners.AdaptyUiEventListener;
import com.adapty.utils.AdaptyResult;
import com.adapty.utils.ErrorCallback;
import com.adapty.utils.ImmutableCollection;
import com.adapty.utils.ImmutableList;
import com.adapty.utils.ImmutableMap;
import com.adapty.utils.TimeIntervalKt;
import com.appsflyer.AppsFlyerLib;
import com.bettertogether.BetterTogetherApp;
import com.bettertogether.base.BaseActivity;
import com.bettertogether.remote.model.common.GroupData;
import com.bettertogether.screens.dashboard.DashboardFragment;
import com.google.firebase.messaging.a0;
import com.google.firebase.messaging.e;
import et.d;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.collections.x0;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.g0;
import lf.k;
import lq.m;
import lq.n;
import lq.o;
import lq.x;
import s6.s;
import s8.h;
import tf.f;
import tf.l;
import tf.p;
import xs.c;
import zs.a;
@Metadata
public final class SubscriptionPlansActivity extends BaseActivity implements p, AdaptyUiEventListener {
public static final int U = 0;
public Map M;
public final ArrayList N;
public AdaptyPaywallProduct O;
public AdaptyPaywallProduct P;
public AdaptyPaywallProduct Q;
public final x R;
public final m S;
public final m T;
public Integer f213e = 0;
public Integer i = -1;
public GroupData f214v;
public Double w;
public Double x;
public AppsFlyerLib y;
public SubscriptionPlansActivity() {
Double valueOf = Double.valueOf(0.0d);
this.w = valueOf;
this.x = valueOf;
this.M = x0.g();
this.N = new ArrayList();
this.R = n.b(new f(this, 1));
n.b(new f(this, 3));
h s3 = e.s(this);
a a = ((ys.a) s3.a).a(e.o(), new c(g0.a(SubscriptionPlansActivity.class)));
f fVar = new f(this, 4);
o oVar = o.d;
this.S = n.a(oVar, new l(a, fVar, 1));
this.T = n.a(oVar, new tf.h(this, (ce.a) null, 0));
}
public final void c(com.bettertogether.remote.model.common.subscription.SubscriptionPromotionalText r7, com.bettertogether.remote.model.common.subscription.SubscriptionReminderConfig r8) {
throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.subscription.SubscriptionPlansActivity.c(com.bettertogether.remote.model.common.subscription.SubscriptionPromotionalText, com.bettertogether.remote.model.common.subscription.SubscriptionReminderConfig):void");
}
public final View getView() {
RelativeLayout relativeLayout = t().a;
Intrinsics.checkNotNullExpressionValue(relativeLayout, "binding.root");
return relativeLayout;
}
public final void initViews() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
if (extras.containsKey("group_day")) {
Integer valueOf = Integer.valueOf(extras.getInt("group_day"));
this.f213e = valueOf;
d.c("GroupDay: " + valueOf, new Object[0]);
}
if (extras.containsKey("group_id")) {
this.i = Integer.valueOf(extras.getInt("group_id"));
d.c("GROUP_ID: group_id", new Object[0]);
}
if (extras.containsKey("open_from_create_or_join") && extras.getBoolean("open_from_create_or_join")) {
this.f213e = -1;
}
if (extras.containsKey("group")) {
this.f214v = extras.getSerializable("group");
}
}
u().d(this.i);
t().g.setOnClickListener(new tf.c(this, 0));
AppsFlyerLib appsFlyerLib = AppsFlyerLib.getInstance();
Intrinsics.checkNotNullExpressionValue(appsFlyerLib, "getInstance()");
Intrinsics.checkNotNullParameter(appsFlyerLib, "<set-?>");
this.y = appsFlyerLib;
if (appsFlyerLib == null) {
Intrinsics.m("mAppsFlyer");
throw null;
}
BetterTogetherApp betterTogetherApp = BetterTogetherApp.f198d;
appsFlyerLib.start(s.j(), "wayzp4kcqdvYnqjoJQny9i", new k(1));
}
public final void m() {
if (yc.c.a()) {
fs.d.o(this, new f(this, 0));
}
}
public final void onActionPerformed(AdaptyUI.Action action, Context context) {
Intrinsics.checkNotNullParameter(action, "action");
Intrinsics.checkNotNullParameter(context, "context");
AdaptyUI.Action.Close close = AdaptyUI.Action.Close.INSTANCE;
if (Intrinsics.c(action, close)) {
finish();
} else {
d.d("currenAction").c(og.m.i(" the current action is ", Intrinsics.c(action, close)), new Object[0]);
}
}
public final AdaptySubscriptionUpdateParameters onAwaitingSubscriptionUpdateParams(AdaptyPaywallProduct adaptyPaywallProduct, Context context) {
Intrinsics.checkNotNullParameter(adaptyPaywallProduct, "product");
Intrinsics.checkNotNullParameter(context, "context");
return null;
}
public final boolean onLoadingProductsFailure(AdaptyError adaptyError, Context context) {
Intrinsics.checkNotNullParameter(adaptyError, "error");
Intrinsics.checkNotNullParameter(context, "context");
finish();
return false;
}
public final void onProductSelected(AdaptyPaywallProduct adaptyPaywallProduct, Context context) {
Intrinsics.checkNotNullParameter(adaptyPaywallProduct, "product");
Intrinsics.checkNotNullParameter(context, "context");
}
public final void onPurchaseCanceled(AdaptyPaywallProduct adaptyPaywallProduct, Context context) {
Intrinsics.checkNotNullParameter(adaptyPaywallProduct, "product");
Intrinsics.checkNotNullParameter(context, "context");
}
public final void onPurchaseFailure(AdaptyError adaptyError, AdaptyPaywallProduct adaptyPaywallProduct, Context context) {
Intrinsics.checkNotNullParameter(adaptyError, "error");
Intrinsics.checkNotNullParameter(adaptyPaywallProduct, "product");
Intrinsics.checkNotNullParameter(context, "context");
}
public final void onPurchaseStarted(AdaptyPaywallProduct adaptyPaywallProduct, Context context) {
Intrinsics.checkNotNullParameter(adaptyPaywallProduct, "product");
Intrinsics.checkNotNullParameter(context, "context");
}
public final void onPurchaseSuccess(AdaptyPurchasedInfo adaptyPurchasedInfo, AdaptyPaywallProduct adaptyPaywallProduct, Context context) {
Intrinsics.checkNotNullParameter(adaptyPaywallProduct, "product");
Intrinsics.checkNotNullParameter(context, "context");
s(adaptyPurchasedInfo != null ? adaptyPurchasedInfo.getProfile() : null, adaptyPaywallProduct);
u().d.r("paywall displayed", true);
}
public final void onRenderingError(AdaptyError adaptyError, Context context) {
Intrinsics.checkNotNullParameter(adaptyError, "error");
Intrinsics.checkNotNullParameter(context, "context");
Uri parse = Uri.parse("android.resource://" + context.getPackageName() + "/2131886080");
Intrinsics.checkNotNullExpressionValue(parse, "fallbackUri");
Adapty.setFallbackPaywalls(parse, (ErrorCallback) null);
}
public final void onRestoreFailure(AdaptyError adaptyError, Context context) {
Intrinsics.checkNotNullParameter(adaptyError, "error");
Intrinsics.checkNotNullParameter(context, "context");
}
public final void onRestoreStarted(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
}
public final void onRestoreSuccess(AdaptyProfile adaptyProfile, Context context) {
Intrinsics.checkNotNullParameter(adaptyProfile, "profile");
Intrinsics.checkNotNullParameter(context, "context");
}
public final void onResume() {
Integer daysSinceStarted;
super.onResume();
tf.n u4 = u();
GroupData groupData = this.f214v;
u4.getClass();
if (xh.k.q()) {
Adapty.getPaywall$default(com.bumptech.glide.e.m(Integer.valueOf((groupData == null || (daysSinceStarted = groupData.getDaysSinceStarted()) == null) ? -1 : daysSinceStarted.intValue()), com.bumptech.glide.e.o(groupData != null ? groupData.getId() : null)), yc.c.b(), null, null, new fe.o(u4, groupData, 2), 12, null);
} else {
u4.d(groupData != null ? groupData.getId() : null);
}
}
public final void onStart() {
boolean z;
boolean z2;
super/*androidx.fragment.app.e0*/.onStart();
et.a d2 = d.d("groupID");
GroupData groupData = this.f214v;
Integer id = groupData != null ? groupData.getId() : null;
DashboardFragment.Companion.getClass();
z = DashboardFragment.isAdaptyPaywallBuilderAvailable;
d2.c("the id of the groupd is " + id + " " + z + " " + zf.d.d, new Object[0]);
z2 = DashboardFragment.isAdaptyPaywallBuilderAvailable;
if (z2) {
RelativeLayout relativeLayout = t().f;
Intrinsics.checkNotNullExpressionValue(relativeLayout, "binding.hideView");
fs.d.x(relativeLayout);
AdaptyPaywall adaptyPaywall = zf.d.d;
if (adaptyPaywall != null) {
Adapty.getProfile(new b(2));
AdaptyUI.getViewConfiguration(adaptyPaywall, TimeIntervalKt.getSeconds(10), new a0(this, 3));
}
}
}
public final ad.a providePresenter() {
return u();
}
public final void s(AdaptyProfile adaptyProfile, AdaptyPaywallProduct adaptyPaywallProduct) {
ImmutableMap.Entry entry;
ImmutableList immutableList;
AdaptyProfile$NonSubscription adaptyProfile$NonSubscription;
ImmutableMap nonSubscriptions;
ImmutableCollection entrySet;
ImmutableMap subscriptions;
ImmutableCollection entrySet2;
Object obj;
ImmutableMap accessLevels;
AdaptyProfile$AccessLevel adaptyProfile$AccessLevel;
((g) this.T.getValue()).e();
String currencyCode = adaptyPaywallProduct.getPrice().getCurrencyCode();
float floatValue = adaptyPaywallProduct.getPrice().getAmount().floatValue();
ImmutableMap.Entry entry2 = null;
String vendorProductId = (adaptyProfile == null || (accessLevels = adaptyProfile.getAccessLevels()) == null || (adaptyProfile$AccessLevel = (AdaptyProfile$AccessLevel) accessLevels.get("premium")) == null) ? null : adaptyProfile$AccessLevel.getVendorProductId();
HashMap hashMap = new HashMap();
hashMap.put("af_currency", currencyCode);
hashMap.put("af_price", Float.valueOf(floatValue));
hashMap.put("af_content_id", vendorProductId);
AppsFlyerLib appsFlyerLib = this.y;
if (appsFlyerLib == null) {
Intrinsics.m("mAppsFlyer");
throw null;
}
BetterTogetherApp betterTogetherApp = BetterTogetherApp.f198d;
appsFlyerLib.logEvent(s.j(), "af_purchase", hashMap, new tf.g(0, hashMap));
if (adaptyProfile == null || (subscriptions = adaptyProfile.getSubscriptions()) == null || (entrySet2 = subscriptions.entrySet()) == null) {
entry = null;
} else {
Iterator it = entrySet2.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
} else {
obj = it.next();
if (Intrinsics.c(((ImmutableMap.Entry) obj).getKey(), vendorProductId)) {
break;
}
}
}
entry = (ImmutableMap.Entry) obj;
}
if (adaptyProfile != null && (nonSubscriptions = adaptyProfile.getNonSubscriptions()) != null && (entrySet = nonSubscriptions.entrySet()) != null) {
Iterator it2 = entrySet.iterator();
while (true) {
if (!it2.hasNext()) {
break;
}
Object next = it2.next();
if (Intrinsics.c(((ImmutableMap.Entry) next).getKey(), vendorProductId)) {
entry2 = next;
break;
}
}
entry2 = entry2;
}
if (entry != null) {
AdaptyProfile.Subscription subscription = (AdaptyProfile.Subscription) entry.getValue();
x(vendorProductId, subscription.getVendorOriginalTransactionId(), subscription.getVendorTransactionId(), subscription.getActivatedAt());
} else {
if (entry2 == null || (immutableList = (ImmutableList) entry2.getValue()) == null || (adaptyProfile$NonSubscription = (AdaptyProfile$NonSubscription) CollectionsKt.B(immutableList)) == null) {
return;
}
x(vendorProductId, adaptyProfile$NonSubscription.getVendorTransactionId(), adaptyProfile$NonSubscription.getVendorTransactionId(), adaptyProfile$NonSubscription.getPurchasedAt());
}
}
public final z0 t() {
return (z0) this.R.getValue();
}
public final tf.n u() {
return (tf.n) this.S.getValue();
}
public final void v(AdaptyResult adaptyResult, AdaptyPaywallProduct adaptyPaywallProduct) {
ImmutableMap accessLevels;
AdaptyProfile$AccessLevel adaptyProfile$AccessLevel;
boolean z = false;
if (adaptyResult instanceof AdaptyResult.Success) {
AdaptyProfile adaptyProfile = (AdaptyProfile) ((AdaptyResult.Success) adaptyResult).getValue();
d.c("PRODUCTS_LIST_PURCHASER_INFO " + adaptyProfile, new Object[0]);
d.c("PRODUCTS_LIST_PRODUCT " + adaptyPaywallProduct, new Object[0]);
if (adaptyProfile != null && (accessLevels = adaptyProfile.getAccessLevels()) != null && (adaptyProfile$AccessLevel = (AdaptyProfile$AccessLevel) accessLevels.get("premium")) != null && adaptyProfile$AccessLevel.isActive()) {
z = true;
}
if (z) {
s(adaptyProfile, adaptyPaywallProduct);
}
} else if (adaptyResult instanceof AdaptyResult.Error) {
AdaptyResult.Error error = (AdaptyResult.Error) adaptyResult;
String message = error.getError().getMessage();
if (message == null) {
message = "";
}
if (!Intrinsics.c(message, "Purchase: USER_CANCELED")) {
showErrorMessageDialog("Please try again later.");
}
String message2 = error.getError().getMessage();
d.c("ADAPTY_ERROR ".concat(message2 != null ? message2 : ""), new Object[0]);
}
u().d.r("paywall displayed", true);
}
public final void w(com.adapty.models.AdaptyPaywall r18, java.util.Map r19, java.util.ArrayList r20, com.bettertogether.remote.model.common.subscription.SubscriptionReminderConfig r21) {
throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.subscription.SubscriptionPlansActivity.w(com.adapty.models.AdaptyPaywall, java.util.Map, java.util.ArrayList, com.bettertogether.remote.model.common.subscription.SubscriptionReminderConfig):void");
}
public final void x(String str, String str2, String str3, String str4) {
SubscriptionRequest subscriptionRequest = new SubscriptionRequest(zf.d.a(str + "|" + str2 + "|" + str3 + "|safeGuard"), str4, str2, str, str3, "purchased");
d.a(a0.g0.j("UserSubscribed: SubscriptionRequest: ", new en.o().i(subscriptionRequest)), new Object[0]);
if (isAppInForeground()) {
subscriptionRequest.getOTransactionId();
qh.a.m(str4, str);
}
u().e(subscriptionRequest);
z0 t = t();
t.b.setVisibility(0);
t.w.setVisibility(0);
t.l.setVisibility(4);
t.i.setVisibility(4);
t.k.setVisibility(4);
}
}