package com.ss.android.ugc.aweme.shoutouts.review;

import X.46i;
import X.8gF;
import X.KDD;
import X.KDE;
import X.KDF;
import X.SNU;
import android.content.Intent;
import android.os.Bundle;
import android.util.SparseArray;
import android.view.View;
import com.bytedance.apm.agent.v2.instrumentation.ActivityAgent;
import com.bytedance.common.utility.collection.WeakHandler;
import com.bytedance.covode.number.Covode;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;
import com.ss.android.ugc.aweme.shoutouts.model.StandardMoney;
import kotlin.o.y;

public final class ShoutoutsRedirectActivity extends SNU implements WeakHandler.IHandler {
    public static final KDF LIZJ = new KDF((byte) 0);
    public int LIZ = -1;
    public int LIZIZ = -1;
    public int LIZLLL = -1;
    public int LJ = -1;
    public String LJFF;
    public final WeakHandler LJI = new WeakHandler(this);
    public SparseArray LJII;

    static {
        Covode.recordClassIndex(114284);
    }

    public final void _$_clearFindViewByIdCache() {
        SparseArray sparseArray = this.LJII;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public final View _$_findCachedViewById(int i) {
        if (this.LJII == null) {
            this.LJII = new SparseArray();
        }
        View view = (View) this.LJII.get(i);
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        this.LJII.put(i, findViewById);
        return findViewById;
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.shoutouts.review.ShoutoutsRedirectActivity, X.SNU, android.app.Activity] */
    public final void onDestroy() {
        8gF.LJ(this);
        ShoutoutsRedirectActivity.super.onDestroy();
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.shoutouts.review.ShoutoutsRedirectActivity, X.SNU, android.app.Activity] */
    public final void onPause() {
        8gF.LIZJ(this);
        ShoutoutsRedirectActivity.super.onPause();
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [com.ss.android.ugc.aweme.shoutouts.review.ShoutoutsRedirectActivity, X.SNU, android.app.Activity] */
    public final void onResume() {
        8gF.LIZIZ(this);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.shoutouts.review.ShoutoutsRedirectActivity", "onResume", true);
        ShoutoutsRedirectActivity.super.onResume();
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.shoutouts.review.ShoutoutsRedirectActivity", "onResume", false);
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.shoutouts.review.ShoutoutsRedirectActivity, X.SNU, android.app.Activity] */
    public final void onStart() {
        8gF.LIZ(this);
        ShoutoutsRedirectActivity.super.onStart();
    }

    public final void onWindowFocusChanged(boolean z) {
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.shoutouts.review.ShoutoutsRedirectActivity", "onWindowFocusChanged", true);
        ShoutoutsRedirectActivity.super.onWindowFocusChanged(z);
    }

    public final void finish() {
        ShoutoutsRedirectActivity.super.finish();
        overridePendingTransition(0, 0);
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.ss.android.ugc.aweme.shoutouts.review.ShoutoutsRedirectActivity, X.SNU, android.app.Activity] */
    public final void onStop() {
        8gF.LIZLLL(this);
        ShoutoutsRedirectActivity.super.onStop();
        if (EnterTransitionCrashOptimizer.getContext() != null) {
            try {
                getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
            } catch (Throwable unused) {
            }
        }
        try {
            getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
        } catch (Throwable unused2) {
        }
    }

    public static Bundle LIZ(Intent intent) {
        try {
            return intent.getExtras();
        } catch (Exception unused) {
            return null;
        }
    }

    public final KDE LIZ(StandardMoney standardMoney) {
        KDE kde = new KDE();
        kde.setCurrencyCharacter(standardMoney.getCurrencyCharacter());
        kde.setCurrencyName(standardMoney.getCurrencyName());
        kde.setMoney(standardMoney.getMoney());
        return kde;
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [android.content.Context] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(android.os.Bundle r7) {
        /*
            r6 = this;
            java.lang.String r5 = "https://www.tiktok.com/web-inapp/shoutouts/creator/entry/?hide_nav_bar=1"
            if (r7 == 0) goto L_0x003b
            java.util.Set r0 = r7.keySet()
            if (r0 == 0) goto L_0x003b
            java.util.Iterator r4 = r0.iterator()
        L_0x000e:
            boolean r0 = r4.hasNext()
            if (r0 == 0) goto L_0x003b
            java.lang.Object r3 = r4.next()
            java.lang.String r3 = (java.lang.String) r3
            java.lang.Object r2 = LIZ((android.os.Bundle) r7, (java.lang.String) r3)
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            r1.<init>()
            r1.append(r5)
            r0 = 38
            r1.append(r0)
            r1.append(r3)
            r0 = 61
            r1.append(r0)
            r1.append(r2)
            java.lang.String r5 = r1.toString()
            goto L_0x000e
        L_0x003b:
            X.3wy r1 = X.3wy.LIZ
            r0 = r6
            r1.LIZIZ(r0, r5)
            r6.finish()
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.shoutouts.review.ShoutoutsRedirectActivity.LIZ(android.os.Bundle):void");
    }

    /* JADX WARNING: type inference failed for: r8v0, types: [com.ss.android.ugc.aweme.shoutouts.review.ShoutoutsRedirectActivity, X.1oX, X.SNU, android.app.Activity] */
    public final void onCreate(Bundle bundle) {
        Integer num;
        Integer num2;
        Integer num3;
        String str;
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.shoutouts.review.ShoutoutsRedirectActivity", "onCreate", true);
        activityConfiguration(KDD.LIZ);
        ShoutoutsRedirectActivity.super.onCreate(bundle);
        supportRequestWindowFeature(10);
        setContentView(2131561336);
        String dataString = getIntent().getDataString();
        if (dataString == null || !y.LIZIZ(dataString, "aweme://shoutouts/detail/redirect", false)) {
            Intent intent = getIntent();
            Integer num4 = null;
            if (intent != null) {
                num = Integer.valueOf(intent.getIntExtra("origin_product_status", -1));
            } else {
                num = null;
            }
            this.LIZ = num.intValue();
            Intent intent2 = getIntent();
            if (intent2 != null) {
                num2 = Integer.valueOf(intent2.getIntExtra("origin_enroll_status", -1));
            } else {
                num2 = null;
            }
            this.LIZLLL = num2.intValue();
            Intent intent3 = getIntent();
            if (intent3 != null) {
                num3 = Integer.valueOf(intent3.getIntExtra("origin_order_status", -1));
            } else {
                num3 = null;
            }
            this.LJ = num3.intValue();
            Intent intent4 = getIntent();
            if (intent4 != null) {
                str = LIZ(intent4, "order_id");
            } else {
                str = null;
            }
            this.LJFF = str;
            Intent intent5 = getIntent();
            if (intent5 != null) {
                num4 = Integer.valueOf(intent5.getIntExtra("force_edit", -1));
            }
            int intValue = num4.intValue();
            this.LIZIZ = intValue;
            int i = this.LIZ;
            if (i == 2 || (i == 7 && intValue == 1)) {
                46i.LJFF().queryUser(this.LJI);
            } else {
                LIZ(LIZ(getIntent()));
            }
        } else {
            46i.LJFF().queryUser(this.LJI);
        }
        Intent intent6 = getIntent();
        if (intent6 != null) {
            intent6.getDataString();
        }
        Intent intent7 = getIntent();
        if (intent7 != null) {
            LIZ(intent7);
        }
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.shoutouts.review.ShoutoutsRedirectActivity", "onCreate", false);
    }

    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r7v1, resolved type: java.lang.String} */
    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r7v5, resolved type: android.os.Bundle} */
    /* JADX WARNING: type inference failed for: r7v0 */
    /* JADX WARNING: type inference failed for: r2v1, types: [android.content.Context, java.lang.Object] */
    /* JADX WARNING: type inference failed for: r1v9, types: [android.content.Context] */
    /* JADX WARNING: type inference failed for: r7v7 */
    /* JADX WARNING: type inference failed for: r7v10 */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void handleMsg(android.os.Message r9) {
        /*
            r8 = this;
            java.lang.String r5 = ""
            if (r9 == 0) goto L_0x0010
            int r1 = r9.what
            r0 = 112(0x70, float:1.57E-43)
            if (r1 != r0) goto L_0x0010
            java.lang.Object r0 = r9.obj
            boolean r0 = r0 instanceof com.ss.android.ugc.aweme.profile.model.User
            if (r0 != 0) goto L_0x00a6
        L_0x0010:
            com.ss.android.ugc.aweme.IAccountUserService r0 = X.46i.LJFF()
            kotlin.h.b.n.LIZIZ(r0, r5)
            com.ss.android.ugc.aweme.profile.model.User r1 = r0.getCurUser()
        L_0x001b:
            android.content.Intent r0 = r8.getIntent()
            java.lang.String r4 = r0.getDataString()
            r7 = 0
            r3 = 1
            r2 = 0
            if (r4 == 0) goto L_0x0058
            java.lang.String r0 = "aweme://shoutouts/detail/redirect"
            boolean r0 = kotlin.o.y.LIZIZ(r4, r0, r2)
            if (r0 != r3) goto L_0x0058
            if (r1 == 0) goto L_0x00b1
            X.M12.LIZ((java.lang.Object) r1)
            int r0 = r1.shoutoutsStatus
            int r1 = r0 / 100
            r0 = 4
            if (r1 == r0) goto L_0x00b1
            r1 = r8
            java.lang.String r0 = "//shoutouts/detail"
            com.bytedance.router.SmartRoute r1 = com.bytedance.router.SmartRouter.buildRoute(r1, r0)
            android.content.Intent r0 = r8.getIntent()
            if (r0 == 0) goto L_0x004d
            android.os.Bundle r7 = LIZ((android.content.Intent) r0)
        L_0x004d:
            r1.withParam(r7)
            r1.open()
            r8.finish()
            r0 = 0
        L_0x0057:
            return
        L_0x0058:
            if (r1 == 0) goto L_0x009a
            X.M12.LIZ((java.lang.Object) r1)
            int r0 = r1.shoutoutsStatus
            int r1 = r0 % 100
            r0 = 2
            if (r1 == r0) goto L_0x0067
            r0 = 7
            if (r1 != r0) goto L_0x009a
        L_0x0067:
            com.ss.android.ugc.aweme.IAccountUserService r0 = X.46i.LJFF()
            kotlin.h.b.n.LIZIZ(r0, r5)
            java.lang.String r1 = r0.getCurUserId()
            X.KCG r0 = com.ss.android.ugc.aweme.shoutouts.model.ShoutoutsProductApi.LIZ
            com.ss.android.ugc.aweme.shoutouts.model.ShoutoutsProductApi r0 = r0.LIZ()
            X.PgV r1 = r0.getProduct(r1, r7)
            X.PlG r0 = X.PlI.LIZJ
            X.PlG r0 = X.PhE.LIZIZ(r0)
            X.PgV r1 = r1.LIZIZ(r0)
            X.PlG r0 = X.Mk3.LIZ
            X.PlG r0 = X.Mk2.LIZ(r0)
            X.PgV r1 = r1.LIZ(r0)
            X.KDG r0 = new X.KDG
            r0.<init>(r8)
            r1.a_(r0)
            r0 = 0
            goto L_0x0057
        L_0x009a:
            android.content.Intent r0 = r8.getIntent()
            android.os.Bundle r0 = LIZ((android.content.Intent) r0)
            r8.LIZ((android.os.Bundle) r0)
            goto L_0x0057
        L_0x00a6:
            java.lang.Object r1 = r9.obj
            java.lang.String r0 = "null cannot be cast to non-null type com.ss.android.ugc.aweme.profile.model.User"
            java.util.Objects.requireNonNull(r1, r0)
            com.ss.android.ugc.aweme.profile.model.User r1 = (com.ss.android.ugc.aweme.profile.model.User) r1
            goto L_0x001b
        L_0x00b1:
            android.content.Intent r0 = r8.getIntent()
            android.os.Bundle r6 = LIZ((android.content.Intent) r0)
            if (r6 == 0) goto L_0x011c
            java.util.Set r0 = r6.keySet()
            if (r0 == 0) goto L_0x011c
            java.util.Iterator r5 = r0.iterator()
        L_0x00c5:
            boolean r0 = r5.hasNext()
            if (r0 == 0) goto L_0x0107
            java.lang.Object r4 = r5.next()
            java.lang.String r4 = (java.lang.String) r4
            java.lang.Object r3 = LIZ((android.os.Bundle) r6, (java.lang.String) r4)
            r2 = 61
            if (r7 != 0) goto L_0x00ec
            java.lang.StringBuilder r0 = new java.lang.StringBuilder
            r0.<init>()
            r0.append(r4)
            r0.append(r2)
            r0.append(r3)
            java.lang.String r7 = r0.toString()
            goto L_0x00c5
        L_0x00ec:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            r1.<init>()
            r1.append(r7)
            r0 = 38
            r1.append(r0)
            r1.append(r4)
            r1.append(r2)
            r1.append(r3)
            java.lang.String r7 = r1.toString()
            goto L_0x00c5
        L_0x0107:
            if (r7 == 0) goto L_0x011c
            X.3wy r3 = X.3wy.LIZ
            r2 = r8
            X.M12.LIZ((java.lang.Object) r2, (java.lang.Object) r7)
            java.lang.String r1 = java.lang.String.valueOf(r7)
            java.lang.String r0 = "https://www.tiktok.com/web-inapp/shoutouts/creator/entry/?"
            java.lang.String r0 = r0.concat(r1)
            r3.LIZIZ(r2, r0)
        L_0x011c:
            r8.finish()
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.shoutouts.review.ShoutoutsRedirectActivity.handleMsg(android.os.Message):void");
    }

    public static Object LIZ(Bundle bundle, String str) {
        try {
            return bundle.get(str);
        } catch (Exception | OutOfMemoryError unused) {
            return null;
        }
    }

    public static String LIZ(Intent intent, String str) {
        try {
            return intent.getStringExtra(str);
        } catch (Exception unused) {
            return null;
        }
    }
}
