LINE.apk(点击下载) / PortalSearchActivity.java


package jp.naver.line.android.bridgejs;

import a1.e;
import a1.i;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import androidx.fragment.app.u;
import b2.b;
import com.linecorp.line.share.common.model.ChosenChat;
import em3.q;
import em3.s;
import io.jsonwebtoken.JwtParser;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Objects;
import java.util.Set;
import jp.naver.line.android.R;
import jp.naver.line.android.bridgejs.portalsearch.PortalSearchVoiceData;
import jp.naver.line.android.bridgejs.portalsearch.keyword.SearchBarKeywordData;
import kotlin.Lazy;
import kotlin.Metadata;
import mc3.j0;
import mc3.n0;
import mc3.p0;
import mc3.s0;
import mc3.y0;
import mc3.z0;
import n7.h;
import nc3.i0;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import r13.c;
import u3.a0;
import zg1.d;
import zi1.g;
import zi1.n;

@Metadata(bv = {}, d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Ljp/naver/line/android/bridgejs/PortalSearchActivity;", "Lr13/c;", "<init>", "()V", "app_productionRelease"}, k = 1, mv = {1, 6, 0})
public final class PortalSearchActivity extends c {

    /* renamed from: u  reason: collision with root package name */
    public static final PortalSearchActivity f96775u = null;

    /* renamed from: v  reason: collision with root package name */
    public static final Set<String> f96776v = h.o(i0.HOME.d(), i0.FRIEND.d(), i0.CHAT.d());

    /* renamed from: j  reason: collision with root package name */
    public String f96777j;

    /* renamed from: k  reason: collision with root package name */
    public final Lazy f96778k = jp.naver.line.android.util.b.b(this, R.id.portal_search_web_app_view, null, 2);

    /* renamed from: l  reason: collision with root package name */
    public final Lazy f96779l = jp.naver.line.android.util.b.b(this, R.id.webview_RES_2131372356, null, 2);

    /* renamed from: m  reason: collision with root package name */
    public final Lazy f96780m = u.e(this, n.f199365z3);

    /* renamed from: n  reason: collision with root package name */
    public String f96781n;

    /* renamed from: o  reason: collision with root package name */
    public n0 f96782o;

    /* renamed from: p  reason: collision with root package name */
    public final Lazy f96783p = jp.naver.line.android.util.b.b(this, R.id.portal_search_header_view, null, 2);

    /* renamed from: q  reason: collision with root package name */
    public p0 f96784q;

    /* renamed from: r  reason: collision with root package name */
    public s0 f96785r;

    /* renamed from: s  reason: collision with root package name */
    public y0 f96786s;

    /* renamed from: t  reason: collision with root package name */
    public boolean f96787t;

    public static final class a extends s implements dm3.a<String> {

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ PortalSearchActivity f96788b;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public a(PortalSearchActivity portalSearchActivity) {
            super(0);
            this.f96788b = portalSearchActivity;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // dm3.a
        public String invoke() {
            PortalSearchActivity portalSearchActivity = this.f96788b;
            PortalSearchActivity portalSearchActivity2 = PortalSearchActivity.f96775u;
            String url = portalSearchActivity.z8().getUrl();
            return url == null ? "" : url;
        }
    }

    public static final class b implements rc3.a {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ PortalSearchActivity f96789a;

        public b(PortalSearchActivity portalSearchActivity) {
            this.f96789a = portalSearchActivity;
        }

        @Override // rc3.a
        public void a() {
        }

        @Override // rc3.a
        public void b() {
            this.f96789a.finish();
        }
    }

    public final n A8() {
        return (n) this.f96780m.getValue();
    }

    @Override // androidx.activity.ComponentActivity, androidx.fragment.app.n
    public void onActivityResult(int i14, int i15, Intent intent) {
        super.onActivityResult(i14, i15, intent);
        if (i14 == 1000) {
            s0 s0Var = this.f96785r;
            if (s0Var != null) {
                ((qa0.h) s0Var.f111764l.getValue()).a(s0Var.f111754b, i15, intent);
            } else {
                q.l("portalSearchHeaderViewController");
                throw null;
            }
        } else if (i14 == 1421) {
            p0 p0Var = this.f96784q;
            if (p0Var != null) {
                j0 j0Var = p0Var.f111722i;
                Objects.requireNonNull(j0Var);
                if (i14 == 1421) {
                    if (i15 == -1) {
                        j0Var.f(true);
                    } else if (i15 == 0) {
                        j0Var.f(false);
                    }
                }
            } else {
                q.l("portalSearchBridgeJsViewController");
                throw null;
            }
        } else if (i14 == 5000) {
            y0 y0Var = this.f96786s;
            if (y0Var != null) {
                qc3.a aVar = y0Var.f111804i;
                if (aVar.a()) {
                    ArrayList<ChosenChat> parcelableArrayListExtra = (i14 == 5000 && i15 == -1 && intent != null) ? intent.getParcelableArrayListExtra("EXTRA_CHOSEN_CHATS") : null;
                    if (!(parcelableArrayListExtra == null || parcelableArrayListExtra.isEmpty())) {
                        String str = aVar.f132253d;
                        String str2 = aVar.f132254e;
                        q.f(str, "callbackId");
                        q.f(str2, "requestType");
                        q.f(parcelableArrayListExtra, "resultList");
                        Objects.requireNonNull(aVar.f132252c);
                        JSONObject jSONObject = new JSONObject();
                        JSONArray jSONArray = new JSONArray();
                        for (ChosenChat chosenChat : parcelableArrayListExtra) {
                            JSONObject jSONObject2 = new JSONObject();
                            try {
                                jSONObject2.put(zq0.c.QUERY_KEY_MID, chosenChat.f42235b);
                            } catch (JSONException unused) {
                            }
                            try {
                                jSONObject2.put("name", chosenChat.f42236c);
                            } catch (JSONException unused2) {
                            }
                            String str3 = chosenChat.f42237d;
                            if (!(str3 == null || str3.length() == 0)) {
                                try {
                                    jSONObject2.put("squareId", str3);
                                } catch (JSONException unused3) {
                                }
                            }
                            jSONArray.put(jSONObject2);
                        }
                        try {
                            jSONObject.put("shareTargetList", jSONArray);
                        } catch (JSONException unused4) {
                        }
                        aVar.f132251b.k(str2, str, null, jSONObject);
                    }
                }
                aVar.f132253d = "";
                aVar.f132254e = "";
                return;
            }
            q.l("portalSearchWebToAppRequestHandler");
            throw null;
        }
    }

    @Override // androidx.activity.ComponentActivity, r13.c, od3.d
    public void onBackPressed() {
        p0 p0Var = this.f96784q;
        if (p0Var == null) {
            q.l("portalSearchBridgeJsViewController");
            throw null;
        } else if (!p0Var.h()) {
            finish();
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:69:0x01ab, code lost:
        if (r0 == null) goto L_0x01eb;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:89:0x01e9, code lost:
        if (r0 == null) goto L_0x01eb;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:90:0x01eb, code lost:
        r23 = "";
        r0 = r23;
     */
    /* JADX WARNING: Removed duplicated region for block: B:110:0x0281  */
    /* JADX WARNING: Removed duplicated region for block: B:150:0x0354  */
    /* JADX WARNING: Removed duplicated region for block: B:39:0x0120  */
    @Override // androidx.activity.ComponentActivity, a2.f, r13.c, androidx.fragment.app.n, od3.d
    public void onCreate(Bundle bundle) {
        SearchBarKeywordData.Keyword keyword;
        String str;
        PortalSearchVoiceData portalSearchVoiceData;
        String str2;
        String str3;
        String str4;
        String str5;
        String str6;
        String str7;
        String str8;
        String str9;
        String str10;
        String str11;
        boolean z14;
        super.onCreate(bundle);
        n.c w14 = A8().w();
        n.c cVar = n.c.DARK;
        boolean z15 = true;
        if (w14 == cVar) {
            fe3.a.e(this, null, 1);
        } else {
            Object obj = b2.b.f10850a;
            fe3.a.a(this, b.d.a(this, R.color.unified_search_header_bg));
            getWindow().getDecorView().setSystemUiVisibility(8192);
        }
        getWindow().setSoftInputMode(32);
        LayoutInflater layoutInflater = getLayoutInflater();
        q.e(layoutInflater, "layoutInflater");
        View inflate = com.android.billingclient.api.i0.b(layoutInflater).inflate(R.layout.unified_search_activity, (ViewGroup) null);
        q.e(inflate, "supportLibraryLayoutInfl…ed_search_activity, null)");
        setContentView(inflate);
        if (A8().w() == cVar) {
            n A8 = A8();
            g[] gVarArr = rj3.j0.f138409a;
            zi1.c cVar2 = A8.q((g[]) Arrays.copyOf(gVarArr, gVarArr.length)).f199359c;
            if (cVar2 != null) {
                ((View) this.f96778k.getValue()).setBackgroundColor(cVar2.e());
                z8().setBackgroundColor(cVar2.e());
            }
        }
        String stringExtra = getIntent().getStringExtra("ENCODED_QUERY_STRING");
        if (stringExtra == null) {
            stringExtra = "";
        }
        this.f96777j = stringExtra;
        String stringExtra2 = getIntent().getStringExtra("searchType");
        if (stringExtra2 == null) {
            stringExtra2 = "";
        }
        this.f96781n = stringExtra2;
        SearchBarKeywordData.Keyword keyword2 = (SearchBarKeywordData.Keyword) getIntent().getParcelableExtra("searchBarWordInfo");
        SearchBarKeywordData.Keyword keyword3 = (SearchBarKeywordData.Keyword) getIntent().getParcelableExtra("SEARCH_BAR_BACKGROUND_KEYWORD_INFO");
        PortalSearchVoiceData portalSearchVoiceData2 = (PortalSearchVoiceData) getIntent().getParcelableExtra("QUERY_VOICE_SEARCH_DATA");
        String str12 = this.f96781n;
        if (str12 != null) {
            boolean z16 = getResources().getBoolean(R.bool.is_tablet);
            boolean z17 = false;
            boolean z18 = portalSearchVoiceData2 != null;
            boolean z19 = A8().w() == cVar;
            if (keyword2 == null) {
                if (keyword3 != null) {
                    if (!keyword3.s()) {
                        String e14 = keyword3.e();
                        if (e14 == null || e14.length() == 0) {
                            z14 = false;
                            if (z14) {
                                keyword = keyword3;
                            }
                        }
                    }
                    z14 = true;
                    if (z14) {
                    }
                }
                keyword = null;
            } else {
                keyword = keyword2;
            }
            this.f96782o = new n0(z8(), new mc3.a(str12, z16, z18, z19, keyword, null, 32), portalSearchVoiceData2);
            iy0.h hVar = (iy0.h) rb.a.d(this, iy0.h.X0);
            String c14 = hVar.c();
            String b14 = hVar.b();
            View view = (View) this.f96778k.getValue();
            WebView z84 = z8();
            n0 n0Var = this.f96782o;
            if (n0Var != null) {
                if (keyword3 != null) {
                    if (keyword3.s()) {
                        str8 = keyword3.f();
                        if (str8 == null) {
                            str8 = "";
                        }
                        str7 = keyword3.o();
                        if (str7 == null) {
                            str7 = "";
                        }
                    } else {
                        String e15 = keyword3.e();
                        if (!(e15 == null || e15.length() == 0)) {
                            z15 = false;
                        }
                        if (z15) {
                            str11 = this.f96777j;
                            if (str11 == null) {
                                q.l("initEncodedQueryString");
                                throw null;
                            }
                            str4 = str11;
                            str = "";
                            str2 = "searchType";
                            portalSearchVoiceData = portalSearchVoiceData2;
                            str3 = "portalSearchAppToWebRequestHandler";
                            this.f96784q = new p0(view, this, z84, n0Var, str4, c14, b14);
                            str5 = this.f96777j;
                            if (str5 == null) {
                                String queryParameter = Uri.parse("https://dummy.line.me?" + str5).getQueryParameter("q");
                                String str13 = queryParameter == null ? str : queryParameter;
                                View view2 = (View) this.f96783p.getValue();
                                p0 p0Var = this.f96784q;
                                if (p0Var != null) {
                                    Set<String> set = f96776v;
                                    String str14 = this.f96781n;
                                    if (str14 != null) {
                                        s0 s0Var = new s0(view2, this, this, p0Var, set.contains(str14), false, new a(this), 32);
                                        s0Var.e(str13);
                                        this.f96785r = s0Var;
                                        new Handler(Looper.getMainLooper()).post(new a0(this, 10));
                                        if (this.f96781n != null) {
                                            WebView z85 = z8();
                                            p0 p0Var2 = this.f96784q;
                                            if (p0Var2 != null) {
                                                n0 n0Var2 = this.f96782o;
                                                if (n0Var2 != null) {
                                                    s0 s0Var2 = this.f96785r;
                                                    if (s0Var2 != null) {
                                                        this.f96786s = new y0(z85, p0Var2, this, c14, n0Var2, s0Var2, new b(this), this, ((d) rb.a.d(this, d.f199206w3)).l());
                                                        if ((str13.length() > 0) || ((keyword2 != null && keyword2.b()) || portalSearchVoiceData != null)) {
                                                            z17 = true;
                                                        }
                                                        this.f96787t = z17;
                                                        return;
                                                    }
                                                    q.l("portalSearchHeaderViewController");
                                                    throw null;
                                                }
                                                q.l(str3);
                                                throw null;
                                            }
                                            q.l("portalSearchBridgeJsViewController");
                                            throw null;
                                        }
                                        q.l(str2);
                                        throw null;
                                    }
                                    q.l(str2);
                                    throw null;
                                }
                                q.l("portalSearchBridgeJsViewController");
                                throw null;
                            }
                            q.l("initEncodedQueryString");
                            throw null;
                        }
                        str7 = keyword3.e();
                        str8 = "";
                    }
                    str6 = xt.c.a(JwtParser.SEPARATOR_CHAR, str7);
                    Long i14 = keyword3.i();
                    str9 = i14 != null ? i14.toString() : null;
                } else if (keyword2 == null) {
                    str11 = this.f96777j;
                    if (str11 == null) {
                        q.l("initEncodedQueryString");
                        throw null;
                    }
                    str4 = str11;
                    str = "";
                    str2 = "searchType";
                    portalSearchVoiceData = portalSearchVoiceData2;
                    str3 = "portalSearchAppToWebRequestHandler";
                    this.f96784q = new p0(view, this, z84, n0Var, str4, c14, b14);
                    str5 = this.f96777j;
                    if (str5 == null) {
                    }
                } else {
                    String f14 = keyword2.f();
                    if (f14 == null) {
                        str8 = "";
                    } else {
                        str8 = f14;
                    }
                    String o14 = keyword2.o();
                    if (o14 == null) {
                        str7 = "";
                    } else {
                        str7 = o14;
                    }
                    str6 = xt.c.a(JwtParser.SEPARATOR_CHAR, str7);
                    Long i15 = keyword2.i();
                    str9 = i15 != null ? i15.toString() : null;
                }
                str = "";
                String str15 = this.f96781n;
                if (str15 != null) {
                    str2 = "searchType";
                    str3 = "portalSearchAppToWebRequestHandler";
                    if (q.b(str15, i0.HOME.d())) {
                        StringBuilder a14 = i.a("sm=hmn_rkw", str6, "&utm_source=line_home&utm_medium=rkw&utm_campaign=", str9, "&utm_content=");
                        a14.append(str7);
                        str10 = a14.toString();
                    } else if (q.b(str15, i0.CHAT.d())) {
                        StringBuilder a15 = i.a("sm=cmn_rkw", str6, "&utm_source=line_chat&utm_medium=rkw&utm_campaign=", str9, "&utm_content=");
                        a15.append(str7);
                        str10 = a15.toString();
                    } else {
                        if (q.b(str15, i0.NEWS.d())) {
                            portalSearchVoiceData = portalSearchVoiceData2;
                            str10 = e.a(i.a("q=", str8, "&sm=nmn_rkw", str6, "&utm_source=line_news&utm_medium=rkw&utm_campaign="), str9, "&utm_content=", str7);
                        } else {
                            portalSearchVoiceData = portalSearchVoiceData2;
                            if (q.b(str15, i0.TIMELINE_DISCOVER.d())) {
                                StringBuilder a16 = i.a("sm=dmn_rkw", str6, "&utm_source=line_discover&utm_medium=rkw&utm_campaign=", str9, "&utm_content=");
                                a16.append(str7);
                                str10 = a16.toString();
                            } else {
                                str10 = str;
                            }
                        }
                        str4 = str10;
                        this.f96784q = new p0(view, this, z84, n0Var, str4, c14, b14);
                        str5 = this.f96777j;
                        if (str5 == null) {
                        }
                    }
                    portalSearchVoiceData = portalSearchVoiceData2;
                    str4 = str10;
                    this.f96784q = new p0(view, this, z84, n0Var, str4, c14, b14);
                    str5 = this.f96777j;
                    if (str5 == null) {
                    }
                } else {
                    q.l("searchType");
                    throw null;
                }
            } else {
                q.l("portalSearchAppToWebRequestHandler");
                throw null;
            }
        } else {
            q.l("searchType");
            throw null;
        }
    }

    @Override // r13.c, androidx.appcompat.app.g, androidx.fragment.app.n
    public void onDestroy() {
        s0 s0Var = this.f96785r;
        if (s0Var != null) {
            s0Var.a(((i82.s0) i82.s0.f85651i.a(this)).c());
            p0 p0Var = this.f96784q;
            if (p0Var != null) {
                p0Var.j();
                y0 y0Var = this.f96786s;
                if (y0Var != null) {
                    y0Var.f111806k.f117212f.dispose();
                    y0Var.f111807l.f117108h.dispose();
                    y0Var.f111805j.f117190h.e();
                    super.onDestroy();
                    return;
                }
                q.l("portalSearchWebToAppRequestHandler");
                throw null;
            }
            q.l("portalSearchBridgeJsViewController");
            throw null;
        }
        q.l("portalSearchHeaderViewController");
        throw null;
    }

    @Override // androidx.fragment.app.n
    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        String stringExtra = intent != null ? intent.getStringExtra("ENCODED_QUERY_STRING") : null;
        String str = "";
        if (stringExtra == null) {
            stringExtra = str;
        }
        Uri parse = Uri.parse("https://dummy.line.me?" + stringExtra);
        p0 p0Var = this.f96784q;
        if (p0Var != null) {
            String queryParameter = parse.getQueryParameter("q");
            if (queryParameter != null) {
                str = queryParameter;
            }
            p0Var.n(3, str, stringExtra);
            return;
        }
        q.l("portalSearchBridgeJsViewController");
        throw null;
    }

    @Override // r13.c, androidx.fragment.app.n, od3.d
    public void onPause() {
        p0 p0Var = this.f96784q;
        if (p0Var != null) {
            z0 z0Var = p0Var.f111741q;
            z0Var.f111624c.f111667e = false;
            z0Var.f111622a.onPause();
            super.onPause();
            return;
        }
        q.l("portalSearchBridgeJsViewController");
        throw null;
    }

    @Override // androidx.activity.ComponentActivity, androidx.fragment.app.n
    public void onRequestPermissionsResult(int i14, String[] strArr, int[] iArr) {
        q.f(strArr, "permissions");
        q.f(iArr, "grantResults");
        super.onRequestPermissionsResult(i14, strArr, iArr);
        p0 p0Var = this.f96784q;
        if (p0Var != null) {
            Objects.requireNonNull(p0Var);
            j0 j0Var = p0Var.f111722i;
            Objects.requireNonNull(j0Var);
            if (i14 == 421) {
                boolean k14 = jp.naver.line.android.util.p0.k(j0Var.f111708e, strArr);
                if (!k14) {
                    wd3.g.a(R.string.permission_error_unable_to_use_feature_RES_2131959606);
                }
                j0Var.f(k14);
                return;
            }
            return;
        }
        q.l("portalSearchBridgeJsViewController");
        throw null;
    }

    @Override // r13.c, androidx.fragment.app.n, od3.d
    public void onResume() {
        super.onResume();
        if (!this.f96787t) {
            s0 s0Var = this.f96785r;
            if (s0Var != null) {
                s0Var.g();
            } else {
                q.l("portalSearchHeaderViewController");
                throw null;
            }
        }
        p0 p0Var = this.f96784q;
        if (p0Var != null) {
            p0Var.o();
        } else {
            q.l("portalSearchBridgeJsViewController");
            throw null;
        }
    }

    @Override // r13.c, androidx.appcompat.app.g, androidx.fragment.app.n
    public void onStop() {
        p0 p0Var = this.f96784q;
        if (p0Var != null) {
            p0Var.p();
            super.onStop();
            return;
        }
        q.l("portalSearchBridgeJsViewController");
        throw null;
    }

    public final WebView z8() {
        return (WebView) this.f96779l.getValue();
    }
}