导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - OrderConfirmationActivity.java 源代码

正在查看: Hopscotch v9.7.2 应用的 OrderConfirmationActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package in.hopscotch.android.activity;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import com.payu.india.Payu.PayuConstants;
import com.segment.analytics.Properties;
import in.hopscotch.android.api.ApiParam;
import in.hopscotch.android.api.RetrofitApiBuilder;
import in.hopscotch.android.api.factory.CustomerInfoApiFactory;
import in.hopscotch.android.api.model.CreditPromotionData;
import in.hopscotch.android.api.model.OrderConfirmationDetails;
import in.hopscotch.android.api.model.OrderDetails;
import in.hopscotch.android.api.model.PromoItem;
import in.hopscotch.android.api.model.ReviewCartItem;
import in.hopscotch.android.api.model.ShoppingBagResponse;
import in.hopscotch.android.api.response.OrderConfirmationResponse;
import in.hopscotch.android.application.HsApplication;
import in.hopscotch.android.application.r;
import in.hopscotch.android.common.helper.b;
import in.hopscotch.android.model.UserStatus;
import in.hopscotch.android.service.applaunch.CustomerInfoWorker;
import in.hopscotch.android.ui.orders.OrdersMainActivity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import net.mischneider.MSREventBridgeModule;
import org.json.JSONObject;

public class OrderConfirmationActivity extends v0 implements net.mischneider.a, com.clevertap.android.sdk.d1, r.a {
    public static final int i = 0;
    private String address;
    private String addressType;
    private in.hopscotch.android.databinding.a1 binding;
    private String card;
    private String cardType;
    private net.mischneider.d notificationPermissionCallback;
    private String orderBarCode;
    private OrderConfirmationResponse orderConfirmationResponse;
    private long orderId;
    private int paymentRetryCount;
    private long payutime;
    private boolean isFirstView = true;
    private String paymentModeText = "payment_mode";

    public static void X0(net.mischneider.d dVar, WritableMap writableMap) {
        if (dVar != null) {
            ((MSREventBridgeModule.b.a) dVar).a(writableMap);
        }
    }

    public static void Y0(ReadableMap readableMap) {
        String str;
        String str2;
        String string = readableMap.getString("user_id");
        String string2 = readableMap.getString("email");
        String string3 = readableMap.getString("phone_no");
        String string4 = readableMap.getString("name");
        String string5 = readableMap.getString("mobile_status");
        boolean z = readableMap.getBoolean("isFromMobile");
        String string6 = in.hopscotch.android.db.a.x().getString("mobile_number_and_status", null);
        if (string6 == null || string6.length() <= 10) {
            str = "";
            str2 = "";
        } else {
            str = string6.substring(0, 10);
            str2 = string6.substring(str.length(), string6.length());
        }
        if (z && str.equalsIgnoreCase(string3) && str2.equalsIgnoreCase(string5)) {
            in.hopscotch.android.db.a.T(string3 + string5);
            return;
        }
        in.hopscotch.android.db.a.T(string3 + string5);
        in.hopscotch.android.analytics.c.m().s(string2, string3, string, string4, string5, false);
    }

    @Override
    public final void B() {
        RetrofitApiBuilder.getInstance().cancelAllRequests();
        Intent a = in.hopscotch.android.application.a0.a(this);
        a.setFlags(268468224);
        startActivity(a);
        finish();
        finish();
    }

    public final void Z0(ReadableMap readableMap) {
        String string;
        String str;
        List<PromoItem> list;
        List<Object> list2;
        if (this.isFirstView) {
            string = readableMap.getString("eventName");
            string.getClass();
            str = null;
            switch (string) {
                case "notification_permission_accepted":
                case "notification_permission_intent_shown":
                case "notification_permission_dismissed":
                    in.hopscotch.android.util.react.a d = in.hopscotch.android.util.react.a.d();
                    ReadableMap map = readableMap.getMap("eventData");
                    d.getClass();
                    HashMap g = in.hopscotch.android.util.react.a.g(map);
                    g.put("from_screen", "Order confirmation");
                    com.google.android.gms.internal.icing.v1.f(string, g, true, false);
                    break;
                case "clear_segment_user_type":
                    in.hopscotch.android.db.a.a0(null);
                    break;
                case "order_placed":
                    in.hopscotch.android.util.react.a d2 = in.hopscotch.android.util.react.a.d();
                    ReadableMap map2 = readableMap.getMap("eventData");
                    d2.getClass();
                    HashMap hashMap = new HashMap(in.hopscotch.android.util.react.a.g(map2));
                    if (!TextUtils.isEmpty(this.addressType)) {
                        hashMap.put("address", this.addressType);
                    }
                    hashMap.put("payment_retry", Integer.valueOf(this.paymentRetryCount));
                    if (!TextUtils.isEmpty(this.cardType)) {
                        hashMap.put(PayuConstants.CARD, this.cardType);
                    }
                    if (hashMap.containsKey(this.paymentModeText) && !TextUtils.isEmpty((String) hashMap.get(this.paymentModeText)) && ((String) hashMap.get(this.paymentModeText)).equals("CARD")) {
                        hashMap.put(this.paymentModeText, "Card");
                    }
                    OrderConfirmationResponse orderConfirmationResponse = this.orderConfirmationResponse;
                    if (orderConfirmationResponse != null) {
                        hashMap.put("paymentOffersActive", Boolean.valueOf(orderConfirmationResponse.paymentOffersActive));
                        OrderConfirmationDetails orderConfirmationDetails = this.orderConfirmationResponse.orderDetails;
                        if (orderConfirmationDetails != null && (list2 = orderConfirmationDetails.promoApplied) != null && !list2.isEmpty()) {
                            hashMap.put("promoApplied", in.hopscotch.android.core.util.a.b(in.hopscotch.android.core.util.a.a(this.orderConfirmationResponse.orderDetails.promoApplied)));
                        }
                    }
                    in.hopscotch.android.analytics.c.m().getClass();
                    in.hopscotch.android.analytics.c.Q("order_placed", hashMap, true);
                    break;
                case "product_ordered":
                    in.hopscotch.android.util.react.a d3 = in.hopscotch.android.util.react.a.d();
                    ReadableMap map3 = readableMap.getMap("eventData");
                    d3.getClass();
                    HashMap g2 = in.hopscotch.android.util.react.a.g(map3);
                    if (!TextUtils.isEmpty((String) g2.get("sku"))) {
                        String str2 = (String) g2.get("sku");
                        in.hopscotch.android.analytics.c.m().getClass();
                        HashMap f0 = in.hopscotch.android.analytics.c.f0(str2);
                        if (f0.size() > 0) {
                            g2.putAll(f0);
                        }
                    }
                    if (!TextUtils.isEmpty(in.hopscotch.android.db.a.h())) {
                        g2.put("checkout_user", in.hopscotch.android.db.a.h());
                    }
                    if (g2.containsKey(this.paymentModeText) && !TextUtils.isEmpty((String) g2.get(this.paymentModeText)) && ((String) g2.get(this.paymentModeText)).equals("CARD")) {
                        g2.put(this.paymentModeText, "Card");
                    }
                    g2.put("step_duration", Long.valueOf(in.hopscotch.android.helper.a.c(true)));
                    g2.put("from_pincode", g2.get(ApiParam.PIN_CODE));
                    g2.put("total_duration", Long.valueOf(in.hopscotch.android.helper.a.b()));
                    in.hopscotch.android.analytics.c.m().getClass();
                    in.hopscotch.android.analytics.c.I("product_ordered", g2, false, false);
                    break;
                case "Order Completed":
                    try {
                        ShoppingBagResponse A = in.hopscotch.android.util.a1.A();
                        if (A != null && A.orderDetails != null) {
                            ArrayList arrayList = new ArrayList();
                            ArrayList arrayList2 = new ArrayList();
                            List<ReviewCartItem> list3 = A.cartItems;
                            if (list3 != null && !list3.isEmpty()) {
                                for (int i2 = 0; i2 < list3.size(); i2++) {
                                    arrayList.add(list3.get(i2).sku);
                                    arrayList2.add(list3.get(i2).brandName);
                                }
                            }
                            CreditPromotionData creditPromotionData = A.creditPromotionData;
                            if (creditPromotionData != null && (list = creditPromotionData.orderPromocodes) != null && list.size() > 0) {
                                str = A.creditPromotionData.orderPromocodes.get(0).code;
                            }
                            in.hopscotch.android.analytics.facebook.a aVar = HsApplication.b().c;
                            String obj = arrayList.toString();
                            String obj2 = arrayList2.toString();
                            OrderDetails orderDetails = A.orderDetails;
                            aVar.g(obj, obj2, orderDetails.itemCount, orderDetails.totalAmount, str);
                        }
                    } catch (Exception e) {
                        in.hopscotch.android.util.g.b(e);
                    }
                    in.hopscotch.android.util.react.a d4 = in.hopscotch.android.util.react.a.d();
                    ReadableMap map4 = readableMap.getMap("eventData");
                    d4.getClass();
                    HashMap g3 = in.hopscotch.android.util.react.a.g(map4);
                    if (in.hopscotch.android.util.a1.A() != null) {
                        ShoppingBagResponse A2 = in.hopscotch.android.util.a1.A();
                        ArrayList arrayList3 = new ArrayList();
                        for (int i3 = 0; i3 < A2.cartItems.size(); i3++) {
                            ReviewCartItem reviewCartItem = A2.cartItems.get(i3);
                            if (reviewCartItem != null) {
                                Properties.Product product = new Properties.Product(android.support.v4.media.b.i("", reviewCartItem.productId, new StringBuilder()), reviewCartItem.sku, reviewCartItem.orderPrice * reviewCartItem.quantity);
                                product.put("quantity", (Object) Integer.valueOf(reviewCartItem.quantity));
                                product.put("name", (Object) reviewCartItem.productName);
                                product.put("brand", (Object) reviewCartItem.brandName);
                                arrayList3.add(product);
                            }
                        }
                        g3.put("products", arrayList3);
                    }
                    com.google.android.gms.internal.icing.v1.f("Order Completed", g3, false, false);
                    break;
            }
        }
    }

    public final void a1(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        if (str.equals("allowNotifications")) {
            b.a.a.getClass();
            if (b.a.b() != null) {
                b.a.b().N(true);
                return;
            }
            return;
        }
        Intent a = in.hopscotch.android.util.s0.a(this, str, "", (String) null, (String) null, "", "", (Bundle) null);
        a.putExtra("FROM_SCREEN", "Confirmation");
        a.putExtra("from_location", "Banner");
        startActivity(a);
        androidx.localbroadcastmanager.content.a.b(this).d(new Intent("isFromOrderConfirmation"));
    }

    public final void d(String str, ReadableMap readableMap, MSREventBridgeModule.b.a aVar) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        if (str.equalsIgnoreCase("orderConfirmation")) {
            CustomerInfoApiFactory.getInstance().getOrderConfirmation(this.orderId, new v1(this, aVar));
        } else if (str.equalsIgnoreCase("forgetMe")) {
            CustomerInfoApiFactory.getInstance().forgetGuestUser(new w1(this, aVar));
        } else if (str.equalsIgnoreCase("listenForNotificationPermission")) {
            this.notificationPermissionCallback = aVar;
        }
    }

    public final void e(boolean z) {
        try {
            HashMap hashMap = new HashMap();
            hashMap.put("notificationPermissionResponse", Boolean.valueOf(z));
            net.mischneider.d dVar = this.notificationPermissionCallback;
            String h = in.hopscotch.android.common.util.d.b().a().h(hashMap);
            in.hopscotch.android.util.react.a d = in.hopscotch.android.util.react.a.d();
            JSONObject jSONObject = new JSONObject(h);
            d.getClass();
            X0(dVar, in.hopscotch.android.util.react.a.e(jSONObject));
        } catch (Exception unused) {
            X0(this.notificationPermissionCallback, null);
        }
    }

    public final void onBackPressed() {
        B();
    }

    @Override
    public final void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        if (!UserStatus.getInstance().getLoginStatus()) {
            try {
                CustomerInfoWorker.b.getClass();
                CustomerInfoWorker.a.a(this, false);
            } catch (Exception e) {
                in.hopscotch.android.util.g.b(e);
            }
        }
        in.hopscotch.android.application.a.e(0, this);
        in.hopscotch.android.util.e0.b().h();
        String str = in.hopscotch.android.util.a1.a;
        LayoutInflater layoutInflater = getLayoutInflater();
        int i2 = in.hopscotch.android.databinding.a1.f;
        in.hopscotch.android.databinding.a1 a1Var = (in.hopscotch.android.databinding.a1) androidx.databinding.p.M(layoutInflater, 2131558478, (ViewGroup) null, false, androidx.databinding.g.e());
        this.binding = a1Var;
        setContentView(a1Var.E());
        in.hopscotch.android.application.r.b().h(this);
        this.binding.d.setEventBridgeEventReceiver(this);
        this.orderId = getIntent().getLongExtra("ORDER_ID", 0L);
        this.address = getIntent().getStringExtra("ADDRESS");
        this.card = getIntent().getStringExtra("CARD");
        this.orderBarCode = getIntent().getStringExtra("orderBarcode");
        this.addressType = getIntent().getStringExtra(ApiParam.PaymentGatewayParams.ADDRESS_TYPE);
        this.cardType = getIntent().getStringExtra(PayuConstants.CARDTYPE);
        this.paymentRetryCount = getIntent().getIntExtra("retryCount", 0);
        this.payutime = getIntent().getLongExtra("payutime", 0L);
        if (this.orderId == 0) {
            startActivity(in.hopscotch.android.application.a0.a(this));
            return;
        }
        b.a.a.getClass();
        if (b.a.b() != null) {
            b.a.b().W(this);
        }
        Bundle g = android.support.v4.media.c.g("initialRoute", "ORDER_CONFIRMATION");
        g.putBundle("checkoutData", new Bundle());
        g.putString("orderBarcode", this.orderBarCode);
        g.putString("notificationPermissionNudge", new com.google.gson.k().h(in.hopscotch.android.notificationnudge.a.a("ORDER_CONFIRMATION")));
        in.hopscotch.android.util.h0.a.getClass();
        if (in.hopscotch.android.util.h0.a()) {
            g.putString("isNotificationPermissionGranted", (b.a.b() == null || !b.a.b().H()) ? "NO" : "YES");
        } else {
            g.putString("isNotificationPermissionGranted", "YES");
        }
        g.putString("loggedInState", UserStatus.getInstance().getLoginStatus() ? "YES" : "NO");
        this.binding.d.startReactApplication(in.hopscotch.android.application.r.b().c(), "HSCheckout", g);
        in.hopscotch.android.db.a.H(null);
        in.hopscotch.android.db.a.Y(0L);
        in.hopscotch.android.db.a.X(null);
    }

    @Override
    public final void onDestroy() {
        in.hopscotch.android.application.r.b().h(null);
        in.hopscotch.android.application.r.b().e(this);
        this.binding.d.unmountReactApplication();
        super.onDestroy();
        b.a.a.getClass();
        if (b.a.b() != null) {
            b.a.b().k0(this);
        }
    }

    public final void onPause() {
        in.hopscotch.android.application.r.b().f(this);
        super/*androidx.fragment.app.n*/.onPause();
    }

    public final void onResume() {
        in.hopscotch.android.application.r.b().g(this);
        super/*androidx.fragment.app.n*/.onResume();
    }

    public final void r0(ReadableMap readableMap, String str) {
        int i2;
        try {
            if (!TextUtils.isEmpty(str)) {
                if (str.equalsIgnoreCase("productTapped")) {
                    if (readableMap != null && readableMap.hasKey("productId") && (i2 = readableMap.getInt("productId")) > 0) {
                        in.hopscotch.android.application.a0.g(i2, this, in.hopscotch.android.components.util.q.b("", "order_confirmation", readableMap.getString("brandName"), ""));
                    }
                } else if (str.equalsIgnoreCase("continueShoppingTapped")) {
                    Intent a = in.hopscotch.android.application.a0.a(this);
                    a.setFlags(268468224);
                    startActivity(a);
                    finish();
                } else if (str.equalsIgnoreCase("bannerAction")) {
                    a1(readableMap.getString(PayuConstants.GV_ACTION));
                } else if (str.equalsIgnoreCase("messageDeeplink")) {
                    a1(readableMap.getString(ApiParam.Search.DEEPLINK));
                } else if (str.equalsIgnoreCase("viewOrders")) {
                    OrdersMainActivity.b bVar = OrdersMainActivity.b.LISTING;
                    OrdersMainActivity.j.getClass();
                    startActivity(OrdersMainActivity.a.a(this, "Order confirmation", false, bVar));
                    androidx.localbroadcastmanager.content.a.b(this).d(new Intent("isFromOrderConfirmation"));
                    finish();
                } else if ("segmentEvent".equalsIgnoreCase(str)) {
                    if (!in.hopscotch.android.db.a.x().getBoolean("IsOrderPaid", false)) {
                        Z0(readableMap);
                    }
                } else if ("identification".equalsIgnoreCase(str)) {
                    Y0(readableMap);
                }
            }
        } catch (Exception e) {
            in.hopscotch.android.util.g.b(e);
        }
    }
}