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


package bu;

import ai.clova.cic.clientlib.api.ClovaEnvironment;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Message;
import android.text.InputFilter;
import android.view.View;
import android.webkit.GeolocationPermissions;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
import android.webkit.PermissionRequest;
import android.webkit.WebView;
import android.widget.FrameLayout;
import com.linecorp.liff.LiffAppParams;
import com.linecorp.liff.LiffFragment;
import com.linecorp.liff.remote.LiffView;
import com.linecorp.liff.view.SwipeDismissLayout;
import dm3.l;
import em3.k0;
import em3.n;
import em3.q;
import em3.s;
import java.util.Objects;
import jp.naver.line.android.R;
import jt.a0;
import jt.d0;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import ok.j;
import ot.e;
import ot.i;
import rt.c;
import rt.f;
import um3.g;
import vd3.a;

public final class r implements k0 {

    /* renamed from: a  reason: collision with root package name */
    public final LiffFragment f15152a;

    /* renamed from: b  reason: collision with root package name */
    public final LiffAppParams f15153b;

    /* renamed from: c  reason: collision with root package name */
    public final Lazy<rt.c> f15154c = LazyKt.lazy(new c(this));

    /* renamed from: d  reason: collision with root package name */
    public final i f15155d;

    public static abstract class a {

        /* renamed from: a  reason: collision with root package name */
        public final String f15156a;

        /* renamed from: b  reason: collision with root package name */
        public final String f15157b;

        /* renamed from: c  reason: collision with root package name */
        public final JsResult f15158c;

        /* renamed from: d  reason: collision with root package name */
        public final boolean f15159d;

        /* renamed from: e  reason: collision with root package name */
        public final boolean f15160e;

        /* renamed from: f  reason: collision with root package name */
        public final boolean f15161f;

        /* renamed from: bu.r$a$a  reason: collision with other inner class name */
        public static final class C0288a extends a {
            public C0288a(String str, String str2, JsResult jsResult, boolean z14) {
                super(str, str2, jsResult, z14, false, false, null);
            }
        }

        public static final class b extends a {
            public b(String str, String str2, JsResult jsResult, boolean z14) {
                super(str, str2, jsResult, z14, true, false, null);
            }
        }

        public static final class c extends a {

            /* renamed from: g  reason: collision with root package name */
            public final String f15162g;

            public c(String str, String str2, JsPromptResult jsPromptResult, boolean z14, String str3) {
                super(str, str2, jsPromptResult, z14, true, true, null);
                this.f15162g = str3;
            }
        }

        public a(String str, String str2, JsResult jsResult, boolean z14, boolean z15, boolean z16, DefaultConstructorMarker defaultConstructorMarker) {
            this.f15156a = str;
            this.f15157b = str2;
            this.f15158c = jsResult;
            this.f15159d = z14;
            this.f15160e = z15;
            this.f15161f = z16;
        }
    }

    public /* synthetic */ class b extends n implements l<String, Unit> {
        public b(Object obj) {
            super(1, obj, r.class, "handleRetrievedUrl", "handleRetrievedUrl(Ljava/lang/String;)V", 0);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        /* JADX WARNING: Removed duplicated region for block: B:33:0x007c  */
        @Override // dm3.l
        public Unit invoke(String str) {
            Uri parse;
            String str2 = str;
            q.f(str2, "p0");
            androidx.fragment.app.n activity = ((r) this.receiver).f15152a.getActivity();
            if (!(activity == null || (parse = Uri.parse(str2)) == null)) {
                ActivityInfo activityInfo = null;
                String queryParameter = parse.isHierarchical() ? parse.getQueryParameter("is_liff_external_open_window") : null;
                boolean z14 = true;
                if ((queryParameter == null || !q.b(queryParameter, ClovaEnvironment.TRUE)) ? true : true) {
                    try {
                        ResolveInfo resolveActivity = activity.getPackageManager().resolveActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://www.wikipedia.org")), 0);
                        if (resolveActivity != null) {
                            activityInfo = resolveActivity.activityInfo;
                        }
                        if (activityInfo != null) {
                            if (activityInfo.exported) {
                                Intent intent = new Intent("android.intent.action.VIEW", parse);
                                intent.setPackage(activityInfo.applicationInfo.packageName);
                                intent.setFlags(268435456);
                                activity.startActivity(intent);
                                if (!z14) {
                                    try {
                                        Intent intent2 = new Intent("android.intent.action.VIEW", parse);
                                        intent2.setPackage("com.android.chrome");
                                        intent2.setFlags(268435456);
                                        activity.startActivity(intent2);
                                    } catch (Exception unused) {
                                    }
                                }
                            }
                        }
                    } catch (Exception unused2) {
                    }
                    z14 = false;
                    if (!z14) {
                    }
                } else {
                    ((d0) rb.a.d(activity, d0.f98923a)).a(activity, parse, true);
                }
            }
            return Unit.INSTANCE;
        }
    }

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

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

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public c(r rVar) {
            super(0);
            this.f15163b = rVar;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // dm3.a
        public rt.c invoke() {
            return new rt.c(this.f15163b.f15152a);
        }
    }

    public r(LiffFragment liffFragment, LiffAppParams liffAppParams) {
        this.f15152a = liffFragment;
        this.f15153b = liffAppParams;
        this.f15155d = new i(liffFragment, liffAppParams, null, 4);
    }

    @Override // bu.k0
    public boolean a() {
        Dialog dialog = this.f15155d.f124654e;
        if (dialog == null) {
            return true;
        }
        dialog.cancel();
        Unit unit = Unit.INSTANCE;
        return true;
    }

    @Override // bu.k0
    public boolean b(WebView webView, String str, String str2, String str3, JsPromptResult jsPromptResult) {
        LiffView liffView = this.f15153b.f33266i;
        return l(new a.c(str, str2, jsPromptResult, liffView != null && liffView.f33390c, str3), webView);
    }

    @Override // bu.k0
    public boolean c(WebView webView, String str, String str2, JsResult jsResult) {
        LiffView liffView = this.f15153b.f33266i;
        boolean z14 = true;
        if (liffView == null || !liffView.f33390c) {
            z14 = false;
        }
        return l(new a.C0288a(str, str2, jsResult, z14), webView);
    }

    @Override // bu.k0
    public boolean d(View view) {
        LiffFragment liffFragment = this.f15152a;
        Objects.requireNonNull(liffFragment);
        et.b bVar = liffFragment.f33294e;
        if (bVar == null) {
            return true;
        }
        FrameLayout frameLayout = bVar.f69407f;
        q.e(frameLayout, "binding.liffFullScreenView");
        if (frameLayout.getChildCount() > 0) {
            return true;
        }
        frameLayout.setSystemUiVisibility(5894);
        frameLayout.addView(view);
        frameLayout.setVisibility(0);
        SwipeDismissLayout swipeDismissLayout = bVar.f69414m;
        q.e(swipeDismissLayout, "binding.swipeDismissContainer");
        swipeDismissLayout.setVisibility(8);
        return true;
    }

    @Override // bu.k0
    public boolean e(WebView webView, String str, String str2, JsResult jsResult) {
        LiffView liffView = this.f15153b.f33266i;
        boolean z14 = true;
        if (liffView == null || !liffView.f33390c) {
            z14 = false;
        }
        return l(new a.b(str, str2, jsResult, z14), webView);
    }

    @Override // bu.k0
    public boolean f(WebView webView, i0 i0Var, j0 j0Var) {
        return false;
    }

    @Override // bu.k0
    public boolean g(String str, GeolocationPermissions.Callback callback) {
        i iVar = this.f15155d;
        Objects.requireNonNull(iVar);
        Context context = iVar.f124650a.getContext();
        if (context == null) {
            return true;
        }
        g.d(iVar.f124652c, null, 0, new e((a0) rb.a.d(context, a0.f98917q1), iVar, str, callback, null), 3, null);
        return true;
    }

    /* JADX WARNING: Removed duplicated region for block: B:42:0x00d6  */
    @Override // bu.k0
    public boolean h(PermissionRequest permissionRequest) {
        boolean z14;
        String str;
        Integer num;
        rt.c value = this.f15154c.getValue();
        Objects.requireNonNull(value);
        int i14 = f.a.$EnumSwitchMapping$0[j.q.e(f.a(permissionRequest))];
        if (i14 == 1 || i14 == 2 || i14 == 3) {
            z14 = true;
        } else if (i14 == 4) {
            z14 = false;
        } else {
            throw new NoWhenBranchMatchedException();
        }
        if (z14) {
            Dialog dialog = value.f140194c;
            if (dialog != null) {
                dialog.cancel();
            }
            c.a aVar = value.f140195d.get(permissionRequest.getOrigin());
            int i15 = aVar == null ? -1 : c.b.$EnumSwitchMapping$0[aVar.ordinal()];
            vd3.a aVar2 = null;
            if (i15 == -1) {
                Context context = value.f140192a.getContext();
                if (context != null) {
                    a.b bVar = new a.b(context);
                    String host = permissionRequest.getOrigin().getHost();
                    if (host != null) {
                        int i16 = c.b.$EnumSwitchMapping$1[j.q.e(f.a(permissionRequest))];
                        if (i16 == 1) {
                            num = Integer.valueOf((int) R.string.liff_webrtc_camera_request_description);
                        } else if (i16 == 2) {
                            num = Integer.valueOf((int) R.string.liff_webrtc_microphone_request_description);
                        } else if (i16 == 3) {
                            num = Integer.valueOf((int) R.string.liff_webrtc_camera_and_microphone_request_description);
                        } else if (i16 == 4) {
                            num = null;
                        } else {
                            throw new NoWhenBranchMatchedException();
                        }
                        if (num != null) {
                            str = context.getResources().getString(num.intValue(), host);
                            if (str != null) {
                                bVar.f171168d = str;
                                bVar.f(R.string.liff_webrtc_permission_request_allow, new rt.b(value, permissionRequest, 0));
                                bVar.e(R.string.liff_webrtc_permission_request_deny, new rt.a(value, permissionRequest, 0));
                                bVar.f171185u = false;
                                aVar2 = bVar.a();
                            }
                        }
                    }
                    str = null;
                    if (str != null) {
                    }
                }
                value.f140194c = aVar2;
                if (aVar2 != null) {
                    aVar2.show();
                } else {
                    permissionRequest.deny();
                }
            } else if (i15 == 1) {
                g.d(value.f140193b, null, 0, new rt.e(value, permissionRequest, null), 3, null);
            } else if (i15 == 2) {
                permissionRequest.deny();
            }
        } else {
            permissionRequest.deny();
        }
        return true;
    }

    @Override // bu.k0
    public boolean i() {
        et.b bVar = this.f15152a.f33294e;
        if (bVar == null) {
            return true;
        }
        FrameLayout frameLayout = bVar.f69407f;
        q.e(frameLayout, "binding.liffFullScreenView");
        if (frameLayout.getChildCount() == 0) {
            return true;
        }
        frameLayout.setVisibility(8);
        frameLayout.removeAllViews();
        frameLayout.setSystemUiVisibility(0);
        SwipeDismissLayout swipeDismissLayout = bVar.f69414m;
        q.e(swipeDismissLayout, "binding.swipeDismissContainer");
        swipeDismissLayout.setVisibility(0);
        return true;
    }

    @Override // bu.k0
    public boolean j(WebView webView, boolean z14, boolean z15, Message message) {
        if (!z15) {
            return false;
        }
        webView.requestFocusNodeHref(new q0(webView, message, new b(this), null).obtainMessage());
        return true;
    }

    @Override // bu.k0
    public boolean k(PermissionRequest permissionRequest) {
        Dialog dialog = this.f15154c.getValue().f140194c;
        if (dialog == null) {
            return true;
        }
        dialog.cancel();
        return true;
    }

    public final boolean l(a aVar, WebView webView) {
        Context context = webView != null ? webView.getContext() : null;
        if (context == null) {
            return false;
        }
        a.b bVar = new a.b(context);
        if (!aVar.f15159d) {
            bVar.f171166b = aVar.f15156a;
        }
        bVar.f171168d = aVar.f15157b;
        bVar.f171185u = true;
        bVar.f171187w = new n(aVar, 0);
        bVar.f(R.string.confirm, new p(aVar, 0));
        if (aVar.f15160e) {
            bVar.e(R.string.cancel, new j(aVar, 1));
        }
        if (aVar.f15161f) {
            a.c cVar = (a.c) aVar;
            k0 k0Var = new k0();
            s sVar = new s(k0Var);
            bVar.f171179o = cVar.f15162g;
            bVar.f171180p = "";
            bVar.f171181q = sVar;
            bVar.f171182r = 1;
            bVar.f171183s = new InputFilter[0];
            bVar.f(R.string.confirm, new q(cVar, k0Var));
            bVar.e(R.string.cancel, new o(cVar, 0));
        }
        bVar.k();
        return true;
    }
}