CheetahGram v8.5.4版本的 MD5 值为:3d14e79cc242c314d3933620ff3ab030

以下内容为反编译后的 LaunchActivity.java 源代码,内容仅作参考


package org.telegram.ui;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Shader;
import android.location.LocationManager;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.os.StatFs;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Base64;
import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.m;
import androidx.recyclerview.widget.u;
import co.cheetah.gram.R;
import com.batch.android.localcampaigns.b;
import com.google.android.gms.common.api.Status;
import com.viewbadger.helperlib.NatHelper;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.telegram.Dark.Service.AlarmService;
import org.telegram.messenger.AccountInstance;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.ContactsLoadingObserver;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLoader;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.LocationController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.MessagesStorage;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.PServices;
import org.telegram.messenger.SendMessagesHelper;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.UserObject;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.camera.CameraController;
import org.telegram.messenger.p110.a27;
import org.telegram.messenger.p110.ae5;
import org.telegram.messenger.p110.ah6;
import org.telegram.messenger.p110.az4;
import org.telegram.messenger.p110.b21;
import org.telegram.messenger.p110.b36;
import org.telegram.messenger.p110.b46;
import org.telegram.messenger.p110.c21;
import org.telegram.messenger.p110.cu6;
import org.telegram.messenger.p110.d17;
import org.telegram.messenger.p110.d27;
import org.telegram.messenger.p110.d31;
import org.telegram.messenger.p110.e21;
import org.telegram.messenger.p110.eb5;
import org.telegram.messenger.p110.f27;
import org.telegram.messenger.p110.f47;
import org.telegram.messenger.p110.fx0;
import org.telegram.messenger.p110.g17;
import org.telegram.messenger.p110.g27;
import org.telegram.messenger.p110.g52;
import org.telegram.messenger.p110.ga5;
import org.telegram.messenger.p110.gm;
import org.telegram.messenger.p110.gy4;
import org.telegram.messenger.p110.gz5;
import org.telegram.messenger.p110.h15;
import org.telegram.messenger.p110.h46;
import org.telegram.messenger.p110.hj;
import org.telegram.messenger.p110.hw5;
import org.telegram.messenger.p110.i77;
import org.telegram.messenger.p110.i95;
import org.telegram.messenger.p110.ie5;
import org.telegram.messenger.p110.j27;
import org.telegram.messenger.p110.j46;
import org.telegram.messenger.p110.jg1;
import org.telegram.messenger.p110.jj1;
import org.telegram.messenger.p110.jy4;
import org.telegram.messenger.p110.ke4;
import org.telegram.messenger.p110.lb6;
import org.telegram.messenger.p110.ld5;
import org.telegram.messenger.p110.le5;
import org.telegram.messenger.p110.ln7;
import org.telegram.messenger.p110.lw5;
import org.telegram.messenger.p110.m21;
import org.telegram.messenger.p110.m27;
import org.telegram.messenger.p110.me1;
import org.telegram.messenger.p110.me4;
import org.telegram.messenger.p110.me6;
import org.telegram.messenger.p110.n21;
import org.telegram.messenger.p110.n27;
import org.telegram.messenger.p110.ne6;
import org.telegram.messenger.p110.o17;
import org.telegram.messenger.p110.o26;
import org.telegram.messenger.p110.o9;
import org.telegram.messenger.p110.oa4;
import org.telegram.messenger.p110.oe5;
import org.telegram.messenger.p110.ok;
import org.telegram.messenger.p110.ov5;
import org.telegram.messenger.p110.oy4;
import org.telegram.messenger.p110.pa6;
import org.telegram.messenger.p110.pj;
import org.telegram.messenger.p110.pp3;
import org.telegram.messenger.p110.px5;
import org.telegram.messenger.p110.q05;
import org.telegram.messenger.p110.qw5;
import org.telegram.messenger.p110.r12;
import org.telegram.messenger.p110.r84;
import org.telegram.messenger.p110.ra6;
import org.telegram.messenger.p110.rb5;
import org.telegram.messenger.p110.s52;
import org.telegram.messenger.p110.sa6;
import org.telegram.messenger.p110.tc6;
import org.telegram.messenger.p110.te5;
import org.telegram.messenger.p110.tg5;
import org.telegram.messenger.p110.th5;
import org.telegram.messenger.p110.u26;
import org.telegram.messenger.p110.u95;
import org.telegram.messenger.p110.ut;
import org.telegram.messenger.p110.uw3;
import org.telegram.messenger.p110.uy5;
import org.telegram.messenger.p110.v67;
import org.telegram.messenger.p110.v84;
import org.telegram.messenger.p110.vs7;
import org.telegram.messenger.p110.vx5;
import org.telegram.messenger.p110.w95;
import org.telegram.messenger.p110.wb5;
import org.telegram.messenger.p110.wc5;
import org.telegram.messenger.p110.wn5;
import org.telegram.messenger.p110.wr5;
import org.telegram.messenger.p110.x11;
import org.telegram.messenger.p110.xa4;
import org.telegram.messenger.p110.xe1;
import org.telegram.messenger.p110.xp4;
import org.telegram.messenger.p110.xp5;
import org.telegram.messenger.p110.xq5;
import org.telegram.messenger.p110.xr5;
import org.telegram.messenger.p110.xr7;
import org.telegram.messenger.p110.xw5;
import org.telegram.messenger.p110.yl7;
import org.telegram.messenger.p110.yt4;
import org.telegram.messenger.p110.z57;
import org.telegram.messenger.p110.zq0;
import org.telegram.messenger.voip.VideoCapturerDevice;
import org.telegram.messenger.voip.VoIPPendingCall;
import org.telegram.messenger.voip.VoIPService;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.RequestDelegate;
import org.telegram.ui.ActionBar.ActionBarLayout;
import org.telegram.ui.ActionBar.DrawerLayoutContainer;
import org.telegram.ui.ActionBar.i;
import org.telegram.ui.ActionBar.w;
import org.telegram.ui.Cif;
import org.telegram.ui.Components.PipRoundVideoView;
import org.telegram.ui.Components.RLottieDrawable;
import org.telegram.ui.Components.ThemeEditorView;
import org.telegram.ui.Components.UndoView;
import org.telegram.ui.Components.b;
import org.telegram.ui.Components.c8;
import org.telegram.ui.Components.h6;
import org.telegram.ui.Components.n7;
import org.telegram.ui.Components.r8;
import org.telegram.ui.Components.x0;
import org.telegram.ui.LaunchActivity;
import org.telegram.ui.a;
import org.telegram.ui.d3;
import org.telegram.ui.p3;
import org.telegram.ui.w5;
import org.webrtc.MediaStreamTrack;
import org.webrtc.voiceengine.WebRtcAudioTrack;
import uk.co.chrisjenx.calligraphy.BuildConfig;

public class LaunchActivity extends Activity implements ActionBarLayout.l, NotificationCenter.NotificationCenterDelegate, p3.b1 {
    public static LaunchActivity t0;
    public static ArrayList<org.telegram.ui.ActionBar.k> u0 = new ArrayList<>();
    private static ArrayList<org.telegram.ui.ActionBar.k> v0 = new ArrayList<>();
    private static ArrayList<org.telegram.ui.ActionBar.k> w0 = new ArrayList<>();
    private org.telegram.ui.Components.o7 A;
    private FrameLayout B;
    public DrawerLayoutContainer G;
    public e21 H;
    private pp3 I;
    private v67 J;
    private pj Q;
    private org.telegram.ui.ActionBar.i R;
    private org.telegram.ui.ActionBar.i S;
    public org.telegram.ui.Components.h6 T;
    private oy4 U;
    private FrameLayout V;
    private me4 W;
    private az4 X;
    private TextView Y;
    private FrameLayout Z;
    private boolean a;
    private org.telegram.ui.ActionBar.i a0;
    private String b;
    private boolean b0;
    private String c;
    private HashMap<String, String> c0;
    private ArrayList<SendMessagesHelper.SendingMediaInfo> d;
    private HashMap<String, String> d0;
    private ArrayList<String> e;
    private int e0;
    private ArrayList<Uri> f;
    private Intent f0;
    private Uri g;
    private boolean g0;
    private String h;
    private boolean h0;
    private ArrayList<String> i;
    private boolean i0;
    private ArrayList<f27> j;
    private String j0;
    private Uri k;
    private String k0;
    private int l;
    private d17 l0;
    private ViewTreeObserver.OnGlobalLayoutListener m;
    private w.v m0;
    private ArrayList<Parcelable> n;
    private cu6 n0;
    private ArrayList<String> o;
    private boolean o0;
    private String p;
    private org.telegram.ui.ActionBar.i p0;
    private ActionMode q;
    private Runnable q0;
    private boolean r;
    private androidx.recyclerview.widget.o r0;
    private ImageView s;
    private int s0 = 0;
    private View t;
    private RLottieDrawable u;
    private ActionBarLayout v;
    private ActionBarLayout w;
    private ActionBarLayout x;
    private FrameLayout y;
    private FrameLayout z;

    public class a extends r8.k {
        a(LaunchActivity launchActivity) {
        }

        @Override
        public boolean b() {
            return false;
        }
    }

    public class b extends pj {
        b(Context context) {
            super(context);
        }

        @Override
        public void setVisibility(int i) {
            super.setVisibility(i);
            if (i == 8) {
                LaunchActivity.this.G.q(true, false);
            }
        }
    }

    public class c implements v67.a {
        c() {
        }

        public void c() {
            LaunchActivity.this.J.setVisibility(8);
        }

        @Override
        public void a(int i) {
            UserConfig.getInstance(i).unacceptedTermsOfService = null;
            UserConfig.getInstance(i).saveConfig(false);
            LaunchActivity.this.G.q(true, false);
            if (LaunchActivity.u0.size() > 0) {
                ArrayList<org.telegram.ui.ActionBar.k> arrayList = LaunchActivity.u0;
                arrayList.get(arrayList.size() - 1).M0();
            }
            LaunchActivity.this.J.animate().alpha(0.0f).setDuration(150L).setInterpolator(AndroidUtilities.accelerateInterpolator).withEndAction(new Runnable() {
                @Override
                public final void run() {
                    LaunchActivity.c.this.c();
                }
            }).start();
        }
    }

    public class d extends p3 {
        d(Bundle bundle) {
            super(bundle);
        }

        @Override
        public boolean Wa(p3 p3Var, ArrayList<Long> arrayList, CharSequence charSequence, boolean z) {
            if (LaunchActivity.this.g != null) {
                return false;
            }
            if (LaunchActivity.this.j != null && LaunchActivity.this.j.size() == 1 && !LaunchActivity.u0.isEmpty()) {
                return true;
            }
            if (arrayList.size() <= 1) {
                if (LaunchActivity.this.b != null) {
                    return true;
                }
                if (LaunchActivity.this.d != null && LaunchActivity.this.d.size() > 0) {
                    return true;
                }
            }
            return false;
        }
    }

    public class e implements MessagesController.MessagesLoadedCallback {
        final org.telegram.ui.ActionBar.i a;
        final Bundle b;

        e(org.telegram.ui.ActionBar.i iVar, Bundle bundle) {
            this.a = iVar;
            this.b = bundle;
        }

        @Override
        public void onError() {
            if (!LaunchActivity.this.isFinishing()) {
                org.telegram.ui.Components.b.A4(LaunchActivity.u0.get(r0.size() - 1), LocaleController.getString("JoinToGroupErrorNotExist", R.string.JoinToGroupErrorNotExist));
            }
            try {
                this.a.dismiss();
            } catch (Exception e) {
                FileLog.e(e);
            }
        }

        @Override
        public void onMessagesLoaded(boolean z) {
            try {
                this.a.dismiss();
            } catch (Exception e) {
                FileLog.e(e);
            }
            if (LaunchActivity.this.isFinishing()) {
                return;
            }
            LaunchActivity.this.v.C0(new v0(this.b));
        }
    }

    public class f implements MessagesController.MessagesLoadedCallback {
        final org.telegram.ui.ActionBar.i a;
        final boolean[] b;
        final Bundle c;
        final w95 d;

        f(org.telegram.ui.ActionBar.i iVar, boolean[] zArr, Bundle bundle, w95 w95Var) {
            this.a = iVar;
            this.b = zArr;
            this.c = bundle;
            this.d = w95Var;
        }

        @Override
        public void onError() {
            if (!LaunchActivity.this.isFinishing()) {
                org.telegram.ui.Components.b.A4(LaunchActivity.u0.get(r0.size() - 1), LocaleController.getString("JoinToGroupErrorNotExist", R.string.JoinToGroupErrorNotExist));
            }
            try {
                this.a.dismiss();
            } catch (Exception e) {
                FileLog.e(e);
            }
        }

        @Override
        public void onMessagesLoaded(boolean z) {
            try {
                this.a.dismiss();
            } catch (Exception e) {
                FileLog.e(e);
            }
            if (this.b[0]) {
                return;
            }
            v0 v0Var = new v0(this.c);
            w95 w95Var = this.d;
            if (w95Var instanceof xp5) {
                v0Var.uo(w95Var);
            }
            LaunchActivity.this.v.C0(v0Var);
        }
    }

    public class g extends FrameLayout {
        private Paint a;
        private Matrix b;
        private LinearGradient c;
        private int d;

        g(Context context) {
            super(context);
            this.a = new Paint();
            this.b = new Matrix();
        }

        @Override
        public void draw(Canvas canvas) {
            if (this.c != null) {
                this.a.setColor(-1);
                this.a.setShader(this.c);
                this.c.setLocalMatrix(this.b);
                canvas.drawRect(0.0f, 0.0f, getMeasuredWidth(), getMeasuredHeight(), this.a);
                LaunchActivity.this.W.o(this.c);
                LaunchActivity.this.W.a(canvas);
            }
            super.draw(canvas);
        }

        @Override
        protected void onMeasure(int i, int i2) {
            super.onMeasure(i, i2);
            int size = View.MeasureSpec.getSize(i);
            if (this.d != size) {
                this.c = new LinearGradient(0.0f, 0.0f, size, 0.0f, new int[]{-9846926, -11291731}, new float[]{0.0f, 1.0f}, Shader.TileMode.CLAMP);
                this.d = size;
            }
        }
    }

    public class h extends AnimatorListenerAdapter {
        h() {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            if (LaunchActivity.this.V.getTag() == null) {
                LaunchActivity.this.V.setVisibility(4);
            }
        }
    }

    class i extends AnimatorListenerAdapter {
        final boolean a;
        final ke4 b;

        i(boolean z, ke4 ke4Var) {
            this.a = z;
            this.b = ke4Var;
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            LaunchActivity.this.s.setImageDrawable(null);
            LaunchActivity.this.s.setVisibility(8);
            LaunchActivity.this.t.setVisibility(8);
            NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.themeAccentListUpdated, new Object[0]);
            if (!this.a) {
                this.b.setVisibility(0);
            }
            m21.x = false;
        }
    }

    public class j implements Runnable {
        j() {
        }

        @Override
        public void run() {
            if (LaunchActivity.this.q0 == this) {
                if (AndroidUtilities.needShowPasscode(true)) {
                    if (BuildVars.LOGS_ENABLED) {
                        FileLog.d("lock app");
                    }
                    LaunchActivity.this.H3(true, false, -1, -1, null, null);
                } else if (BuildVars.LOGS_ENABLED) {
                    FileLog.d("didn't pass lock check");
                }
                LaunchActivity.this.q0 = null;
            }
        }
    }

    class k extends ActionBarLayout {
        k(Context context) {
            super(context);
        }

        @Override
        public void setThemeAnimationValue(float f) {
            super.setThemeAnimationValue(f);
            if (ArticleViewer.X2() && ArticleViewer.L2().Z2()) {
                ArticleViewer.L2().w4(f);
            }
            LaunchActivity.this.G.setBehindKeyboardColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
            if (PhotoViewer.W7()) {
                PhotoViewer.L7().nb();
            }
        }
    }

    public class l implements Runnable {
        l() {
        }

        @Override
        public void run() {
            if (LaunchActivity.this.l == 1) {
                org.telegram.messenger.p110.o9.a(o9.f.PROXY_AUTO_SYSTEM, false);
                org.telegram.messenger.p110.o9.a(o9.f.PROXY_SYSTEM_ENABLED, true);
                s52.m(LaunchActivity.this, PServices.class);
                LaunchActivity.this.y3(true);
            }
        }
    }

    class m extends DrawerLayoutContainer {
        m(LaunchActivity launchActivity, Context context) {
            super(context);
        }

        @Override
        protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
            super.onLayout(z, i, i2, i3, i4);
            setDrawerPosition(getDrawerPosition());
        }
    }

    class n extends View {
        n(Context context) {
            super(context);
        }

        @Override
        protected void onDraw(Canvas canvas) {
            if (LaunchActivity.this.u != null) {
                LaunchActivity.this.u.draw(canvas);
                invalidate();
            }
        }
    }

    class o extends RelativeLayout {
        private boolean a;

        o(Context context) {
            super(context);
        }

        @Override
        protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
            int i5 = i3 - i;
            int i6 = i4 - i2;
            if (AndroidUtilities.isInMultiwindow || (AndroidUtilities.isSmallTablet() && getResources().getConfiguration().orientation != 2)) {
                LaunchActivity.this.v.layout(0, 0, LaunchActivity.this.v.getMeasuredWidth(), LaunchActivity.this.v.getMeasuredHeight());
            } else {
                int i7 = (i5 / 100) * 35;
                if (i7 < AndroidUtilities.dp(320.0f)) {
                    i7 = AndroidUtilities.dp(320.0f);
                }
                LaunchActivity.this.z.layout(i7, 0, LaunchActivity.this.z.getMeasuredWidth() + i7, LaunchActivity.this.z.getMeasuredHeight());
                LaunchActivity.this.v.layout(0, 0, LaunchActivity.this.v.getMeasuredWidth(), LaunchActivity.this.v.getMeasuredHeight());
                LaunchActivity.this.x.layout(i7, 0, LaunchActivity.this.x.getMeasuredWidth() + i7, LaunchActivity.this.x.getMeasuredHeight());
            }
            int measuredWidth = (i5 - LaunchActivity.this.w.getMeasuredWidth()) / 2;
            int measuredHeight = (i6 - LaunchActivity.this.w.getMeasuredHeight()) / 2;
            LaunchActivity.this.w.layout(measuredWidth, measuredHeight, LaunchActivity.this.w.getMeasuredWidth() + measuredWidth, LaunchActivity.this.w.getMeasuredHeight() + measuredHeight);
            LaunchActivity.this.A.layout(0, 0, LaunchActivity.this.A.getMeasuredWidth(), LaunchActivity.this.A.getMeasuredHeight());
            LaunchActivity.this.y.layout(0, 0, LaunchActivity.this.y.getMeasuredWidth(), LaunchActivity.this.y.getMeasuredHeight());
        }

        @Override
        protected void onMeasure(int i, int i2) {
            this.a = true;
            int size = View.MeasureSpec.getSize(i);
            int size2 = View.MeasureSpec.getSize(i2);
            setMeasuredDimension(size, size2);
            if (AndroidUtilities.isInMultiwindow || (AndroidUtilities.isSmallTablet() && getResources().getConfiguration().orientation != 2)) {
                LaunchActivity.this.i0 = true;
                LaunchActivity.this.v.measure(View.MeasureSpec.makeMeasureSpec(size, 1073741824), View.MeasureSpec.makeMeasureSpec(size2, 1073741824));
            } else {
                LaunchActivity.this.i0 = false;
                int i3 = (size / 100) * 35;
                if (i3 < AndroidUtilities.dp(320.0f)) {
                    i3 = AndroidUtilities.dp(320.0f);
                }
                LaunchActivity.this.v.measure(View.MeasureSpec.makeMeasureSpec(i3, 1073741824), View.MeasureSpec.makeMeasureSpec(size2, 1073741824));
                LaunchActivity.this.z.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1.0f), 1073741824), View.MeasureSpec.makeMeasureSpec(size2, 1073741824));
                LaunchActivity.this.x.measure(View.MeasureSpec.makeMeasureSpec(size - i3, 1073741824), View.MeasureSpec.makeMeasureSpec(size2, 1073741824));
            }
            LaunchActivity.this.A.measure(View.MeasureSpec.makeMeasureSpec(size, 1073741824), View.MeasureSpec.makeMeasureSpec(size2, 1073741824));
            LaunchActivity.this.y.measure(View.MeasureSpec.makeMeasureSpec(size, 1073741824), View.MeasureSpec.makeMeasureSpec(size2, 1073741824));
            LaunchActivity.this.w.measure(View.MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(530.0f), size), 1073741824), View.MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(528.0f), size2), 1073741824));
            this.a = false;
        }

        @Override
        public void requestLayout() {
            if (this.a) {
                return;
            }
            super.requestLayout();
        }
    }

    class p extends org.telegram.ui.Components.o7 {
        p(LaunchActivity launchActivity, Context context) {
            super(context);
        }

        @Override
        protected boolean z() {
            return false;
        }
    }

    class q extends org.telegram.ui.Components.h6 {
        q(Context context) {
            super(context);
        }

        @Override
        public boolean drawChild(Canvas canvas, View view, long j) {
            int i;
            if (LaunchActivity.this.U != null && LaunchActivity.this.U.p() && LaunchActivity.this.U.g0(view)) {
                i = canvas.save();
                canvas.clipRect(0, LaunchActivity.this.U.f0(), getMeasuredWidth(), getMeasuredHeight());
            } else {
                i = -1;
            }
            boolean drawChild = super.drawChild(canvas, view, j);
            if (i >= 0) {
                canvas.restoreToCount(i);
                invalidate();
                G2();
            }
            return drawChild;
        }
    }

    public class r implements Runnable {
        r() {
        }

        @Override
        public void run() {
            LaunchActivity.this.s0 = 0;
        }
    }

    class s extends m.i {
        private u.d0 f;

        public class a extends AnimatorListenerAdapter {
            final View a;

            a(s sVar, View view) {
                this.a = view;
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                this.a.setBackground(null);
            }
        }

        s(int i, int i2) {
            super(i, i2);
        }

        private void E() {
            u.d0 d0Var = this.f;
            if (d0Var != null) {
                View view = d0Var.a;
                this.f = null;
                view.setTranslationX(0.0f);
                view.setTranslationY(0.0f);
                if (Build.VERSION.SDK_INT >= 21) {
                    ObjectAnimator ofFloat = ObjectAnimator.ofFloat(view, "elevation", 0.0f);
                    ofFloat.addListener(new a(this, view));
                    ofFloat.setDuration(150L).start();
                }
            }
        }

        @Override
        public void A(u.d0 d0Var, int i) {
            E();
            if (i != 0) {
                this.f = d0Var;
                View view = d0Var.a;
                LaunchActivity.this.T.q2(false);
                view.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("dialogBackground"));
                if (Build.VERSION.SDK_INT >= 21) {
                    ObjectAnimator.ofFloat(view, "elevation", AndroidUtilities.dp(1.0f)).setDuration(150L).start();
                }
            }
        }

        @Override
        public void B(u.d0 d0Var, int i) {
        }

        @Override
        public void c(androidx.recyclerview.widget.u uVar, u.d0 d0Var) {
            E();
        }

        @Override
        public boolean r() {
            return false;
        }

        @Override
        public void u(Canvas canvas, androidx.recyclerview.widget.u uVar, u.d0 d0Var, float f, float f2, int i, boolean z) {
            View view;
            View view2;
            View view3 = d0Var.a;
            if (LaunchActivity.this.H.M()) {
                u.d0 Z = uVar.Z(LaunchActivity.this.H.J() - 1);
                u.d0 Z2 = uVar.Z(LaunchActivity.this.H.L() + 1);
                if ((Z != null && (view2 = Z.a) != null && view2.getBottom() == view3.getTop() && f2 < 0.0f) || (Z2 != null && (view = Z2.a) != null && view.getTop() == view3.getBottom() && f2 > 0.0f)) {
                    f2 = 0.0f;
                }
            }
            view3.setTranslationX(f);
            view3.setTranslationY(f2);
        }

        @Override
        public boolean y(androidx.recyclerview.widget.u uVar, u.d0 d0Var, u.d0 d0Var2) {
            if (d0Var.l() != d0Var2.l()) {
                return false;
            }
            LaunchActivity.this.H.Q(d0Var.j(), d0Var2.j());
            return true;
        }
    }

    public class t extends p3 {
        final int b3;

        t(Bundle bundle, int i) {
            super(bundle);
            this.b3 = i;
        }

        @Override
        public void I0() {
            super.I0();
            LaunchActivity.this.G.q(false, false);
            LaunchActivity.this.G.setDrawCurrentPreviewFragmentAbove(false);
            LaunchActivity.this.M3(this.b3, true);
        }

        @Override
        public void O0(boolean z, boolean z2) {
            super.O0(z, z2);
            if (z || !z2) {
                return;
            }
            LaunchActivity.this.G.setDrawCurrentPreviewFragmentAbove(false);
        }
    }

    public void A2(String str, int i2, xr5 xr5Var, p3 p3Var, ArrayList arrayList, CharSequence charSequence, boolean z) {
        String str2;
        long longValue = ((Long) arrayList.get(0)).longValue();
        gz5 gz5Var = new gz5();
        uy5 uy5Var = new uy5();
        gz5Var.x = uy5Var;
        uy5Var.b = str;
        uy5Var.a = MessagesController.getInstance(i2).getInputUser(xr5Var.c.get(0));
        SendMessagesHelper.getInstance(i2).sendGame(MessagesController.getInstance(i2).getInputPeer(longValue), gz5Var, 0L, 0L);
        Bundle bundle = new Bundle();
        bundle.putBoolean("scrollToTopOnResume", true);
        if (DialogObject.isEncryptedDialog(longValue)) {
            bundle.putInt("enc_id", DialogObject.getEncryptedChatId(longValue));
        } else {
            if (DialogObject.isUserDialog(longValue)) {
                str2 = "user_id";
            } else {
                longValue = -longValue;
                str2 = "chat_id";
            }
            bundle.putLong(str2, longValue);
        }
        if (MessagesController.getInstance(i2).checkCanOpenChat(bundle, p3Var)) {
            NotificationCenter.getInstance(i2).postNotificationName(NotificationCenter.closeChats, new Object[0]);
            this.v.E0(new v0(bundle), true, false, true, false);
        }
    }

    private int A3(final int i2, final org.telegram.ui.ActionBar.i iVar, final Integer num, final Integer num2, final Integer num3, final u95 u95Var) {
        if (u95Var == null) {
            return 0;
        }
        final tc6 tc6Var = new tc6();
        tc6Var.a = MessagesController.getInputPeer(u95Var);
        tc6Var.b = (num2 != null ? num : num3).intValue();
        return ConnectionsManager.getInstance(i2).sendRequest(tc6Var, new RequestDelegate() {
            @Override
            public final void run(i95 i95Var, ov5 ov5Var) {
                LaunchActivity.this.v2(i2, num, u95Var, tc6Var, num2, num3, iVar, i95Var, ov5Var);
            }
        });
    }

    private String B1(HashMap<String, String> hashMap, String str, int i2) {
        String str2 = hashMap.get(str);
        return str2 == null ? LocaleController.getString(str, i2) : str2;
    }

    public void B2(int i2, f27 f27Var, String str, p3 p3Var, ArrayList arrayList, CharSequence charSequence, boolean z) {
        long longValue = ((Long) arrayList.get(0)).longValue();
        Bundle bundle = new Bundle();
        bundle.putBoolean("scrollToTopOnResume", true);
        long j2 = -longValue;
        bundle.putLong("chat_id", j2);
        if (!u0.isEmpty()) {
            MessagesController messagesController = MessagesController.getInstance(i2);
            ArrayList<org.telegram.ui.ActionBar.k> arrayList2 = u0;
            if (!messagesController.checkCanOpenChat(bundle, arrayList2.get(arrayList2.size() - 1))) {
                return;
            }
        }
        NotificationCenter.getInstance(i2).postNotificationName(NotificationCenter.closeChats, new Object[0]);
        MessagesController.getInstance(i2).addUserToChat(j2, f27Var, 0, str, null, null);
        this.v.E0(new v0(bundle), true, false, true, false);
    }

    private void B3(final Uri uri, ArrayList<Uri> arrayList) {
        InputStream openInputStream;
        final int i2 = UserConfig.selectedAccount;
        final org.telegram.ui.ActionBar.i iVar = new org.telegram.ui.ActionBar.i(this, 3);
        final int[] iArr = {0};
        final ?? r3 = 0;
        InputStream inputStream = null;
        try {
            try {
                openInputStream = getContentResolver().openInputStream(uri);
            } catch (Throwable th) {
                th = th;
            }
        } catch (Exception e2) {
            e = e2;
        }
        try {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(openInputStream));
            StringBuilder sb = new StringBuilder();
            int i3 = 0;
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine == null || i3 >= 100) {
                    break;
                }
                sb.append(readLine);
                sb.append('\n');
                i3++;
            }
            String sb2 = sb.toString();
            if (openInputStream != null) {
                try {
                    openInputStream.close();
                } catch (Exception e3) {
                    FileLog.e(e3);
                }
            }
            sa6 sa6Var = new sa6();
            sa6Var.a = sb2;
            iArr[0] = ConnectionsManager.getInstance(i2).sendRequest(sa6Var, new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    LaunchActivity.this.x2(uri, i2, iVar, i95Var, ov5Var);
                }
            });
            iVar.setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public final void onCancel(DialogInterface dialogInterface) {
                    LaunchActivity.y2(i2, iArr, r3, dialogInterface);
                }
            });
            try {
                iVar.N0(300L);
            } catch (Exception unused) {
            }
        } catch (Exception e4) {
            e = e4;
            r3 = openInputStream;
            FileLog.e(e);
            if (r3 != 0) {
                try {
                    r3.close();
                } catch (Exception e5) {
                    FileLog.e(e5);
                }
            }
        } catch (Throwable th2) {
            th = th2;
            inputStream = openInputStream;
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (Exception e6) {
                    FileLog.e(e6);
                }
            }
            throw th;
        }
    }

    public static int C1(Uri uri) {
        int i2;
        String query = uri.getPathSegments().contains(MediaStreamTrack.VIDEO_TRACK_KIND) ? uri.getQuery() : uri.getQueryParameter("t") != null ? uri.getQueryParameter("t") : null;
        if (query == null) {
            return -1;
        }
        try {
            i2 = Integer.parseInt(query);
        } catch (Throwable unused) {
            i2 = -1;
        }
        if (i2 == -1) {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss");
            try {
                return (int) ((simpleDateFormat.parse(query).getTime() - simpleDateFormat.parse("00:00").getTime()) / 1000);
            } catch (ParseException e2) {
                e2.printStackTrace();
            }
        }
        return i2;
    }

    public void C2(i95 i95Var, ov5 ov5Var, final String str, String str2, String str3, final int i2, Integer num, Integer num2, Integer num3, int[] iArr, org.telegram.ui.ActionBar.i iVar, final String str4, String str5, int i3) {
        String str6;
        long j2;
        boolean z;
        boolean z2;
        if (isFinishing()) {
            return;
        }
        final xr5 xr5Var = (xr5) i95Var;
        boolean z3 = true;
        if (ov5Var != null || this.v == null || (!(str == null && str2 == null) && ((str == null || xr5Var.c.isEmpty()) && ((str2 == null || xr5Var.b.isEmpty()) && (str3 == null || xr5Var.b.isEmpty()))))) {
            try {
                if (!u0.isEmpty()) {
                    ArrayList<org.telegram.ui.ActionBar.k> arrayList = u0;
                    org.telegram.ui.ActionBar.k kVar = arrayList.get(arrayList.size() - 1);
                    ((ov5Var == null || (str6 = ov5Var.b) == null || !str6.startsWith("FLOOD_WAIT")) ? org.telegram.ui.Components.b0.E(kVar).n(LocaleController.getString("NoUsernameFound", R.string.NoUsernameFound)) : org.telegram.ui.Components.b0.E(kVar).n(LocaleController.getString("FloodWait", R.string.FloodWait))).J();
                }
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        } else {
            MessagesController.getInstance(i2).putUsers(xr5Var.c, false);
            MessagesController.getInstance(i2).putChats(xr5Var.b, false);
            MessagesStorage.getInstance(i2).putUsersAndChats(xr5Var.c, xr5Var.b, false, true);
            if (num != null && ((num2 != null || num3 != null) && !xr5Var.b.isEmpty())) {
                iArr[0] = A3(i2, iVar, num, num2, num3, xr5Var.b.get(0));
                if (iArr[0] != 0) {
                    z3 = false;
                }
            } else if (str != null) {
                Bundle bundle = new Bundle();
                bundle.putBoolean("onlySelect", true);
                bundle.putBoolean("cantSendToChannels", true);
                bundle.putInt("dialogsType", 1);
                bundle.putString("selectAlertString", LocaleController.getString("SendGameToText", R.string.SendGameToText));
                bundle.putString("selectAlertStringGroup", LocaleController.getString("SendGameToGroupText", R.string.SendGameToGroupText));
                p3 p3Var = new p3(bundle);
                p3Var.Ka(new p3.b1() {
                    @Override
                    public final void l(org.telegram.ui.p3 p3Var2, ArrayList arrayList2, CharSequence charSequence, boolean z4) {
                        LaunchActivity.this.A2(str, i2, xr5Var, p3Var2, arrayList2, charSequence, z4);
                    }
                });
                if (AndroidUtilities.isTablet()) {
                    if (this.w.v0.size() > 0) {
                        ArrayList<org.telegram.ui.ActionBar.k> arrayList2 = this.w.v0;
                    }
                    z2 = false;
                } else {
                    if (this.v.v0.size() > 1) {
                        ArrayList<org.telegram.ui.ActionBar.k> arrayList3 = this.v.v0;
                    }
                    z2 = false;
                }
                this.v.E0(p3Var, z2, true, true, false);
                if (SecretMediaViewer.d0() && SecretMediaViewer.b0().f0()) {
                    SecretMediaViewer.b0().V(false, false);
                } else if (PhotoViewer.W7() && PhotoViewer.L7().o8()) {
                    PhotoViewer.L7().f7(false, true);
                } else if (ArticleViewer.X2() && ArticleViewer.L2().Z2()) {
                    ArticleViewer.L2().z2(false, true);
                }
                p4 p4Var = p4.F2;
                if (p4Var != null) {
                    p4Var.dismiss();
                }
                this.G.q(false, false);
                if (AndroidUtilities.isTablet()) {
                    this.v.R0();
                    this.x.R0();
                } else {
                    this.G.q(true, false);
                }
            } else {
                org.telegram.ui.ActionBar.k kVar2 = null;
                kVar2 = null;
                if (str4 != null) {
                    final f27 f27Var = xr5Var.c.isEmpty() ? null : xr5Var.c.get(0);
                    if (f27Var == null || (f27Var.n && f27Var.p)) {
                        try {
                            if (u0.isEmpty()) {
                                return;
                            }
                            ArrayList<org.telegram.ui.ActionBar.k> arrayList4 = u0;
                            org.telegram.ui.Components.b0.E(arrayList4.get(arrayList4.size() - 1)).n(LocaleController.getString("BotCantJoinGroups", R.string.BotCantJoinGroups)).J();
                            return;
                        } catch (Exception e3) {
                            FileLog.e(e3);
                            return;
                        }
                    }
                    Bundle bundle2 = new Bundle();
                    bundle2.putBoolean("onlySelect", true);
                    bundle2.putInt("dialogsType", 2);
                    bundle2.putString("addToGroupAlertString", LocaleController.formatString("AddToTheGroupAlertText", R.string.AddToTheGroupAlertText, UserObject.getUserName(f27Var), "%1$s"));
                    p3 p3Var2 = new p3(bundle2);
                    p3Var2.Ka(new p3.b1() {
                        @Override
                        public final void l(org.telegram.ui.p3 p3Var3, ArrayList arrayList5, CharSequence charSequence, boolean z4) {
                            LaunchActivity.this.B2(i2, f27Var, str4, p3Var3, arrayList5, charSequence, z4);
                        }
                    });
                    S2(p3Var2);
                } else {
                    Bundle bundle3 = new Bundle();
                    if (xr5Var.b.isEmpty()) {
                        bundle3.putLong("user_id", xr5Var.c.get(0).a);
                        j2 = xr5Var.c.get(0).a;
                    } else {
                        bundle3.putLong("chat_id", xr5Var.b.get(0).a);
                        j2 = -xr5Var.b.get(0).a;
                    }
                    if (str5 == null || xr5Var.c.size() <= 0 || !xr5Var.c.get(0).n) {
                        z = false;
                    } else {
                        bundle3.putString("botUser", str5);
                        z = true;
                    }
                    if (num != null) {
                        bundle3.putInt("message_id", num.intValue());
                    }
                    if (str2 != null) {
                        bundle3.putString("voicechat", str2);
                    }
                    if (str3 != null) {
                        bundle3.putString("livestream", str3);
                    }
                    if (i3 >= 0) {
                        bundle3.putInt("video_timestamp", i3);
                    }
                    if (!u0.isEmpty() && str2 == null) {
                        ArrayList<org.telegram.ui.ActionBar.k> arrayList5 = u0;
                        kVar2 = arrayList5.get(arrayList5.size() - 1);
                    }
                    if (kVar2 == null || MessagesController.getInstance(i2).checkCanOpenChat(bundle3, kVar2)) {
                        if (z && (kVar2 instanceof v0)) {
                            v0 v0Var = (v0) kVar2;
                            if (v0Var.Th() == j2) {
                                v0Var.so(str5);
                            }
                        }
                        MessagesController.getInstance(i2).ensureMessagesLoaded(j2, num == null ? 0 : num.intValue(), new e(iVar, bundle3));
                        z3 = false;
                    }
                }
            }
        }
        if (z3) {
            try {
                iVar.dismiss();
            } catch (Exception e4) {
                FileLog.e(e4);
            }
        }
    }

    private void C3(final int i2, final String str, final String str2, final String str3, final String str4, final String str5, final String str6, final boolean z, final Integer num, final Long l2, final Integer num2, final Integer num3, final String str7, final HashMap<String, String> hashMap, final String str8, final String str9, final String str10, final String str11, final d17 d17Var, final String str12, final String str13, final String str14, int i3, final int i4) {
        char c2;
        final int i5;
        final org.telegram.ui.ActionBar.i iVar;
        Runnable runnable;
        org.telegram.ui.ActionBar.k kVar;
        final Runnable runnable2;
        Cif.i iVar2;
        org.telegram.ui.Components.c8 c8Var;
        if (i3 == 0 && UserConfig.getActivatedAccountsCount() >= 2 && hashMap != null) {
            org.telegram.ui.Components.b.k1(this, new b.w() {
                @Override
                public final void a(int i6) {
                    LaunchActivity.this.z2(i2, str, str2, str3, str4, str5, str6, z, num, l2, num2, num3, str7, hashMap, str8, str9, str10, str11, d17Var, str12, str13, str14, i4, i6);
                }
            }).show();
            return;
        }
        boolean z2 = true;
        if (str10 != null) {
            NotificationCenter globalInstance = NotificationCenter.getGlobalInstance();
            int i6 = NotificationCenter.didReceiveSmsCode;
            if (globalInstance.hasObservers(i6)) {
                NotificationCenter.getGlobalInstance().postNotificationName(i6, str10);
                return;
            }
            i.C0142i c0142i = new i.C0142i(this);
            c0142i.u(LocaleController.getString("AppName", R.string.AppName));
            c0142i.l(AndroidUtilities.replaceTags(LocaleController.formatString("OtherLoginCode", R.string.OtherLoginCode, str10)));
            c0142i.s(LocaleController.getString("OK", R.string.OK), null);
            D3(c0142i);
            return;
        }
        if (str11 != null) {
            i.C0142i c0142i2 = new i.C0142i(this);
            c0142i2.u(LocaleController.getString("AuthAnotherClient", R.string.AuthAnotherClient));
            c0142i2.l(LocaleController.getString("AuthAnotherClientUrl", R.string.AuthAnotherClientUrl));
            c0142i2.s(LocaleController.getString("OK", R.string.OK), null);
            D3(c0142i2);
            return;
        }
        final org.telegram.ui.ActionBar.i iVar3 = new org.telegram.ui.ActionBar.i(this, 3);
        final int[] iArr = {0};
        if (str != null) {
            wr5 wr5Var = new wr5();
            wr5Var.a = str;
            int sendRequest = ConnectionsManager.getInstance(i2).sendRequest(wr5Var, new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    LaunchActivity.this.D2(str7, str13, str14, i2, num, num3, num2, iArr, iVar3, str5, str4, i4, i95Var, ov5Var);
                }
            });
            iArr = iArr;
            c2 = 0;
            iArr[0] = sendRequest;
            i5 = i2;
            iVar = iVar3;
        } else {
            c2 = 0;
            if (str2 == null) {
                i5 = i2;
                iVar = iVar3;
                if (str3 != null) {
                    if (u0.isEmpty()) {
                        return;
                    }
                    o26 o26Var = new o26();
                    o26Var.c = str3;
                    ArrayList<org.telegram.ui.ActionBar.k> arrayList = u0;
                    org.telegram.ui.ActionBar.k kVar2 = arrayList.get(arrayList.size() - 1);
                    if (kVar2 instanceof v0) {
                        v0 v0Var = (v0) kVar2;
                        c8Var = new org.telegram.ui.Components.c8(this, kVar2, o26Var, null, v0Var.Kh(), v0Var.f0());
                        c8Var.setCalcMandatoryInsets(v0Var.Li());
                    } else {
                        c8Var = new org.telegram.ui.Components.c8(this, kVar2, o26Var, (ah6) null, (c8.q) null);
                    }
                    kVar2.o1(c8Var);
                    return;
                }
                if (str6 != null) {
                    Bundle bundle = new Bundle();
                    bundle.putBoolean("onlySelect", true);
                    bundle.putInt("dialogsType", 3);
                    p3 p3Var = new p3(bundle);
                    p3Var.Ka(new p3.b1() {
                        @Override
                        public final void l(org.telegram.ui.p3 p3Var2, ArrayList arrayList2, CharSequence charSequence, boolean z3) {
                            LaunchActivity.this.J2(z, i5, str6, p3Var2, arrayList2, charSequence, z3);
                        }
                    });
                    x3(p3Var, false, true);
                } else if (hashMap != null) {
                    int intValue = Utilities.parseInt(hashMap.get("bot_id")).intValue();
                    if (intValue == 0) {
                        return;
                    }
                    final String str15 = hashMap.get("payload");
                    final String str16 = hashMap.get("nonce");
                    final String str17 = hashMap.get("callback_url");
                    final ae5 ae5Var = new ae5();
                    ae5Var.a = intValue;
                    ae5Var.b = hashMap.get("scope");
                    ae5Var.c = hashMap.get("public_key");
                    iArr[0] = ConnectionsManager.getInstance(i2).sendRequest(ae5Var, new RequestDelegate() {
                        @Override
                        public final void run(i95 i95Var, ov5 ov5Var) {
                            LaunchActivity.this.N2(iArr, i2, iVar, ae5Var, str15, str16, str17, i95Var, ov5Var);
                        }
                    });
                } else if (str9 != null) {
                    xw5 xw5Var = new xw5();
                    xw5Var.a = str9;
                    iArr[0] = ConnectionsManager.getInstance(this.e0).sendRequest(xw5Var, new RequestDelegate() {
                        @Override
                        public final void run(i95 i95Var, ov5 ov5Var) {
                            LaunchActivity.this.P2(iVar, i95Var, ov5Var);
                        }
                    });
                } else if (str8 != null) {
                    h46 h46Var = new h46();
                    h46Var.b = str8;
                    h46Var.a = "android";
                    iArr[0] = ConnectionsManager.getInstance(this.e0).sendRequest(h46Var, new RequestDelegate() {
                        @Override
                        public final void run(i95 i95Var, ov5 ov5Var) {
                            LaunchActivity.this.R2(iVar, i95Var, ov5Var);
                        }
                    });
                } else {
                    if (d17Var != null) {
                        if (TextUtils.isEmpty(d17Var.h)) {
                            try {
                                n27 n27Var = d17Var.j;
                                int i7 = n27Var.f;
                                iVar2 = i7 != 0 ? new Cif.i("c", n27Var.d, n27Var.e, i7, n27Var.g) : new Cif.i("c", n27Var.d, n27Var.e, AndroidUtilities.getWallpaperRotation(n27Var.i, false));
                                runnable = null;
                            } catch (Exception e2) {
                                e = e2;
                                runnable = null;
                            }
                            try {
                                final ff ffVar = new ff(iVar2, null, true, false);
                                AndroidUtilities.runOnUIThread(new Runnable() {
                                    @Override
                                    public final void run() {
                                        LaunchActivity.this.S2(ffVar);
                                    }
                                });
                            } catch (Exception e3) {
                                e = e3;
                                FileLog.e(e);
                                z2 = false;
                                if (!z2) {
                                }
                                runnable2 = runnable;
                                if (iArr[c2] == 0) {
                                }
                            }
                            if (!z2) {
                                oe5 oe5Var = new oe5();
                                b36 b36Var = new b36();
                                b36Var.a = d17Var.h;
                                oe5Var.a = b36Var;
                                iArr[0] = ConnectionsManager.getInstance(this.e0).sendRequest(oe5Var, new RequestDelegate() {
                                    @Override
                                    public final void run(i95 i95Var, ov5 ov5Var) {
                                        LaunchActivity.this.U2(iVar, d17Var, i95Var, ov5Var);
                                    }
                                });
                            }
                        } else {
                            runnable = null;
                        }
                        z2 = false;
                        if (!z2) {
                        }
                    } else {
                        runnable = null;
                        if (str12 != null) {
                            runnable2 = new Runnable() {
                                @Override
                                public final void run() {
                                    LaunchActivity.this.V2();
                                }
                            };
                            le5 le5Var = new le5();
                            le5Var.a = "android";
                            u26 u26Var = new u26();
                            u26Var.a = str12;
                            le5Var.b = u26Var;
                            iArr[0] = ConnectionsManager.getInstance(this.e0).sendRequest(le5Var, new RequestDelegate() {
                                @Override
                                public final void run(i95 i95Var, ov5 ov5Var) {
                                    LaunchActivity.this.X2(iVar, i95Var, ov5Var);
                                }
                            });
                            if (iArr[c2] == 0) {
                                iVar.setOnCancelListener(new DialogInterface.OnCancelListener() {
                                    @Override
                                    public final void onCancel(DialogInterface dialogInterface) {
                                        LaunchActivity.d3(i5, iArr, runnable2, dialogInterface);
                                    }
                                });
                                try {
                                    iVar.N0(300L);
                                    return;
                                } catch (Exception unused) {
                                    return;
                                }
                            }
                            return;
                        }
                        if (l2 != null && num != null) {
                            if (num2 != null) {
                                u95 chat = MessagesController.getInstance(i2).getChat(l2);
                                if (chat != null) {
                                    iArr[0] = A3(i2, iVar, num, num3, num2, chat);
                                } else {
                                    wn5 wn5Var = new wn5();
                                    vx5 vx5Var = new vx5();
                                    vx5Var.a = l2.longValue();
                                    wn5Var.a.add(vx5Var);
                                    iArr[0] = ConnectionsManager.getInstance(this.e0).sendRequest(wn5Var, new RequestDelegate() {
                                        @Override
                                        public final void run(i95 i95Var, ov5 ov5Var) {
                                            LaunchActivity.this.Z2(iArr, i2, iVar, num, num3, num2, i95Var, ov5Var);
                                        }
                                    });
                                }
                            } else {
                                final Bundle bundle2 = new Bundle();
                                bundle2.putLong("chat_id", l2.longValue());
                                bundle2.putInt("message_id", num.intValue());
                                if (u0.isEmpty()) {
                                    kVar = null;
                                } else {
                                    ArrayList<org.telegram.ui.ActionBar.k> arrayList2 = u0;
                                    kVar = arrayList2.get(arrayList2.size() - 1);
                                }
                                if (kVar == null || MessagesController.getInstance(i2).checkCanOpenChat(bundle2, kVar)) {
                                    final org.telegram.ui.ActionBar.k kVar3 = kVar;
                                    AndroidUtilities.runOnUIThread(new Runnable() {
                                        @Override
                                        public final void run() {
                                            LaunchActivity.this.c3(bundle2, l2, iArr, iVar, kVar3, i2);
                                        }
                                    });
                                }
                            }
                        }
                    }
                    runnable2 = runnable;
                    if (iArr[c2] == 0) {
                    }
                }
            } else if (i3 == 0) {
                ra6 ra6Var = new ra6();
                ra6Var.a = str2;
                i5 = i2;
                iVar = iVar3;
                iArr[0] = ConnectionsManager.getInstance(i2).sendRequest(ra6Var, new RequestDelegate() {
                    @Override
                    public final void run(i95 i95Var, ov5 ov5Var) {
                        LaunchActivity.this.G2(i5, iVar, str2, i95Var, ov5Var);
                    }
                }, 2);
            } else {
                i5 = i2;
                iVar = iVar3;
                if (i3 == 1) {
                    ne6 ne6Var = new ne6();
                    ne6Var.a = str2;
                    ConnectionsManager.getInstance(i2).sendRequest(ne6Var, new RequestDelegate() {
                        @Override
                        public final void run(i95 i95Var, ov5 ov5Var) {
                            LaunchActivity.this.I2(i5, iVar, i95Var, ov5Var);
                        }
                    }, 2);
                }
            }
        }
        runnable = null;
        runnable2 = runnable;
        if (iArr[c2] == 0) {
        }
    }

    private boolean D1(Intent intent, boolean z, boolean z2, boolean z3) {
        long j2;
        String str;
        final LaunchActivity launchActivity;
        int i2;
        long j3;
        long j4;
        long j5;
        String str2;
        int i3;
        String str3;
        int i4;
        String str4;
        char c2;
        String str5;
        int i5;
        boolean z4;
        boolean z5;
        boolean z6;
        boolean z7;
        boolean z8;
        boolean z9;
        boolean z10;
        boolean z11;
        boolean z12;
        boolean z13;
        boolean z14;
        final boolean z15;
        boolean z16;
        boolean z17;
        boolean z18;
        boolean z19;
        boolean z20;
        ?? r10;
        p4 p4Var;
        p3 p3Var;
        ActionBarLayout actionBarLayout;
        y5 y5Var;
        String str6;
        ?? r6;
        char c3;
        final org.telegram.ui.ActionBar.k h4Var;
        final boolean z21;
        org.telegram.ui.ActionBar.k me1Var;
        org.telegram.ui.ActionBar.k kVar;
        Dialog n7Var;
        boolean z22;
        boolean z23;
        boolean z24;
        ArrayList parcelableArrayListExtra;
        String type;
        ArrayList arrayList;
        boolean z25;
        Pattern compile;
        int intExtra;
        char c4;
        int i6;
        boolean z26;
        String str7;
        int[] iArr;
        long j6;
        long j7;
        int i7;
        char c5;
        boolean z27;
        boolean z28;
        String str8;
        String str9;
        String str10;
        String str11;
        long j8;
        long j9;
        String str12;
        String str13;
        String str14;
        String str15;
        String str16;
        String str17;
        String str18;
        String str19;
        boolean z29;
        int i8;
        char c6;
        String str20;
        String str21;
        String str22;
        String str23;
        String str24;
        String str25;
        String str26;
        String str27;
        String str28;
        String str29;
        String str30;
        String str31;
        String str32;
        String str33;
        int i9;
        String str34;
        String str35;
        Cursor query;
        boolean z30;
        char c7;
        String str36;
        String str37;
        String queryParameter;
        String str38;
        String str39;
        String str40;
        boolean z31;
        String queryParameter2;
        String queryParameter3;
        String[] split;
        boolean z32;
        int i10;
        String str41;
        long j10;
        long j11;
        int parseInt;
        String queryParameter4;
        String str42;
        long j12;
        boolean z33;
        String str43;
        boolean z34;
        String str44;
        String str45;
        boolean z35;
        boolean z36;
        boolean z37;
        String str46;
        String str47;
        String str48;
        String str49;
        String str50;
        String str51;
        String str52;
        String str53;
        String str54;
        String str55;
        String str56;
        int i11;
        String str57;
        String str58;
        String str59;
        String str60;
        String str61;
        String str62;
        boolean z38;
        int i12;
        String str63;
        int i13;
        String str64;
        String str65;
        String str66;
        String str67;
        String str68;
        String str69;
        String str70;
        String str71;
        String str72;
        boolean z39;
        String queryParameter5;
        String queryParameter6;
        String[] split2;
        String str73;
        String type2;
        String stringExtra;
        Parcelable parcelableExtra;
        boolean z40;
        Pattern compile2;
        CharSequence charSequenceExtra;
        String str74;
        String str75;
        z57.j0(this, intent);
        if (intent.hasExtra("selectlang")) {
            S2(new r12());
        }
        if (AndroidUtilities.handleProxyIntent(this, intent)) {
            this.v.R0();
            if (AndroidUtilities.isTablet()) {
                this.w.R0();
                this.x.R0();
            }
            return true;
        }
        if (PhotoViewer.W7() && PhotoViewer.L7().o8() && !"android.intent.action.MAIN".equals(intent.getAction())) {
            PhotoViewer.L7().f7(false, true);
        }
        int flags = intent.getFlags();
        String action = intent.getAction();
        final int[] iArr2 = {intent.getIntExtra("currentAccount", UserConfig.selectedAccount)};
        M3(iArr2[0], true);
        boolean z41 = action != null && action.equals("voip");
        if (!z3 && (AndroidUtilities.needShowPasscode(true) || SharedConfig.isWaitingForPasscodeEnter)) {
            H3(true, false, -1, -1, null, null);
            UserConfig.getInstance(this.e0).saveConfig(false);
            if (!z41) {
                this.f0 = intent;
                this.g0 = z;
                this.h0 = z2;
                return false;
            }
        }
        this.d = null;
        this.b = null;
        this.c = null;
        this.e = null;
        this.i = null;
        this.h = null;
        this.f = null;
        this.g = null;
        this.j = null;
        this.k = null;
        this.n = null;
        this.o = null;
        this.p = null;
        if ((1048576 & flags) == 0 && intent.getAction() != null && !z2) {
            boolean equals = "android.intent.action.SEND".equals(intent.getAction());
            String str76 = BuildConfig.FLAVOR;
            if (equals) {
                if (SharedConfig.directShare && intent.getExtras() != null) {
                    j5 = intent.getExtras().getLong("dialogId", 0L);
                    if (j5 == 0) {
                        try {
                            String string = intent.getExtras().getString("android.intent.extra.shortcut.ID");
                            if (string != null) {
                                List<gy4> d2 = jy4.d(ApplicationLoader.applicationContext);
                                int size = d2.size();
                                for (int i14 = 0; i14 < size; i14++) {
                                    gy4 gy4Var = d2.get(i14);
                                    if (string.equals(gy4Var.g())) {
                                        Bundle extras = gy4Var.h().getExtras();
                                        long j13 = extras.getLong("dialogId", 0L);
                                        try {
                                            str74 = extras.getString("hash", null);
                                            j5 = j13;
                                            break;
                                        } catch (Throwable th) {
                                            th = th;
                                            j5 = j13;
                                            FileLog.e(th);
                                            str74 = null;
                                            str75 = SharedConfig.directShareHash;
                                            if (str75 != null) {
                                            }
                                            j5 = 0;
                                            type2 = intent.getType();
                                            if (type2 == null) {
                                            }
                                            stringExtra = intent.getStringExtra("android.intent.extra.TEXT");
                                            if (stringExtra == null) {
                                                stringExtra = charSequenceExtra.toString();
                                            }
                                            String stringExtra2 = intent.getStringExtra("android.intent.extra.SUBJECT");
                                            if (TextUtils.isEmpty(stringExtra)) {
                                            }
                                            parcelableExtra = intent.getParcelableExtra("android.intent.extra.STREAM");
                                            if (parcelableExtra == null) {
                                            }
                                        }
                                    }
                                }
                            }
                        } catch (Throwable th2) {
                            th = th2;
                        }
                        str74 = null;
                    } else {
                        str74 = intent.getExtras().getString("hash", null);
                    }
                    str75 = SharedConfig.directShareHash;
                    if (str75 != null) {
                    }
                }
                j5 = 0;
                type2 = intent.getType();
                if (type2 == null && type2.equals("text/x-vcard")) {
                    try {
                        Uri uri = (Uri) intent.getExtras().get("android.intent.extra.STREAM");
                        if (uri != null) {
                            ArrayList<f27> loadVCardFromStream = AndroidUtilities.loadVCardFromStream(uri, this.e0, false, null, null);
                            this.j = loadVCardFromStream;
                            if (loadVCardFromStream.size() > 5) {
                                this.j = null;
                                ArrayList<Uri> arrayList2 = new ArrayList<>();
                                this.f = arrayList2;
                                arrayList2.add(uri);
                                this.h = type2;
                            } else {
                                this.k = uri;
                            }
                        }
                    } catch (Exception e2) {
                        FileLog.e(e2);
                    }
                    z40 = true;
                    if (z40) {
                    }
                    j3 = 0;
                    j4 = 0;
                    j2 = 0;
                    str = "message_id";
                    launchActivity = this;
                    str2 = null;
                    i3 = -1;
                    str3 = null;
                    i4 = -1;
                    str4 = null;
                    c2 = 0;
                } else {
                    stringExtra = intent.getStringExtra("android.intent.extra.TEXT");
                    if (stringExtra == null && (charSequenceExtra = intent.getCharSequenceExtra("android.intent.extra.TEXT")) != null) {
                        stringExtra = charSequenceExtra.toString();
                    }
                    String stringExtra22 = intent.getStringExtra("android.intent.extra.SUBJECT");
                    if (TextUtils.isEmpty(stringExtra)) {
                        if ((stringExtra.startsWith("http://") || stringExtra.startsWith("https://")) && !TextUtils.isEmpty(stringExtra22)) {
                            stringExtra = stringExtra22 + "\n" + stringExtra;
                        }
                        this.c = stringExtra;
                    } else if (!TextUtils.isEmpty(stringExtra22)) {
                        this.c = stringExtra22;
                    }
                    parcelableExtra = intent.getParcelableExtra("android.intent.extra.STREAM");
                    if (parcelableExtra == null) {
                        boolean z42 = parcelableExtra instanceof Uri;
                        Parcelable parcelable = parcelableExtra;
                        if (!z42) {
                            parcelable = Uri.parse(parcelableExtra.toString());
                        }
                        Uri uri2 = (Uri) parcelable;
                        boolean z43 = uri2 != null && AndroidUtilities.isInternalUri(uri2);
                        if (!z43 && uri2 != null) {
                            if ((type2 == null || !type2.startsWith("image/")) && !uri2.toString().toLowerCase().endsWith(".jpg")) {
                                String uri3 = uri2.toString();
                                if (j5 == 0 && uri3 != null) {
                                    if (BuildVars.LOGS_ENABLED) {
                                        FileLog.d("export path = " + uri3);
                                    }
                                    Set<String> set = MessagesController.getInstance(iArr2[0]).exportUri;
                                    String fixFileName = FileLoader.fixFileName(MediaController.getFileName(uri2));
                                    Iterator<String> it = set.iterator();
                                    while (it.hasNext()) {
                                        try {
                                            compile2 = Pattern.compile(it.next());
                                        } catch (Exception e3) {
                                            FileLog.e(e3);
                                        }
                                        if (compile2.matcher(uri3).find() || compile2.matcher(fixFileName).find()) {
                                            this.g = uri2;
                                            break;
                                        }
                                    }
                                    if (this.g == null && uri3.startsWith("content://com.kakao.talk") && uri3.endsWith("KakaoTalkChats.txt")) {
                                        this.g = uri2;
                                    }
                                }
                                if (this.g == null) {
                                    String path = AndroidUtilities.getPath(uri2);
                                    if (!BuildVars.NO_SCOPED_STORAGE) {
                                        path = MediaController.copyFileToCache(uri2, "file");
                                    }
                                    if (path != null) {
                                        if (path.startsWith("file:")) {
                                            path = path.replace("file://", BuildConfig.FLAVOR);
                                        }
                                        if (type2 == null || !type2.startsWith("video/")) {
                                            if (this.e == null) {
                                                this.e = new ArrayList<>();
                                                this.i = new ArrayList<>();
                                            }
                                            this.e.add(path);
                                            this.i.add(uri2.toString());
                                        } else {
                                            this.b = path;
                                        }
                                    } else {
                                        if (this.f == null) {
                                            this.f = new ArrayList<>();
                                        }
                                        this.f.add(uri2);
                                        this.h = type2;
                                    }
                                }
                            } else {
                                if (this.d == null) {
                                    this.d = new ArrayList<>();
                                }
                                SendMessagesHelper.SendingMediaInfo sendingMediaInfo = new SendMessagesHelper.SendingMediaInfo();
                                sendingMediaInfo.uri = uri2;
                                this.d.add(sendingMediaInfo);
                            }
                        }
                        z40 = z43;
                        if (z40) {
                            Toast.makeText(this, "Unsupported content", 0).show();
                        }
                        j3 = 0;
                        j4 = 0;
                        j2 = 0;
                        str = "message_id";
                        launchActivity = this;
                        str2 = null;
                        i3 = -1;
                        str3 = null;
                        i4 = -1;
                        str4 = null;
                        c2 = 0;
                    }
                }
                z40 = false;
                if (z40) {
                }
                j3 = 0;
                j4 = 0;
                j2 = 0;
                str = "message_id";
                launchActivity = this;
                str2 = null;
                i3 = -1;
                str3 = null;
                i4 = -1;
                str4 = null;
                c2 = 0;
            } else {
                if (!"org.telegram.messenger.CREATE_STICKER_PACK".equals(intent.getAction())) {
                    if ("android.intent.action.SEND_MULTIPLE".equals(intent.getAction())) {
                        try {
                            parcelableArrayListExtra = intent.getParcelableArrayListExtra("android.intent.extra.STREAM");
                            type = intent.getType();
                        } catch (Exception e4) {
                            FileLog.e(e4);
                        }
                        if (parcelableArrayListExtra != null) {
                            int i15 = 0;
                            while (i15 < parcelableArrayListExtra.size()) {
                                Parcelable parcelable2 = (Parcelable) parcelableArrayListExtra.get(i15);
                                boolean z44 = parcelable2 instanceof Uri;
                                Parcelable parcelable3 = parcelable2;
                                if (!z44) {
                                    parcelable3 = Uri.parse(parcelable2.toString());
                                }
                                Uri uri4 = (Uri) parcelable3;
                                if (uri4 != null && AndroidUtilities.isInternalUri(uri4)) {
                                    parcelableArrayListExtra.remove(i15);
                                    i15--;
                                }
                                i15++;
                            }
                            if (parcelableArrayListExtra.isEmpty()) {
                                arrayList = null;
                                if (arrayList != null) {
                                    if (type == null || !type.startsWith("image/")) {
                                        Set<String> set2 = MessagesController.getInstance(iArr2[0]).exportUri;
                                        for (int i16 = 0; i16 < arrayList.size(); i16++) {
                                            Object obj = (Parcelable) arrayList.get(i16);
                                            if (!(obj instanceof Uri)) {
                                                obj = Uri.parse(obj.toString());
                                            }
                                            Uri uri5 = (Uri) obj;
                                            String path2 = AndroidUtilities.getPath(uri5);
                                            String obj2 = obj.toString();
                                            String str77 = obj2 == null ? path2 : obj2;
                                            if (BuildVars.LOGS_ENABLED) {
                                                FileLog.d("export path = " + str77);
                                            }
                                            if (str77 != null && this.g == null) {
                                                String fixFileName2 = FileLoader.fixFileName(MediaController.getFileName(uri5));
                                                Iterator<String> it2 = set2.iterator();
                                                while (it2.hasNext()) {
                                                    try {
                                                        compile = Pattern.compile(it2.next());
                                                    } catch (Exception e5) {
                                                        FileLog.e(e5);
                                                    }
                                                    if (compile.matcher(str77).find() || compile.matcher(fixFileName2).find()) {
                                                        this.g = uri5;
                                                        z25 = true;
                                                        break;
                                                    }
                                                }
                                                z25 = false;
                                                if (!z25) {
                                                    if (str77.startsWith("content://com.kakao.talk") && str77.endsWith("KakaoTalkChats.txt")) {
                                                        this.g = uri5;
                                                    }
                                                }
                                            }
                                            if (path2 != null) {
                                                if (path2.startsWith("file:")) {
                                                    path2 = path2.replace("file://", BuildConfig.FLAVOR);
                                                }
                                                if (this.e == null) {
                                                    this.e = new ArrayList<>();
                                                    this.i = new ArrayList<>();
                                                }
                                                this.e.add(path2);
                                                this.i.add(str77);
                                            } else {
                                                if (this.f == null) {
                                                    this.f = new ArrayList<>();
                                                }
                                                this.f.add(uri5);
                                                this.h = type;
                                            }
                                        }
                                    } else {
                                        for (int i17 = 0; i17 < arrayList.size(); i17++) {
                                            Parcelable parcelable4 = (Parcelable) arrayList.get(i17);
                                            boolean z45 = parcelable4 instanceof Uri;
                                            Parcelable parcelable5 = parcelable4;
                                            if (!z45) {
                                                parcelable5 = Uri.parse(parcelable4.toString());
                                            }
                                            Uri uri6 = (Uri) parcelable5;
                                            if (this.d == null) {
                                                this.d = new ArrayList<>();
                                            }
                                            SendMessagesHelper.SendingMediaInfo sendingMediaInfo2 = new SendMessagesHelper.SendingMediaInfo();
                                            sendingMediaInfo2.uri = uri6;
                                            this.d.add(sendingMediaInfo2);
                                        }
                                    }
                                    z24 = false;
                                    if (z24) {
                                        Toast.makeText(this, "Unsupported content", 0).show();
                                    }
                                    str = "message_id";
                                    launchActivity = this;
                                    i2 = 0;
                                    j2 = 0;
                                }
                                z24 = true;
                                if (z24) {
                                }
                                str = "message_id";
                                launchActivity = this;
                                i2 = 0;
                                j2 = 0;
                            }
                        }
                        arrayList = parcelableArrayListExtra;
                        if (arrayList != null) {
                        }
                        z24 = true;
                        if (z24) {
                        }
                        str = "message_id";
                        launchActivity = this;
                        i2 = 0;
                        j2 = 0;
                    } else {
                        if ("android.intent.action.VIEW".equals(intent.getAction())) {
                            Uri data = intent.getData();
                            if (data != null) {
                                String scheme = data.getScheme();
                                if (scheme != null) {
                                    switch (scheme.hashCode()) {
                                        case 3699:
                                            if (scheme.equals("tg")) {
                                                c7 = 0;
                                                break;
                                            }
                                            c7 = 65535;
                                            break;
                                        case 3213448:
                                            if (scheme.equals("http")) {
                                                c7 = 1;
                                                break;
                                            }
                                            c7 = 65535;
                                            break;
                                        case 99617003:
                                            if (scheme.equals("https")) {
                                                c7 = 2;
                                                break;
                                            }
                                            c7 = 65535;
                                            break;
                                        default:
                                            c7 = 65535;
                                            break;
                                    }
                                    switch (c7) {
                                        case 0:
                                            String uri7 = data.toString();
                                            if (uri7.startsWith("tg:resolve") || uri7.startsWith("tg://resolve")) {
                                                str18 = null;
                                                j8 = 0;
                                                Uri parse = Uri.parse(uri7.replace("tg:resolve", "tg://telegram.org").replace("tg://resolve", "tg://telegram.org"));
                                                String queryParameter7 = parse.getQueryParameter("domain");
                                                if ("telegrampassport".equals(queryParameter7)) {
                                                    ?? hashMap = new HashMap();
                                                    String queryParameter8 = parse.getQueryParameter("scope");
                                                    if (!TextUtils.isEmpty(queryParameter8) && queryParameter8.startsWith("{") && queryParameter8.endsWith("}")) {
                                                        queryParameter = parse.getQueryParameter("nonce");
                                                        str38 = "nonce";
                                                    } else {
                                                        queryParameter = parse.getQueryParameter("payload");
                                                        str38 = "payload";
                                                    }
                                                    hashMap.put(str38, queryParameter);
                                                    hashMap.put("bot_id", parse.getQueryParameter("bot_id"));
                                                    hashMap.put("scope", queryParameter8);
                                                    hashMap.put("public_key", parse.getQueryParameter("public_key"));
                                                    hashMap.put("callback_url", parse.getQueryParameter("callback_url"));
                                                    str25 = hashMap;
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                    str19 = null;
                                                    str8 = null;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str20 = null;
                                                    str21 = null;
                                                    str22 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                    str26 = null;
                                                    str27 = str26;
                                                    str28 = str27;
                                                    str29 = str28;
                                                    str33 = str29;
                                                    str32 = str33;
                                                    str31 = str32;
                                                    str30 = str31;
                                                    j9 = j8;
                                                    j7 = j9;
                                                    z29 = false;
                                                    i8 = 0;
                                                    c6 = 0;
                                                    z9 = false;
                                                    z27 = false;
                                                    z28 = false;
                                                    z8 = false;
                                                    z7 = false;
                                                    z6 = false;
                                                    z5 = false;
                                                    i9 = -1;
                                                    break;
                                                } else {
                                                    str15 = parse.getQueryParameter("start");
                                                    String queryParameter9 = parse.getQueryParameter("startgroup");
                                                    String queryParameter10 = parse.getQueryParameter("game");
                                                    String queryParameter11 = parse.getQueryParameter("voicechat");
                                                    String queryParameter12 = parse.getQueryParameter("livestream");
                                                    ?? parseInt2 = Utilities.parseInt(parse.getQueryParameter("post"));
                                                    int intValue = parseInt2.intValue();
                                                    String str78 = parseInt2;
                                                    if (intValue == 0) {
                                                        str78 = null;
                                                    }
                                                    ?? parseInt3 = Utilities.parseInt(parse.getQueryParameter("thread"));
                                                    if (parseInt3.intValue() == 0) {
                                                        str36 = str78;
                                                        str37 = null;
                                                    } else {
                                                        str36 = str78;
                                                        str37 = parseInt3;
                                                    }
                                                    ?? parseInt4 = Utilities.parseInt(parse.getQueryParameter("comment"));
                                                    if (parseInt4.intValue() == 0) {
                                                        str31 = queryParameter11;
                                                        str22 = str37;
                                                        str30 = queryParameter12;
                                                        str24 = queryParameter10;
                                                        j9 = 0;
                                                        j7 = 0;
                                                        str20 = str36;
                                                        str12 = null;
                                                        str13 = null;
                                                        str16 = null;
                                                        str18 = null;
                                                        z29 = false;
                                                        i8 = 0;
                                                        c6 = 0;
                                                        z9 = false;
                                                        z27 = false;
                                                        z28 = false;
                                                        z8 = false;
                                                        z7 = false;
                                                        z6 = false;
                                                        z5 = false;
                                                        str8 = null;
                                                        str9 = null;
                                                        str10 = null;
                                                        str11 = null;
                                                        str21 = null;
                                                        str23 = null;
                                                    } else {
                                                        str23 = parseInt4;
                                                        str31 = queryParameter11;
                                                        str22 = str37;
                                                        str30 = queryParameter12;
                                                        str24 = queryParameter10;
                                                        j9 = 0;
                                                        j7 = 0;
                                                        str20 = str36;
                                                        str12 = null;
                                                        str13 = null;
                                                        str16 = null;
                                                        str18 = null;
                                                        z29 = false;
                                                        i8 = 0;
                                                        c6 = 0;
                                                        z9 = false;
                                                        z27 = false;
                                                        z28 = false;
                                                        z8 = false;
                                                        z7 = false;
                                                        z6 = false;
                                                        z5 = false;
                                                        str8 = null;
                                                        str9 = null;
                                                        str10 = null;
                                                        str11 = null;
                                                        str21 = null;
                                                    }
                                                    str25 = null;
                                                    str26 = null;
                                                    str27 = null;
                                                    str28 = null;
                                                    str29 = null;
                                                    str33 = null;
                                                    str32 = null;
                                                    i9 = -1;
                                                    str14 = queryParameter7;
                                                    str19 = queryParameter9;
                                                    str17 = null;
                                                    break;
                                                }
                                            } else if (uri7.startsWith("tg:privatepost") || uri7.startsWith("tg://privatepost")) {
                                                str18 = null;
                                                Uri parse2 = Uri.parse(uri7.replace("tg:privatepost", "tg://telegram.org").replace("tg://privatepost", "tg://telegram.org"));
                                                ?? parseInt5 = Utilities.parseInt(parse2.getQueryParameter("post"));
                                                ?? parseLong = Utilities.parseLong(parse2.getQueryParameter("channel"));
                                                if (parseInt5.intValue() != 0) {
                                                    long longValue = parseLong.longValue();
                                                    j8 = 0;
                                                    str39 = parseLong;
                                                    str40 = parseInt5;
                                                    break;
                                                } else {
                                                    j8 = 0;
                                                }
                                                str39 = null;
                                                str40 = null;
                                                ?? parseInt6 = Utilities.parseInt(parse2.getQueryParameter("thread"));
                                                int intValue2 = parseInt6.intValue();
                                                String str79 = parseInt6;
                                                if (intValue2 == 0) {
                                                    str79 = null;
                                                }
                                                ?? parseInt7 = Utilities.parseInt(parse2.getQueryParameter("comment"));
                                                if (parseInt7.intValue() == 0) {
                                                    str21 = str39;
                                                    str22 = str79;
                                                    str20 = str40;
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                    str19 = null;
                                                    str8 = null;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                } else {
                                                    str23 = parseInt7;
                                                    str21 = str39;
                                                    str22 = str79;
                                                    str20 = str40;
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                    str19 = null;
                                                    str8 = null;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str24 = null;
                                                }
                                                str25 = str24;
                                                str26 = str25;
                                                str27 = str26;
                                                str28 = str27;
                                                str29 = str28;
                                                str33 = str29;
                                                str32 = str33;
                                                str31 = str32;
                                                str30 = str31;
                                                j9 = j8;
                                                j7 = j9;
                                                z29 = false;
                                                i8 = 0;
                                                c6 = 0;
                                                z9 = false;
                                                z27 = false;
                                                z28 = false;
                                                z8 = false;
                                                z7 = false;
                                                z6 = false;
                                                z5 = false;
                                                i9 = -1;
                                            } else if (uri7.startsWith("tg:bg") || uri7.startsWith("tg://bg")) {
                                                Uri parse3 = Uri.parse(uri7.replace("tg:bg", "tg://telegram.org").replace("tg://bg", "tg://telegram.org"));
                                                ?? d17Var = new d17();
                                                d17Var.j = new g17();
                                                String queryParameter13 = parse3.getQueryParameter("slug");
                                                d17Var.h = queryParameter13;
                                                if (queryParameter13 == null) {
                                                    d17Var.h = parse3.getQueryParameter("color");
                                                }
                                                String str80 = d17Var.h;
                                                if (str80 == null || str80.length() != 6) {
                                                    String str81 = d17Var.h;
                                                    if (str81 != null && str81.length() >= 13 && AndroidUtilities.isValidWallChar(d17Var.h.charAt(6))) {
                                                        d17Var.j.d = Integer.parseInt(d17Var.h.substring(0, 6), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                        d17Var.j.e = Integer.parseInt(d17Var.h.substring(7, 13), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                        if (d17Var.h.length() >= 20 && AndroidUtilities.isValidWallChar(d17Var.h.charAt(13))) {
                                                            d17Var.j.f = Integer.parseInt(d17Var.h.substring(14, 20), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                        }
                                                        if (d17Var.h.length() == 27 && AndroidUtilities.isValidWallChar(d17Var.h.charAt(20))) {
                                                            d17Var.j.g = Integer.parseInt(d17Var.h.substring(21), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                        }
                                                        try {
                                                            String queryParameter14 = parse3.getQueryParameter("rotation");
                                                            if (!TextUtils.isEmpty(queryParameter14)) {
                                                                d17Var.j.i = Utilities.parseInt(queryParameter14).intValue();
                                                            }
                                                        } catch (Exception unused) {
                                                        }
                                                        str18 = null;
                                                        try {
                                                            d17Var.h = null;
                                                            z31 = true;
                                                        } catch (Exception unused2) {
                                                        }
                                                    }
                                                    str18 = null;
                                                    z31 = false;
                                                } else {
                                                    d17Var.j.d = Integer.parseInt(d17Var.h, 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                    d17Var.h = null;
                                                    z31 = true;
                                                    str18 = null;
                                                }
                                                if (!z31) {
                                                    String queryParameter15 = parse3.getQueryParameter("mode");
                                                    if (queryParameter15 != null && (split = queryParameter15.toLowerCase().split(" ")) != null && split.length > 0) {
                                                        for (int i18 = 0; i18 < split.length; i18++) {
                                                            if ("blur".equals(split[i18])) {
                                                                d17Var.j.b = true;
                                                            } else if ("motion".equals(split[i18])) {
                                                                d17Var.j.c = true;
                                                            }
                                                        }
                                                    }
                                                    d17Var.j.h = Utilities.parseInt(parse3.getQueryParameter("intensity")).intValue();
                                                    try {
                                                        queryParameter3 = parse3.getQueryParameter("bg_color");
                                                    } catch (Exception unused3) {
                                                    }
                                                    try {
                                                        if (!TextUtils.isEmpty(queryParameter3)) {
                                                            try {
                                                                d17Var.j.d = Integer.parseInt(queryParameter3.substring(0, 6), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                                if (queryParameter3.length() >= 13) {
                                                                    d17Var.j.e = Integer.parseInt(queryParameter3.substring(8, 13), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                                    if (queryParameter3.length() >= 20 && AndroidUtilities.isValidWallChar(queryParameter3.charAt(13))) {
                                                                        d17Var.j.f = Integer.parseInt(queryParameter3.substring(14, 20), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                                    }
                                                                    if (queryParameter3.length() == 27 && AndroidUtilities.isValidWallChar(queryParameter3.charAt(20))) {
                                                                        d17Var.j.g = Integer.parseInt(queryParameter3.substring(21), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                                    }
                                                                }
                                                            } catch (Exception unused4) {
                                                            }
                                                            queryParameter2 = parse3.getQueryParameter("rotation");
                                                            if (!TextUtils.isEmpty(queryParameter2)) {
                                                                d17Var.j.i = Utilities.parseInt(queryParameter2).intValue();
                                                            }
                                                        }
                                                        queryParameter2 = parse3.getQueryParameter("rotation");
                                                        if (!TextUtils.isEmpty(queryParameter2)) {
                                                        }
                                                    } catch (Exception unused5) {
                                                    }
                                                }
                                                str33 = d17Var;
                                                str12 = str18;
                                                str13 = str12;
                                                str14 = str13;
                                                str15 = str14;
                                                str16 = str15;
                                                str17 = str16;
                                                str19 = str17;
                                                str8 = str19;
                                                str9 = str8;
                                                str10 = str9;
                                                str11 = str10;
                                                str20 = str11;
                                                str21 = str20;
                                                str22 = str21;
                                                str23 = str22;
                                                str24 = str23;
                                                str25 = str24;
                                                str26 = str25;
                                                str27 = str26;
                                                str28 = str27;
                                                str29 = str28;
                                                str32 = str29;
                                                str31 = str32;
                                                str30 = str31;
                                                j8 = 0;
                                                z29 = false;
                                                i8 = 0;
                                                c6 = 0;
                                                z9 = false;
                                                z27 = false;
                                                z28 = false;
                                                z8 = false;
                                                z7 = false;
                                                z6 = false;
                                                z5 = false;
                                                j9 = 0;
                                                j7 = 0;
                                                i9 = -1;
                                            } else {
                                                if (uri7.startsWith("tg:join") || uri7.startsWith("tg://join")) {
                                                    str18 = Uri.parse(uri7.replace("tg:join", "tg://telegram.org").replace("tg://join", "tg://telegram.org")).getQueryParameter("invite");
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                } else if (uri7.startsWith("tg:addstickers") || uri7.startsWith("tg://addstickers")) {
                                                    str12 = Uri.parse(uri7.replace("tg:addstickers", "tg://telegram.org").replace("tg://addstickers", "tg://telegram.org")).getQueryParameter("set");
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                    str18 = null;
                                                } else if (uri7.startsWith("tg:msg") || uri7.startsWith("tg://msg") || uri7.startsWith("tg://share") || uri7.startsWith("tg:share")) {
                                                    Uri parse4 = Uri.parse(uri7.replace("tg:msg", "tg://telegram.org").replace("tg://msg", "tg://telegram.org").replace("tg://share", "tg://telegram.org").replace("tg:share", "tg://telegram.org"));
                                                    String queryParameter16 = parse4.getQueryParameter("url");
                                                    if (queryParameter16 != null) {
                                                        str76 = queryParameter16;
                                                    }
                                                    if (parse4.getQueryParameter("text") != null) {
                                                        if (str76.length() > 0) {
                                                            str76 = str76 + "\n";
                                                            z32 = true;
                                                        } else {
                                                            z32 = false;
                                                        }
                                                        str76 = str76 + parse4.getQueryParameter("text");
                                                    } else {
                                                        z32 = false;
                                                    }
                                                    if (str76.length() > 16384) {
                                                        i10 = 0;
                                                        str41 = str76.substring(0, 16384);
                                                    } else {
                                                        i10 = 0;
                                                        str41 = str76;
                                                    }
                                                    while (str41.endsWith("\n")) {
                                                        str41 = str41.substring(i10, str41.length() - 1);
                                                    }
                                                    str17 = str41;
                                                    z29 = z32;
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str18 = null;
                                                    str19 = null;
                                                    j8 = 0;
                                                    i8 = 0;
                                                    c6 = 0;
                                                    z9 = false;
                                                    z27 = false;
                                                    z28 = false;
                                                    z8 = false;
                                                    z7 = false;
                                                    z6 = false;
                                                    z5 = false;
                                                    str8 = null;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str20 = null;
                                                    str21 = null;
                                                    str22 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                    str25 = null;
                                                    str26 = null;
                                                    str27 = null;
                                                    str28 = null;
                                                    str29 = null;
                                                    j9 = 0;
                                                    j7 = 0;
                                                    str33 = null;
                                                    str32 = null;
                                                    str31 = null;
                                                    str30 = null;
                                                    i9 = -1;
                                                } else if (uri7.startsWith("tg:confirmphone") || uri7.startsWith("tg://confirmphone")) {
                                                    Uri parse5 = Uri.parse(uri7.replace("tg:confirmphone", "tg://telegram.org").replace("tg://confirmphone", "tg://telegram.org"));
                                                    str16 = parse5.getQueryParameter("phone");
                                                    str14 = null;
                                                    str15 = null;
                                                    str17 = null;
                                                    str18 = null;
                                                    str19 = null;
                                                    j8 = 0;
                                                    z29 = false;
                                                    i8 = 0;
                                                    c6 = 0;
                                                    z9 = false;
                                                    z27 = false;
                                                    z28 = false;
                                                    z8 = false;
                                                    z7 = false;
                                                    z6 = false;
                                                    z5 = false;
                                                    str8 = null;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str20 = null;
                                                    str21 = null;
                                                    str22 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                    str25 = null;
                                                    str26 = null;
                                                    str27 = null;
                                                    str28 = null;
                                                    str29 = null;
                                                    j9 = 0;
                                                    j7 = 0;
                                                    str33 = null;
                                                    str32 = null;
                                                    str31 = null;
                                                    str30 = null;
                                                    i9 = -1;
                                                    str13 = parse5.getQueryParameter("hash");
                                                    str12 = null;
                                                    break;
                                                } else if (uri7.startsWith("tg:login") || uri7.startsWith("tg://login")) {
                                                    Uri parse6 = Uri.parse(uri7.replace("tg:login", "tg://telegram.org").replace("tg://login", "tg://telegram.org"));
                                                    String queryParameter17 = parse6.getQueryParameter("token");
                                                    int intValue3 = Utilities.parseInt(parse6.getQueryParameter("code")).intValue();
                                                    str28 = intValue3 != 0 ? BuildConfig.FLAVOR + intValue3 : null;
                                                    str29 = queryParameter17;
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                    str18 = null;
                                                    str19 = null;
                                                    j8 = 0;
                                                    z29 = false;
                                                    i8 = 0;
                                                    c6 = 0;
                                                    z9 = false;
                                                    z27 = false;
                                                    z28 = false;
                                                    z8 = false;
                                                    z7 = false;
                                                    z6 = false;
                                                    z5 = false;
                                                    str8 = null;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str20 = null;
                                                    str21 = null;
                                                    str22 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                    str25 = null;
                                                    str26 = null;
                                                    str27 = null;
                                                    j9 = 0;
                                                    j7 = 0;
                                                    str33 = null;
                                                    str32 = null;
                                                    str31 = null;
                                                    str30 = null;
                                                    i9 = -1;
                                                } else if (uri7.startsWith("tg:openmessage") || uri7.startsWith("tg://openmessage")) {
                                                    Uri parse7 = Uri.parse(uri7.replace("tg:openmessage", "tg://telegram.org").replace("tg://openmessage", "tg://telegram.org"));
                                                    String queryParameter18 = parse7.getQueryParameter("user_id");
                                                    String queryParameter19 = parse7.getQueryParameter("chat_id");
                                                    String queryParameter20 = parse7.getQueryParameter("message_id");
                                                    if (queryParameter18 != null) {
                                                        j10 = Long.parseLong(queryParameter18);
                                                        j11 = 0;
                                                        if (queryParameter20 != null) {
                                                            try {
                                                                parseInt = Integer.parseInt(queryParameter20);
                                                            } catch (NumberFormatException unused6) {
                                                            }
                                                            i8 = parseInt;
                                                            j9 = j10;
                                                            j7 = j11;
                                                            str12 = null;
                                                            str13 = null;
                                                            str14 = null;
                                                            str15 = null;
                                                            str16 = null;
                                                            str17 = null;
                                                            str18 = null;
                                                            str19 = null;
                                                            j8 = 0;
                                                            z29 = false;
                                                            c6 = 0;
                                                            z9 = false;
                                                            z27 = false;
                                                            z28 = false;
                                                            z8 = false;
                                                            z7 = false;
                                                            z6 = false;
                                                            z5 = false;
                                                            str8 = null;
                                                            str9 = null;
                                                            str10 = null;
                                                            str11 = null;
                                                            str20 = null;
                                                            str21 = null;
                                                            str22 = null;
                                                            str23 = null;
                                                            str24 = null;
                                                            str25 = null;
                                                            str26 = null;
                                                            str27 = null;
                                                            str28 = null;
                                                            str29 = null;
                                                            str33 = null;
                                                            str32 = null;
                                                            str31 = null;
                                                            str30 = null;
                                                            i9 = -1;
                                                        }
                                                        parseInt = 0;
                                                        i8 = parseInt;
                                                        j9 = j10;
                                                        j7 = j11;
                                                        str12 = null;
                                                        str13 = null;
                                                        str14 = null;
                                                        str15 = null;
                                                        str16 = null;
                                                        str17 = null;
                                                        str18 = null;
                                                        str19 = null;
                                                        j8 = 0;
                                                        z29 = false;
                                                        c6 = 0;
                                                        z9 = false;
                                                        z27 = false;
                                                        z28 = false;
                                                        z8 = false;
                                                        z7 = false;
                                                        z6 = false;
                                                        z5 = false;
                                                        str8 = null;
                                                        str9 = null;
                                                        str10 = null;
                                                        str11 = null;
                                                        str20 = null;
                                                        str21 = null;
                                                        str22 = null;
                                                        str23 = null;
                                                        str24 = null;
                                                        str25 = null;
                                                        str26 = null;
                                                        str27 = null;
                                                        str28 = null;
                                                        str29 = null;
                                                        str33 = null;
                                                        str32 = null;
                                                        str31 = null;
                                                        str30 = null;
                                                        i9 = -1;
                                                    } else {
                                                        if (queryParameter19 != null) {
                                                            j11 = Long.parseLong(queryParameter19);
                                                            j10 = 0;
                                                            if (queryParameter20 != null) {
                                                            }
                                                            parseInt = 0;
                                                            i8 = parseInt;
                                                            j9 = j10;
                                                            j7 = j11;
                                                            str12 = null;
                                                            str13 = null;
                                                            str14 = null;
                                                            str15 = null;
                                                            str16 = null;
                                                            str17 = null;
                                                            str18 = null;
                                                            str19 = null;
                                                            j8 = 0;
                                                            z29 = false;
                                                            c6 = 0;
                                                            z9 = false;
                                                            z27 = false;
                                                            z28 = false;
                                                            z8 = false;
                                                            z7 = false;
                                                            z6 = false;
                                                            z5 = false;
                                                            str8 = null;
                                                            str9 = null;
                                                            str10 = null;
                                                            str11 = null;
                                                            str20 = null;
                                                            str21 = null;
                                                            str22 = null;
                                                            str23 = null;
                                                            str24 = null;
                                                            str25 = null;
                                                            str26 = null;
                                                            str27 = null;
                                                            str28 = null;
                                                            str29 = null;
                                                            str33 = null;
                                                            str32 = null;
                                                            str31 = null;
                                                            str30 = null;
                                                            i9 = -1;
                                                        }
                                                        j10 = 0;
                                                        j11 = 0;
                                                        if (queryParameter20 != null) {
                                                        }
                                                        parseInt = 0;
                                                        i8 = parseInt;
                                                        j9 = j10;
                                                        j7 = j11;
                                                        str12 = null;
                                                        str13 = null;
                                                        str14 = null;
                                                        str15 = null;
                                                        str16 = null;
                                                        str17 = null;
                                                        str18 = null;
                                                        str19 = null;
                                                        j8 = 0;
                                                        z29 = false;
                                                        c6 = 0;
                                                        z9 = false;
                                                        z27 = false;
                                                        z28 = false;
                                                        z8 = false;
                                                        z7 = false;
                                                        z6 = false;
                                                        z5 = false;
                                                        str8 = null;
                                                        str9 = null;
                                                        str10 = null;
                                                        str11 = null;
                                                        str20 = null;
                                                        str21 = null;
                                                        str22 = null;
                                                        str23 = null;
                                                        str24 = null;
                                                        str25 = null;
                                                        str26 = null;
                                                        str27 = null;
                                                        str28 = null;
                                                        str29 = null;
                                                        str33 = null;
                                                        str32 = null;
                                                        str31 = null;
                                                        str30 = null;
                                                        i9 = -1;
                                                    }
                                                } else if (uri7.startsWith("tg:passport") || uri7.startsWith("tg://passport") || uri7.startsWith("tg:secureid")) {
                                                    Uri parse8 = Uri.parse(uri7.replace("tg:passport", "tg://telegram.org").replace("tg://passport", "tg://telegram.org").replace("tg:secureid", "tg://telegram.org"));
                                                    ?? hashMap2 = new HashMap();
                                                    String queryParameter21 = parse8.getQueryParameter("scope");
                                                    if (!TextUtils.isEmpty(queryParameter21) && queryParameter21.startsWith("{") && queryParameter21.endsWith("}")) {
                                                        queryParameter4 = parse8.getQueryParameter("nonce");
                                                        str42 = "nonce";
                                                    } else {
                                                        queryParameter4 = parse8.getQueryParameter("payload");
                                                        str42 = "payload";
                                                    }
                                                    hashMap2.put(str42, queryParameter4);
                                                    hashMap2.put("bot_id", parse8.getQueryParameter("bot_id"));
                                                    hashMap2.put("scope", queryParameter21);
                                                    hashMap2.put("public_key", parse8.getQueryParameter("public_key"));
                                                    hashMap2.put("callback_url", parse8.getQueryParameter("callback_url"));
                                                    str25 = hashMap2;
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                    str18 = null;
                                                    str19 = null;
                                                    j8 = 0;
                                                    z29 = false;
                                                    i8 = 0;
                                                    c6 = 0;
                                                    z9 = false;
                                                    z27 = false;
                                                    z28 = false;
                                                    z8 = false;
                                                    z7 = false;
                                                    z6 = false;
                                                    z5 = false;
                                                    str8 = null;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str20 = null;
                                                    str21 = null;
                                                    str22 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                    str26 = null;
                                                    str27 = null;
                                                    str28 = null;
                                                    str29 = null;
                                                    j9 = 0;
                                                    j7 = 0;
                                                    str33 = null;
                                                    str32 = null;
                                                    str31 = null;
                                                    str30 = null;
                                                    i9 = -1;
                                                } else if (uri7.startsWith("tg:setlanguage") || uri7.startsWith("tg://setlanguage")) {
                                                    str26 = Uri.parse(uri7.replace("tg:setlanguage", "tg://telegram.org").replace("tg://setlanguage", "tg://telegram.org")).getQueryParameter("lang");
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                    str18 = null;
                                                    str19 = null;
                                                    j8 = 0;
                                                    z29 = false;
                                                    i8 = 0;
                                                    c6 = 0;
                                                    z9 = false;
                                                    z27 = false;
                                                    z28 = false;
                                                    z8 = false;
                                                    z7 = false;
                                                    z6 = false;
                                                    z5 = false;
                                                    str8 = null;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str20 = null;
                                                    str21 = null;
                                                    str22 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                    str25 = null;
                                                    str27 = null;
                                                    str28 = null;
                                                    str29 = null;
                                                    j9 = 0;
                                                    j7 = 0;
                                                    str33 = null;
                                                    str32 = null;
                                                    str31 = null;
                                                    str30 = null;
                                                    i9 = -1;
                                                } else if (uri7.startsWith("tg:addtheme") || uri7.startsWith("tg://addtheme")) {
                                                    str32 = Uri.parse(uri7.replace("tg:addtheme", "tg://telegram.org").replace("tg://addtheme", "tg://telegram.org")).getQueryParameter("slug");
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                    str18 = null;
                                                    str19 = null;
                                                    j8 = 0;
                                                    z29 = false;
                                                    i8 = 0;
                                                    c6 = 0;
                                                    z9 = false;
                                                    z27 = false;
                                                    z28 = false;
                                                    z8 = false;
                                                    z7 = false;
                                                    z6 = false;
                                                    z5 = false;
                                                    str8 = null;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str20 = null;
                                                    str21 = null;
                                                    str22 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                    str25 = null;
                                                    str26 = null;
                                                    str27 = null;
                                                    str28 = null;
                                                    str29 = null;
                                                    j9 = 0;
                                                    j7 = 0;
                                                    str33 = null;
                                                    str31 = null;
                                                    str30 = null;
                                                    i9 = -1;
                                                } else if (uri7.startsWith("tg:settings") || uri7.startsWith("tg://settings")) {
                                                    if (uri7.contains("themes")) {
                                                        str12 = null;
                                                        str13 = null;
                                                        str14 = null;
                                                        str15 = null;
                                                        str16 = null;
                                                        str17 = null;
                                                        str18 = null;
                                                        str19 = null;
                                                        j8 = 0;
                                                        z29 = false;
                                                        i8 = 0;
                                                        c6 = 2;
                                                    } else if (uri7.contains("devices")) {
                                                        str12 = null;
                                                        str13 = null;
                                                        str14 = null;
                                                        str15 = null;
                                                        str16 = null;
                                                        str17 = null;
                                                        str18 = null;
                                                        str19 = null;
                                                        j8 = 0;
                                                        z29 = false;
                                                        i8 = 0;
                                                        c6 = 3;
                                                    } else if (uri7.contains("folders")) {
                                                        str12 = null;
                                                        str13 = null;
                                                        str14 = null;
                                                        str15 = null;
                                                        str16 = null;
                                                        str17 = null;
                                                        str18 = null;
                                                        str19 = null;
                                                        j8 = 0;
                                                        z29 = false;
                                                        i8 = 0;
                                                        c6 = 4;
                                                    } else if (uri7.contains("change_number")) {
                                                        str12 = null;
                                                        str13 = null;
                                                        str14 = null;
                                                        str15 = null;
                                                        str16 = null;
                                                        str17 = null;
                                                        str18 = null;
                                                        str19 = null;
                                                        j8 = 0;
                                                        z29 = false;
                                                        i8 = 0;
                                                        c6 = 5;
                                                    } else {
                                                        str12 = null;
                                                        str13 = null;
                                                        str14 = null;
                                                        str15 = null;
                                                        str16 = null;
                                                        str17 = null;
                                                        str18 = null;
                                                        str19 = null;
                                                        j8 = 0;
                                                        z29 = false;
                                                        i8 = 0;
                                                        c6 = 1;
                                                    }
                                                    z9 = false;
                                                    z27 = false;
                                                    z28 = false;
                                                    z8 = false;
                                                    z7 = false;
                                                    z6 = false;
                                                    z5 = false;
                                                    str8 = null;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str20 = null;
                                                    str21 = null;
                                                    str22 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                    str25 = null;
                                                    str26 = null;
                                                    str27 = null;
                                                    str28 = null;
                                                    str29 = null;
                                                    j9 = 0;
                                                    j7 = 0;
                                                    str33 = null;
                                                    str32 = null;
                                                    str31 = null;
                                                    str30 = null;
                                                    i9 = -1;
                                                } else if (uri7.startsWith("tg:search") || uri7.startsWith("tg://search")) {
                                                    String queryParameter22 = Uri.parse(uri7.replace("tg:search", "tg://telegram.org").replace("tg://search", "tg://telegram.org")).getQueryParameter("query");
                                                    if (queryParameter22 != null) {
                                                        str76 = queryParameter22.trim();
                                                    }
                                                    str8 = str76;
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                    str18 = null;
                                                    str19 = null;
                                                    j8 = 0;
                                                    z29 = false;
                                                    i8 = 0;
                                                    c6 = 0;
                                                    z9 = false;
                                                    z27 = false;
                                                    z28 = false;
                                                    z8 = false;
                                                    z7 = false;
                                                    z6 = false;
                                                    z5 = false;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str20 = null;
                                                    str21 = null;
                                                    str22 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                    str25 = null;
                                                    str26 = null;
                                                    str27 = null;
                                                    str28 = null;
                                                    str29 = null;
                                                    j9 = 0;
                                                    j7 = 0;
                                                    str33 = null;
                                                    str32 = null;
                                                    str31 = null;
                                                    str30 = null;
                                                    i9 = -1;
                                                } else if (uri7.startsWith("tg:calllog") || uri7.startsWith("tg://calllog")) {
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                    str18 = null;
                                                    str19 = null;
                                                    j8 = 0;
                                                    z29 = false;
                                                    i8 = 0;
                                                    c6 = 0;
                                                    z9 = true;
                                                    z27 = false;
                                                    z28 = false;
                                                    z8 = false;
                                                    z7 = false;
                                                    z6 = false;
                                                    z5 = false;
                                                    str8 = null;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str20 = null;
                                                    str21 = null;
                                                    str22 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                    str25 = null;
                                                    str26 = null;
                                                    str27 = null;
                                                    str28 = null;
                                                    str29 = null;
                                                    j9 = 0;
                                                    j7 = 0;
                                                    str33 = null;
                                                    str32 = null;
                                                    str31 = null;
                                                    str30 = null;
                                                    i9 = -1;
                                                } else if (uri7.startsWith("tg:call") || uri7.startsWith("tg://call")) {
                                                    if (UserConfig.getInstance(this.e0).isClientActivated()) {
                                                        if (ContactsController.getInstance(this.e0).contactsLoaded || intent.hasExtra("extra_force_call")) {
                                                            String queryParameter23 = data.getQueryParameter("format");
                                                            String queryParameter24 = data.getQueryParameter("name");
                                                            String queryParameter25 = data.getQueryParameter("phone");
                                                            List<xq5> w1 = w1(queryParameter24, queryParameter25, false);
                                                            if (!w1.isEmpty() || queryParameter25 == null) {
                                                                j12 = w1.size() == 1 ? w1.get(0).a : 0L;
                                                                if (j12 != 0) {
                                                                    str76 = null;
                                                                } else if (queryParameter24 != null) {
                                                                    str76 = queryParameter24;
                                                                }
                                                                boolean equalsIgnoreCase = MediaStreamTrack.VIDEO_TRACK_KIND.equalsIgnoreCase(queryParameter23);
                                                                boolean z46 = !equalsIgnoreCase;
                                                                z33 = equalsIgnoreCase;
                                                                str43 = str76;
                                                                z34 = true;
                                                                str44 = null;
                                                                str45 = null;
                                                                z35 = z46;
                                                                z36 = false;
                                                            } else {
                                                                str45 = queryParameter25;
                                                                str44 = queryParameter24;
                                                                z34 = false;
                                                                z36 = true;
                                                                z35 = false;
                                                                z33 = false;
                                                                j12 = 0;
                                                                str43 = null;
                                                            }
                                                        } else {
                                                            final Intent intent2 = new Intent((Intent) intent);
                                                            intent2.removeExtra("actions.fulfillment.extra.ACTION_TOKEN");
                                                            intent2.putExtra("extra_force_call", true);
                                                            ContactsLoadingObserver.observe(new ContactsLoadingObserver.Callback() {
                                                                @Override
                                                                public final void onResult(boolean z47) {
                                                                    LaunchActivity.this.j2(intent2, z47);
                                                                }
                                                            }, 1000L);
                                                            z34 = false;
                                                            z36 = false;
                                                            z35 = false;
                                                            z33 = false;
                                                            j12 = 0;
                                                            str43 = null;
                                                            str44 = null;
                                                            str45 = null;
                                                        }
                                                        z8 = z34;
                                                        z6 = z36;
                                                        z27 = z35;
                                                        z28 = z33;
                                                        j9 = j12;
                                                        str9 = str43;
                                                        str10 = str44;
                                                        str11 = str45;
                                                        str12 = null;
                                                        str13 = null;
                                                        str14 = null;
                                                        str15 = null;
                                                        str16 = null;
                                                        str17 = null;
                                                        str18 = null;
                                                        str19 = null;
                                                        j8 = 0;
                                                        z29 = false;
                                                        i8 = 0;
                                                        c6 = 0;
                                                        z9 = false;
                                                        z7 = false;
                                                        z5 = false;
                                                        str8 = null;
                                                        str20 = null;
                                                        str21 = null;
                                                        str22 = null;
                                                        str23 = null;
                                                        str24 = null;
                                                        str25 = null;
                                                        str26 = null;
                                                        str27 = null;
                                                        str28 = null;
                                                        str29 = null;
                                                        j7 = 0;
                                                        str33 = null;
                                                        str32 = null;
                                                        str31 = null;
                                                        str30 = null;
                                                        i9 = -1;
                                                    }
                                                } else if (uri7.startsWith("tg:scanqr") || uri7.startsWith("tg://scanqr")) {
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                    str18 = null;
                                                    str19 = null;
                                                    j8 = 0;
                                                    z29 = false;
                                                    i8 = 0;
                                                    c6 = 0;
                                                    z9 = false;
                                                    z27 = false;
                                                    z28 = false;
                                                    z8 = false;
                                                    z7 = false;
                                                    z6 = false;
                                                    z5 = true;
                                                    str8 = null;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str20 = null;
                                                    str21 = null;
                                                    str22 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                    str25 = null;
                                                    str26 = null;
                                                    str27 = null;
                                                    str28 = null;
                                                    str29 = null;
                                                    j9 = 0;
                                                    j7 = 0;
                                                    str33 = null;
                                                    str32 = null;
                                                    str31 = null;
                                                    str30 = null;
                                                    i9 = -1;
                                                } else if (uri7.startsWith("tg:addcontact") || uri7.startsWith("tg://addcontact")) {
                                                    Uri parse9 = Uri.parse(uri7.replace("tg:addcontact", "tg://telegram.org").replace("tg://addcontact", "tg://telegram.org"));
                                                    String queryParameter26 = parse9.getQueryParameter("name");
                                                    str11 = parse9.getQueryParameter("phone");
                                                    str10 = queryParameter26;
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                    str18 = null;
                                                    str19 = null;
                                                    j8 = 0;
                                                    z29 = false;
                                                    i8 = 0;
                                                    c6 = 0;
                                                    z9 = false;
                                                    z27 = false;
                                                    z28 = false;
                                                    z8 = false;
                                                    z7 = true;
                                                    z6 = false;
                                                    z5 = false;
                                                    str8 = null;
                                                    str9 = null;
                                                    str20 = null;
                                                    str21 = null;
                                                    str22 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                    str25 = null;
                                                    str26 = null;
                                                    str27 = null;
                                                    str28 = null;
                                                    str29 = null;
                                                    j9 = 0;
                                                    j7 = 0;
                                                    str33 = null;
                                                    str32 = null;
                                                    str31 = null;
                                                    str30 = null;
                                                    i9 = -1;
                                                } else {
                                                    String replace = uri7.replace("tg://", BuildConfig.FLAVOR).replace("tg:", BuildConfig.FLAVOR);
                                                    int indexOf = replace.indexOf(63);
                                                    if (indexOf >= 0) {
                                                        replace = replace.substring(0, indexOf);
                                                    }
                                                    str27 = replace;
                                                    str12 = null;
                                                    str13 = null;
                                                    str14 = null;
                                                    str15 = null;
                                                    str16 = null;
                                                    str17 = null;
                                                    str18 = null;
                                                    str19 = null;
                                                    j8 = 0;
                                                    z29 = false;
                                                    i8 = 0;
                                                    c6 = 0;
                                                    z9 = false;
                                                    z27 = false;
                                                    z28 = false;
                                                    z8 = false;
                                                    z7 = false;
                                                    z6 = false;
                                                    z5 = false;
                                                    str8 = null;
                                                    str9 = null;
                                                    str10 = null;
                                                    str11 = null;
                                                    str20 = null;
                                                    str21 = null;
                                                    str22 = null;
                                                    str23 = null;
                                                    str24 = null;
                                                    str25 = null;
                                                    str26 = null;
                                                    str28 = null;
                                                    str29 = null;
                                                    j9 = 0;
                                                    j7 = 0;
                                                    str33 = null;
                                                    str32 = null;
                                                    str31 = null;
                                                    str30 = null;
                                                    i9 = -1;
                                                }
                                                str19 = null;
                                                j8 = 0;
                                                z29 = false;
                                                i8 = 0;
                                                c6 = 0;
                                                z9 = false;
                                                z27 = false;
                                                z28 = false;
                                                z8 = false;
                                                z7 = false;
                                                z6 = false;
                                                z5 = false;
                                                str8 = null;
                                                str9 = null;
                                                str10 = null;
                                                str11 = null;
                                                str20 = null;
                                                str21 = null;
                                                str22 = null;
                                                str23 = null;
                                                str24 = null;
                                                str25 = null;
                                                str26 = null;
                                                str27 = null;
                                                str28 = null;
                                                str29 = null;
                                                j9 = 0;
                                                j7 = 0;
                                                str33 = null;
                                                str32 = null;
                                                str31 = null;
                                                str30 = null;
                                                i9 = -1;
                                            }
                                            i5 = 0;
                                            if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                                                if (str5 != null) {
                                                    org.telegram.ui.ActionBar.k lastFragment = launchActivity.v.getLastFragment();
                                                    str6 = str4;
                                                    if (lastFragment instanceof p3) {
                                                        p3 p3Var2 = (p3) lastFragment;
                                                        if (p3Var2.h9()) {
                                                            if (p3Var2.R() != null) {
                                                                r6 = 1;
                                                                p3Var2.Ha(str5, true);
                                                            } else {
                                                                r6 = 1;
                                                                p3Var2.Oa(str5);
                                                            }
                                                        }
                                                    } else {
                                                        r6 = 1;
                                                        z14 = true;
                                                    }
                                                    if (j3 != j2) {
                                                        if (j4 == j2) {
                                                            int i19 = i5;
                                                            if (i19 == 0) {
                                                                if (z14) {
                                                                    if (!AndroidUtilities.isTablet()) {
                                                                        launchActivity.v.K0();
                                                                    } else if (!launchActivity.w.v0.isEmpty()) {
                                                                        while (launchActivity.w.v0.size() - r6 > 0) {
                                                                            ActionBarLayout actionBarLayout2 = launchActivity.w;
                                                                            actionBarLayout2.M0(actionBarLayout2.v0.get(0));
                                                                        }
                                                                        z18 = false;
                                                                        launchActivity.w.V(false);
                                                                        z16 = true;
                                                                        z19 = false;
                                                                    }
                                                                    z18 = false;
                                                                    z16 = true;
                                                                    z19 = false;
                                                                } else if (!z13) {
                                                                    z17 = false;
                                                                    z23 = false;
                                                                    z22 = false;
                                                                    z17 = false;
                                                                    z22 = false;
                                                                    z17 = false;
                                                                    z17 = false;
                                                                    r10 = 0;
                                                                    z17 = false;
                                                                    r10 = 0;
                                                                    if (!z12) {
                                                                        Uri uri8 = launchActivity.g;
                                                                        if (uri8 != null) {
                                                                            launchActivity.B3(uri8, launchActivity.f);
                                                                            z16 = true;
                                                                        } else {
                                                                            if (launchActivity.n == null) {
                                                                                if (launchActivity.b == null && launchActivity.d == null && launchActivity.c == null && launchActivity.e == null && launchActivity.j == null && launchActivity.f == null) {
                                                                                    if (c2 != 0) {
                                                                                        if (c2 == r6) {
                                                                                            Bundle bundle = new Bundle();
                                                                                            bundle.putLong("user_id", UserConfig.getInstance(launchActivity.e0).clientUserId);
                                                                                            h4Var = new ProfileActivity(bundle);
                                                                                        } else {
                                                                                            if (c2 == 2) {
                                                                                                me1Var = new ThemeActivity(0);
                                                                                            } else if (c2 == 3) {
                                                                                                me1Var = new le(0);
                                                                                            } else if (c2 == 4) {
                                                                                                me1Var = new me1();
                                                                                            } else if (c2 == 5) {
                                                                                                h4Var = new org.telegram.ui.a(3);
                                                                                                z21 = true;
                                                                                                c3 = 6;
                                                                                                if (c2 == c3) {
                                                                                                    launchActivity.v.E0(h4Var, false, true, true, false);
                                                                                                } else {
                                                                                                    AndroidUtilities.runOnUIThread(new Runnable() {
                                                                                                        @Override
                                                                                                        public final void run() {
                                                                                                            LaunchActivity.this.c2(h4Var, z21);
                                                                                                        }
                                                                                                    });
                                                                                                }
                                                                                                break;
                                                                                            } else {
                                                                                                c3 = 6;
                                                                                                h4Var = c2 == 6 ? new h4(i4, i3) : null;
                                                                                                z21 = false;
                                                                                                if (c2 == c3) {
                                                                                                }
                                                                                            }
                                                                                            h4Var = me1Var;
                                                                                        }
                                                                                        z21 = false;
                                                                                        c3 = 6;
                                                                                        if (c2 == c3) {
                                                                                        }
                                                                                    } else if (z11) {
                                                                                        ?? bundle2 = new Bundle();
                                                                                        bundle2.putBoolean("destroyAfterSelect", r6);
                                                                                        launchActivity.v.E0(new d3(bundle2), false, true, true, false);
                                                                                        break;
                                                                                    } else if (str3 != null) {
                                                                                        ?? bundle3 = new Bundle();
                                                                                        bundle3.putBoolean("destroyAfterSelect", r6);
                                                                                        bundle3.putBoolean("returnAsResult", r6);
                                                                                        bundle3.putBoolean("onlyUsers", r6);
                                                                                        bundle3.putBoolean("allowSelf", false);
                                                                                        d3 d3Var = new d3(bundle3);
                                                                                        d3Var.w2(str3);
                                                                                        d3Var.v2(new d3.t() {
                                                                                            @Override
                                                                                            public final void f(f27 f27Var, String str82, org.telegram.ui.d3 d3Var2) {
                                                                                                LaunchActivity.this.d2(z15, iArr2, f27Var, str82, d3Var2);
                                                                                            }
                                                                                        });
                                                                                        ActionBarLayout actionBarLayout3 = launchActivity.v;
                                                                                        actionBarLayout3.E0(d3Var, actionBarLayout3.getLastFragment() instanceof d3, true, true, false);
                                                                                        break;
                                                                                    } else if (z5) {
                                                                                        final org.telegram.ui.a aVar = new org.telegram.ui.a(5);
                                                                                        aVar.X1(new a.e() {
                                                                                            @Override
                                                                                            public final void a(String str82) {
                                                                                                LaunchActivity.this.h2(aVar, str82);
                                                                                            }
                                                                                        });
                                                                                        launchActivity.v.E0(aVar, false, true, true, false);
                                                                                        break;
                                                                                    } else if (z7) {
                                                                                        j6 j6Var = new j6();
                                                                                        if (str6 != null) {
                                                                                            String[] split3 = str6.split(" ", 2);
                                                                                            j6Var.q2(split3[0], split3.length > r6 ? split3[r6] : null);
                                                                                        }
                                                                                        if (str2 != null) {
                                                                                            j6Var.r2(uw3.i(str2, r6), false);
                                                                                        }
                                                                                        launchActivity.v.E0(j6Var, false, true, true, false);
                                                                                        break;
                                                                                    } else {
                                                                                        String str82 = str2;
                                                                                        final String str83 = str6;
                                                                                        if (z10) {
                                                                                            z16 = true;
                                                                                            p4.K4(this, AccountInstance.getInstance(launchActivity.e0), null, null, false, null);
                                                                                            if (p4.F2 != null) {
                                                                                                p4.G2 = true;
                                                                                            }
                                                                                        } else {
                                                                                            z16 = true;
                                                                                            if (z6) {
                                                                                                final org.telegram.ui.ActionBar.k lastFragment2 = launchActivity.v.getLastFragment();
                                                                                                if (lastFragment2 == null || lastFragment2.c0() == null) {
                                                                                                    z20 = false;
                                                                                                } else {
                                                                                                    final String e22 = j6.e2(launchActivity, UserConfig.getInstance(launchActivity.e0).getCurrentUser(), str82, false);
                                                                                                    lastFragment2.o1(new i.C0142i(lastFragment2.c0()).u(LocaleController.getString("NewContactAlertTitle", R.string.NewContactAlertTitle)).l(AndroidUtilities.replaceTags(LocaleController.formatString("NewContactAlertMessage", R.string.NewContactAlertMessage, uw3.d().c(e22)))).s(LocaleController.getString("NewContactAlertButton", R.string.NewContactAlertButton), new DialogInterface.OnClickListener() {
                                                                                                        @Override
                                                                                                        public final void onClick(DialogInterface dialogInterface, int i20) {
                                                                                                            LaunchActivity.i2(e22, str83, lastFragment2, dialogInterface, i20);
                                                                                                        }
                                                                                                    }).n(LocaleController.getString("Cancel", R.string.Cancel), null).a());
                                                                                                    z20 = true;
                                                                                                }
                                                                                                z18 = z;
                                                                                            } else if (z9) {
                                                                                                launchActivity.v.E0(new v(), false, true, true, false);
                                                                                                if (AndroidUtilities.isTablet()) {
                                                                                                    launchActivity.v.R0();
                                                                                                    launchActivity.x.R0();
                                                                                                    launchActivity.G.q(false, false);
                                                                                                } else {
                                                                                                    launchActivity.G.q(true, false);
                                                                                                }
                                                                                                z18 = z;
                                                                                                z20 = true;
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                    z18 = z;
                                                                                    z16 = true;
                                                                                    z20 = true;
                                                                                } else {
                                                                                    z16 = true;
                                                                                    if (!AndroidUtilities.isTablet()) {
                                                                                        NotificationCenter.getInstance(iArr2[0]).postNotificationName(NotificationCenter.closeChats, new Object[0]);
                                                                                    }
                                                                                    if (j5 == j2) {
                                                                                        launchActivity.t3(false);
                                                                                        z18 = z;
                                                                                        z20 = true;
                                                                                    } else {
                                                                                        ArrayList<Long> arrayList3 = new ArrayList<>();
                                                                                        arrayList3.add(Long.valueOf(j5));
                                                                                        launchActivity.l(null, arrayList3, null, false);
                                                                                    }
                                                                                }
                                                                                if (!z20 && !z18) {
                                                                                    if (!AndroidUtilities.isTablet()) {
                                                                                        if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                                                                                            if (launchActivity.v.v0.isEmpty()) {
                                                                                                p3Var = new p3(r10);
                                                                                                p3Var.Ua(launchActivity.T);
                                                                                                break;
                                                                                            }
                                                                                        } else if (launchActivity.w.v0.isEmpty()) {
                                                                                            actionBarLayout = launchActivity.w;
                                                                                            y5Var = new y5();
                                                                                            actionBarLayout.O(y5Var);
                                                                                            launchActivity.G.q(false, false);
                                                                                        }
                                                                                    } else if (launchActivity.v.v0.isEmpty()) {
                                                                                        if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                                                                                            p3Var = new p3(r10);
                                                                                            p3Var.Ua(launchActivity.T);
                                                                                            break;
                                                                                        } else {
                                                                                            actionBarLayout = launchActivity.v;
                                                                                            y5Var = new y5();
                                                                                            actionBarLayout.O(y5Var);
                                                                                            launchActivity.G.q(false, false);
                                                                                        }
                                                                                    }
                                                                                    launchActivity.v.R0();
                                                                                    if (AndroidUtilities.isTablet()) {
                                                                                        launchActivity.w.R0();
                                                                                        launchActivity.x.R0();
                                                                                    }
                                                                                }
                                                                                if (z41) {
                                                                                    xr7.S1(launchActivity, iArr2[0]);
                                                                                }
                                                                                if (!z10 && !"android.intent.action.MAIN".equals(intent.getAction()) && (p4Var = p4.F2) != null) {
                                                                                    p4Var.dismiss();
                                                                                }
                                                                                intent.setAction(r10);
                                                                                return z20;
                                                                            }
                                                                            AndroidUtilities.runOnUIThread(new Runnable() {
                                                                                @Override
                                                                                public final void run() {
                                                                                    LaunchActivity.this.b2();
                                                                                }
                                                                            });
                                                                        }
                                                                        z18 = z;
                                                                        z19 = z17;
                                                                    } else if (!launchActivity.v.v0.isEmpty()) {
                                                                        kVar = launchActivity.v.v0.get(0);
                                                                        n7Var = new org.telegram.ui.Components.n7(launchActivity, new n7.e() {
                                                                            @Override
                                                                            public final void a(LocationController.SharingLocationInfo sharingLocationInfo) {
                                                                                LaunchActivity.this.a2(iArr2, sharingLocationInfo);
                                                                            }
                                                                        }, null);
                                                                        kVar.o1(n7Var);
                                                                        z22 = z23;
                                                                    }
                                                                    z18 = z;
                                                                    z16 = true;
                                                                    z19 = z22;
                                                                } else if (launchActivity.v.v0.isEmpty()) {
                                                                    z22 = false;
                                                                    z18 = z;
                                                                    z16 = true;
                                                                    z19 = z22;
                                                                } else {
                                                                    kVar = launchActivity.v.v0.get(0);
                                                                    z23 = false;
                                                                    n7Var = new org.telegram.ui.Components.e(launchActivity, null);
                                                                    kVar.o1(n7Var);
                                                                    z22 = z23;
                                                                    z18 = z;
                                                                    z16 = true;
                                                                    z19 = z22;
                                                                }
                                                                z20 = false;
                                                                r10 = z19;
                                                                if (!z20) {
                                                                    if (!AndroidUtilities.isTablet()) {
                                                                    }
                                                                    launchActivity.v.R0();
                                                                    if (AndroidUtilities.isTablet()) {
                                                                    }
                                                                }
                                                                if (z41) {
                                                                }
                                                                if (!z10) {
                                                                    p4Var.dismiss();
                                                                }
                                                                intent.setAction(r10);
                                                                return z20;
                                                            }
                                                            Bundle bundle4 = new Bundle();
                                                            bundle4.putInt("enc_id", i19);
                                                            break;
                                                        } else {
                                                            Bundle bundle5 = new Bundle();
                                                            bundle5.putLong("chat_id", j4);
                                                            if (i2 != 0) {
                                                                bundle5.putInt(str, i2);
                                                            }
                                                            if (!u0.isEmpty()) {
                                                                MessagesController messagesController = MessagesController.getInstance(iArr2[0]);
                                                                ArrayList<org.telegram.ui.ActionBar.k> arrayList4 = u0;
                                                                break;
                                                            }
                                                            break;
                                                        }
                                                    } else if (!z4 && !z15) {
                                                        Bundle bundle6 = new Bundle();
                                                        bundle6.putLong("user_id", j3);
                                                        if (i2 != 0) {
                                                            bundle6.putInt(str, i2);
                                                        }
                                                        if (!u0.isEmpty()) {
                                                            MessagesController messagesController2 = MessagesController.getInstance(iArr2[0]);
                                                            ArrayList<org.telegram.ui.ActionBar.k> arrayList5 = u0;
                                                            break;
                                                        }
                                                        break;
                                                    } else if (z8) {
                                                        org.telegram.ui.ActionBar.k lastFragment3 = launchActivity.v.getLastFragment();
                                                        if (lastFragment3 != null) {
                                                            org.telegram.ui.Components.b.o1(lastFragment3, lastFragment3.W().getUser(Long.valueOf(j3)), z15);
                                                        }
                                                    } else {
                                                        VoIPPendingCall.startOrSchedule(launchActivity, j3, z15, AccountInstance.getInstance(iArr2[0]));
                                                    }
                                                    z18 = z;
                                                    z16 = true;
                                                    r10 = 0;
                                                    if (!z20) {
                                                    }
                                                    if (z41) {
                                                    }
                                                    if (!z10) {
                                                    }
                                                    intent.setAction(r10);
                                                    return z20;
                                                }
                                                str6 = str4;
                                                r6 = 1;
                                                if (j3 != j2) {
                                                }
                                                z18 = z;
                                                z16 = true;
                                                r10 = 0;
                                                if (!z20) {
                                                }
                                                if (z41) {
                                                }
                                                if (!z10) {
                                                }
                                                intent.setAction(r10);
                                                return z20;
                                            }
                                            z16 = true;
                                            z17 = false;
                                            z18 = z;
                                            z19 = z17;
                                            z20 = false;
                                            r10 = z19;
                                            if (!z20) {
                                            }
                                            if (z41) {
                                            }
                                            if (!z10) {
                                            }
                                            intent.setAction(r10);
                                            return z20;
                                        case 1:
                                        case 2:
                                            String lowerCase = data.getHost().toLowerCase();
                                            if (lowerCase.equals("telegram.me") || lowerCase.equals("t.me") || lowerCase.equals("telegram.dog")) {
                                                String path3 = data.getPath();
                                                if (path3 != null && path3.length() > 1) {
                                                    String substring = path3.substring(1);
                                                    if (substring.startsWith("bg/")) {
                                                        ?? d17Var2 = new d17();
                                                        d17Var2.j = new g17();
                                                        String replace2 = substring.replace("bg/", BuildConfig.FLAVOR);
                                                        d17Var2.h = replace2;
                                                        if (replace2 == null || replace2.length() != 6) {
                                                            String str84 = d17Var2.h;
                                                            if (str84 != null && str84.length() >= 13 && AndroidUtilities.isValidWallChar(d17Var2.h.charAt(6))) {
                                                                d17Var2.j.d = Integer.parseInt(d17Var2.h.substring(0, 6), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                                d17Var2.j.e = Integer.parseInt(d17Var2.h.substring(7, 13), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                                if (d17Var2.h.length() >= 20 && AndroidUtilities.isValidWallChar(d17Var2.h.charAt(13))) {
                                                                    d17Var2.j.f = Integer.parseInt(d17Var2.h.substring(14, 20), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                                }
                                                                if (d17Var2.h.length() == 27 && AndroidUtilities.isValidWallChar(d17Var2.h.charAt(20))) {
                                                                    d17Var2.j.g = Integer.parseInt(d17Var2.h.substring(21), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                                }
                                                                try {
                                                                    String queryParameter27 = data.getQueryParameter("rotation");
                                                                    if (!TextUtils.isEmpty(queryParameter27)) {
                                                                        d17Var2.j.i = Utilities.parseInt(queryParameter27).intValue();
                                                                    }
                                                                } catch (Exception unused7) {
                                                                }
                                                                str73 = null;
                                                            }
                                                            z39 = false;
                                                            if (!z39) {
                                                                String queryParameter28 = data.getQueryParameter("mode");
                                                                if (queryParameter28 != null && (split2 = queryParameter28.toLowerCase().split(" ")) != null && split2.length > 0) {
                                                                    for (int i20 = 0; i20 < split2.length; i20++) {
                                                                        if ("blur".equals(split2[i20])) {
                                                                            d17Var2.j.b = true;
                                                                        } else if ("motion".equals(split2[i20])) {
                                                                            d17Var2.j.c = true;
                                                                        }
                                                                    }
                                                                }
                                                                String queryParameter29 = data.getQueryParameter("intensity");
                                                                if (TextUtils.isEmpty(queryParameter29)) {
                                                                    d17Var2.j.h = 50;
                                                                } else {
                                                                    d17Var2.j.h = Utilities.parseInt(queryParameter29).intValue();
                                                                }
                                                                try {
                                                                    queryParameter6 = data.getQueryParameter("bg_color");
                                                                } catch (Exception unused8) {
                                                                }
                                                                if (TextUtils.isEmpty(queryParameter6)) {
                                                                    try {
                                                                        d17Var2.j.d = -1;
                                                                    } catch (Exception unused9) {
                                                                    }
                                                                    queryParameter5 = data.getQueryParameter("rotation");
                                                                    if (!TextUtils.isEmpty(queryParameter5)) {
                                                                    }
                                                                } else {
                                                                    d17Var2.j.d = Integer.parseInt(queryParameter6.substring(0, 6), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                                    if (queryParameter6.length() >= 13) {
                                                                        d17Var2.j.e = Integer.parseInt(queryParameter6.substring(7, 13), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                                        if (queryParameter6.length() >= 20 && AndroidUtilities.isValidWallChar(queryParameter6.charAt(13))) {
                                                                            d17Var2.j.f = Integer.parseInt(queryParameter6.substring(14, 20), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                                        }
                                                                        if (queryParameter6.length() == 27 && AndroidUtilities.isValidWallChar(queryParameter6.charAt(20))) {
                                                                            d17Var2.j.g = Integer.parseInt(queryParameter6.substring(21), 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                                        }
                                                                    }
                                                                    try {
                                                                        queryParameter5 = data.getQueryParameter("rotation");
                                                                        if (!TextUtils.isEmpty(queryParameter5)) {
                                                                            d17Var2.j.i = Utilities.parseInt(queryParameter5).intValue();
                                                                        }
                                                                    } catch (Exception unused10) {
                                                                    }
                                                                }
                                                            }
                                                            str58 = d17Var2;
                                                            z37 = false;
                                                            str46 = null;
                                                            str14 = null;
                                                            i11 = -1;
                                                            str56 = null;
                                                            str55 = null;
                                                            str19 = null;
                                                            str54 = null;
                                                            str53 = null;
                                                            str52 = null;
                                                            str51 = null;
                                                            str50 = null;
                                                            str49 = null;
                                                            str48 = null;
                                                            str47 = null;
                                                            str57 = null;
                                                            str62 = null;
                                                            str61 = null;
                                                            str60 = null;
                                                            str59 = null;
                                                            i9 = i11;
                                                            str15 = str55;
                                                            str17 = str54;
                                                            str24 = str52;
                                                            str31 = str51;
                                                            str30 = str50;
                                                            str26 = str48;
                                                            str32 = str47;
                                                            str28 = str57;
                                                            str33 = str58;
                                                            str20 = str62;
                                                            str21 = str61;
                                                            str22 = str60;
                                                            str23 = str59;
                                                            j8 = 0;
                                                            i8 = 0;
                                                            c6 = 0;
                                                            z9 = false;
                                                            z28 = false;
                                                            z8 = false;
                                                            z7 = false;
                                                            z6 = false;
                                                            z5 = false;
                                                            str8 = null;
                                                            str9 = null;
                                                            str10 = null;
                                                            str11 = null;
                                                            str25 = null;
                                                            str27 = null;
                                                            str29 = null;
                                                            j9 = 0;
                                                            j7 = 0;
                                                            z29 = z37;
                                                            str18 = str46;
                                                            str12 = str56;
                                                            str16 = str53;
                                                            str13 = str49;
                                                            z27 = false;
                                                            break;
                                                        } else {
                                                            d17Var2.j.d = Integer.parseInt(d17Var2.h, 16) | com.batch.android.messaging.view.roundimage.b.v;
                                                            str73 = null;
                                                        }
                                                        d17Var2.h = str73;
                                                        z39 = true;
                                                        if (!z39) {
                                                        }
                                                        str58 = d17Var2;
                                                        z37 = false;
                                                        str46 = null;
                                                        str14 = null;
                                                        i11 = -1;
                                                        str56 = null;
                                                        str55 = null;
                                                        str19 = null;
                                                        str54 = null;
                                                        str53 = null;
                                                        str52 = null;
                                                        str51 = null;
                                                        str50 = null;
                                                        str49 = null;
                                                        str48 = null;
                                                        str47 = null;
                                                        str57 = null;
                                                        str62 = null;
                                                        str61 = null;
                                                        str60 = null;
                                                        str59 = null;
                                                        i9 = i11;
                                                        str15 = str55;
                                                        str17 = str54;
                                                        str24 = str52;
                                                        str31 = str51;
                                                        str30 = str50;
                                                        str26 = str48;
                                                        str32 = str47;
                                                        str28 = str57;
                                                        str33 = str58;
                                                        str20 = str62;
                                                        str21 = str61;
                                                        str22 = str60;
                                                        str23 = str59;
                                                        j8 = 0;
                                                        i8 = 0;
                                                        c6 = 0;
                                                        z9 = false;
                                                        z28 = false;
                                                        z8 = false;
                                                        z7 = false;
                                                        z6 = false;
                                                        z5 = false;
                                                        str8 = null;
                                                        str9 = null;
                                                        str10 = null;
                                                        str11 = null;
                                                        str25 = null;
                                                        str27 = null;
                                                        str29 = null;
                                                        j9 = 0;
                                                        j7 = 0;
                                                        z29 = z37;
                                                        str18 = str46;
                                                        str12 = str56;
                                                        str16 = str53;
                                                        str13 = str49;
                                                        z27 = false;
                                                    } else if (substring.startsWith("login/")) {
                                                        int intValue4 = Utilities.parseInt(substring.replace("login/", BuildConfig.FLAVOR)).intValue();
                                                        str57 = intValue4 != 0 ? BuildConfig.FLAVOR + intValue4 : null;
                                                        z37 = false;
                                                        str46 = null;
                                                        str14 = null;
                                                        i11 = -1;
                                                        str56 = null;
                                                        str55 = null;
                                                        str19 = null;
                                                        str54 = null;
                                                        str53 = null;
                                                        str52 = null;
                                                        str51 = null;
                                                        str50 = null;
                                                        str49 = null;
                                                        str48 = null;
                                                        str47 = null;
                                                        str58 = null;
                                                        str62 = null;
                                                        str61 = null;
                                                        str60 = null;
                                                        str59 = null;
                                                        i9 = i11;
                                                        str15 = str55;
                                                        str17 = str54;
                                                        str24 = str52;
                                                        str31 = str51;
                                                        str30 = str50;
                                                        str26 = str48;
                                                        str32 = str47;
                                                        str28 = str57;
                                                        str33 = str58;
                                                        str20 = str62;
                                                        str21 = str61;
                                                        str22 = str60;
                                                        str23 = str59;
                                                        j8 = 0;
                                                        i8 = 0;
                                                        c6 = 0;
                                                        z9 = false;
                                                        z28 = false;
                                                        z8 = false;
                                                        z7 = false;
                                                        z6 = false;
                                                        z5 = false;
                                                        str8 = null;
                                                        str9 = null;
                                                        str10 = null;
                                                        str11 = null;
                                                        str25 = null;
                                                        str27 = null;
                                                        str29 = null;
                                                        j9 = 0;
                                                        j7 = 0;
                                                        z29 = z37;
                                                        str18 = str46;
                                                        str12 = str56;
                                                        str16 = str53;
                                                        str13 = str49;
                                                        z27 = false;
                                                    } else {
                                                        if (substring.startsWith("joinchat/")) {
                                                            str72 = "joinchat/";
                                                        } else if (substring.startsWith("+")) {
                                                            str72 = "+";
                                                        } else if (substring.startsWith("addstickers/")) {
                                                            str56 = substring.replace("addstickers/", BuildConfig.FLAVOR);
                                                            z37 = false;
                                                            str46 = null;
                                                            str14 = null;
                                                            i11 = -1;
                                                            str55 = null;
                                                            str19 = null;
                                                            str54 = null;
                                                            str53 = null;
                                                            str52 = null;
                                                            str51 = null;
                                                            str50 = null;
                                                            str49 = null;
                                                            str48 = null;
                                                            str47 = null;
                                                            str57 = null;
                                                            str58 = null;
                                                            str62 = null;
                                                            str61 = null;
                                                            str60 = null;
                                                            str59 = null;
                                                            i9 = i11;
                                                            str15 = str55;
                                                            str17 = str54;
                                                            str24 = str52;
                                                            str31 = str51;
                                                            str30 = str50;
                                                            str26 = str48;
                                                            str32 = str47;
                                                            str28 = str57;
                                                            str33 = str58;
                                                            str20 = str62;
                                                            str21 = str61;
                                                            str22 = str60;
                                                            str23 = str59;
                                                            j8 = 0;
                                                            i8 = 0;
                                                            c6 = 0;
                                                            z9 = false;
                                                            z28 = false;
                                                            z8 = false;
                                                            z7 = false;
                                                            z6 = false;
                                                            z5 = false;
                                                            str8 = null;
                                                            str9 = null;
                                                            str10 = null;
                                                            str11 = null;
                                                            str25 = null;
                                                            str27 = null;
                                                            str29 = null;
                                                            j9 = 0;
                                                            j7 = 0;
                                                            z29 = z37;
                                                            str18 = str46;
                                                            str12 = str56;
                                                            str16 = str53;
                                                            str13 = str49;
                                                            z27 = false;
                                                        } else if (substring.startsWith("msg/") || substring.startsWith("share/")) {
                                                            String queryParameter30 = data.getQueryParameter("url");
                                                            if (queryParameter30 != null) {
                                                                str76 = queryParameter30;
                                                            }
                                                            if (data.getQueryParameter("text") != null) {
                                                                if (str76.length() > 0) {
                                                                    str76 = str76 + "\n";
                                                                    z38 = true;
                                                                } else {
                                                                    z38 = false;
                                                                }
                                                                str76 = str76 + data.getQueryParameter("text");
                                                            } else {
                                                                z38 = false;
                                                            }
                                                            if (str76.length() > 16384) {
                                                                i12 = 0;
                                                                str63 = str76.substring(0, 16384);
                                                            } else {
                                                                i12 = 0;
                                                                str63 = str76;
                                                            }
                                                            while (str63.endsWith("\n")) {
                                                                str63 = str63.substring(i12, str63.length() - 1);
                                                            }
                                                            str54 = str63;
                                                            z37 = z38;
                                                            str46 = null;
                                                            str14 = null;
                                                            i11 = -1;
                                                            str56 = null;
                                                            str55 = null;
                                                            str19 = null;
                                                            str53 = null;
                                                            str52 = null;
                                                            str51 = null;
                                                            str50 = null;
                                                            str49 = null;
                                                            str48 = null;
                                                            str47 = null;
                                                            str57 = null;
                                                            str58 = null;
                                                            str62 = null;
                                                            str61 = null;
                                                            str60 = null;
                                                            str59 = null;
                                                            i9 = i11;
                                                            str15 = str55;
                                                            str17 = str54;
                                                            str24 = str52;
                                                            str31 = str51;
                                                            str30 = str50;
                                                            str26 = str48;
                                                            str32 = str47;
                                                            str28 = str57;
                                                            str33 = str58;
                                                            str20 = str62;
                                                            str21 = str61;
                                                            str22 = str60;
                                                            str23 = str59;
                                                            j8 = 0;
                                                            i8 = 0;
                                                            c6 = 0;
                                                            z9 = false;
                                                            z28 = false;
                                                            z8 = false;
                                                            z7 = false;
                                                            z6 = false;
                                                            z5 = false;
                                                            str8 = null;
                                                            str9 = null;
                                                            str10 = null;
                                                            str11 = null;
                                                            str25 = null;
                                                            str27 = null;
                                                            str29 = null;
                                                            j9 = 0;
                                                            j7 = 0;
                                                            z29 = z37;
                                                            str18 = str46;
                                                            str12 = str56;
                                                            str16 = str53;
                                                            str13 = str49;
                                                            z27 = false;
                                                        } else if (substring.startsWith("confirmphone")) {
                                                            String queryParameter31 = data.getQueryParameter("phone");
                                                            str49 = data.getQueryParameter("hash");
                                                            str53 = queryParameter31;
                                                            z37 = false;
                                                            str46 = null;
                                                            str14 = null;
                                                            i11 = -1;
                                                            str56 = null;
                                                            str55 = null;
                                                            str19 = null;
                                                            str54 = null;
                                                            str52 = null;
                                                            str51 = null;
                                                            str50 = null;
                                                            str48 = null;
                                                            str47 = null;
                                                            str57 = null;
                                                            str58 = null;
                                                            str62 = null;
                                                            str61 = null;
                                                            str60 = null;
                                                            str59 = null;
                                                            i9 = i11;
                                                            str15 = str55;
                                                            str17 = str54;
                                                            str24 = str52;
                                                            str31 = str51;
                                                            str30 = str50;
                                                            str26 = str48;
                                                            str32 = str47;
                                                            str28 = str57;
                                                            str33 = str58;
                                                            str20 = str62;
                                                            str21 = str61;
                                                            str22 = str60;
                                                            str23 = str59;
                                                            j8 = 0;
                                                            i8 = 0;
                                                            c6 = 0;
                                                            z9 = false;
                                                            z28 = false;
                                                            z8 = false;
                                                            z7 = false;
                                                            z6 = false;
                                                            z5 = false;
                                                            str8 = null;
                                                            str9 = null;
                                                            str10 = null;
                                                            str11 = null;
                                                            str25 = null;
                                                            str27 = null;
                                                            str29 = null;
                                                            j9 = 0;
                                                            j7 = 0;
                                                            z29 = z37;
                                                            str18 = str46;
                                                            str12 = str56;
                                                            str16 = str53;
                                                            str13 = str49;
                                                            z27 = false;
                                                        } else if (substring.startsWith("setlanguage/")) {
                                                            str48 = substring.substring(12);
                                                            z37 = false;
                                                            str46 = null;
                                                            str14 = null;
                                                            i11 = -1;
                                                            str56 = null;
                                                            str55 = null;
                                                            str19 = null;
                                                            str54 = null;
                                                            str53 = null;
                                                            str52 = null;
                                                            str51 = null;
                                                            str50 = null;
                                                            str49 = null;
                                                            str47 = null;
                                                            str57 = null;
                                                            str58 = null;
                                                            str62 = null;
                                                            str61 = null;
                                                            str60 = null;
                                                            str59 = null;
                                                            i9 = i11;
                                                            str15 = str55;
                                                            str17 = str54;
                                                            str24 = str52;
                                                            str31 = str51;
                                                            str30 = str50;
                                                            str26 = str48;
                                                            str32 = str47;
                                                            str28 = str57;
                                                            str33 = str58;
                                                            str20 = str62;
                                                            str21 = str61;
                                                            str22 = str60;
                                                            str23 = str59;
                                                            j8 = 0;
                                                            i8 = 0;
                                                            c6 = 0;
                                                            z9 = false;
                                                            z28 = false;
                                                            z8 = false;
                                                            z7 = false;
                                                            z6 = false;
                                                            z5 = false;
                                                            str8 = null;
                                                            str9 = null;
                                                            str10 = null;
                                                            str11 = null;
                                                            str25 = null;
                                                            str27 = null;
                                                            str29 = null;
                                                            j9 = 0;
                                                            j7 = 0;
                                                            z29 = z37;
                                                            str18 = str46;
                                                            str12 = str56;
                                                            str16 = str53;
                                                            str13 = str49;
                                                            z27 = false;
                                                        } else if (substring.startsWith("addtheme/")) {
                                                            str47 = substring.substring(9);
                                                            z37 = false;
                                                            str46 = null;
                                                            str14 = null;
                                                            i11 = -1;
                                                            str56 = null;
                                                            str55 = null;
                                                            str19 = null;
                                                            str54 = null;
                                                            str53 = null;
                                                            str52 = null;
                                                            str51 = null;
                                                            str50 = null;
                                                            str49 = null;
                                                            str48 = null;
                                                            str57 = null;
                                                            str58 = null;
                                                            str62 = null;
                                                            str61 = null;
                                                            str60 = null;
                                                            str59 = null;
                                                            i9 = i11;
                                                            str15 = str55;
                                                            str17 = str54;
                                                            str24 = str52;
                                                            str31 = str51;
                                                            str30 = str50;
                                                            str26 = str48;
                                                            str32 = str47;
                                                            str28 = str57;
                                                            str33 = str58;
                                                            str20 = str62;
                                                            str21 = str61;
                                                            str22 = str60;
                                                            str23 = str59;
                                                            j8 = 0;
                                                            i8 = 0;
                                                            c6 = 0;
                                                            z9 = false;
                                                            z28 = false;
                                                            z8 = false;
                                                            z7 = false;
                                                            z6 = false;
                                                            z5 = false;
                                                            str8 = null;
                                                            str9 = null;
                                                            str10 = null;
                                                            str11 = null;
                                                            str25 = null;
                                                            str27 = null;
                                                            str29 = null;
                                                            j9 = 0;
                                                            j7 = 0;
                                                            z29 = z37;
                                                            str18 = str46;
                                                            str12 = str56;
                                                            str16 = str53;
                                                            str13 = str49;
                                                            z27 = false;
                                                        } else if (substring.startsWith("c/")) {
                                                            List<String> pathSegments = data.getPathSegments();
                                                            if (pathSegments.size() == 3) {
                                                                ?? parseLong2 = Utilities.parseLong(pathSegments.get(1));
                                                                ?? parseInt8 = Utilities.parseInt(pathSegments.get(2));
                                                                if (parseInt8.intValue() != 0) {
                                                                    long longValue2 = parseLong2.longValue();
                                                                    str70 = parseInt8;
                                                                    str71 = parseLong2;
                                                                    break;
                                                                }
                                                                str70 = null;
                                                                str71 = null;
                                                                ?? parseInt9 = Utilities.parseInt(data.getQueryParameter("thread"));
                                                                int intValue5 = parseInt9.intValue();
                                                                str67 = parseInt9;
                                                                str68 = str70;
                                                                str69 = str71;
                                                                if (intValue5 == 0) {
                                                                    str67 = null;
                                                                    str68 = str70;
                                                                    str69 = str71;
                                                                }
                                                            } else {
                                                                str67 = null;
                                                                str68 = null;
                                                                str69 = null;
                                                            }
                                                            str60 = str67;
                                                            str62 = str68;
                                                            str61 = str69;
                                                            z37 = false;
                                                            str46 = null;
                                                            str14 = null;
                                                            i11 = -1;
                                                            str56 = null;
                                                            str55 = null;
                                                            str19 = null;
                                                            str54 = null;
                                                            str53 = null;
                                                            str52 = null;
                                                            str51 = null;
                                                            str50 = null;
                                                            str49 = null;
                                                            str48 = null;
                                                            str47 = null;
                                                            str57 = null;
                                                            str58 = null;
                                                            str59 = null;
                                                            i9 = i11;
                                                            str15 = str55;
                                                            str17 = str54;
                                                            str24 = str52;
                                                            str31 = str51;
                                                            str30 = str50;
                                                            str26 = str48;
                                                            str32 = str47;
                                                            str28 = str57;
                                                            str33 = str58;
                                                            str20 = str62;
                                                            str21 = str61;
                                                            str22 = str60;
                                                            str23 = str59;
                                                            j8 = 0;
                                                            i8 = 0;
                                                            c6 = 0;
                                                            z9 = false;
                                                            z28 = false;
                                                            z8 = false;
                                                            z7 = false;
                                                            z6 = false;
                                                            z5 = false;
                                                            str8 = null;
                                                            str9 = null;
                                                            str10 = null;
                                                            str11 = null;
                                                            str25 = null;
                                                            str27 = null;
                                                            str29 = null;
                                                            j9 = 0;
                                                            j7 = 0;
                                                            z29 = z37;
                                                            str18 = str46;
                                                            str12 = str56;
                                                            str16 = str53;
                                                            str13 = str49;
                                                            z27 = false;
                                                        } else if (substring.length() >= 1) {
                                                            ArrayList arrayList6 = new ArrayList(data.getPathSegments());
                                                            if (arrayList6.size() > 0) {
                                                                i13 = 0;
                                                                if (((String) arrayList6.get(0)).equals("s")) {
                                                                    arrayList6.remove(0);
                                                                }
                                                            } else {
                                                                i13 = 0;
                                                            }
                                                            if (arrayList6.size() > 0) {
                                                                str14 = (String) arrayList6.get(i13);
                                                                if (arrayList6.size() > 1) {
                                                                    ?? parseInt10 = Utilities.parseInt((CharSequence) arrayList6.get(1));
                                                                    int intValue6 = parseInt10.intValue();
                                                                    str64 = parseInt10;
                                                                    break;
                                                                }
                                                                str64 = null;
                                                            } else {
                                                                str64 = null;
                                                                str14 = null;
                                                            }
                                                            i11 = str64 != null ? C1(data) : -1;
                                                            str55 = data.getQueryParameter("start");
                                                            str19 = data.getQueryParameter("startgroup");
                                                            String str85 = str64;
                                                            String queryParameter32 = data.getQueryParameter("game");
                                                            String queryParameter33 = data.getQueryParameter("voicechat");
                                                            String queryParameter34 = data.getQueryParameter("livestream");
                                                            ?? parseInt11 = Utilities.parseInt(data.getQueryParameter("thread"));
                                                            if (parseInt11.intValue() == 0) {
                                                                str65 = queryParameter34;
                                                                str66 = null;
                                                            } else {
                                                                str65 = queryParameter34;
                                                                str66 = parseInt11;
                                                            }
                                                            ?? parseInt12 = Utilities.parseInt(data.getQueryParameter("comment"));
                                                            str62 = str85;
                                                            if (parseInt12.intValue() == 0) {
                                                                str60 = str66;
                                                                str51 = queryParameter33;
                                                                str50 = str65;
                                                                z37 = false;
                                                                str46 = null;
                                                                str56 = null;
                                                                str53 = null;
                                                                str49 = null;
                                                                str48 = null;
                                                                str47 = null;
                                                                str57 = null;
                                                                str58 = null;
                                                                str61 = null;
                                                                str59 = null;
                                                            } else {
                                                                str59 = parseInt12;
                                                                str60 = str66;
                                                                str51 = queryParameter33;
                                                                str50 = str65;
                                                                z37 = false;
                                                                str46 = null;
                                                                str56 = null;
                                                                str53 = null;
                                                                str49 = null;
                                                                str48 = null;
                                                                str47 = null;
                                                                str57 = null;
                                                                str58 = null;
                                                                str61 = null;
                                                            }
                                                            str52 = queryParameter32;
                                                            str54 = null;
                                                            i9 = i11;
                                                            str15 = str55;
                                                            str17 = str54;
                                                            str24 = str52;
                                                            str31 = str51;
                                                            str30 = str50;
                                                            str26 = str48;
                                                            str32 = str47;
                                                            str28 = str57;
                                                            str33 = str58;
                                                            str20 = str62;
                                                            str21 = str61;
                                                            str22 = str60;
                                                            str23 = str59;
                                                            j8 = 0;
                                                            i8 = 0;
                                                            c6 = 0;
                                                            z9 = false;
                                                            z28 = false;
                                                            z8 = false;
                                                            z7 = false;
                                                            z6 = false;
                                                            z5 = false;
                                                            str8 = null;
                                                            str9 = null;
                                                            str10 = null;
                                                            str11 = null;
                                                            str25 = null;
                                                            str27 = null;
                                                            str29 = null;
                                                            j9 = 0;
                                                            j7 = 0;
                                                            z29 = z37;
                                                            str18 = str46;
                                                            str12 = str56;
                                                            str16 = str53;
                                                            str13 = str49;
                                                            z27 = false;
                                                        }
                                                        str46 = substring.replace(str72, BuildConfig.FLAVOR);
                                                        z37 = false;
                                                        str14 = null;
                                                        i11 = -1;
                                                        str56 = null;
                                                        str55 = null;
                                                        str19 = null;
                                                        str54 = null;
                                                        str53 = null;
                                                        str52 = null;
                                                        str51 = null;
                                                        str50 = null;
                                                        str49 = null;
                                                        str48 = null;
                                                        str47 = null;
                                                        str57 = null;
                                                        str58 = null;
                                                        str62 = null;
                                                        str61 = null;
                                                        str60 = null;
                                                        str59 = null;
                                                        i9 = i11;
                                                        str15 = str55;
                                                        str17 = str54;
                                                        str24 = str52;
                                                        str31 = str51;
                                                        str30 = str50;
                                                        str26 = str48;
                                                        str32 = str47;
                                                        str28 = str57;
                                                        str33 = str58;
                                                        str20 = str62;
                                                        str21 = str61;
                                                        str22 = str60;
                                                        str23 = str59;
                                                        j8 = 0;
                                                        i8 = 0;
                                                        c6 = 0;
                                                        z9 = false;
                                                        z28 = false;
                                                        z8 = false;
                                                        z7 = false;
                                                        z6 = false;
                                                        z5 = false;
                                                        str8 = null;
                                                        str9 = null;
                                                        str10 = null;
                                                        str11 = null;
                                                        str25 = null;
                                                        str27 = null;
                                                        str29 = null;
                                                        j9 = 0;
                                                        j7 = 0;
                                                        z29 = z37;
                                                        str18 = str46;
                                                        str12 = str56;
                                                        str16 = str53;
                                                        str13 = str49;
                                                        z27 = false;
                                                    }
                                                }
                                                z37 = false;
                                                str46 = null;
                                                str14 = null;
                                                i11 = -1;
                                                str56 = null;
                                                str55 = null;
                                                str19 = null;
                                                str54 = null;
                                                str53 = null;
                                                str52 = null;
                                                str51 = null;
                                                str50 = null;
                                                str49 = null;
                                                str48 = null;
                                                str47 = null;
                                                str57 = null;
                                                str58 = null;
                                                str62 = null;
                                                str61 = null;
                                                str60 = null;
                                                str59 = null;
                                                i9 = i11;
                                                str15 = str55;
                                                str17 = str54;
                                                str24 = str52;
                                                str31 = str51;
                                                str30 = str50;
                                                str26 = str48;
                                                str32 = str47;
                                                str28 = str57;
                                                str33 = str58;
                                                str20 = str62;
                                                str21 = str61;
                                                str22 = str60;
                                                str23 = str59;
                                                j8 = 0;
                                                i8 = 0;
                                                c6 = 0;
                                                z9 = false;
                                                z28 = false;
                                                z8 = false;
                                                z7 = false;
                                                z6 = false;
                                                z5 = false;
                                                str8 = null;
                                                str9 = null;
                                                str10 = null;
                                                str11 = null;
                                                str25 = null;
                                                str27 = null;
                                                str29 = null;
                                                j9 = 0;
                                                j7 = 0;
                                                z29 = z37;
                                                str18 = str46;
                                                str12 = str56;
                                                str16 = str53;
                                                str13 = str49;
                                                z27 = false;
                                            }
                                            break;
                                    }
                                    if (intent.hasExtra("actions.fulfillment.extra.ACTION_TOKEN")) {
                                        str34 = "hash";
                                        str35 = "message_id";
                                    } else {
                                        str35 = "message_id";
                                        str34 = "hash";
                                        jg1.b(this).a(new org.telegram.messenger.p110.xb().i(intent.getStringExtra("actions.fulfillment.extra.ACTION_TOKEN")).c(UserConfig.getInstance(this.e0).isClientActivated() && "tg".equals(scheme) && str27 == null ? "http://schema.org/CompletedActionStatus" : "http://schema.org/FailedActionStatus").a());
                                        intent.removeExtra("actions.fulfillment.extra.ACTION_TOKEN");
                                    }
                                    if (str28 != null && !UserConfig.getInstance(this.e0).isClientActivated()) {
                                        iArr = iArr2;
                                        launchActivity = this;
                                        j2 = j8;
                                        str7 = str35;
                                    } else if (str16 == null || str13 != null) {
                                        iArr = iArr2;
                                        j2 = j8;
                                        str7 = str35;
                                        final Bundle bundle7 = new Bundle();
                                        bundle7.putString("phone", str16);
                                        bundle7.putString(str34, str13);
                                        launchActivity = this;
                                        AndroidUtilities.runOnUIThread(new Runnable() {
                                            @Override
                                            public final void run() {
                                                LaunchActivity.this.k2(bundle7);
                                            }
                                        });
                                    } else if (str14 == null && str18 == null && str12 == null && str17 == null && str24 == null && str31 == null && str25 == null && str27 == null && str26 == null && str28 == null && str33 == null && str21 == null && str32 == null && str29 == null) {
                                        try {
                                            query = getContentResolver().query(intent.getData(), null, null, null, null);
                                        } catch (Exception e6) {
                                            e = e6;
                                        }
                                        if (query != null) {
                                            try {
                                                if (query.moveToFirst()) {
                                                    int intValue7 = Utilities.parseInt(query.getString(query.getColumnIndex("account_name"))).intValue();
                                                    int i21 = 0;
                                                    while (true) {
                                                        if (i21 < 3) {
                                                            try {
                                                                if (UserConfig.getInstance(i21).getClientUserId() == intValue7) {
                                                                    iArr2[0] = i21;
                                                                    M3(iArr2[0], true);
                                                                } else {
                                                                    try {
                                                                        i21++;
                                                                    } catch (Throwable th3) {
                                                                        th = th3;
                                                                        try {
                                                                            query.close();
                                                                        } catch (Throwable unused11) {
                                                                        }
                                                                        try {
                                                                            throw th;
                                                                        } catch (Exception e7) {
                                                                            e = e7;
                                                                            FileLog.e(e);
                                                                            iArr = iArr2;
                                                                            launchActivity = this;
                                                                            j2 = j8;
                                                                            i7 = i8;
                                                                            c5 = c6;
                                                                            j6 = j9;
                                                                            str7 = str35;
                                                                            j3 = j6;
                                                                            i2 = i7;
                                                                            c2 = c5;
                                                                            z4 = z27;
                                                                            z15 = z28;
                                                                            str5 = str8;
                                                                            str3 = str9;
                                                                            str4 = str10;
                                                                            str2 = str11;
                                                                            j4 = j7;
                                                                            j5 = j2;
                                                                            iArr2 = iArr;
                                                                            str = str7;
                                                                            i3 = -1;
                                                                            i4 = -1;
                                                                            z14 = false;
                                                                            z13 = false;
                                                                            z12 = false;
                                                                            z11 = false;
                                                                            z10 = false;
                                                                            i5 = 0;
                                                                            if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                                                                            }
                                                                            z16 = true;
                                                                            z17 = false;
                                                                            z18 = z;
                                                                            z19 = z17;
                                                                            z20 = false;
                                                                            r10 = z19;
                                                                            if (!z20) {
                                                                            }
                                                                            if (z41) {
                                                                            }
                                                                            if (!z10) {
                                                                            }
                                                                            intent.setAction(r10);
                                                                            return z20;
                                                                        }
                                                                    }
                                                                }
                                                            } catch (Throwable th4) {
                                                                th = th4;
                                                                query.close();
                                                                throw th;
                                                            }
                                                        }
                                                    }
                                                    long j14 = query.getLong(query.getColumnIndex("data4"));
                                                    NotificationCenter.getInstance(iArr2[0]).postNotificationName(NotificationCenter.closeChats, new Object[0]);
                                                    try {
                                                        String string2 = query.getString(query.getColumnIndex("mimetype"));
                                                        if (TextUtils.equals(string2, "vnd.android.cursor.item/vnd.org.telegram.messenger.android.call")) {
                                                            j9 = j14;
                                                            z30 = true;
                                                        } else {
                                                            j9 = j14;
                                                            z30 = z27;
                                                            if (TextUtils.equals(string2, "vnd.android.cursor.item/vnd.org.telegram.messenger.android.call.video")) {
                                                                z28 = true;
                                                            }
                                                        }
                                                        if (query != null) {
                                                            try {
                                                                query.close();
                                                            } catch (Exception e8) {
                                                                e = e8;
                                                                z27 = z30;
                                                                FileLog.e(e);
                                                                iArr = iArr2;
                                                                launchActivity = this;
                                                                j2 = j8;
                                                                i7 = i8;
                                                                c5 = c6;
                                                                j6 = j9;
                                                                str7 = str35;
                                                                j3 = j6;
                                                                i2 = i7;
                                                                c2 = c5;
                                                                z4 = z27;
                                                                z15 = z28;
                                                                str5 = str8;
                                                                str3 = str9;
                                                                str4 = str10;
                                                                str2 = str11;
                                                                j4 = j7;
                                                                j5 = j2;
                                                                iArr2 = iArr;
                                                                str = str7;
                                                                i3 = -1;
                                                                i4 = -1;
                                                                z14 = false;
                                                                z13 = false;
                                                                z12 = false;
                                                                z11 = false;
                                                                z10 = false;
                                                                i5 = 0;
                                                                if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                                                                }
                                                                z16 = true;
                                                                z17 = false;
                                                                z18 = z;
                                                                z19 = z17;
                                                                z20 = false;
                                                                r10 = z19;
                                                                if (!z20) {
                                                                }
                                                                if (z41) {
                                                                }
                                                                if (!z10) {
                                                                }
                                                                intent.setAction(r10);
                                                                return z20;
                                                            }
                                                        }
                                                        z27 = z30;
                                                        iArr = iArr2;
                                                        launchActivity = this;
                                                        j2 = j8;
                                                        i7 = i8;
                                                        c5 = c6;
                                                        j6 = j9;
                                                        str7 = str35;
                                                    } catch (Throwable th5) {
                                                        th = th5;
                                                        j9 = j14;
                                                        query.close();
                                                        throw th;
                                                    }
                                                }
                                            } catch (Throwable th6) {
                                                th = th6;
                                            }
                                        }
                                        z30 = z27;
                                        if (query != null) {
                                        }
                                        z27 = z30;
                                        iArr = iArr2;
                                        launchActivity = this;
                                        j2 = j8;
                                        i7 = i8;
                                        c5 = c6;
                                        j6 = j9;
                                        str7 = str35;
                                    } else {
                                        j2 = j8;
                                        iArr = iArr2;
                                        str7 = str35;
                                        C3(iArr2[0], str14, str18, str12, str15, str19, (str17 == null || !str17.startsWith("@")) ? str17 : " " + str17, z29, str20, str21, str22, str23, str24, str25, str26, str27, str28, str29, str33, str32, str31, str30, 0, i9);
                                        launchActivity = this;
                                    }
                                    i7 = i8;
                                    c5 = c6;
                                    j6 = j9;
                                }
                                j8 = 0;
                                j9 = 0;
                                j7 = 0;
                                str12 = null;
                                str13 = null;
                                str14 = null;
                                str15 = null;
                                str16 = null;
                                str17 = null;
                                str18 = null;
                                str19 = null;
                                z29 = false;
                                i8 = 0;
                                c6 = 0;
                                z9 = false;
                                z27 = false;
                                z28 = false;
                                z8 = false;
                                z7 = false;
                                z6 = false;
                                z5 = false;
                                str8 = null;
                                str9 = null;
                                str10 = null;
                                str11 = null;
                                str20 = null;
                                str21 = null;
                                str22 = null;
                                str23 = null;
                                str24 = null;
                                str25 = null;
                                str26 = null;
                                str27 = null;
                                str28 = null;
                                str29 = null;
                                str33 = null;
                                str32 = null;
                                str31 = null;
                                str30 = null;
                                i9 = -1;
                                if (intent.hasExtra("actions.fulfillment.extra.ACTION_TOKEN")) {
                                }
                                if (str28 != null) {
                                }
                                if (str16 == null) {
                                }
                                iArr = iArr2;
                                j2 = j8;
                                str7 = str35;
                                final Bundle bundle72 = new Bundle();
                                bundle72.putString("phone", str16);
                                bundle72.putString(str34, str13);
                                launchActivity = this;
                                AndroidUtilities.runOnUIThread(new Runnable() {
                                    @Override
                                    public final void run() {
                                        LaunchActivity.this.k2(bundle72);
                                    }
                                });
                                i7 = i8;
                                c5 = c6;
                                j6 = j9;
                            } else {
                                str7 = "message_id";
                                iArr = iArr2;
                                launchActivity = this;
                                j2 = 0;
                                j6 = 0;
                                j7 = 0;
                                i7 = 0;
                                c5 = 0;
                                z9 = false;
                                z27 = false;
                                z28 = false;
                                z8 = false;
                                z7 = false;
                                z6 = false;
                                z5 = false;
                                str8 = null;
                                str9 = null;
                                str10 = null;
                                str11 = null;
                            }
                            j3 = j6;
                            i2 = i7;
                            c2 = c5;
                            z4 = z27;
                            z15 = z28;
                            str5 = str8;
                            str3 = str9;
                            str4 = str10;
                            str2 = str11;
                            j4 = j7;
                            j5 = j2;
                            iArr2 = iArr;
                            str = str7;
                            i3 = -1;
                            i4 = -1;
                            z14 = false;
                            z13 = false;
                            z12 = false;
                            z11 = false;
                            z10 = false;
                            i5 = 0;
                            if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                            }
                            z16 = true;
                            z17 = false;
                            z18 = z;
                            z19 = z17;
                            z20 = false;
                            r10 = z19;
                            if (!z20) {
                            }
                            if (z41) {
                            }
                            if (!z10) {
                            }
                            intent.setAction(r10);
                            return z20;
                        }
                        launchActivity = this;
                        int i22 = -1;
                        j2 = 0;
                        if (intent.getAction().equals("org.telegram.messenger.OPEN_ACCOUNT")) {
                            j3 = 0;
                            j4 = 0;
                            j5 = 0;
                            iArr2 = iArr2;
                            str = "message_id";
                            str2 = null;
                            i3 = -1;
                            str3 = null;
                            i4 = -1;
                            str4 = null;
                            c2 = 1;
                        } else {
                            if (intent.getAction().equals("new_dialog")) {
                                j3 = 0;
                                j4 = 0;
                                j5 = 0;
                                iArr2 = iArr2;
                                str = "message_id";
                                str2 = null;
                                i3 = -1;
                                str3 = null;
                                i4 = -1;
                                str4 = null;
                                c2 = 0;
                                str5 = null;
                                i2 = 0;
                                z15 = false;
                                z14 = false;
                                z13 = false;
                                z12 = false;
                                z11 = true;
                                z10 = false;
                                z9 = false;
                                z8 = false;
                                z7 = false;
                                z6 = false;
                                z5 = false;
                                z4 = false;
                                i5 = 0;
                                if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                                }
                                z16 = true;
                                z17 = false;
                                z18 = z;
                                z19 = z17;
                                z20 = false;
                                r10 = z19;
                                if (!z20) {
                                }
                                if (z41) {
                                }
                                if (!z10) {
                                }
                                intent.setAction(r10);
                                return z20;
                            }
                            if (intent.getAction().startsWith("com.tmessages.openchat")) {
                                long longExtra = intent.getLongExtra("chatId", intent.getIntExtra("chatId", 0));
                                j3 = intent.getLongExtra("userId", intent.getIntExtra("userId", 0));
                                int intExtra2 = intent.getIntExtra("encId", 0);
                                int intExtra3 = intent.getIntExtra("appWidgetId", 0);
                                if (intExtra3 != 0) {
                                    i4 = intent.getIntExtra("appWidgetType", 0);
                                    i22 = intExtra3;
                                    longExtra = 0;
                                    j3 = 0;
                                    iArr2 = iArr2;
                                    str = "message_id";
                                    intExtra = 0;
                                    c4 = 6;
                                } else {
                                    str = "message_id";
                                    intExtra = intent.getIntExtra(str, 0);
                                    iArr2 = iArr2;
                                    if (longExtra != 0) {
                                        NotificationCenter.getInstance(iArr2[0]).postNotificationName(NotificationCenter.closeChats, new Object[0]);
                                        j3 = 0;
                                    } else {
                                        if (j3 == 0) {
                                            if (intExtra2 == 0) {
                                                longExtra = 0;
                                                j3 = 0;
                                                i4 = -1;
                                                c4 = 0;
                                                i6 = 0;
                                                z26 = true;
                                                i2 = intExtra;
                                                c2 = c4;
                                                i5 = i6;
                                                z14 = z26;
                                                j5 = 0;
                                                str2 = null;
                                                str4 = null;
                                                str5 = null;
                                                z15 = false;
                                                z13 = false;
                                                z12 = false;
                                                z11 = false;
                                                z10 = false;
                                                z9 = false;
                                                z8 = false;
                                                z7 = false;
                                                z6 = false;
                                                z5 = false;
                                                z4 = false;
                                                j4 = longExtra;
                                                i3 = i22;
                                                str3 = null;
                                                if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                                                }
                                                z16 = true;
                                                z17 = false;
                                                z18 = z;
                                                z19 = z17;
                                                z20 = false;
                                                r10 = z19;
                                                if (!z20) {
                                                }
                                                if (z41) {
                                                }
                                                if (!z10) {
                                                }
                                                intent.setAction(r10);
                                                return z20;
                                            }
                                            NotificationCenter.getInstance(iArr2[0]).postNotificationName(NotificationCenter.closeChats, new Object[0]);
                                            i6 = intExtra2;
                                            longExtra = 0;
                                            j3 = 0;
                                            i4 = -1;
                                            c4 = 0;
                                            z26 = false;
                                            i2 = intExtra;
                                            c2 = c4;
                                            i5 = i6;
                                            z14 = z26;
                                            j5 = 0;
                                            str2 = null;
                                            str4 = null;
                                            str5 = null;
                                            z15 = false;
                                            z13 = false;
                                            z12 = false;
                                            z11 = false;
                                            z10 = false;
                                            z9 = false;
                                            z8 = false;
                                            z7 = false;
                                            z6 = false;
                                            z5 = false;
                                            z4 = false;
                                            j4 = longExtra;
                                            i3 = i22;
                                            str3 = null;
                                            if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                                            }
                                            z16 = true;
                                            z17 = false;
                                            z18 = z;
                                            z19 = z17;
                                            z20 = false;
                                            r10 = z19;
                                            if (!z20) {
                                            }
                                            if (z41) {
                                            }
                                            if (!z10) {
                                            }
                                            intent.setAction(r10);
                                            return z20;
                                        }
                                        NotificationCenter.getInstance(iArr2[0]).postNotificationName(NotificationCenter.closeChats, new Object[0]);
                                        longExtra = 0;
                                    }
                                    i4 = -1;
                                    c4 = 0;
                                }
                                i6 = 0;
                                z26 = false;
                                i2 = intExtra;
                                c2 = c4;
                                i5 = i6;
                                z14 = z26;
                                j5 = 0;
                                str2 = null;
                                str4 = null;
                                str5 = null;
                                z15 = false;
                                z13 = false;
                                z12 = false;
                                z11 = false;
                                z10 = false;
                                z9 = false;
                                z8 = false;
                                z7 = false;
                                z6 = false;
                                z5 = false;
                                z4 = false;
                                j4 = longExtra;
                                i3 = i22;
                                str3 = null;
                                if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                                }
                                z16 = true;
                                z17 = false;
                                z18 = z;
                                z19 = z17;
                                z20 = false;
                                r10 = z19;
                                if (!z20) {
                                }
                                if (z41) {
                                }
                                if (!z10) {
                                }
                                intent.setAction(r10);
                                return z20;
                            }
                            iArr2 = iArr2;
                            str = "message_id";
                            i2 = 0;
                            if (intent.getAction().equals("com.tmessages.openplayer")) {
                                j3 = 0;
                                j4 = 0;
                                j5 = 0;
                                str2 = null;
                                i3 = -1;
                                str3 = null;
                                i4 = -1;
                                str4 = null;
                                c2 = 0;
                                str5 = null;
                                z15 = false;
                                z14 = false;
                                z13 = true;
                                z12 = false;
                                z11 = false;
                                z10 = false;
                                z9 = false;
                                z8 = false;
                                z7 = false;
                                z6 = false;
                                z5 = false;
                                z4 = false;
                                i5 = 0;
                                if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                                }
                                z16 = true;
                                z17 = false;
                                z18 = z;
                                z19 = z17;
                                z20 = false;
                                r10 = z19;
                                if (!z20) {
                                }
                                if (z41) {
                                }
                                if (!z10) {
                                }
                                intent.setAction(r10);
                                return z20;
                            }
                            if (intent.getAction().equals("org.tmessages.openlocations")) {
                                j3 = 0;
                                j4 = 0;
                                j5 = 0;
                                str2 = null;
                                i3 = -1;
                                str3 = null;
                                i4 = -1;
                                str4 = null;
                                c2 = 0;
                                str5 = null;
                                z15 = false;
                                z14 = false;
                                z13 = false;
                                z12 = true;
                                z11 = false;
                                z10 = false;
                                z9 = false;
                                z8 = false;
                                z7 = false;
                                z6 = false;
                                z5 = false;
                                z4 = false;
                                i5 = 0;
                                if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                                }
                                z16 = true;
                                z17 = false;
                                z18 = z;
                                z19 = z17;
                                z20 = false;
                                r10 = z19;
                                if (!z20) {
                                }
                                if (z41) {
                                }
                                if (!z10) {
                                }
                                intent.setAction(r10);
                                return z20;
                            }
                            if (action.equals("voip_chat")) {
                                j3 = 0;
                                j4 = 0;
                                j5 = 0;
                                str2 = null;
                                i3 = -1;
                                str3 = null;
                                i4 = -1;
                                str4 = null;
                                c2 = 0;
                                str5 = null;
                                z15 = false;
                                z14 = false;
                                z13 = false;
                                z12 = false;
                                z11 = false;
                                z10 = true;
                                z9 = false;
                                z8 = false;
                                z7 = false;
                                z6 = false;
                                z5 = false;
                                z4 = false;
                                i5 = 0;
                                if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                                }
                                z16 = true;
                                z17 = false;
                                z18 = z;
                                z19 = z17;
                                z20 = false;
                                r10 = z19;
                                if (!z20) {
                                }
                                if (z41) {
                                }
                                if (!z10) {
                                }
                                intent.setAction(r10);
                                return z20;
                            }
                        }
                    }
                    j3 = j2;
                    j4 = j3;
                    j5 = j4;
                    str2 = null;
                    i3 = -1;
                    str3 = null;
                    i4 = -1;
                    str4 = null;
                    c2 = 0;
                    str5 = null;
                    z15 = false;
                    z14 = false;
                    z13 = false;
                    z12 = false;
                    z11 = false;
                    z10 = false;
                    z9 = false;
                    z8 = false;
                    z7 = false;
                    z6 = false;
                    z5 = false;
                    z4 = false;
                    i5 = 0;
                    if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
                    }
                    z16 = true;
                    z17 = false;
                    z18 = z;
                    z19 = z17;
                    z20 = false;
                    r10 = z19;
                    if (!z20) {
                    }
                    if (z41) {
                    }
                    if (!z10) {
                    }
                    intent.setAction(r10);
                    return z20;
                }
                try {
                    this.n = intent.getParcelableArrayListExtra("android.intent.extra.STREAM");
                    this.o = intent.getStringArrayListExtra("STICKER_EMOJIS");
                    this.p = intent.getStringExtra("IMPORTER");
                } catch (Throwable th7) {
                    FileLog.e(th7);
                    this.n = null;
                    this.o = null;
                    this.p = null;
                }
            }
            str5 = null;
            i2 = 0;
            z15 = false;
            z14 = false;
            z13 = false;
            z12 = false;
            z11 = false;
            z10 = false;
            z9 = false;
            z8 = false;
            z7 = false;
            z6 = false;
            z5 = false;
            z4 = false;
            i5 = 0;
            if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
            }
            z16 = true;
            z17 = false;
            z18 = z;
            z19 = z17;
            z20 = false;
            r10 = z19;
            if (!z20) {
            }
            if (z41) {
            }
            if (!z10) {
            }
            intent.setAction(r10);
            return z20;
        }
        j2 = 0;
        str = "message_id";
        launchActivity = this;
        i2 = 0;
        j3 = j2;
        j4 = j3;
        j5 = j4;
        str2 = null;
        i3 = -1;
        str3 = null;
        i4 = -1;
        str4 = null;
        c2 = 0;
        str5 = null;
        z15 = false;
        z14 = false;
        z13 = false;
        z12 = false;
        z11 = false;
        z10 = false;
        z9 = false;
        z8 = false;
        z7 = false;
        z6 = false;
        z5 = false;
        z4 = false;
        i5 = 0;
        if (UserConfig.getInstance(launchActivity.e0).isClientActivated()) {
        }
        z16 = true;
        z17 = false;
        z18 = z;
        z19 = z17;
        z20 = false;
        r10 = z19;
        if (!z20) {
        }
        if (z41) {
        }
        if (!z10) {
        }
        intent.setAction(r10);
        return z20;
    }

    public void D2(final String str, final String str2, final String str3, final int i2, final Integer num, final Integer num2, final Integer num3, final int[] iArr, final org.telegram.ui.ActionBar.i iVar, final String str4, final String str5, final int i3, final i95 i95Var, final ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.C2(i95Var, ov5Var, str, str2, str3, i2, num, num2, num3, iArr, iVar, str4, str5, i3);
            }
        }, 2L);
    }

    public static void E2(boolean[] zArr, DialogInterface dialogInterface) {
        zArr[0] = true;
    }

    private void F1(View view) {
        if (view.getLayerType() != 0) {
            view.invalidate();
        }
        if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            for (int i2 = 0; i2 < viewGroup.getChildCount(); i2++) {
                F1(viewGroup.getChildAt(i2));
            }
        }
    }

    public void F2(ov5 ov5Var, i95 i95Var, int i2, org.telegram.ui.ActionBar.i iVar, String str) {
        int i3;
        String str2;
        if (isFinishing()) {
            return;
        }
        boolean z = true;
        if (ov5Var != null || this.v == null) {
            i.C0142i c0142i = new i.C0142i(this);
            c0142i.u(LocaleController.getString("AppName", R.string.AppName));
            if (ov5Var.b.startsWith("FLOOD_WAIT")) {
                i3 = R.string.FloodWait;
                str2 = "FloodWait";
            } else if (ov5Var.b.startsWith("INVITE_HASH_EXPIRED")) {
                c0142i.u(LocaleController.getString("ExpiredLink", R.string.ExpiredLink));
                i3 = R.string.InviteExpired;
                str2 = "InviteExpired";
            } else {
                i3 = R.string.JoinToGroupErrorNotExist;
                str2 = "JoinToGroupErrorNotExist";
            }
            c0142i.l(LocaleController.getString(str2, i3));
            c0142i.s(LocaleController.getString("OK", R.string.OK), null);
            D3(c0142i);
        } else {
            w95 w95Var = (w95) i95Var;
            u95 u95Var = w95Var.l;
            if (u95Var != null) {
                if (ChatObject.isLeftFromChat(u95Var)) {
                    u95 u95Var2 = w95Var.l;
                    if (!u95Var2.f) {
                        if (TextUtils.isEmpty(u95Var2.v)) {
                            if (!(w95Var instanceof xp5)) {
                            }
                        }
                    }
                }
                MessagesController.getInstance(i2).putChat(w95Var.l, false);
                ArrayList<u95> arrayList = new ArrayList<>();
                arrayList.add(w95Var.l);
                MessagesStorage.getInstance(i2).putUsersAndChats(null, arrayList, false, true);
                Bundle bundle = new Bundle();
                bundle.putLong("chat_id", w95Var.l.a);
                if (!u0.isEmpty()) {
                    MessagesController messagesController = MessagesController.getInstance(i2);
                    ArrayList<org.telegram.ui.ActionBar.k> arrayList2 = u0;
                }
                final boolean[] zArr = new boolean[1];
                iVar.setOnCancelListener(new DialogInterface.OnCancelListener() {
                    @Override
                    public final void onCancel(DialogInterface dialogInterface) {
                        LaunchActivity.E2(zArr, dialogInterface);
                    }
                });
                MessagesController.getInstance(i2).ensureMessagesLoaded(-w95Var.l.a, 0, new f(iVar, zArr, bundle, w95Var));
                z = false;
            }
            ArrayList<org.telegram.ui.ActionBar.k> arrayList3 = u0;
            org.telegram.ui.ActionBar.k kVar = arrayList3.get(arrayList3.size() - 1);
            kVar.o1(new org.telegram.ui.Components.v4(this, w95Var, str, kVar));
        }
        if (z) {
            try {
                iVar.dismiss();
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        }
    }

    private void F3(boolean z) {
        try {
            if (!this.b0 && !ApplicationLoader.mainInterfacePaused) {
                String string = MessagesController.getGlobalMainSettings().getString("language_showed2", BuildConfig.FLAVOR);
                final String str = MessagesController.getInstance(this.e0).suggestedLangCode;
                if (!z && string.equals(str)) {
                    if (BuildVars.LOGS_ENABLED) {
                        FileLog.d("alert already showed for " + string);
                        return;
                    }
                    return;
                }
                final LocaleController.LocaleInfo[] localeInfoArr = new LocaleController.LocaleInfo[2];
                String str2 = str.contains("-") ? str.split("-")[0] : str;
                String str3 = "in".equals(str2) ? b.a.b : "iw".equals(str2) ? "he" : "jw".equals(str2) ? "jv" : null;
                for (int i2 = 0; i2 < LocaleController.getInstance().languages.size(); i2++) {
                    LocaleController.LocaleInfo localeInfo = LocaleController.getInstance().languages.get(i2);
                    if (localeInfo.shortName.equals("en")) {
                        localeInfoArr[0] = localeInfo;
                    }
                    if (localeInfo.shortName.replace("_", "-").equals(str) || localeInfo.shortName.equals(str2) || localeInfo.shortName.equals(str3)) {
                        localeInfoArr[1] = localeInfo;
                    }
                    if (localeInfoArr[0] != null && localeInfoArr[1] != null) {
                        break;
                    }
                }
                if (localeInfoArr[0] != null && localeInfoArr[1] != null && localeInfoArr[0] != localeInfoArr[1]) {
                    if (BuildVars.LOGS_ENABLED) {
                        FileLog.d("show lang alert for " + localeInfoArr[0].getKey() + " and " + localeInfoArr[1].getKey());
                    }
                    this.c0 = null;
                    this.d0 = null;
                    this.b0 = true;
                    j46 j46Var = new j46();
                    j46Var.a = localeInfoArr[1].getLangCode();
                    j46Var.b.add("English");
                    j46Var.b.add("ChooseYourLanguage");
                    j46Var.b.add("ChooseYourLanguageOther");
                    j46Var.b.add("ChangeLanguageLater");
                    ConnectionsManager.getInstance(this.e0).sendRequest(j46Var, new RequestDelegate() {
                        @Override
                        public final void run(i95 i95Var, ov5 ov5Var) {
                            LaunchActivity.this.g3(localeInfoArr, str, i95Var, ov5Var);
                        }
                    }, 8);
                    j46 j46Var2 = new j46();
                    j46Var2.a = localeInfoArr[0].getLangCode();
                    j46Var2.b.add("English");
                    j46Var2.b.add("ChooseYourLanguage");
                    j46Var2.b.add("ChooseYourLanguageOther");
                    j46Var2.b.add("ChangeLanguageLater");
                    ConnectionsManager.getInstance(this.e0).sendRequest(j46Var2, new RequestDelegate() {
                        @Override
                        public final void run(i95 i95Var, ov5 ov5Var) {
                            LaunchActivity.this.i3(localeInfoArr, str, i95Var, ov5Var);
                        }
                    }, 8);
                }
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    public void G2(final int i2, final org.telegram.ui.ActionBar.i iVar, final String str, final i95 i95Var, final ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.F2(ov5Var, i95Var, i2, iVar, str);
            }
        });
    }

    private void G3(LocaleController.LocaleInfo localeInfo, LocaleController.LocaleInfo localeInfo2, String str) {
    }

    public void H1() {
        P3(this.e0);
    }

    public void H2(org.telegram.ui.ActionBar.i iVar, ov5 ov5Var, i95 i95Var, int i2) {
        int i3;
        String str;
        if (isFinishing()) {
            return;
        }
        try {
            iVar.dismiss();
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        if (ov5Var != null) {
            i.C0142i c0142i = new i.C0142i(this);
            c0142i.u(LocaleController.getString("AppName", R.string.AppName));
            if (ov5Var.b.startsWith("FLOOD_WAIT")) {
                i3 = R.string.FloodWait;
                str = "FloodWait";
            } else if (ov5Var.b.equals("USERS_TOO_MUCH")) {
                i3 = R.string.JoinToGroupErrorFull;
                str = "JoinToGroupErrorFull";
            } else {
                i3 = R.string.JoinToGroupErrorNotExist;
                str = "JoinToGroupErrorNotExist";
            }
            c0142i.l(LocaleController.getString(str, i3));
            c0142i.s(LocaleController.getString("OK", R.string.OK), null);
            D3(c0142i);
            return;
        }
        if (this.v != null) {
            d27 d27Var = (d27) i95Var;
            if (d27Var.chats.isEmpty()) {
                return;
            }
            u95 u95Var = d27Var.chats.get(0);
            u95Var.h = false;
            u95Var.f = false;
            MessagesController.getInstance(i2).putUsers(d27Var.users, false);
            MessagesController.getInstance(i2).putChats(d27Var.chats, false);
            Bundle bundle = new Bundle();
            bundle.putLong("chat_id", u95Var.a);
            if (!u0.isEmpty()) {
                if (!MessagesController.getInstance(i2).checkCanOpenChat(bundle, u0.get(r0.size() - 1))) {
                    return;
                }
            }
            v0 v0Var = new v0(bundle);
            NotificationCenter.getInstance(i2).postNotificationName(NotificationCenter.closeChats, new Object[0]);
            this.v.E0(v0Var, false, true, true, false);
        }
    }

    public void I1() {
        try {
            org.telegram.ui.Components.b.C1(this).show();
        } catch (Throwable unused) {
        }
    }

    public void I2(final int i2, final org.telegram.ui.ActionBar.i iVar, final i95 i95Var, final ov5 ov5Var) {
        if (ov5Var == null) {
            MessagesController.getInstance(i2).processUpdates((d27) i95Var, false);
        }
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.H2(iVar, ov5Var, i95Var, i2);
            }
        });
    }

    private void I3(String str) {
        i.C0142i c0142i = new i.C0142i(this);
        c0142i.u(LocaleController.getString("AppName", R.string.AppName));
        c0142i.l(str);
        c0142i.n(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i2) {
                LaunchActivity.this.l3(dialogInterface, i2);
            }
        });
        c0142i.s(LocaleController.getString("OK", R.string.OK), null);
        c0142i.C();
    }

    public void J1() {
        File directory;
        if (UserConfig.getInstance(this.e0).isClientActivated()) {
            try {
                SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
                if (Math.abs(globalMainSettings.getLong("last_space_check", 0L) - System.currentTimeMillis()) < 259200000 || (directory = FileLoader.getDirectory(4)) == null) {
                    return;
                }
                StatFs statFs = new StatFs(directory.getAbsolutePath());
                if ((Build.VERSION.SDK_INT < 18 ? Math.abs(statFs.getAvailableBlocks() * statFs.getBlockSize()) : statFs.getBlockSizeLong() * statFs.getAvailableBlocksLong()) < 104857600) {
                    globalMainSettings.edit().putLong("last_space_check", System.currentTimeMillis()).commit();
                    AndroidUtilities.runOnUIThread(new Runnable() {
                        @Override
                        public final void run() {
                            LaunchActivity.this.I1();
                        }
                    });
                }
            } catch (Throwable unused) {
            }
        }
    }

    public void J2(boolean z, int i2, String str, p3 p3Var, ArrayList arrayList, CharSequence charSequence, boolean z2) {
        long longValue = ((Long) arrayList.get(0)).longValue();
        Bundle bundle = new Bundle();
        bundle.putBoolean("scrollToTopOnResume", true);
        bundle.putBoolean("hasUrl", z);
        if (DialogObject.isEncryptedDialog(longValue)) {
            bundle.putInt("enc_id", DialogObject.getEncryptedChatId(longValue));
        } else if (DialogObject.isUserDialog(longValue)) {
            bundle.putLong("user_id", longValue);
        } else {
            bundle.putLong("chat_id", -longValue);
        }
        if (MessagesController.getInstance(i2).checkCanOpenChat(bundle, p3Var)) {
            NotificationCenter.getInstance(i2).postNotificationName(NotificationCenter.closeChats, new Object[0]);
            MediaDataController.getInstance(i2).saveDraft(longValue, 0, str, null, null, false);
            this.v.E0(new v0(bundle), true, false, true, false);
        }
    }

    private void J3(int i2, px5 px5Var) {
        if (this.J == null) {
            v67 v67Var = new v67(this);
            this.J = v67Var;
            v67Var.setAlpha(0.0f);
            this.G.addView(this.J, g52.a(-1, -1.0f));
            this.J.setDelegate(new c());
        }
        px5 px5Var2 = UserConfig.getInstance(i2).unacceptedTermsOfService;
        if (px5Var2 != px5Var && (px5Var2 == null || !px5Var2.c.a.equals(px5Var.c.a))) {
            UserConfig.getInstance(i2).unacceptedTermsOfService = px5Var;
            UserConfig.getInstance(i2).saveConfig(false);
        }
        this.J.s(i2, px5Var);
        this.G.q(false, false);
        this.J.animate().alpha(1.0f).setDuration(150L).setInterpolator(AndroidUtilities.decelerateInterpolator).setListener(null).start();
    }

    public void K1(DialogInterface dialogInterface, int i2) {
        try {
            startActivity(new Intent("android.settings.action.MANAGE_OVERLAY_PERMISSION", Uri.parse("package:" + getPackageName())));
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    public void K2(org.telegram.ui.ActionBar.i iVar, i95 i95Var, int i2, ld5 ld5Var, ae5 ae5Var, String str, String str2, String str3) {
        try {
            iVar.dismiss();
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        if (i95Var != null) {
            MessagesController.getInstance(i2).putUsers(ld5Var.e, false);
            S2(new w6(5, ae5Var.a, ae5Var.b, ae5Var.c, str, str2, str3, ld5Var, (te5) i95Var));
        }
    }

    private void K3(int i2, lw5 lw5Var, boolean z) {
        if (this.Q == null) {
            b bVar = new b(this);
            this.Q = bVar;
            this.G.addView(bVar, g52.a(-1, -1.0f));
        }
        this.Q.r(i2, lw5Var, z);
        this.G.q(false, false);
    }

    public void L1(View view) {
        if (SharedConfig.isAppUpdateAvailable()) {
            if (this.W.c() == 2) {
                FileLoader.getInstance(this.e0).loadFile(SharedConfig.pendingAppUpdate.g, "update", 1, 1);
            } else {
                if (this.W.c() != 3) {
                    AndroidUtilities.openForView(SharedConfig.pendingAppUpdate.g, true, (Activity) this);
                    return;
                }
                FileLoader.getInstance(this.e0).cancelLoadFile(SharedConfig.pendingAppUpdate.g);
            }
            O3(true);
        }
    }

    public void L2(final org.telegram.ui.ActionBar.i iVar, final int i2, final ld5 ld5Var, final ae5 ae5Var, final String str, final String str2, final String str3, final i95 i95Var, ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.K2(iVar, i95Var, i2, ld5Var, ae5Var, str, str2, str3);
            }
        });
    }

    private void L3(int i2) {
        UndoView n7;
        VoIPService sharedInstance = VoIPService.getSharedInstance();
        if (sharedInstance == null || u0.isEmpty() || sharedInstance.groupCall == null || u0.isEmpty()) {
            return;
        }
        u95 chat = sharedInstance.getChat();
        org.telegram.ui.ActionBar.k kVar = this.v.v0.get(r1.size() - 1);
        if (kVar instanceof v0) {
            v0 v0Var = (v0) kVar;
            if (v0Var.Th() == (-chat.a)) {
                chat = null;
            }
            n7 = v0Var.oi();
        } else {
            if (!(kVar instanceof p3)) {
                if (kVar instanceof ProfileActivity) {
                    n7 = ((ProfileActivity) kVar).n7();
                }
                if (i2 == 38 || VoIPService.getSharedInstance() == null) {
                }
                VoIPService.getSharedInstance().playAllowTalkSound();
                return;
            }
            n7 = ((p3) kVar).a9();
        }
        n7.z(0L, i2, chat);
        if (i2 == 38) {
        }
    }

    public static void M1(int i2, DialogInterface dialogInterface, int i3) {
        if (u0.isEmpty()) {
            return;
        }
        MessagesController messagesController = MessagesController.getInstance(i2);
        ArrayList<org.telegram.ui.ActionBar.k> arrayList = u0;
        messagesController.openByUserName("spambot", arrayList.get(arrayList.size() - 1), 1);
    }

    public void M2(org.telegram.ui.ActionBar.i iVar, ov5 ov5Var) {
        try {
            iVar.dismiss();
            if ("APP_VERSION_OUTDATED".equals(ov5Var.b)) {
                org.telegram.ui.Components.b.E4(this, LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
            } else {
                D3(org.telegram.ui.Components.b.T1(this, LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + ov5Var.b));
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    public void N1(DialogInterface dialogInterface, int i2) {
        MessagesController.getInstance(this.e0).performLogout(2);
    }

    public void N2(int[] iArr, final int i2, final org.telegram.ui.ActionBar.i iVar, final ae5 ae5Var, final String str, final String str2, final String str3, i95 i95Var, final ov5 ov5Var) {
        final ld5 ld5Var = (ld5) i95Var;
        if (ld5Var == null) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    LaunchActivity.this.M2(iVar, ov5Var);
                }
            });
        } else {
            iArr[0] = ConnectionsManager.getInstance(i2).sendRequest(new ie5(), new RequestDelegate() {
                @Override
                public final void run(i95 i95Var2, ov5 ov5Var2) {
                    LaunchActivity.this.L2(iVar, i2, ld5Var, ae5Var, str, str2, str3, i95Var2, ov5Var2);
                }
            });
        }
    }

    private void N3() {
        int i2 = 0;
        while (true) {
            if (i2 >= 3) {
                i2 = -1;
                break;
            } else if (UserConfig.getInstance(i2).isClientActivated()) {
                break;
            } else {
                i2++;
            }
        }
        v67 v67Var = this.J;
        if (v67Var != null) {
            v67Var.setVisibility(8);
        }
        if (i2 != -1) {
            M3(i2, true);
            return;
        }
        e21 e21Var = this.H;
        if (e21Var != null) {
            e21Var.j();
        }
        u1();
        startActivity(new Intent(this, (Class<?>) IntroActivity.class));
        o3();
        finish();
    }

    public static void O0(int i2) {
        LaunchActivity launchActivity = t0;
        if (launchActivity != null) {
            launchActivity.p3(i2);
        }
    }

    public static void O1(HashMap hashMap, int i2, wb5 wb5Var, int i3, boolean z, int i4) {
        Iterator it = hashMap.entrySet().iterator();
        while (it.hasNext()) {
            MessageObject messageObject = (MessageObject) ((Map.Entry) it.next()).getValue();
            SendMessagesHelper.getInstance(i2).sendMessage(wb5Var, messageObject.getDialogId(), messageObject, (MessageObject) null, (wc5) null, (HashMap<String, String>) null, z, i4);
        }
    }

    public void O2(org.telegram.ui.ActionBar.i iVar, i95 i95Var) {
        try {
            iVar.dismiss();
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        if (i95Var instanceof qw5) {
            qw5 qw5Var = (qw5) i95Var;
            org.telegram.ui.Components.b.E4(this, qw5Var.c, qw5Var.b);
        }
    }

    private void O3(boolean z) {
        boolean z2;
        ViewPropertyAnimator scaleY;
        if (this.Z == null) {
            return;
        }
        if (!SharedConfig.isAppUpdateAvailable()) {
            FrameLayout frameLayout = this.V;
            if (frameLayout == null || frameLayout.getTag() == null) {
                return;
            }
            this.V.setTag(null);
            if (z) {
                this.V.animate().translationY(AndroidUtilities.dp(44.0f)).setInterpolator(zq0.g).setListener(new h()).setDuration(180L).start();
            } else {
                this.V.setTranslationY(AndroidUtilities.dp(44.0f));
                this.V.setVisibility(4);
            }
            this.T.setPadding(0, 0, 0, 0);
            return;
        }
        final FrameLayout frameLayout2 = this.V;
        v1();
        this.Y.setText(AndroidUtilities.formatFileSize(SharedConfig.pendingAppUpdate.g.size));
        String attachFileName = FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.g);
        if (FileLoader.getPathToAttach(SharedConfig.pendingAppUpdate.g, true).exists()) {
            this.W.u(15, true, false);
            this.X.i(LocaleController.getString("AppUpdateNow", R.string.AppUpdateNow));
        } else if (FileLoader.getInstance(this.e0).isLoadingFile(attachFileName)) {
            this.W.u(3, true, false);
            this.W.C(0.0f, false);
            Float fileProgress = ImageLoader.getInstance().getFileProgress(attachFileName);
            az4 az4Var = this.X;
            Object[] objArr = new Object[1];
            objArr[0] = Integer.valueOf((int) ((fileProgress != null ? fileProgress.floatValue() : 0.0f) * 100.0f));
            az4Var.i(LocaleController.formatString("AppUpdateDownloading", R.string.AppUpdateDownloading, objArr));
        } else {
            this.W.u(2, true, false);
            this.X.i(LocaleController.getString("AppUpdate", R.string.AppUpdate));
            z2 = true;
            if (!z2) {
                if (this.Y.getTag() != null) {
                    TextView textView = this.Y;
                    if (z) {
                        textView.setTag(null);
                        scaleY = this.Y.animate().alpha(1.0f).scaleX(1.0f).scaleY(1.0f);
                        scaleY.setDuration(180L).start();
                    } else {
                        textView.setAlpha(1.0f);
                        this.Y.setScaleX(1.0f);
                        this.Y.setScaleY(1.0f);
                    }
                }
                if (this.V.getTag() == null) {
                    return;
                }
                this.V.setVisibility(0);
                this.V.setTag(1);
                if (z) {
                    this.V.animate().translationY(0.0f).setInterpolator(zq0.g).setListener(null).setDuration(180L).withEndAction(new Runnable() {
                        @Override
                        public final void run() {
                            LaunchActivity.m3(frameLayout2);
                        }
                    }).start();
                } else {
                    this.V.setTranslationY(0.0f);
                    if (frameLayout2 != null) {
                        ((ViewGroup) frameLayout2.getParent()).removeView(frameLayout2);
                    }
                }
                this.T.setPadding(0, 0, 0, AndroidUtilities.dp(44.0f));
                return;
            }
            if (this.Y.getTag() == null) {
                TextView textView2 = this.Y;
                if (z) {
                    textView2.setTag(1);
                    scaleY = this.Y.animate().alpha(0.0f).scaleX(0.0f).scaleY(0.0f);
                    scaleY.setDuration(180L).start();
                } else {
                    textView2.setAlpha(0.0f);
                    this.Y.setScaleX(0.0f);
                    this.Y.setScaleY(0.0f);
                }
            }
            if (this.V.getTag() == null) {
            }
        }
        z2 = false;
        if (!z2) {
        }
    }

    public static void P0() {
        LaunchActivity launchActivity = t0;
        if (launchActivity != null) {
            launchActivity.P3(UserConfig.selectedAccount);
            t0.H.j();
        }
        ConnectionsManager.getInstance(UserConfig.selectedAccount).setAppPaused(false, false);
    }

    public void P1(final HashMap hashMap, final int i2, DialogInterface dialogInterface, int i3) {
        if (u0.isEmpty()) {
            return;
        }
        if (AndroidUtilities.isGoogleMapsInstalled(u0.get(r3.size() - 1))) {
            w5 w5Var = new w5(0);
            w5Var.u4(new w5.q() {
                @Override
                public final void b(wb5 wb5Var, int i4, boolean z, int i5) {
                    LaunchActivity.O1(hashMap, i2, wb5Var, i4, z, i5);
                }
            });
            S2(w5Var);
        }
    }

    public void P2(final org.telegram.ui.ActionBar.i iVar, final i95 i95Var, ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.O2(iVar, i95Var);
            }
        });
    }

    private void P3(int i2) {
        String str;
        if (this.v == null) {
            return;
        }
        int i3 = 0;
        this.l = ConnectionsManager.getInstance(this.e0).getConnectionState();
        if (org.telegram.messenger.p110.o9.b(o9.f.POWER_OFF_MODE)) {
            i3 = R.string.Off;
            ConnectionsManager.native_pauseNetwork(this.e0);
            str = "Off";
        } else {
            int i4 = this.l;
            if (i4 == 2) {
                i3 = R.string.WaitingForNetwork;
                str = "WaitingForNetwork";
            } else if (i4 == 5) {
                i3 = R.string.Updating;
                str = "Updating";
            } else if (i4 == 4) {
                if (!org.telegram.messenger.p110.o9.b(o9.f.DONT_SHOW_CONNECTING_PROXY)) {
                    i3 = R.string.ConnectingToProxy;
                    str = "ConnectingToProxy";
                }
                str = null;
            } else {
                if (i4 == 1) {
                    i3 = R.string.Connecting;
                    if (org.telegram.messenger.p110.o9.b(o9.f.PROXY_AUTO_SYSTEM)) {
                        AndroidUtilities.runOnUIThread(new l(), 10000L);
                    }
                    str = "Connecting";
                }
                str = null;
            }
        }
        int i5 = this.l;
        this.v.P0(str, i3, (i5 == 1 || i5 == 4) ? new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.n3();
            }
        } : null);
    }

    public static void Q1(int i2, HashMap hashMap, boolean z, boolean z2, DialogInterface dialogInterface, int i3) {
        ContactsController.getInstance(i2).syncPhoneBookByAlert(hashMap, z, z2, false);
    }

    public void Q2(org.telegram.ui.ActionBar.i iVar, i95 i95Var, ov5 ov5Var) {
        String str;
        i.C0142i T1;
        try {
            iVar.dismiss();
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        if (i95Var instanceof b46) {
            T1 = org.telegram.ui.Components.b.F1(this, (b46) i95Var);
        } else {
            if (ov5Var == null) {
                return;
            }
            if ("LANG_CODE_NOT_SUPPORTED".equals(ov5Var.b)) {
                str = LocaleController.getString("LanguageUnsupportedError", R.string.LanguageUnsupportedError);
            } else {
                str = LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + ov5Var.b;
            }
            T1 = org.telegram.ui.Components.b.T1(this, str);
        }
        D3(T1);
    }

    public static void R1(int i2, HashMap hashMap, boolean z, boolean z2, DialogInterface dialogInterface, int i3) {
        ContactsController.getInstance(i2).syncPhoneBookByAlert(hashMap, z, z2, true);
    }

    public void R2(final org.telegram.ui.ActionBar.i iVar, final i95 i95Var, final ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.Q2(iVar, i95Var, ov5Var);
            }
        });
    }

    public static void S1(int i2, HashMap hashMap, boolean z, boolean z2, DialogInterface dialogInterface, int i3) {
        ContactsController.getInstance(i2).syncPhoneBookByAlert(hashMap, z, z2, true);
    }

    public void T1(i95 i95Var, w.v vVar) {
        if (!(i95Var instanceof d17)) {
            s3();
            return;
        }
        d17 d17Var = (d17) i95Var;
        this.m0 = vVar;
        this.k0 = FileLoader.getAttachFileName(d17Var.i);
        this.l0 = d17Var;
        FileLoader.getInstance(vVar.o).loadFile(d17Var.i, d17Var, 1, 1);
    }

    public void T2(org.telegram.ui.ActionBar.i iVar, i95 i95Var, d17 d17Var, ov5 ov5Var) {
        try {
            iVar.dismiss();
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        if (!(i95Var instanceof d17)) {
            D3(org.telegram.ui.Components.b.T1(this, LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + ov5Var.b));
            return;
        }
        d17 d17Var2 = (d17) i95Var;
        if (d17Var2.e) {
            String str = d17Var2.h;
            n27 n27Var = d17Var.j;
            Cif.i iVar2 = new Cif.i(str, n27Var.d, n27Var.e, n27Var.f, n27Var.g, AndroidUtilities.getWallpaperRotation(n27Var.i, false), r0.h / 100.0f, d17Var.j.c, null);
            iVar2.h = d17Var2;
            d17Var2 = iVar2;
        }
        ff ffVar = new ff(d17Var2, null, true, false);
        n27 n27Var2 = d17Var.j;
        ffVar.J4(n27Var2.b, n27Var2.c);
        S2(ffVar);
    }

    public void U1(final w.v vVar, final i95 i95Var, ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.T1(i95Var, vVar);
            }
        });
    }

    public void U2(final org.telegram.ui.ActionBar.i iVar, final d17 d17Var, final i95 i95Var, final ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.T2(iVar, i95Var, d17Var, ov5Var);
            }
        });
    }

    public void V1() {
        if (this.n0 == null) {
            return;
        }
        File file = new File(ApplicationLoader.getFilesDirFixed(), "remote" + this.n0.e + ".attheme");
        cu6 cu6Var = this.n0;
        w.v f0 = org.telegram.ui.ActionBar.w.f0(file, cu6Var.h, cu6Var, true);
        if (f0 != null) {
            S2(new ff(f0, true, 0, false, false));
        }
        s3();
    }

    public void V2() {
        this.j0 = null;
        this.k0 = null;
        this.l0 = null;
        this.m0 = null;
        this.p0 = null;
        this.n0 = null;
    }

    public void W1(w.v vVar, File file) {
        vVar.s(file, vVar.c);
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.V1();
            }
        });
    }

    public void W2(i95 i95Var, org.telegram.ui.ActionBar.i iVar, ov5 ov5Var) {
        char c2;
        int i2;
        String str;
        if (i95Var instanceof cu6) {
            cu6 cu6Var = (cu6) i95Var;
            d17 d17Var = null;
            c2 = 0;
            a27 a27Var = cu6Var.j.size() > 0 ? cu6Var.j.get(0) : null;
            if (a27Var != null) {
                w.v X1 = org.telegram.ui.ActionBar.w.X1(org.telegram.ui.ActionBar.w.n1(a27Var));
                if (X1 != null) {
                    m27 m27Var = a27Var.g;
                    if (m27Var instanceof d17) {
                        d17Var = (d17) m27Var;
                        if (!FileLoader.getPathToAttach(d17Var.i, true).exists()) {
                            this.p0 = iVar;
                            this.o0 = true;
                            this.m0 = X1;
                            this.n0 = cu6Var;
                            this.l0 = d17Var;
                            this.k0 = FileLoader.getAttachFileName(d17Var.i);
                            FileLoader.getInstance(this.e0).loadFile(d17Var.i, d17Var, 1, 1);
                            return;
                        }
                    }
                    try {
                        iVar.dismiss();
                    } catch (Exception e2) {
                        FileLog.e(e2);
                    }
                    v3(cu6Var, d17Var, X1);
                }
                c2 = 1;
            } else {
                ga5 ga5Var = cu6Var.i;
                if (ga5Var != null) {
                    this.o0 = false;
                    this.n0 = cu6Var;
                    this.j0 = FileLoader.getAttachFileName(ga5Var);
                    this.p0 = iVar;
                    FileLoader.getInstance(this.e0).loadFile(this.n0.i, cu6Var, 1, 1);
                }
                c2 = 1;
            }
        } else {
            if (ov5Var == null || !"THEME_FORMAT_INVALID".equals(ov5Var.b)) {
                c2 = 2;
            }
            c2 = 1;
        }
        if (c2 != 0) {
            try {
                iVar.dismiss();
            } catch (Exception e3) {
                FileLog.e(e3);
            }
            String string = LocaleController.getString("Theme", R.string.Theme);
            if (c2 == 1) {
                i2 = R.string.ThemeNotSupported;
                str = "ThemeNotSupported";
            } else {
                i2 = R.string.ThemeNotFound;
                str = "ThemeNotFound";
            }
            D3(org.telegram.ui.Components.b.U1(this, string, LocaleController.getString(str, i2)));
        }
    }

    public void X1(int i2, p3 p3Var, boolean z, ArrayList arrayList, Uri uri, org.telegram.ui.ActionBar.i iVar, long j2) {
        String str;
        long j3 = j2;
        if (j3 != 0) {
            Bundle bundle = new Bundle();
            bundle.putBoolean("scrollToTopOnResume", true);
            if (!AndroidUtilities.isTablet()) {
                NotificationCenter.getInstance(i2).postNotificationName(NotificationCenter.closeChats, new Object[0]);
            }
            if (DialogObject.isUserDialog(j2)) {
                str = "user_id";
            } else {
                j3 = -j3;
                str = "chat_id";
            }
            bundle.putLong(str, j3);
            v0 v0Var = new v0(bundle);
            v0Var.zo();
            this.v.E0(v0Var, p3Var != null || z, p3Var == null, true, false);
        } else {
            this.f = arrayList;
            if (arrayList == null) {
                this.f = new ArrayList<>();
            }
            this.f.add(0, uri);
            t3(true);
        }
        try {
            iVar.dismiss();
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    public void X2(final org.telegram.ui.ActionBar.i iVar, final i95 i95Var, final ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.W2(i95Var, iVar, ov5Var);
            }
        });
    }

    public void Y1(v0 v0Var, ArrayList arrayList, int i2, f27 f27Var, boolean z, int i3) {
        if (v0Var != null) {
            this.v.E0(v0Var, true, false, true, false);
        }
        for (int i4 = 0; i4 < arrayList.size(); i4++) {
            SendMessagesHelper.getInstance(i2).sendMessage(f27Var, ((Long) arrayList.get(i4)).longValue(), (MessageObject) null, (MessageObject) null, (wc5) null, (HashMap<String, String>) null, z, i3);
        }
    }

    public void Y2(i95 i95Var, int[] iArr, int i2, org.telegram.ui.ActionBar.i iVar, Integer num, Integer num2, Integer num3) {
        boolean z = false;
        if (i95Var instanceof pa6) {
            pa6 pa6Var = (pa6) i95Var;
            if (!pa6Var.a.isEmpty()) {
                MessagesController.getInstance(this.e0).putChats(pa6Var.a, false);
                iArr[0] = A3(i2, iVar, num, num2, num3, pa6Var.a.get(0));
                if (z) {
                    return;
                }
                try {
                    iVar.dismiss();
                } catch (Exception e2) {
                    FileLog.e(e2);
                }
                D3(org.telegram.ui.Components.b.T1(this, LocaleController.getString("LinkNotFound", R.string.LinkNotFound)));
                return;
            }
        }
        z = true;
        if (z) {
        }
    }

    public static void Z1(int[] iArr, long j2, wb5 wb5Var, int i2, boolean z, int i3) {
        SendMessagesHelper.getInstance(iArr[0]).sendMessage(wb5Var, j2, (MessageObject) null, (MessageObject) null, (wc5) null, (HashMap<String, String>) null, z, i3);
    }

    public void Z2(final int[] iArr, final int i2, final org.telegram.ui.ActionBar.i iVar, final Integer num, final Integer num2, final Integer num3, final i95 i95Var, ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.Y2(i95Var, iArr, i2, iVar, num, num2, num3);
            }
        });
    }

    public void a2(final int[] iArr, LocationController.SharingLocationInfo sharingLocationInfo) {
        iArr[0] = sharingLocationInfo.messageObject.currentAccount;
        M3(iArr[0], true);
        w5 w5Var = new w5(2);
        w5Var.x4(sharingLocationInfo.messageObject);
        final long dialogId = sharingLocationInfo.messageObject.getDialogId();
        w5Var.u4(new w5.q() {
            @Override
            public final void b(wb5 wb5Var, int i2, boolean z, int i3) {
                LaunchActivity.Z1(iArr, dialogId, wb5Var, i2, z, i3);
            }
        });
        S2(w5Var);
    }

    public void a3(org.telegram.ui.ActionBar.i iVar, i95 i95Var, org.telegram.ui.ActionBar.k kVar, int i2, Bundle bundle) {
        try {
            iVar.dismiss();
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        boolean z = true;
        if (i95Var instanceof pa6) {
            pa6 pa6Var = (pa6) i95Var;
            if (!pa6Var.a.isEmpty()) {
                MessagesController.getInstance(this.e0).putChats(pa6Var.a, false);
                pa6Var.a.get(0);
                if (kVar == null || MessagesController.getInstance(i2).checkCanOpenChat(bundle, kVar)) {
                    this.v.C0(new v0(bundle));
                }
                z = false;
            }
        }
        if (z) {
            D3(org.telegram.ui.Components.b.T1(this, LocaleController.getString("LinkNotFound", R.string.LinkNotFound)));
        }
    }

    public void b2() {
        if (this.v.v0.isEmpty()) {
            return;
        }
        this.v.v0.get(0).o1(new org.telegram.ui.Components.c8(this, this.p, this.n, this.o, (w.s) null));
    }

    public void b3(final org.telegram.ui.ActionBar.i iVar, final org.telegram.ui.ActionBar.k kVar, final int i2, final Bundle bundle, final i95 i95Var, ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.a3(iVar, i95Var, kVar, i2, bundle);
            }
        });
    }

    public void c2(org.telegram.ui.ActionBar.k kVar, boolean z) {
        x3(kVar, z, false);
    }

    public void c3(final Bundle bundle, Long l2, int[] iArr, final org.telegram.ui.ActionBar.i iVar, final org.telegram.ui.ActionBar.k kVar, final int i2) {
        if (this.v.C0(new v0(bundle))) {
            return;
        }
        wn5 wn5Var = new wn5();
        vx5 vx5Var = new vx5();
        vx5Var.a = l2.longValue();
        wn5Var.a.add(vx5Var);
        iArr[0] = ConnectionsManager.getInstance(this.e0).sendRequest(wn5Var, new RequestDelegate() {
            @Override
            public final void run(i95 i95Var, ov5 ov5Var) {
                LaunchActivity.this.b3(iVar, kVar, i2, bundle, i95Var, ov5Var);
            }
        });
    }

    public void d2(boolean z, int[] iArr, f27 f27Var, String str, d3 d3Var) {
        g27 userFull = MessagesController.getInstance(this.e0).getUserFull(f27Var.a);
        vs7.f0(f27Var, z, userFull != null && userFull.g, this, userFull, AccountInstance.getInstance(iArr[0]));
    }

    public static void d3(int i2, int[] iArr, Runnable runnable, DialogInterface dialogInterface) {
        ConnectionsManager.getInstance(i2).cancelRequest(iArr[0], true);
        if (runnable != null) {
            runnable.run();
        }
    }

    public static void e2(org.telegram.ui.a aVar, ov5 ov5Var) {
        org.telegram.ui.Components.b.B4(aVar, LocaleController.getString("AuthAnotherClient", R.string.AuthAnotherClient), LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + ov5Var.b);
    }

    public void e3(DialogInterface dialogInterface) {
        org.telegram.ui.ActionBar.i iVar = this.R;
        if (iVar != null) {
            if (iVar == this.a0) {
                try {
                    Toast.makeText(this, B1(LocaleController.getInstance().getCurrentLocaleInfo().shortName.equals("en") ? this.d0 : this.c0, "ChangeLanguageLater", R.string.ChangeLanguageLater), 1).show();
                } catch (Exception e2) {
                    FileLog.e(e2);
                }
                this.a0 = null;
            } else if (iVar == this.S) {
                MessagesController.getGlobalMainSettings();
                SharedPreferences.Editor edit = MessagesController.getGlobalMainSettings().edit();
                edit.putBoolean("proxy_enabled", false);
                edit.putBoolean("proxy_enabled_calls", false);
                edit.commit();
                ConnectionsManager.setProxySettings(false, BuildConfig.FLAVOR, 1080, BuildConfig.FLAVOR, BuildConfig.FLAVOR, BuildConfig.FLAVOR);
                NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxySettingsChanged, new Object[0]);
                this.S = null;
            }
        }
        this.R = null;
    }

    public static void f2(org.telegram.ui.ActionBar.i iVar, i95 i95Var, final org.telegram.ui.a aVar, final ov5 ov5Var) {
        try {
            iVar.dismiss();
        } catch (Exception unused) {
        }
        if (i95Var instanceof th5) {
            return;
        }
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.e2(org.telegram.ui.a.this, ov5Var);
            }
        });
    }

    public void f3(HashMap hashMap, LocaleController.LocaleInfo[] localeInfoArr, String str) {
        this.c0 = hashMap;
        if (this.d0 == null || hashMap == null) {
            return;
        }
        G3(localeInfoArr[1], localeInfoArr[0], str);
    }

    public static void g2(final org.telegram.ui.ActionBar.i iVar, final org.telegram.ui.a aVar, final i95 i95Var, final ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.f2(org.telegram.ui.ActionBar.i.this, i95Var, aVar, ov5Var);
            }
        });
    }

    public void g3(final LocaleController.LocaleInfo[] localeInfoArr, final String str, i95 i95Var, ov5 ov5Var) {
        final HashMap hashMap = new HashMap();
        if (i95Var != null) {
            j27 j27Var = (j27) i95Var;
            for (int i2 = 0; i2 < j27Var.a.size(); i2++) {
                rb5 rb5Var = (rb5) j27Var.a.get(i2);
                hashMap.put(rb5Var.b, rb5Var.i);
            }
        }
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.f3(hashMap, localeInfoArr, str);
            }
        });
    }

    public void h2(final org.telegram.ui.a aVar, String str) {
        final org.telegram.ui.ActionBar.i iVar = new org.telegram.ui.ActionBar.i(this, 3);
        iVar.E0(false);
        iVar.show();
        byte[] decode = Base64.decode(str.substring(17), 8);
        tg5 tg5Var = new tg5();
        tg5Var.a = decode;
        ConnectionsManager.getInstance(this.e0).sendRequest(tg5Var, new RequestDelegate() {
            @Override
            public final void run(i95 i95Var, ov5 ov5Var) {
                LaunchActivity.g2(org.telegram.ui.ActionBar.i.this, aVar, i95Var, ov5Var);
            }
        });
    }

    public void h3(HashMap hashMap, LocaleController.LocaleInfo[] localeInfoArr, String str) {
        this.d0 = hashMap;
        if (hashMap == null || this.c0 == null) {
            return;
        }
        G3(localeInfoArr[1], localeInfoArr[0], str);
    }

    public static void i2(String str, String str2, org.telegram.ui.ActionBar.k kVar, DialogInterface dialogInterface, int i2) {
        j6 j6Var = new j6();
        j6Var.r2(str, false);
        if (str2 != null) {
            String[] split = str2.split(" ", 2);
            j6Var.q2(split[0], split.length > 1 ? split[1] : null);
        }
        kVar.S0(j6Var);
    }

    public void i3(final LocaleController.LocaleInfo[] localeInfoArr, final String str, i95 i95Var, ov5 ov5Var) {
        final HashMap hashMap = new HashMap();
        if (i95Var != null) {
            j27 j27Var = (j27) i95Var;
            for (int i2 = 0; i2 < j27Var.a.size(); i2++) {
                rb5 rb5Var = (rb5) j27Var.a.get(i2);
                hashMap.put(rb5Var.b, rb5Var.i);
            }
        }
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.h3(hashMap, localeInfoArr, str);
            }
        });
    }

    public void j2(Intent intent, boolean z) {
        D1(intent, true, false, false);
    }

    public void j3(Runnable runnable) {
        this.v.setVisibility(4);
        if (AndroidUtilities.isTablet()) {
            if (this.w.getVisibility() == 0) {
                this.w.setVisibility(4);
            }
            this.x.setVisibility(4);
        }
        if (runnable != null) {
            runnable.run();
        }
    }

    public void k2(Bundle bundle) {
        S2(new d0(bundle));
    }

    public void k3() {
        SharedConfig.isWaitingForPasscodeEnter = false;
        Intent intent = this.f0;
        if (intent != null) {
            D1(intent, this.g0, this.h0, true);
            this.f0 = null;
        }
        this.G.q(true, false);
        this.v.setVisibility(0);
        this.v.R0();
        if (AndroidUtilities.isTablet()) {
            this.w.R0();
            this.x.R0();
            if (this.w.getVisibility() == 4) {
                this.w.setVisibility(0);
            }
            this.x.setVisibility(0);
        }
    }

    public void l2(DialogInterface dialogInterface, int i2) {
        org.telegram.messenger.p110.o9.a(o9.f.CUSTOM_RATE_DIALOG_RATED, true);
        try {
            startActivity(new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=" + NatHelper.f0())));
        } catch (ActivityNotFoundException unused) {
            startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=" + NatHelper.f0())));
        }
    }

    public void l3(DialogInterface dialogInterface, int i2) {
        try {
            Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
            intent.setData(Uri.parse("package:" + ApplicationLoader.applicationContext.getPackageName()));
            startActivity(intent);
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    public void m2() {
        org.telegram.ui.Components.m3.r();
        org.telegram.ui.Components.m3.O(this);
    }

    public static void m3(View view) {
        if (view != null) {
            ((ViewGroup) view.getParent()).removeView(view);
        }
    }

    private void n1() {
        int i2 = this.e0;
        if (i2 != UserConfig.selectedAccount) {
            NotificationCenter.getInstance(i2).removeObserver(this, NotificationCenter.appDidLogout);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.mainUserInfoChanged);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.didUpdateConnectionState);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.needShowAlert);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.wasUnableToFindCurrentLocation);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.openArticle);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.hasNewContactsToImport);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.needShowPlayServicesAlert);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.fileLoaded);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.fileLoadProgressChanged);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.fileLoadFailed);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.historyImportProgressChanged);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.groupCallUpdated);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.stickersImportComplete);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.newSuggestionsAvailable);
        }
        int i3 = UserConfig.selectedAccount;
        this.e0 = i3;
        NotificationCenter.getInstance(i3).addObserver(this, NotificationCenter.appDidLogout);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.mainUserInfoChanged);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.didUpdateConnectionState);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.needShowAlert);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.wasUnableToFindCurrentLocation);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.openArticle);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.hasNewContactsToImport);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.needShowPlayServicesAlert);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.fileLoaded);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.fileLoadProgressChanged);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.fileLoadFailed);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.historyImportProgressChanged);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.groupCallUpdated);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.stickersImportComplete);
        NotificationCenter.getInstance(this.e0).addObserver(this, NotificationCenter.newSuggestionsAvailable);
    }

    public boolean n2(View view, MotionEvent motionEvent) {
        if (!this.v.v0.isEmpty() && motionEvent.getAction() == 1) {
            float x = motionEvent.getX();
            float y = motionEvent.getY();
            int[] iArr = new int[2];
            this.w.getLocationOnScreen(iArr);
            int i2 = iArr[0];
            int i3 = iArr[1];
            if (!this.w.U() && (x <= i2 || x >= i2 + this.w.getWidth() || y <= i3 || y >= i3 + this.w.getHeight())) {
                if (!this.w.v0.isEmpty()) {
                    while (this.w.v0.size() - 1 > 0) {
                        ActionBarLayout actionBarLayout = this.w;
                        actionBarLayout.M0(actionBarLayout.v0.get(0));
                    }
                    this.w.V(true);
                }
                return true;
            }
        }
        return false;
    }

    public void n3() {
        ArrayList<org.telegram.ui.ActionBar.k> arrayList;
        org.telegram.ui.ActionBar.k kVar;
        if (AndroidUtilities.isTablet()) {
            if (!v0.isEmpty()) {
                arrayList = v0;
                kVar = arrayList.get(arrayList.size() - 1);
            }
            kVar = null;
        } else {
            if (!u0.isEmpty()) {
                arrayList = u0;
                kVar = arrayList.get(arrayList.size() - 1);
            }
            kVar = null;
        }
        if ((kVar instanceof oa4) || (kVar instanceof xa4)) {
            return;
        }
        S2(new oa4());
    }

    private void o1() {
        SharedConfig.checkKeepMedia();
        SharedConfig.checkLogsToDelete();
        if (Build.VERSION.SDK_INT >= 26) {
            return;
        }
        Utilities.globalQueue.postRunnable(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.J1();
            }
        }, 2000L);
    }

    public static void o2(View view) {
    }

    private void o3() {
        Runnable runnable = this.q0;
        if (runnable != null) {
            AndroidUtilities.cancelRunOnUIThread(runnable);
            this.q0 = null;
        }
        if (this.a) {
            return;
        }
        this.a = true;
        int i2 = this.e0;
        if (i2 != -1) {
            NotificationCenter.getInstance(i2).removeObserver(this, NotificationCenter.appDidLogout);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.mainUserInfoChanged);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.didUpdateConnectionState);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.needShowAlert);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.wasUnableToFindCurrentLocation);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.openArticle);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.hasNewContactsToImport);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.needShowPlayServicesAlert);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.fileLoaded);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.fileLoadProgressChanged);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.fileLoadFailed);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.historyImportProgressChanged);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.groupCallUpdated);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.stickersImportComplete);
            NotificationCenter.getInstance(this.e0).removeObserver(this, NotificationCenter.newSuggestionsAvailable);
        }
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.needShowAlert);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didSetNewWallpapper);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.suggestedLangpack);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.reloadInterface);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didSetNewTheme);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.needSetDayNightTheme);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.needCheckSystemBarColors);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.closeOtherAppActivities);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didSetPasscode);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.notificationsCountUpdated);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.screenStateChanged);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.showBulletin);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.appUpdateAvailable);
    }

    private void p1() {
        FrameLayout frameLayout;
        if (!AndroidUtilities.isTablet() || this.x == null) {
            return;
        }
        int i2 = 0;
        if (AndroidUtilities.isInMultiwindow || (AndroidUtilities.isSmallTablet() && getResources().getConfiguration().orientation != 2)) {
            this.i0 = true;
            if (!this.x.v0.isEmpty()) {
                while (this.x.v0.size() > 0) {
                    org.telegram.ui.ActionBar.k kVar = this.x.v0.get(0);
                    if (kVar instanceof v0) {
                        ((v0) kVar).yo(true);
                    }
                    kVar.H0();
                    this.x.v0.remove(0);
                    this.v.v0.add(kVar);
                }
                pp3 pp3Var = this.I;
                if (pp3Var == null || pp3Var.getVisibility() != 0) {
                    this.v.R0();
                }
            }
            this.z.setVisibility(8);
            this.x.setVisibility(8);
            frameLayout = this.A;
        } else {
            this.i0 = false;
            if (this.v.v0.size() >= 2) {
                while (1 < this.v.v0.size()) {
                    org.telegram.ui.ActionBar.k kVar2 = this.v.v0.get(1);
                    if (kVar2 instanceof v0) {
                        ((v0) kVar2).yo(true);
                    }
                    kVar2.H0();
                    this.v.v0.remove(1);
                    this.x.v0.add(kVar2);
                }
                pp3 pp3Var2 = this.I;
                if (pp3Var2 == null || pp3Var2.getVisibility() != 0) {
                    this.v.R0();
                    this.x.R0();
                }
            }
            ActionBarLayout actionBarLayout = this.x;
            actionBarLayout.setVisibility(actionBarLayout.v0.isEmpty() ? 8 : 0);
            this.A.setVisibility(this.x.v0.isEmpty() ? 0 : 8);
            frameLayout = this.z;
        }
    }

    public void p2(View view, int i2, float f2, float f3) {
        if (i2 == 0) {
            m21 m21Var = (m21) view;
            if (m21Var.k(f2, f3)) {
                u3(m21Var.j());
                return;
            } else {
                this.H.P(!r3.M(), true);
                return;
            }
        }
        if (view instanceof n21) {
            M3(((n21) view).getAccountNumber(), true);
        } else if (view instanceof b21) {
            int i3 = -1;
            int i4 = 0;
            while (true) {
                if (i4 >= 3) {
                    break;
                }
                if (!UserConfig.getInstance(i4).isClientActivated()) {
                    i3 = i4;
                    break;
                }
                i4++;
            }
            if (i3 >= 0) {
                S2(new y5(i3));
            }
        } else {
            if (view instanceof x11) {
                p3(this.H.K(i2));
                return;
            }
            if (!(view instanceof i77)) {
                if (view instanceof c21) {
                    boolean m2 = org.telegram.messenger.p110.o9.m(o9.f.PROXY_SYSTEM_ENABLED);
                    ((c21) view).setChecked(m2);
                    com.viewbadger.helperlib.Services.a currentInstance = com.viewbadger.helperlib.Services.a.getCurrentInstance();
                    if (m2) {
                        currentInstance.updateProxy();
                    } else {
                        currentInstance.clearProxy();
                    }
                    y3(true);
                    return;
                }
                return;
            }
            int i5 = this.s0;
            if (i5 != 3) {
                this.s0 = i5 + 1;
                AndroidUtilities.runOnUIThread(new r(), 3000L);
                return;
            }
            this.s0 = 0;
        }
        this.G.f(false);
    }

    private void p3(int i2) {
        org.telegram.ui.ActionBar.k f47Var;
        org.telegram.ui.ActionBar.k x2Var;
        org.telegram.ui.ActionBar.k oa4Var;
        p3 p3Var;
        MessagesController messagesController;
        o9.f fVar;
        int i3;
        String str;
        if (i2 == 2) {
            oa4Var = new GroupCreateActivity(new Bundle());
        } else {
            boolean z = true;
            if (i2 == 3) {
                Bundle bundle = new Bundle();
                bundle.putBoolean("onlyUsers", true);
                bundle.putBoolean("destroyAfterSelect", true);
                bundle.putBoolean("createSecretChat", true);
                bundle.putBoolean("allowBots", false);
                bundle.putBoolean("allowSelf", false);
                oa4Var = new d3(bundle);
            } else {
                if (i2 != 4) {
                    if (i2 == 6) {
                        x2Var = new d3(null);
                    } else {
                        if (i2 != 7) {
                            if (i2 == 8) {
                                u3(false);
                                return;
                            }
                            if (i2 == 9) {
                                i3 = R.string.TelegramFaqUrl;
                                str = "TelegramFaqUrl";
                            } else if (i2 == 10) {
                                x2Var = new v();
                            } else {
                                if (i2 != 11) {
                                    if (i2 == 12) {
                                        int i4 = Build.VERSION.SDK_INT;
                                        if (i4 >= 23 && checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) {
                                            S2(new org.telegram.ui.a(1));
                                            this.G.f(false);
                                            return;
                                        }
                                        if (i4 >= 28) {
                                            z = ((LocationManager) ApplicationLoader.applicationContext.getSystemService("location")).isLocationEnabled();
                                        } else if (i4 >= 19) {
                                            try {
                                                z = Settings.Secure.getInt(ApplicationLoader.applicationContext.getContentResolver(), "location_mode", 0) != 0;
                                            } catch (Throwable th) {
                                                FileLog.e(th);
                                            }
                                        }
                                        f47Var = z ? new i8() : new org.telegram.ui.a(4);
                                    } else if (i2 == 13) {
                                        i3 = R.string.TelegramFeaturesUrl;
                                        str = "TelegramFeaturesUrl";
                                    } else if (i2 == 200) {
                                        this.G.f(false);
                                        f47Var = new oa4();
                                    } else if (i2 == 201) {
                                        this.G.f(false);
                                        f47Var = new i8();
                                    } else {
                                        if (i2 == 202) {
                                            this.G.f(false);
                                            this.H.j();
                                            com.viewbadger.helperlib.Services.a.reLoad();
                                            ln7.a(this);
                                            return;
                                        }
                                        if (i2 == 203) {
                                            this.G.f(false);
                                            f47Var = new xp4();
                                        } else if (i2 == 204) {
                                            this.G.f(false);
                                            f47Var = new ThemeActivity(0);
                                        } else if (i2 == 205) {
                                            this.G.f(false);
                                            f47Var = new v84();
                                        } else if (i2 == 206) {
                                            this.G.f(false);
                                            f47Var = new r84();
                                        } else if (i2 == 207) {
                                            this.G.f(false);
                                            f47Var = new xe1();
                                        } else if (i2 == 208) {
                                            this.G.f(false);
                                            f47Var = new yl7(null);
                                        } else {
                                            if (i2 != 209) {
                                                if (i2 == 210) {
                                                    this.G.f(false);
                                                    Bundle bundle2 = new Bundle();
                                                    bundle2.putBoolean("justfavor", true);
                                                    bundle2.putInt("dialogsType", 101);
                                                    p3Var = new p3(bundle2);
                                                } else {
                                                    if (i2 != 211) {
                                                        if (i2 == 600) {
                                                            this.G.f(false);
                                                            messagesController = MessagesController.getInstance(this.e0);
                                                            fVar = o9.f.OFFICIAL_CHANNEL;
                                                        } else if (i2 == 601) {
                                                            this.G.f(false);
                                                            messagesController = MessagesController.getInstance(this.e0);
                                                            fVar = o9.f.THEME_CHANNEL;
                                                        } else {
                                                            if (i2 == 602) {
                                                                this.G.f(false);
                                                                ok.w(this, org.telegram.messenger.p110.o9.k(o9.f.PRIVACY_POLICY_URL));
                                                                return;
                                                            }
                                                            if (i2 == 603) {
                                                                this.G.f(false);
                                                                messagesController = MessagesController.getInstance(this.e0);
                                                                fVar = o9.f.MENU_OFFICIAL_CHANNEL;
                                                            } else if (i2 == 606) {
                                                                x2Var = new gm();
                                                            } else if (i2 == 900) {
                                                                x2Var = new yt4();
                                                            } else if (i2 == 607) {
                                                                x2Var = new h15();
                                                            } else {
                                                                if (i2 == 608) {
                                                                    this.G.f(false);
                                                                    hj.b(t0, AccountInstance.getInstance(this.e0));
                                                                    return;
                                                                }
                                                                if (i2 == 700) {
                                                                    this.G.f(false);
                                                                    Bundle bundle3 = new Bundle();
                                                                    bundle3.putInt("folderId", 1);
                                                                    p3Var = new p3(bundle3);
                                                                } else if (i2 == 901) {
                                                                    Bundle bundle4 = new Bundle();
                                                                    bundle4.putBoolean("isProxyMgr", true);
                                                                    oa4Var = new oa4(bundle4);
                                                                } else {
                                                                    if (i2 != 998) {
                                                                        if (i2 == 999) {
                                                                            this.G.f(false);
                                                                            try {
                                                                                startActivity(new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=" + NatHelper.f0())));
                                                                                return;
                                                                            } catch (ActivityNotFoundException unused) {
                                                                                startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=" + NatHelper.f0())));
                                                                                return;
                                                                            }
                                                                        }
                                                                        if (i2 != 1000 && i2 != 1001) {
                                                                            if (i2 == 1004) {
                                                                                this.G.f(false);
                                                                                f47Var = new f47();
                                                                            } else if (i2 == 1005) {
                                                                                this.G.f(false);
                                                                                fx0.l(this, true);
                                                                                return;
                                                                            } else if (i2 == 1006) {
                                                                                this.G.f(false);
                                                                                fx0.k(this, true);
                                                                                return;
                                                                            } else if (i2 != 1002 && i2 != 1003) {
                                                                                if (i2 == 1014) {
                                                                                    this.G.f(false);
                                                                                    new org.telegram.ui.Components.o8(this, this.v.getLastFragment(), new org.telegram.ui.Components.r8(this, new a(this)), null).show();
                                                                                    return;
                                                                                }
                                                                                return;
                                                                            }
                                                                        }
                                                                        this.G.f(false);
                                                                    }
                                                                    x2Var = new org.telegram.messenger.p110.x2();
                                                                }
                                                            }
                                                        }
                                                        String k2 = org.telegram.messenger.p110.o9.k(fVar);
                                                        ArrayList<org.telegram.ui.ActionBar.k> arrayList = u0;
                                                        messagesController.openByUserName(k2, arrayList.get(arrayList.size() - 1), 1);
                                                        return;
                                                    }
                                                    Bundle bundle5 = new Bundle();
                                                    bundle5.putBoolean("justonline", true);
                                                    oa4Var = new d3(bundle5);
                                                }
                                                S2(p3Var);
                                                return;
                                            }
                                            this.G.f(false);
                                            if (t0.G1("specialsettings")) {
                                                return;
                                            } else {
                                                f47Var = new q05();
                                            }
                                        }
                                    }
                                    S2(f47Var);
                                    return;
                                }
                                Bundle bundle6 = new Bundle();
                                bundle6.putLong("user_id", UserConfig.getInstance(this.e0).getClientUserId());
                                oa4Var = new v0(bundle6);
                            }
                            ok.w(this, LocaleController.getString(str, i3));
                            this.G.f(false);
                        }
                        x2Var = new InviteContactsActivity();
                    }
                    S2(x2Var);
                    this.G.f(false);
                }
                SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
                if (BuildVars.DEBUG_VERSION || !globalMainSettings.getBoolean("channel_intro", false)) {
                    S2(new org.telegram.ui.a(0));
                    globalMainSettings.edit().putBoolean("channel_intro", true).commit();
                    this.G.f(false);
                } else {
                    Bundle bundle7 = new Bundle();
                    bundle7.putInt("step", 0);
                    oa4Var = new ut(bundle7);
                }
            }
        }
        S2(oa4Var);
        this.G.f(false);
    }

    public boolean q2(androidx.recyclerview.widget.m mVar, View view, int i2) {
        if (!(view instanceof n21)) {
            return false;
        }
        int accountNumber = ((n21) view).getAccountNumber();
        if (accountNumber == this.e0 || AndroidUtilities.isTablet()) {
            mVar.F(this.T.l0(view));
            return false;
        }
        t tVar = new t(null, accountNumber);
        tVar.b1(accountNumber);
        this.v.G0(tVar);
        this.G.setDrawCurrentPreviewFragmentAbove(true);
        return true;
    }

    private void q3() {
        if (this.q0 != null) {
            if (BuildVars.LOGS_ENABLED) {
                FileLog.d("cancel lockRunnable onPasscodePause");
            }
            AndroidUtilities.cancelRunOnUIThread(this.q0);
            this.q0 = null;
        }
        if (SharedConfig.passcodeHash.length() != 0) {
            SharedConfig.lastPauseTime = (int) (SystemClock.elapsedRealtime() / 1000);
            j jVar = new j();
            this.q0 = jVar;
            if (SharedConfig.appLocked) {
                AndroidUtilities.runOnUIThread(jVar, 1000L);
                if (BuildVars.LOGS_ENABLED) {
                    FileLog.d("schedule app lock in 1000");
                }
            } else if (SharedConfig.autoLockIn != 0) {
                if (BuildVars.LOGS_ENABLED) {
                    FileLog.d("schedule app lock in " + ((SharedConfig.autoLockIn * 1000) + 1000));
                }
                AndroidUtilities.runOnUIThread(this.q0, (SharedConfig.autoLockIn * 1000) + 1000);
            }
        } else {
            SharedConfig.lastPauseTime = 0;
        }
        SharedConfig.saveConfig();
    }

    private void r1() {
        s1(true, true);
    }

    public static void r2(View view) {
        int measuredHeight = view.getMeasuredHeight();
        FileLog.d("height = " + measuredHeight + " displayHeight = " + AndroidUtilities.displaySize.y);
        if (Build.VERSION.SDK_INT >= 21) {
            measuredHeight -= AndroidUtilities.statusBarHeight;
        }
        if (measuredHeight <= AndroidUtilities.dp(100.0f) || measuredHeight >= AndroidUtilities.displaySize.y) {
            return;
        }
        int dp = AndroidUtilities.dp(100.0f) + measuredHeight;
        Point point = AndroidUtilities.displaySize;
        if (dp > point.y) {
            point.y = measuredHeight;
            if (BuildVars.LOGS_ENABLED) {
                FileLog.d("fix display size y to " + AndroidUtilities.displaySize.y);
            }
        }
    }

    private void r3() {
        if (this.q0 != null) {
            if (BuildVars.LOGS_ENABLED) {
                FileLog.d("cancel lockRunnable onPasscodeResume");
            }
            AndroidUtilities.cancelRunOnUIThread(this.q0);
            this.q0 = null;
        }
        if (AndroidUtilities.needShowPasscode(true)) {
            H3(true, false, -1, -1, null, null);
        }
        if (SharedConfig.lastPauseTime != 0) {
            SharedConfig.lastPauseTime = 0;
            SharedConfig.saveConfig();
            if (BuildVars.LOGS_ENABLED) {
                FileLog.d("reset lastPauseTime onPasscodeResume");
            }
        }
    }

    private void s1(boolean z, boolean z2) {
        int i2 = Build.VERSION.SDK_INT;
        if (i2 >= 23) {
            if (z) {
                AndroidUtilities.setLightStatusBar(getWindow(), org.telegram.ui.ActionBar.w.u1("actionBarDefault", null, true) == -1);
            }
            if (i2 >= 26 && z2) {
                Window window = getWindow();
                int u1 = org.telegram.ui.ActionBar.w.u1("windowBackgroundGray", null, true);
                if (window.getNavigationBarColor() != u1) {
                    window.setNavigationBarColor(u1);
                    AndroidUtilities.setLightNavigationBar(getWindow(), AndroidUtilities.computePerceivedBrightness(u1) >= 0.721f);
                }
            }
        }
        if (SharedConfig.noStatusBar && i2 >= 21 && z) {
            getWindow().setStatusBarColor(0);
        }
    }

    public static void s2(int i2) {
        ApplicationLoader.mainInterfacePausedStageQueue = true;
        ApplicationLoader.mainInterfacePausedStageQueueTime = 0L;
        if (VoIPService.getSharedInstance() == null) {
            MessagesController.getInstance(i2).ignoreSetOnline = false;
        }
    }

    private void s3() {
        org.telegram.ui.ActionBar.i iVar = this.p0;
        if (iVar != null) {
            try {
                iVar.dismiss();
            } finally {
                this.p0 = null;
            }
        }
        this.k0 = null;
        this.l0 = null;
        this.m0 = null;
        this.j0 = null;
        this.n0 = null;
    }

    private void t1(boolean z) {
        ChatObject.Call call;
        long j2;
        VoIPService sharedInstance = VoIPService.getSharedInstance();
        boolean z2 = false;
        if (sharedInstance == null || (call = sharedInstance.groupCall) == null) {
            this.r = false;
            return;
        }
        boolean z3 = this.r;
        eb5 groupCallPeer = sharedInstance.getGroupCallPeer();
        if (groupCallPeer != null) {
            j2 = groupCallPeer.c;
            if (j2 == 0) {
                long j3 = groupCallPeer.e;
                if (j3 == 0) {
                    j3 = groupCallPeer.d;
                }
                j2 = -j3;
            }
        } else {
            j2 = UserConfig.getInstance(this.e0).clientUserId;
        }
        hw5 hw5Var = call.participants.get(j2);
        boolean z4 = (hw5Var == null || hw5Var.d || !hw5Var.b) ? false : true;
        if (z4 && hw5Var.r != 0) {
            z2 = true;
        }
        this.r = z2;
        if (z || !z3 || z2 || z4 || p4.F2 != null) {
            return;
        }
        L3(38);
    }

    public static void t2() {
        ApplicationLoader.mainInterfacePausedStageQueue = false;
        ApplicationLoader.mainInterfacePausedStageQueueTime = System.currentTimeMillis();
    }

    private void t3(boolean z) {
        int i2;
        String str;
        boolean z2;
        p4 p4Var;
        Bundle bundle = new Bundle();
        bundle.putBoolean("onlySelect", true);
        bundle.putInt("dialogsType", 3);
        bundle.putBoolean("allowSwitchAccount", true);
        ArrayList<f27> arrayList = this.j;
        if (arrayList != null) {
            if (arrayList.size() != 1) {
                bundle.putString("selectAlertString", LocaleController.getString("SendContactToText", R.string.SendMessagesToText));
                i2 = R.string.SendContactToGroupText;
                str = "SendContactToGroupText";
            }
            d dVar = new d(bundle);
            dVar.Ka(this);
            if (AndroidUtilities.isTablet()) {
                if (this.v.v0.size() > 1) {
                    ArrayList<org.telegram.ui.ActionBar.k> arrayList2 = this.v.v0;
                }
                z2 = false;
            } else {
                if (this.w.v0.size() > 0) {
                    ArrayList<org.telegram.ui.ActionBar.k> arrayList3 = this.w.v0;
                }
                z2 = false;
            }
            this.v.E0(dVar, z2, !z, true, false);
            if (!SecretMediaViewer.d0() && SecretMediaViewer.b0().f0()) {
                SecretMediaViewer.b0().V(false, false);
            } else if (!PhotoViewer.W7() && PhotoViewer.L7().o8()) {
                PhotoViewer.L7().f7(false, true);
            } else if (ArticleViewer.X2() && ArticleViewer.L2().Z2()) {
                ArticleViewer.L2().z2(false, true);
            }
            p4Var = p4.F2;
            if (p4Var != null) {
                p4Var.dismiss();
            }
            if (z) {
                this.G.q(false, false);
                if (!AndroidUtilities.isTablet()) {
                    this.G.q(true, false);
                    return;
                } else {
                    this.v.R0();
                    this.x.R0();
                    return;
                }
            }
            return;
        }
        bundle.putString("selectAlertString", LocaleController.getString("SendMessagesToText", R.string.SendMessagesToText));
        i2 = R.string.SendMessagesToGroupText;
        str = "SendMessagesToGroupText";
        bundle.putString("selectAlertStringGroup", LocaleController.getString(str, i2));
        d dVar2 = new d(bundle);
        dVar2.Ka(this);
        if (AndroidUtilities.isTablet()) {
        }
        this.v.E0(dVar2, z2, !z, true, false);
        if (!SecretMediaViewer.d0()) {
        }
        if (!PhotoViewer.W7()) {
        }
        if (ArticleViewer.X2()) {
            ArticleViewer.L2().z2(false, true);
        }
        p4Var = p4.F2;
        if (p4Var != null) {
        }
        if (z) {
        }
    }

    public static void u1() {
        Iterator<org.telegram.ui.ActionBar.k> it = u0.iterator();
        while (it.hasNext()) {
            it.next().F0();
        }
        u0.clear();
        if (AndroidUtilities.isTablet()) {
            Iterator<org.telegram.ui.ActionBar.k> it2 = v0.iterator();
            while (it2.hasNext()) {
                it2.next().F0();
            }
            v0.clear();
            Iterator<org.telegram.ui.ActionBar.k> it3 = w0.iterator();
            while (it3.hasNext()) {
                it3.next().F0();
            }
            w0.clear();
        }
    }

    public void u2(i95 i95Var, int i2, Integer num, u95 u95Var, tc6 tc6Var, Integer num2, Integer num3, org.telegram.ui.ActionBar.i iVar) {
        int intValue;
        boolean z = false;
        try {
            if (i95Var instanceof lb6) {
                lb6 lb6Var = (lb6) i95Var;
                MessagesController.getInstance(i2).putUsers(lb6Var.h, false);
                MessagesController.getInstance(i2).putChats(lb6Var.g, false);
                ArrayList<MessageObject> arrayList = new ArrayList<>();
                int size = lb6Var.b.size();
                for (int i3 = 0; i3 < size; i3++) {
                    arrayList.add(new MessageObject(UserConfig.selectedAccount, lb6Var.b.get(i3), true, true));
                }
                if (!arrayList.isEmpty()) {
                    Bundle bundle = new Bundle();
                    bundle.putLong("chat_id", -arrayList.get(0).getDialogId());
                    bundle.putInt("message_id", Math.max(1, num.intValue()));
                    v0 v0Var = new v0(bundle);
                    v0Var.Co(arrayList, u95Var, tc6Var.b, lb6Var.d, lb6Var.e);
                    if (num2 == null) {
                        if (num3 != null) {
                            intValue = num.intValue();
                        }
                        S2(v0Var);
                        z = true;
                        if (!z) {
                            try {
                                if (!u0.isEmpty()) {
                                    ArrayList<org.telegram.ui.ActionBar.k> arrayList2 = u0;
                                    org.telegram.ui.Components.b0.E(arrayList2.get(arrayList2.size() - 1)).n(LocaleController.getString("ChannelPostDeleted", R.string.ChannelPostDeleted)).J();
                                }
                            } catch (Exception e2) {
                                FileLog.e(e2);
                            }
                        }
                        iVar.dismiss();
                        return;
                    }
                    intValue = num2.intValue();
                    v0Var.xo(intValue);
                    S2(v0Var);
                    z = true;
                    if (!z) {
                    }
                    iVar.dismiss();
                    return;
                }
            }
            iVar.dismiss();
            return;
        } catch (Exception e3) {
            FileLog.e(e3);
            return;
        }
        if (!z) {
        }
    }

    private void u3(boolean z) {
        Bundle bundle = new Bundle();
        bundle.putLong("user_id", UserConfig.getInstance(this.e0).clientUserId);
        if (z) {
            bundle.putBoolean("expandPhoto", true);
        }
        S2(new ProfileActivity(bundle));
        this.G.f(false);
    }

    private void v1() {
        if (this.Z == null) {
            return;
        }
        g gVar = new g(this);
        this.V = gVar;
        gVar.setWillNotDraw(false);
        this.V.setVisibility(4);
        this.V.setTranslationY(AndroidUtilities.dp(44.0f));
        if (Build.VERSION.SDK_INT >= 21) {
            this.V.setBackground(org.telegram.ui.ActionBar.w.S1(1090519039, false));
        }
        this.Z.addView(this.V, g52.c(-1, 44, 83));
        this.V.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                LaunchActivity.this.L1(view);
            }
        });
        me4 me4Var = new me4(this.V);
        this.W = me4Var;
        me4Var.r(-1, -1, -1, -1);
        this.W.E(AndroidUtilities.dp(22.0f), AndroidUtilities.dp(11.0f), AndroidUtilities.dp(44.0f), AndroidUtilities.dp(33.0f));
        this.W.q(AndroidUtilities.dp(11.0f));
        this.W.m();
        az4 az4Var = new az4(this);
        this.X = az4Var;
        az4Var.setTextSize(15);
        this.X.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        this.X.i(LocaleController.getString("AppUpdate", R.string.AppUpdate));
        this.X.setTextColor(-1);
        this.X.setGravity(3);
        this.V.addView(this.X, g52.b(-2, -2.0f, 16, 74.0f, 0.0f, 0.0f, 0.0f));
        TextView textView = new TextView(this);
        this.Y = textView;
        textView.setTextSize(1, 15.0f);
        this.Y.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        this.Y.setGravity(5);
        this.Y.setTextColor(-1);
        this.V.addView(this.Y, g52.b(-2, -2.0f, 21, 0.0f, 0.0f, 17.0f, 0.0f));
    }

    public void v2(final int i2, final Integer num, final u95 u95Var, final tc6 tc6Var, final Integer num2, final Integer num3, final org.telegram.ui.ActionBar.i iVar, final i95 i95Var, ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.u2(i95Var, i2, num, u95Var, tc6Var, num2, num3, iVar);
            }
        });
    }

    private void v3(cu6 cu6Var, d17 d17Var, w.v vVar) {
        int i2 = vVar.Z;
        w.u t2 = vVar.t(cu6Var, this.e0);
        vVar.T = vVar.S;
        vVar.X(t2.a);
        t2.s = d17Var;
        S2(new ff(vVar, i2 != vVar.Z, 0, false, false));
    }

    private List<xq5> w1(String str, String str2, boolean z) {
        String str3;
        String lowerCase;
        f27 user;
        String str4;
        MessagesController messagesController = MessagesController.getInstance(this.e0);
        ContactsController contactsController = ContactsController.getInstance(this.e0);
        ArrayList arrayList = new ArrayList(contactsController.contacts);
        ArrayList arrayList2 = new ArrayList();
        String str5 = null;
        int i2 = 0;
        if (str2 != null) {
            String h2 = uw3.h(str2);
            xq5 xq5Var = contactsController.contactsByPhone.get(h2);
            if (xq5Var == null) {
                xq5Var = contactsController.contactsByShortPhone.get(h2.substring(Math.max(0, h2.length() - 7)));
            }
            if (xq5Var != null) {
                f27 user2 = messagesController.getUser(Long.valueOf(xq5Var.a));
                if (user2 == null || (user2.j && !z)) {
                    str3 = null;
                    if (arrayList2.isEmpty() && str3 != null) {
                        lowerCase = str3.trim().toLowerCase();
                        if (!TextUtils.isEmpty(lowerCase)) {
                            String translitString = LocaleController.getInstance().getTranslitString(lowerCase);
                            if (lowerCase.equals(translitString) || translitString.length() == 0) {
                                translitString = null;
                            }
                            int i3 = 2;
                            char c2 = 1;
                            String[] strArr = {lowerCase, translitString};
                            int size = arrayList.size();
                            int i4 = 0;
                            while (i4 < size) {
                                xq5 xq5Var2 = (xq5) arrayList.get(i4);
                                if (xq5Var2 != null && (user = messagesController.getUser(Long.valueOf(xq5Var2.a))) != null && (!user.j || z)) {
                                    String[] strArr2 = new String[3];
                                    strArr2[i2] = ContactsController.formatName(user.b, user.c).toLowerCase();
                                    strArr2[c2] = LocaleController.getInstance().getTranslitString(strArr2[i2]);
                                    if (strArr2[i2].equals(strArr2[c2])) {
                                        strArr2[c2] = str5;
                                    }
                                    if (UserObject.isReplyUser(user)) {
                                        strArr2[i3] = LocaleController.getString("RepliesTitle", R.string.RepliesTitle).toLowerCase();
                                    } else if (user.j) {
                                        strArr2[i3] = LocaleController.getString("SavedMessages", R.string.SavedMessages).toLowerCase();
                                    }
                                    int i5 = 0;
                                    boolean z2 = false;
                                    while (true) {
                                        if (i5 >= i3) {
                                            break;
                                        }
                                        String str6 = strArr[i5];
                                        if (str6 != null) {
                                            for (int i6 = 3; i2 < i6; i6 = 3) {
                                                String str7 = strArr2[i2];
                                                if (str7 != null) {
                                                    if (!str7.startsWith(str6)) {
                                                        if (str7.contains(" " + str6)) {
                                                        }
                                                    }
                                                    z2 = true;
                                                    break;
                                                }
                                                i2++;
                                            }
                                            if (!z2 && (str4 = user.d) != null && str4.startsWith(str6)) {
                                                z2 = true;
                                            }
                                            if (z2) {
                                                arrayList2.add(xq5Var2);
                                                break;
                                            }
                                        }
                                        i5++;
                                        i2 = 0;
                                        i3 = 2;
                                    }
                                }
                                i4++;
                                c2 = 1;
                                str5 = null;
                                i2 = 0;
                                i3 = 2;
                            }
                        }
                    }
                    return arrayList2;
                }
                arrayList2.add(xq5Var);
            }
        }
        str3 = str;
        if (arrayList2.isEmpty()) {
            lowerCase = str3.trim().toLowerCase();
            if (!TextUtils.isEmpty(lowerCase)) {
            }
        }
        return arrayList2;
    }

    public void w2(i95 i95Var, Uri uri, int i2, org.telegram.ui.ActionBar.i iVar) {
        boolean z;
        if (isFinishing()) {
            return;
        }
        boolean z2 = false;
        if (i95Var == null || this.v == null) {
            if (this.f == null) {
                this.f = new ArrayList<>();
            }
            this.f.add(0, this.g);
            this.g = null;
            t3(true);
        } else {
            me6 me6Var = (me6) i95Var;
            Bundle bundle = new Bundle();
            bundle.putBoolean("onlySelect", true);
            bundle.putString("importTitle", me6Var.d);
            bundle.putBoolean("allowSwitchAccount", true);
            if (me6Var.b) {
                bundle.putInt("dialogsType", 12);
            } else if (me6Var.c) {
                bundle.putInt("dialogsType", 11);
            } else {
                String uri2 = uri.toString();
                Iterator<String> it = MessagesController.getInstance(i2).exportPrivateUri.iterator();
                while (true) {
                    if (!it.hasNext()) {
                        z = false;
                        break;
                    } else if (uri2.contains(it.next())) {
                        bundle.putInt("dialogsType", 12);
                        z = true;
                        break;
                    }
                }
                if (!z) {
                    Iterator<String> it2 = MessagesController.getInstance(i2).exportGroupUri.iterator();
                    while (true) {
                        if (!it2.hasNext()) {
                            break;
                        }
                        if (uri2.contains(it2.next())) {
                            bundle.putInt("dialogsType", 11);
                            z = true;
                            break;
                        }
                    }
                    if (!z) {
                        bundle.putInt("dialogsType", 13);
                    }
                }
            }
            if (SecretMediaViewer.d0() && SecretMediaViewer.b0().f0()) {
                SecretMediaViewer.b0().V(false, false);
            } else if (PhotoViewer.W7() && PhotoViewer.L7().o8()) {
                PhotoViewer.L7().f7(false, true);
            } else if (ArticleViewer.X2() && ArticleViewer.L2().Z2()) {
                ArticleViewer.L2().z2(false, true);
            }
            p4 p4Var = p4.F2;
            if (p4Var != null) {
                p4Var.dismiss();
            }
            this.G.q(false, false);
            if (AndroidUtilities.isTablet()) {
                this.v.R0();
                this.x.R0();
            } else {
                this.G.q(true, false);
            }
            p3 p3Var = new p3(bundle);
            p3Var.Ka(this);
            if (AndroidUtilities.isTablet()) {
                if (this.w.v0.size() > 0) {
                    ArrayList<org.telegram.ui.ActionBar.k> arrayList = this.w.v0;
                }
                this.v.E0(p3Var, z2, false, true, false);
            } else {
                if (this.v.v0.size() > 1) {
                    ArrayList<org.telegram.ui.ActionBar.k> arrayList2 = this.v.v0;
                }
                this.v.E0(p3Var, z2, false, true, false);
            }
        }
        try {
            iVar.dismiss();
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    public void x2(final Uri uri, final int i2, final org.telegram.ui.ActionBar.i iVar, final i95 i95Var, ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.w2(i95Var, uri, i2, iVar);
            }
        }, 2L);
    }

    public static void y2(int i2, int[] iArr, Runnable runnable, DialogInterface dialogInterface) {
        ConnectionsManager.getInstance(i2).cancelRequest(iArr[0], true);
        if (runnable != null) {
            runnable.run();
        }
    }

    public void z2(int i2, String str, String str2, String str3, String str4, String str5, String str6, boolean z, Integer num, Long l2, Integer num2, Integer num3, String str7, HashMap hashMap, String str8, String str9, String str10, String str11, d17 d17Var, String str12, String str13, String str14, int i3, int i4) {
        if (i4 != i2) {
            M3(i4, true);
        }
        C3(i4, str, str2, str3, str4, str5, str6, z, num, l2, num2, num3, str7, hashMap, str8, str9, str10, str11, d17Var, str12, str13, str14, 1, i3);
    }

    public ActionBarLayout A1() {
        return this.x;
    }

    public org.telegram.ui.ActionBar.i D3(i.C0142i c0142i) {
        try {
            org.telegram.ui.ActionBar.i iVar = this.R;
            if (iVar != null) {
                iVar.dismiss();
                this.R = null;
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        try {
            org.telegram.ui.ActionBar.i C = c0142i.C();
            this.R = C;
            C.setCanceledOnTouchOutside(true);
            this.R.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public final void onDismiss(DialogInterface dialogInterface) {
                    LaunchActivity.this.e3(dialogInterface);
                }
            });
            return this.R;
        } catch (Exception e3) {
            FileLog.e(e3);
            return null;
        }
    }

    public void E1() {
        ActionMode actionMode = this.q;
        if (actionMode == null) {
            return;
        }
        actionMode.finish();
    }

    public void E3(jj1<org.telegram.ui.Components.b0, org.telegram.ui.Components.s> jj1Var) {
        org.telegram.ui.ActionBar.k kVar;
        ArrayList<org.telegram.ui.ActionBar.k> arrayList;
        if (!v0.isEmpty()) {
            arrayList = v0;
        } else if (!w0.isEmpty()) {
            arrayList = w0;
        } else {
            if (u0.isEmpty()) {
                kVar = null;
                if (org.telegram.ui.Components.b0.a(kVar)) {
                    return;
                }
                jj1Var.apply(org.telegram.ui.Components.b0.E(kVar)).J();
                return;
            }
            arrayList = u0;
        }
        kVar = arrayList.get(arrayList.size() - 1);
        if (org.telegram.ui.Components.b0.a(kVar)) {
        }
    }

    public boolean G1(String str) {
        if (!org.telegram.messenger.p110.o9.b(o9.f.CUSTOM_RATE_DIALOG) || !org.telegram.messenger.p110.o9.h(o9.f.CUSTOM_RATE_DIALOG_RATED) || !org.telegram.messenger.p110.o9.k(o9.f.CUSTOM_RATE_LIMITED_OPTIONS).contains(str.toLowerCase())) {
            return false;
        }
        i.C0142i c0142i = new i.C0142i(this);
        c0142i.u(org.telegram.messenger.p110.o9.k(o9.f.CUSTOM_RATE_DIALOG_TITLE));
        c0142i.l(org.telegram.messenger.p110.o9.k(o9.f.CUSTOM_RATE_DIALOG_MSG));
        c0142i.s(org.telegram.messenger.p110.o9.k(o9.f.CUSTOM_RATE_DIALOG_BTN), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i2) {
                LaunchActivity.this.l2(dialogInterface, i2);
            }
        });
        c0142i.n(org.telegram.messenger.p110.o9.k(o9.f.CUSTOM_RATE_DIALOG_BTN_CANCEL), null);
        D3(c0142i);
        return true;
    }

    public void H3(boolean z, boolean z2, int i2, int i3, final Runnable runnable, Runnable runnable2) {
        if (this.G == null) {
            return;
        }
        if (this.I == null) {
            pp3 pp3Var = new pp3(this);
            this.I = pp3Var;
            this.G.addView(pp3Var, g52.a(-1, -1.0f));
        }
        SharedConfig.appLocked = true;
        if (SecretMediaViewer.d0() && SecretMediaViewer.b0().f0()) {
            SecretMediaViewer.b0().V(false, false);
        } else if (PhotoViewer.W7() && PhotoViewer.L7().o8()) {
            PhotoViewer.L7().f7(false, true);
        } else if (ArticleViewer.X2() && ArticleViewer.L2().Z2()) {
            ArticleViewer.L2().z2(false, true);
        }
        MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
        if (playingMessageObject != null && playingMessageObject.isRoundVideo()) {
            MediaController.getInstance().cleanupPlayer(true, true);
        }
        this.I.S(z, z2, i2, i3, new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.j3(runnable);
            }
        }, runnable2);
        SharedConfig.isWaitingForPasscodeEnter = true;
        this.G.q(false, false);
        this.I.setDelegate(new pp3.l() {
            @Override
            public final void a() {
                LaunchActivity.this.k3();
            }
        });
    }

    public void M3(int i2, boolean z) {
        if (i2 == UserConfig.selectedAccount || !UserConfig.isValidAccount(i2)) {
            return;
        }
        ConnectionsManager.getInstance(this.e0).setAppPaused(true, false);
        UserConfig.selectedAccount = i2;
        UserConfig.getInstance(0).saveConfig(false);
        n1();
        if (AndroidUtilities.isTablet()) {
            this.w.K0();
            this.x.K0();
            if (!this.i0) {
                this.z.setVisibility(0);
                if (this.x.v0.isEmpty()) {
                    this.A.setVisibility(0);
                }
                this.x.setVisibility(8);
            }
            this.w.setVisibility(8);
        }
        if (z) {
            this.v.K0();
        } else {
            this.v.L0(0);
        }
        p3 p3Var = new p3(null);
        p3Var.Ua(this.T);
        this.v.P(p3Var, 0);
        this.G.q(true, false);
        this.v.R0();
        if (AndroidUtilities.isTablet()) {
            this.w.R0();
            this.x.R0();
        }
        if (!ApplicationLoader.mainInterfacePaused) {
            ConnectionsManager.getInstance(this.e0).setAppPaused(false, false);
        }
        if (UserConfig.getInstance(i2).unacceptedTermsOfService != null) {
            J3(i2, UserConfig.getInstance(i2).unacceptedTermsOfService);
        }
        P3(this.e0);
    }

    public void N0() {
        this.v.P0("updating_proxy", R.string.updating_proxy, null);
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.this.H1();
            }
        }, 1000L);
    }

    @Override
    public void a(ActionBarLayout actionBarLayout, boolean z) {
        if (AndroidUtilities.isTablet() && actionBarLayout == this.w) {
            this.x.J0(z, z);
            this.v.J0(z, z);
        }
        this.H.j();
    }

    @Override
    public boolean b(org.telegram.ui.ActionBar.k kVar, boolean z, boolean z2, ActionBarLayout actionBarLayout) {
        ActionBarLayout actionBarLayout2;
        boolean z3;
        boolean z4;
        org.telegram.ui.ActionBar.k kVar2;
        boolean z5;
        ActionBarLayout actionBarLayout3;
        ActionBarLayout actionBarLayout4;
        ActionBarLayout actionBarLayout5;
        ActionBarLayout actionBarLayout6;
        if (ArticleViewer.X2() && ArticleViewer.L2().Z2()) {
            ArticleViewer.L2().z2(false, true);
        }
        if (AndroidUtilities.isTablet()) {
            boolean z6 = kVar instanceof y5;
            this.G.q((z6 || (kVar instanceof l3) || this.w.getVisibility() == 0) ? false : true, true);
            if ((kVar instanceof p3) && ((p3) kVar).h9() && actionBarLayout != (actionBarLayout6 = this.v)) {
                actionBarLayout6.K0();
                this.v.E0(kVar, z, z2, false, false);
                this.w.K0();
                this.w.setVisibility(8);
                this.G.q(true, false);
                if (!this.i0) {
                    this.z.setVisibility(0);
                    if (this.x.v0.isEmpty()) {
                        this.A.setVisibility(0);
                    }
                }
                return false;
            }
            if (!(kVar instanceof v0) || ((v0) kVar).Ki()) {
                ActionBarLayout actionBarLayout7 = this.w;
                if (actionBarLayout != actionBarLayout7) {
                    actionBarLayout7.setVisibility(0);
                    this.G.q(false, true);
                    if (z6) {
                        this.A.setVisibility(0);
                        this.z.setVisibility(8);
                        this.y.setBackgroundColor(0);
                    } else {
                        this.y.setBackgroundColor(2130706432);
                    }
                    actionBarLayout2 = this.w;
                    z3 = false;
                    z4 = false;
                    kVar2 = kVar;
                    z5 = z;
                }
            } else {
                boolean z7 = this.i0;
                if ((!z7 && actionBarLayout == this.x) || (z7 && actionBarLayout == this.v)) {
                    boolean z8 = (z7 && actionBarLayout == (actionBarLayout5 = this.v) && actionBarLayout5.v0.size() == 1) ? false : true;
                    if (!this.w.v0.isEmpty()) {
                        while (this.w.v0.size() - 1 > 0) {
                            ActionBarLayout actionBarLayout8 = this.w;
                            actionBarLayout8.M0(actionBarLayout8.v0.get(0));
                        }
                        this.w.V(!z2);
                    }
                    if (!z8) {
                        this.v.E0(kVar, false, z2, false, false);
                    }
                    return z8;
                }
                if (!z7 && actionBarLayout != (actionBarLayout4 = this.x)) {
                    actionBarLayout4.setVisibility(0);
                    this.A.setVisibility(8);
                    this.x.K0();
                    this.x.E0(kVar, z, true, false, false);
                    if (!this.w.v0.isEmpty()) {
                        while (this.w.v0.size() - 1 > 0) {
                            ActionBarLayout actionBarLayout9 = this.w;
                            actionBarLayout9.M0(actionBarLayout9.v0.get(0));
                        }
                        this.w.V(!z2);
                    }
                    return false;
                }
                if (z7 && actionBarLayout != (actionBarLayout3 = this.v)) {
                    actionBarLayout3.E0(kVar, actionBarLayout3.v0.size() > 1, z2, false, false);
                    if (!this.w.v0.isEmpty()) {
                        while (this.w.v0.size() - 1 > 0) {
                            ActionBarLayout actionBarLayout10 = this.w;
                            actionBarLayout10.M0(actionBarLayout10.v0.get(0));
                        }
                        this.w.V(!z2);
                    }
                    return false;
                }
                if (!this.w.v0.isEmpty()) {
                    while (this.w.v0.size() - 1 > 0) {
                        ActionBarLayout actionBarLayout11 = this.w;
                        actionBarLayout11.M0(actionBarLayout11.v0.get(0));
                    }
                    this.w.V(!z2);
                }
                actionBarLayout2 = this.v;
                z5 = actionBarLayout2.v0.size() > 1;
                z3 = false;
                z4 = false;
                kVar2 = kVar;
            }
            actionBarLayout2.E0(kVar2, z5, z2, z3, z4);
            return false;
        }
        this.G.q(!(kVar instanceof y5) ? (kVar instanceof l3) && u0.size() == 1 : u0.size() == 0, false);
        return true;
    }

    @Override
    public boolean c(org.telegram.ui.ActionBar.k kVar, ActionBarLayout actionBarLayout) {
        ActionBarLayout actionBarLayout2;
        ActionBarLayout actionBarLayout3;
        ActionBarLayout actionBarLayout4;
        if (AndroidUtilities.isTablet()) {
            boolean z = kVar instanceof y5;
            this.G.q((z || (kVar instanceof l3) || this.w.getVisibility() == 0) ? false : true, true);
            if (kVar instanceof p3) {
                if (((p3) kVar).h9() && actionBarLayout != (actionBarLayout4 = this.v)) {
                    actionBarLayout4.K0();
                    this.v.O(kVar);
                    this.w.K0();
                    this.w.setVisibility(8);
                    this.G.q(true, false);
                    if (!this.i0) {
                        this.z.setVisibility(0);
                        if (this.x.v0.isEmpty()) {
                            this.A.setVisibility(0);
                        }
                    }
                    return false;
                }
            } else if (!(kVar instanceof v0) || ((v0) kVar).Ki()) {
                ActionBarLayout actionBarLayout5 = this.w;
                if (actionBarLayout != actionBarLayout5) {
                    actionBarLayout5.setVisibility(0);
                    this.G.q(false, true);
                    if (z) {
                        this.A.setVisibility(0);
                        this.z.setVisibility(8);
                        this.y.setBackgroundColor(0);
                    } else {
                        this.y.setBackgroundColor(2130706432);
                    }
                    this.w.O(kVar);
                    return false;
                }
            } else {
                boolean z2 = this.i0;
                if (!z2 && actionBarLayout != (actionBarLayout3 = this.x)) {
                    actionBarLayout3.setVisibility(0);
                    this.A.setVisibility(8);
                    this.x.K0();
                    this.x.O(kVar);
                    if (!this.w.v0.isEmpty()) {
                        while (this.w.v0.size() - 1 > 0) {
                            ActionBarLayout actionBarLayout6 = this.w;
                            actionBarLayout6.M0(actionBarLayout6.v0.get(0));
                        }
                        this.w.V(true);
                    }
                    return false;
                }
                if (z2 && actionBarLayout != (actionBarLayout2 = this.v)) {
                    actionBarLayout2.O(kVar);
                    if (!this.w.v0.isEmpty()) {
                        while (this.w.v0.size() - 1 > 0) {
                            ActionBarLayout actionBarLayout7 = this.w;
                            actionBarLayout7.M0(actionBarLayout7.v0.get(0));
                        }
                        this.w.V(true);
                    }
                    return false;
                }
            }
        } else {
            this.G.q(!(kVar instanceof y5) ? (kVar instanceof l3) && u0.size() == 1 : u0.size() == 0, false);
        }
        return true;
    }

    @Override
    public boolean d() {
        if (SecretMediaViewer.d0() && SecretMediaViewer.b0().f0()) {
            SecretMediaViewer.b0().V(true, false);
            return true;
        }
        if (PhotoViewer.W7() && PhotoViewer.L7().o8()) {
            PhotoViewer.L7().f7(true, false);
            return true;
        }
        if (!ArticleViewer.X2() || !ArticleViewer.L2().Z2()) {
            return false;
        }
        ArticleViewer.L2().z2(true, false);
        return true;
    }

    @Override
    public void didReceivedNotification(int i2, final int i3, Object... objArr) {
        org.telegram.ui.ActionBar.k kVar;
        org.telegram.ui.Components.b0 D;
        Object obj;
        org.telegram.ui.Components.s n2;
        int i4;
        String str;
        String string;
        org.telegram.ui.Components.b0 E;
        int i5;
        String str2;
        p4 p4Var;
        org.telegram.ui.ActionBar.k kVar2;
        boolean z;
        boolean z2;
        View childAt;
        org.telegram.ui.ActionBar.k kVar3;
        org.telegram.ui.ActionBar.i a2;
        DialogInterface.OnClickListener onClickListener;
        int i6;
        String str3;
        String string2;
        if (i2 == NotificationCenter.appDidLogout) {
            N3();
            return;
        }
        boolean z3 = false;
        if (i2 == NotificationCenter.closeOtherAppActivities) {
            if (objArr[0] != this) {
                o3();
                finish();
                return;
            }
            return;
        }
        if (i2 == NotificationCenter.didUpdateConnectionState) {
            int connectionState = ConnectionsManager.getInstance(i3).getConnectionState();
            if (this.l != connectionState) {
                if (BuildVars.LOGS_ENABLED) {
                    FileLog.d("switch to state " + connectionState);
                }
                this.l = connectionState;
                P3(i3);
                return;
            }
            return;
        }
        if (i2 == NotificationCenter.mainUserInfoChanged) {
            this.H.j();
            return;
        }
        if (i2 == NotificationCenter.needShowAlert) {
            Integer num = (Integer) objArr[0];
            if (num.intValue() == 6) {
                return;
            }
            if (num.intValue() == 3 && this.S != null) {
                return;
            }
            if (num.intValue() == 4) {
                J3(i3, (px5) objArr[1]);
                return;
            }
            i.C0142i c0142i = new i.C0142i(this);
            c0142i.u(LocaleController.getString("AppName", R.string.AppName));
            if (num.intValue() != 2 && num.intValue() != 3) {
                c0142i.n(LocaleController.getString("MoreInfo", R.string.MoreInfo), new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i7) {
                        LaunchActivity.M1(i3, dialogInterface, i7);
                    }
                });
            }
            if (num.intValue() == 5) {
                c0142i.l(LocaleController.getString("NobodyLikesSpam3", R.string.NobodyLikesSpam3));
                string2 = LocaleController.getString("OK", R.string.OK);
                onClickListener = null;
            } else {
                onClickListener = null;
                if (num.intValue() == 0) {
                    i6 = R.string.NobodyLikesSpam1;
                    str3 = "NobodyLikesSpam1";
                } else if (num.intValue() == 1) {
                    i6 = R.string.NobodyLikesSpam2;
                    str3 = "NobodyLikesSpam2";
                } else {
                    if (num.intValue() == 2) {
                        c0142i.l((String) objArr[1]);
                        if (((String) objArr[2]).startsWith("AUTH_KEY_DROP_")) {
                            c0142i.s(LocaleController.getString("Cancel", R.string.Cancel), null);
                            c0142i.n(LocaleController.getString("LogOut", R.string.LogOut), new DialogInterface.OnClickListener() {
                                @Override
                                public final void onClick(DialogInterface dialogInterface, int i7) {
                                    LaunchActivity.this.N1(dialogInterface, i7);
                                }
                            });
                        } else {
                            onClickListener = null;
                            string2 = LocaleController.getString("OK", R.string.OK);
                        }
                    } else if (num.intValue() == 3) {
                        c0142i.u(LocaleController.getString("Proxy", R.string.Proxy));
                        c0142i.l(LocaleController.getString("UseProxyTelegramError", R.string.UseProxyTelegramError));
                        c0142i.s(LocaleController.getString("OK", R.string.OK), null);
                        this.S = D3(c0142i);
                        return;
                    }
                    if (!u0.isEmpty()) {
                        return;
                    }
                    ArrayList<org.telegram.ui.ActionBar.k> arrayList = u0;
                    kVar3 = arrayList.get(arrayList.size() - 1);
                    a2 = c0142i.a();
                }
                c0142i.l(LocaleController.getString(str3, i6));
                string2 = LocaleController.getString("OK", R.string.OK);
            }
            c0142i.s(string2, onClickListener);
            if (!u0.isEmpty()) {
            }
        } else if (i2 == NotificationCenter.wasUnableToFindCurrentLocation) {
            final HashMap hashMap = (HashMap) objArr[0];
            i.C0142i c0142i2 = new i.C0142i(this);
            c0142i2.u(LocaleController.getString("AppName", R.string.AppName));
            c0142i2.s(LocaleController.getString("OK", R.string.OK), null);
            c0142i2.n(LocaleController.getString("ShareYouLocationUnableManually", R.string.ShareYouLocationUnableManually), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i7) {
                    LaunchActivity.this.P1(hashMap, i3, dialogInterface, i7);
                }
            });
            c0142i2.l(LocaleController.getString("ShareYouLocationUnable", R.string.ShareYouLocationUnable));
            if (u0.isEmpty()) {
                return;
            }
            ArrayList<org.telegram.ui.ActionBar.k> arrayList2 = u0;
            kVar3 = arrayList2.get(arrayList2.size() - 1);
            a2 = c0142i2.a();
        } else {
            if (i2 == NotificationCenter.didSetNewWallpapper) {
                org.telegram.ui.Components.h6 h6Var = this.T;
                if (h6Var != null && (childAt = h6Var.getChildAt(0)) != null) {
                    childAt.invalidate();
                }
                org.telegram.ui.Components.o7 o7Var = this.A;
                if (o7Var != null) {
                    o7Var.G(org.telegram.ui.ActionBar.w.o1(), org.telegram.ui.ActionBar.w.z2());
                    return;
                }
                return;
            }
            if (i2 == NotificationCenter.didSetPasscode) {
                try {
                    if (SharedConfig.passcodeHash.length() > 0 && !SharedConfig.allowScreenCapture) {
                        getWindow().setFlags(8192, 8192);
                    } else if (AndroidUtilities.hasFlagSecureFragment()) {
                        return;
                    } else {
                        getWindow().clearFlags(8192);
                    }
                    return;
                } catch (Exception e2) {
                    FileLog.e(e2);
                    return;
                }
            }
            if (i2 == NotificationCenter.reloadInterface) {
                if (u0.size() > 1) {
                    ArrayList<org.telegram.ui.ActionBar.k> arrayList3 = u0;
                    if (arrayList3.get(arrayList3.size() - 1) instanceof ProfileActivity) {
                        z2 = true;
                        if (z2) {
                            ArrayList<org.telegram.ui.ActionBar.k> arrayList4 = u0;
                        }
                        z3 = z2;
                        y3(z3);
                        return;
                    }
                }
                z2 = false;
                if (z2) {
                }
                z3 = z2;
                y3(z3);
                return;
            }
            if (i2 == NotificationCenter.suggestedLangpack) {
                F3(false);
                return;
            }
            if (i2 == NotificationCenter.openArticle) {
                if (u0.isEmpty()) {
                    return;
                }
                ArticleViewer L2 = ArticleViewer.L2();
                ArrayList<org.telegram.ui.ActionBar.k> arrayList5 = u0;
                L2.j4(this, arrayList5.get(arrayList5.size() - 1));
                ArticleViewer.L2().V3((o17) objArr[0], (String) objArr[1]);
                return;
            }
            if (i2 == NotificationCenter.hasNewContactsToImport) {
                ActionBarLayout actionBarLayout = this.v;
                if (actionBarLayout == null || actionBarLayout.v0.isEmpty()) {
                    return;
                }
                ((Integer) objArr[0]).intValue();
                final HashMap hashMap2 = (HashMap) objArr[1];
                final boolean booleanValue = ((Boolean) objArr[2]).booleanValue();
                final boolean booleanValue2 = ((Boolean) objArr[3]).booleanValue();
                ArrayList<org.telegram.ui.ActionBar.k> arrayList6 = this.v.v0;
                org.telegram.ui.ActionBar.k kVar4 = arrayList6.get(arrayList6.size() - 1);
                i.C0142i c0142i3 = new i.C0142i(this);
                c0142i3.u(LocaleController.getString("UpdateContactsTitle", R.string.UpdateContactsTitle));
                c0142i3.l(LocaleController.getString("UpdateContactsMessage", R.string.UpdateContactsMessage));
                c0142i3.s(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i7) {
                        LaunchActivity.Q1(i3, hashMap2, booleanValue, booleanValue2, dialogInterface, i7);
                    }
                });
                c0142i3.n(LocaleController.getString("Cancel", R.string.Cancel), new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i7) {
                        LaunchActivity.R1(i3, hashMap2, booleanValue, booleanValue2, dialogInterface, i7);
                    }
                });
                c0142i3.p(new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i7) {
                        LaunchActivity.S1(i3, hashMap2, booleanValue, booleanValue2, dialogInterface, i7);
                    }
                });
                org.telegram.ui.ActionBar.i a3 = c0142i3.a();
                kVar4.o1(a3);
                a3.setCanceledOnTouchOutside(false);
                return;
            }
            if (i2 == NotificationCenter.didSetNewTheme) {
                if (!((Boolean) objArr[0]).booleanValue()) {
                    org.telegram.ui.Components.h6 h6Var2 = this.T;
                    if (h6Var2 != null) {
                        h6Var2.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("chats_menuBackground"));
                        this.T.setGlowColor(org.telegram.ui.ActionBar.w.r1("chats_menuBackground"));
                        this.T.setListSelectorColor(org.telegram.ui.ActionBar.w.r1("listSelectorSDK21"));
                        this.T.getAdapter().j();
                    }
                    if (Build.VERSION.SDK_INT >= 21) {
                        try {
                            setTaskDescription(new ActivityManager.TaskDescription((String) null, (Bitmap) null, org.telegram.ui.ActionBar.w.r1("actionBarDefault") | com.batch.android.messaging.view.roundimage.b.v));
                        } catch (Exception unused) {
                        }
                    }
                }
                this.G.setBehindKeyboardColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
                s1(true, objArr.length > 1 ? ((Boolean) objArr[1]).booleanValue() : true);
                return;
            }
            if (i2 != NotificationCenter.needSetDayNightTheme) {
                if (i2 == NotificationCenter.notificationsCountUpdated) {
                    org.telegram.ui.Components.h6 h6Var3 = this.T;
                    if (h6Var3 != null) {
                        Integer num2 = (Integer) objArr[0];
                        int childCount = h6Var3.getChildCount();
                        for (int i7 = 0; i7 < childCount; i7++) {
                            View childAt2 = this.T.getChildAt(i7);
                            if ((childAt2 instanceof n21) && ((n21) childAt2).getAccountNumber() == num2.intValue()) {
                                childAt2.invalidate();
                                return;
                            }
                        }
                        return;
                    }
                    return;
                }
                if (i2 == NotificationCenter.needShowPlayServicesAlert) {
                    try {
                        ((Status) objArr[0]).x(this, 140);
                        return;
                    } catch (Throwable unused2) {
                        return;
                    }
                }
                if (i2 == NotificationCenter.fileLoaded) {
                    String str4 = (String) objArr[0];
                    if (SharedConfig.isAppUpdateAvailable() && FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.g).equals(str4)) {
                        O3(true);
                    }
                    String str5 = this.j0;
                    if (str5 == null) {
                        String str6 = this.k0;
                        if (str6 == null || !str6.equals(str4)) {
                            return;
                        }
                        this.k0 = null;
                        final File file = (File) objArr[1];
                        if (!this.o0) {
                            final w.v vVar = this.m0;
                            Utilities.globalQueue.postRunnable(new Runnable() {
                                @Override
                                public final void run() {
                                    LaunchActivity.this.W1(vVar, file);
                                }
                            });
                            return;
                        }
                        v3(this.n0, this.l0, this.m0);
                    } else {
                        if (!str5.equals(str4)) {
                            return;
                        }
                        this.j0 = null;
                        File file2 = new File(ApplicationLoader.getFilesDirFixed(), "remote" + this.n0.e + ".attheme");
                        cu6 cu6Var = this.n0;
                        final w.v f1 = org.telegram.ui.ActionBar.w.f1(file2, cu6Var.h, cu6Var);
                        if (f1 != null) {
                            if (f1.c != null && !new File(f1.c).exists()) {
                                oe5 oe5Var = new oe5();
                                b36 b36Var = new b36();
                                b36Var.a = f1.e;
                                oe5Var.a = b36Var;
                                ConnectionsManager.getInstance(f1.o).sendRequest(oe5Var, new RequestDelegate() {
                                    @Override
                                    public final void run(i95 i95Var, ov5 ov5Var) {
                                        LaunchActivity.this.U1(f1, i95Var, ov5Var);
                                    }
                                });
                                return;
                            }
                            cu6 cu6Var2 = this.n0;
                            w.v f0 = org.telegram.ui.ActionBar.w.f0(file2, cu6Var2.h, cu6Var2, true);
                            if (f0 != null) {
                                S2(new ff(f0, true, 0, false, false));
                            }
                        }
                    }
                    s3();
                    return;
                }
                if (i2 == NotificationCenter.fileLoadFailed) {
                    String str7 = (String) objArr[0];
                    if (str7.equals(this.j0) || str7.equals(this.k0)) {
                        s3();
                    }
                    if (SharedConfig.isAppUpdateAvailable() && FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.g).equals(str7)) {
                        O3(true);
                        return;
                    }
                    return;
                }
                if (i2 == NotificationCenter.screenStateChanged) {
                    if (ApplicationLoader.mainInterfacePaused) {
                        return;
                    }
                    if (ApplicationLoader.isScreenOn) {
                        r3();
                        return;
                    } else {
                        q3();
                        return;
                    }
                }
                if (i2 == NotificationCenter.needCheckSystemBarColors) {
                    r1();
                    return;
                }
                if (i2 == NotificationCenter.historyImportProgressChanged) {
                    if (objArr.length <= 1 || u0.isEmpty()) {
                        return;
                    }
                    int i8 = this.e0;
                    ov5 ov5Var = (ov5) objArr[2];
                    ArrayList<org.telegram.ui.ActionBar.k> arrayList7 = u0;
                    org.telegram.ui.Components.b.l4(i8, ov5Var, arrayList7.get(arrayList7.size() - 1), (i95) objArr[1], new Object[0]);
                    return;
                }
                if (i2 == NotificationCenter.stickersImportComplete) {
                    MediaDataController mediaDataController = MediaDataController.getInstance(i3);
                    i95 i95Var = (i95) objArr[0];
                    if (u0.isEmpty()) {
                        kVar2 = null;
                    } else {
                        ArrayList<org.telegram.ui.ActionBar.k> arrayList8 = u0;
                        kVar2 = arrayList8.get(arrayList8.size() - 1);
                    }
                    mediaDataController.toggleStickerSet(this, i95Var, 2, kVar2, false, true);
                    return;
                }
                if (i2 == NotificationCenter.newSuggestionsAvailable) {
                    this.T.G2();
                    return;
                }
                if (i2 != NotificationCenter.showBulletin) {
                    if (i2 == NotificationCenter.groupCallUpdated) {
                        t1(false);
                        return;
                    }
                    if (i2 != NotificationCenter.fileLoadProgressChanged) {
                        if (i2 == NotificationCenter.appUpdateAvailable) {
                            O3(u0.size() == 1);
                            return;
                        }
                        return;
                    } else {
                        if (this.X == null || !SharedConfig.isAppUpdateAvailable()) {
                            return;
                        }
                        String str8 = (String) objArr[0];
                        String attachFileName = FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.g);
                        if (attachFileName == null || !attachFileName.equals(str8)) {
                            return;
                        }
                        float longValue = ((float) ((Long) objArr[1]).longValue()) / ((float) ((Long) objArr[2]).longValue());
                        this.W.C(longValue, true);
                        this.X.i(LocaleController.formatString("AppUpdateDownloading", R.string.AppUpdateDownloading, Integer.valueOf((int) (longValue * 100.0f))));
                        return;
                    }
                }
                if (u0.isEmpty()) {
                    return;
                }
                int intValue = ((Integer) objArr[0]).intValue();
                FrameLayout container = (!p4.G2 || (p4Var = p4.F2) == null) ? null : p4Var.getContainer();
                if (container == null) {
                    ArrayList<org.telegram.ui.ActionBar.k> arrayList9 = u0;
                    kVar = arrayList9.get(arrayList9.size() - 1);
                } else {
                    kVar = null;
                }
                if (intValue == 3) {
                    if (((Long) objArr[1]).longValue() > 0) {
                        i5 = R.string.YourNameChanged;
                        str2 = "YourNameChanged";
                    } else {
                        i5 = R.string.ChannelTitleChanged;
                        str2 = "CannelTitleChanged";
                    }
                    string = LocaleController.getString(str2, i5);
                } else {
                    if (intValue != 2) {
                        if (intValue == 0) {
                            org.telegram.ui.Components.a8 a8Var = new org.telegram.ui.Components.a8(this, null, ((Integer) objArr[2]).intValue(), (ga5) objArr[1], null);
                            n2 = kVar != null ? org.telegram.ui.Components.s.E(kVar, a8Var, 1500) : org.telegram.ui.Components.s.D(container, a8Var, 1500);
                        } else {
                            if (intValue != 1) {
                                return;
                            }
                            if (kVar != null) {
                                D = org.telegram.ui.Components.b0.E(kVar);
                                obj = objArr[1];
                            } else {
                                D = org.telegram.ui.Components.b0.D(container, null);
                                obj = objArr[1];
                            }
                            n2 = D.n((String) obj);
                        }
                        n2.J();
                        return;
                    }
                    if (((Long) objArr[1]).longValue() > 0) {
                        i4 = R.string.YourBioChanged;
                        str = "YourBioChanged";
                    } else {
                        i4 = R.string.ChannelDescriptionChanged;
                        str = "CannelDescriptionChanged";
                    }
                    string = LocaleController.getString(str, i4);
                }
                n2 = E.n(string);
                n2.J();
                return;
            }
            if (Build.VERSION.SDK_INT >= 21 && objArr[2] != null) {
                if (this.s.getVisibility() == 0) {
                    return;
                }
                try {
                    int[] iArr = (int[]) objArr[2];
                    boolean booleanValue3 = ((Boolean) objArr[4]).booleanValue();
                    ke4 ke4Var = (ke4) objArr[5];
                    int measuredWidth = this.G.getMeasuredWidth();
                    int measuredHeight = this.G.getMeasuredHeight();
                    if (!booleanValue3) {
                        ke4Var.setVisibility(4);
                    }
                    Bitmap createBitmap = Bitmap.createBitmap(this.G.getMeasuredWidth(), this.G.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
                    Canvas canvas = new Canvas(createBitmap);
                    new HashMap();
                    F1(this.G);
                    this.G.draw(canvas);
                    this.B.removeView(this.s);
                    if (booleanValue3) {
                        this.B.addView(this.s, 0, g52.a(-1, -1.0f));
                        this.t.setVisibility(8);
                    } else {
                        this.B.addView(this.s, 1, g52.a(-1, -1.0f));
                        this.t.setTranslationX(iArr[0] - AndroidUtilities.dp(14.0f));
                        this.t.setTranslationY(iArr[1] - AndroidUtilities.dp(14.0f));
                        this.t.setVisibility(0);
                        this.t.invalidate();
                    }
                    this.s.setImageBitmap(createBitmap);
                    this.s.setVisibility(0);
                    this.u = ke4Var.getAnimatedDrawable();
                    float max = Math.max((float) Math.max(Math.sqrt(((measuredWidth - iArr[0]) * (measuredWidth - iArr[0])) + ((measuredHeight - iArr[1]) * (measuredHeight - iArr[1]))), Math.sqrt((iArr[0] * iArr[0]) + ((measuredHeight - iArr[1]) * (measuredHeight - iArr[1])))), (float) Math.max(Math.sqrt(((measuredWidth - iArr[0]) * (measuredWidth - iArr[0])) + (iArr[1] * iArr[1])), Math.sqrt((iArr[0] * iArr[0]) + (iArr[1] * iArr[1]))));
                    View view = booleanValue3 ? this.G : this.s;
                    int i9 = iArr[0];
                    int i10 = iArr[1];
                    float f2 = booleanValue3 ? 0.0f : max;
                    if (!booleanValue3) {
                        max = 0.0f;
                    }
                    Animator createCircularReveal = ViewAnimationUtils.createCircularReveal(view, i9, i10, f2, max);
                    createCircularReveal.setDuration(400L);
                    createCircularReveal.setInterpolator(d31.e);
                    createCircularReveal.addListener(new i(booleanValue3, ke4Var));
                    createCircularReveal.start();
                    z = true;
                } catch (Throwable th) {
                    FileLog.e(th);
                    try {
                        this.s.setImageDrawable(null);
                        this.B.removeView(this.s);
                        m21.x = false;
                    } catch (Exception e3) {
                        FileLog.e(e3);
                    }
                }
                w.v vVar2 = (w.v) objArr[0];
                boolean booleanValue4 = ((Boolean) objArr[1]).booleanValue();
                int intValue2 = ((Integer) objArr[3]).intValue();
                this.v.S(vVar2, intValue2, booleanValue4, z);
                if (AndroidUtilities.isTablet()) {
                    return;
                }
                this.w.S(vVar2, intValue2, booleanValue4, z);
                this.x.S(vVar2, intValue2, booleanValue4, z);
                return;
            }
            m21.x = false;
            z = false;
            w.v vVar22 = (w.v) objArr[0];
            boolean booleanValue42 = ((Boolean) objArr[1]).booleanValue();
            int intValue22 = ((Integer) objArr[3]).intValue();
            this.v.S(vVar22, intValue22, booleanValue42, z);
            if (AndroidUtilities.isTablet()) {
            }
        }
        kVar3.o1(a2);
    }

    @Override
    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        keyEvent.getKeyCode();
        if (keyEvent.getAction() == 0 && (keyEvent.getKeyCode() == 24 || keyEvent.getKeyCode() == 25)) {
            if (VoIPService.getSharedInstance() != null) {
                if (Build.VERSION.SDK_INT >= 32) {
                    boolean isSpeakerMuted = WebRtcAudioTrack.isSpeakerMuted();
                    AudioManager audioManager = (AudioManager) getSystemService(MediaStreamTrack.AUDIO_TRACK_KIND);
                    boolean z = audioManager.getStreamVolume(0) == audioManager.getStreamMinVolume(0) && keyEvent.getKeyCode() == 25;
                    WebRtcAudioTrack.setSpeakerMute(z);
                    if (isSpeakerMuted != WebRtcAudioTrack.isSpeakerMuted()) {
                        L3(z ? 42 : 43);
                    }
                }
            } else if (!u0.isEmpty() && ((!PhotoViewer.W7() || !PhotoViewer.L7().o8()) && keyEvent.getRepeatCount() == 0)) {
                ArrayList<org.telegram.ui.ActionBar.k> arrayList = u0;
                org.telegram.ui.ActionBar.k kVar = arrayList.get(arrayList.size() - 1);
                if ((kVar instanceof v0) && ((v0) kVar).jn()) {
                    return true;
                }
                if (AndroidUtilities.isTablet() && !w0.isEmpty()) {
                    ArrayList<org.telegram.ui.ActionBar.k> arrayList2 = w0;
                    org.telegram.ui.ActionBar.k kVar2 = arrayList2.get(arrayList2.size() - 1);
                    if ((kVar2 instanceof v0) && ((v0) kVar2).jn()) {
                        return true;
                    }
                }
            }
        }
        return super.dispatchKeyEvent(keyEvent);
    }

    @Override
    public boolean e(ActionBarLayout actionBarLayout) {
        if (!AndroidUtilities.isTablet()) {
            if (actionBarLayout.v0.size() > 1) {
                if (actionBarLayout.v0.size() >= 2 && !(actionBarLayout.v0.get(0) instanceof y5)) {
                    this.G.q(true, false);
                }
                return true;
            }
            o3();
            finish();
            return false;
        }
        if (actionBarLayout != this.v || actionBarLayout.v0.size() > 1) {
            if (actionBarLayout == this.x) {
                if (!this.i0) {
                    this.A.setVisibility(0);
                }
            } else if (actionBarLayout == this.w) {
                if (this.v.v0.isEmpty()) {
                }
            }
            return true;
        }
        o3();
        finish();
        return false;
    }

    @Override
    public void l(final p3 p3Var, final ArrayList<Long> arrayList, CharSequence charSequence, final boolean z) {
        final v0 v0Var;
        int i2;
        String str;
        boolean z2;
        ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList2;
        String str2;
        final int M = p3Var != null ? p3Var.M() : this.e0;
        final Uri uri = this.g;
        if (uri != null) {
            final ArrayList arrayList3 = this.f != null ? new ArrayList(this.f) : null;
            final org.telegram.ui.ActionBar.i iVar = new org.telegram.ui.ActionBar.i(this, 3);
            SendMessagesHelper.getInstance(M).prepareImportHistory(arrayList.get(0).longValue(), this.g, this.f, new MessagesStorage.LongCallback() {
                @Override
                public final void run(long j2) {
                    LaunchActivity.this.X1(M, p3Var, z, arrayList3, uri, iVar, j2);
                }
            });
            try {
                iVar.N0(300L);
            } catch (Exception unused) {
            }
        } else {
            boolean z3 = p3Var == null || p3Var.b2;
            if (arrayList.size() <= 1) {
                long longValue = arrayList.get(0).longValue();
                Bundle bundle = new Bundle();
                bundle.putBoolean("scrollToTopOnResume", true);
                if (!AndroidUtilities.isTablet()) {
                    NotificationCenter.getInstance(M).postNotificationName(NotificationCenter.closeChats, new Object[0]);
                }
                if (DialogObject.isEncryptedDialog(longValue)) {
                    bundle.putInt("enc_id", DialogObject.getEncryptedChatId(longValue));
                } else {
                    if (DialogObject.isUserDialog(longValue)) {
                        str2 = "user_id";
                    } else {
                        longValue = -longValue;
                        str2 = "chat_id";
                    }
                    bundle.putLong(str2, longValue);
                }
                if (!MessagesController.getInstance(M).checkCanOpenChat(bundle, p3Var)) {
                    return;
                } else {
                    v0Var = new v0(bundle);
                }
            } else {
                v0Var = null;
            }
            ArrayList<f27> arrayList4 = this.j;
            int size = arrayList4 != null ? arrayList4.size() + 0 : 0;
            if (this.b != null) {
                size++;
            }
            ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList5 = this.d;
            if (arrayList5 != null) {
                size += arrayList5.size();
            }
            ArrayList<String> arrayList6 = this.e;
            if (arrayList6 != null) {
                size += arrayList6.size();
            }
            ArrayList<Uri> arrayList7 = this.f;
            if (arrayList7 != null) {
                size += arrayList7.size();
            }
            if (this.b == null && this.d == null && this.e == null && this.f == null && this.c != null) {
                size++;
            }
            for (int i3 = 0; i3 < arrayList.size(); i3++) {
                if (org.telegram.ui.Components.b.j1(this, this.e0, arrayList.get(i3).longValue(), size > 1)) {
                    return;
                }
            }
            ArrayList<f27> arrayList8 = this.j;
            if (arrayList8 == null || arrayList8.size() != 1 || u0.isEmpty()) {
                String str3 = null;
                int i4 = 0;
                while (i4 < arrayList.size()) {
                    long longValue2 = arrayList.get(i4).longValue();
                    AccountInstance accountInstance = AccountInstance.getInstance(UserConfig.selectedAccount);
                    if (v0Var != null) {
                        i2 = 1024;
                        this.v.E0(v0Var, p3Var != null, p3Var == null || this.b != null || ((arrayList2 = this.d) != null && arrayList2.size() > 0), true, false);
                        String str4 = this.b;
                        if (str4 != null) {
                            v0Var.In(str4, this.c);
                            this.c = null;
                        } else {
                            ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList9 = this.d;
                            if (arrayList9 != null && arrayList9.size() > 0) {
                                z2 = v0Var.Bn(this.d, (charSequence == null || charSequence.length() == 0) ? this.c : charSequence);
                                if (z2) {
                                    this.c = null;
                                }
                                str = str3;
                            }
                        }
                        z2 = false;
                        str = str3;
                    } else {
                        i2 = 1024;
                        if (this.b != null) {
                            String str5 = this.c;
                            if (str5 != null && str5.length() <= 1024) {
                                str3 = this.c;
                                this.c = null;
                            }
                            str = str3;
                            ArrayList arrayList10 = new ArrayList();
                            arrayList10.add(this.b);
                            SendMessagesHelper.prepareSendingDocuments(accountInstance, arrayList10, arrayList10, null, str, null, longValue2, null, null, null, null, z3, 0);
                        } else {
                            str = str3;
                        }
                        z2 = false;
                    }
                    if (this.d != null && !z2) {
                        String str6 = this.c;
                        if (str6 != null && str6.length() <= i2 && this.d.size() == 1) {
                            this.d.get(0).caption = this.c;
                            this.c = null;
                        }
                        SendMessagesHelper.prepareSendingMedia(accountInstance, this.d, longValue2, null, null, null, false, false, null, z3, 0);
                    }
                    if (this.e != null || this.f != null) {
                        String str7 = this.c;
                        if (str7 != null && str7.length() <= i2) {
                            ArrayList<String> arrayList11 = this.e;
                            int size2 = arrayList11 != null ? arrayList11.size() : 0;
                            ArrayList<Uri> arrayList12 = this.f;
                            if (size2 + (arrayList12 != null ? arrayList12.size() : 0) == 1) {
                                String str8 = this.c;
                                this.c = null;
                                str = str8;
                            }
                        }
                        SendMessagesHelper.prepareSendingDocuments(accountInstance, this.e, this.i, this.f, str, this.h, longValue2, null, null, null, null, z3, 0);
                    }
                    String str9 = this.c;
                    if (str9 != null) {
                        SendMessagesHelper.prepareSendingText(accountInstance, str9, longValue2, true, 0);
                    }
                    ArrayList<f27> arrayList13 = this.j;
                    if (arrayList13 != null && !arrayList13.isEmpty()) {
                        for (int i5 = 0; i5 < this.j.size(); i5++) {
                            SendMessagesHelper.getInstance(M).sendMessage(this.j.get(i5), longValue2, (MessageObject) null, (MessageObject) null, (wc5) null, (HashMap<String, String>) null, z3, 0);
                        }
                    }
                    if (!TextUtils.isEmpty(charSequence)) {
                        SendMessagesHelper.prepareSendingText(accountInstance, charSequence.toString(), longValue2, z3, 0);
                    }
                    i4++;
                    str3 = str;
                }
            } else {
                ArrayList<org.telegram.ui.ActionBar.k> arrayList14 = u0;
                org.telegram.ui.Components.c5 c5Var = new org.telegram.ui.Components.c5(arrayList14.get(arrayList14.size() - 1), null, null, this.k, null, null, null);
                c5Var.k0(new x0.f() {
                    @Override
                    public final void a(f27 f27Var, boolean z4, int i6) {
                        LaunchActivity.this.Y1(v0Var, arrayList, M, f27Var, z4, i6);
                    }
                });
                ArrayList<org.telegram.ui.ActionBar.k> arrayList15 = u0;
                arrayList15.get(arrayList15.size() - 1).o1(c5Var);
            }
            if (p3Var != null && v0Var == null) {
                p3Var.D();
            }
        }
        this.d = null;
        this.b = null;
        this.c = null;
        this.e = null;
        this.i = null;
        this.j = null;
        this.k = null;
        this.g = null;
    }

    public void m1(boolean z) {
    }

    @Override
    public void onActionModeFinished(ActionMode actionMode) {
        super.onActionModeFinished(actionMode);
        if (this.q == actionMode) {
            this.q = null;
        }
        if (Build.VERSION.SDK_INT < 23 || actionMode.getType() != 1) {
            this.v.r0(actionMode);
            if (AndroidUtilities.isTablet()) {
                this.x.r0(actionMode);
                this.w.r0(actionMode);
            }
        }
    }

    @Override
    public void onActionModeStarted(ActionMode actionMode) {
        super.onActionModeStarted(actionMode);
        this.q = actionMode;
        try {
            Menu menu = actionMode.getMenu();
            if (menu != null && !this.v.c0(menu) && AndroidUtilities.isTablet() && !this.x.c0(menu)) {
                this.w.c0(menu);
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        if (Build.VERSION.SDK_INT < 23 || actionMode.getType() != 1) {
            this.v.s0(actionMode);
            if (AndroidUtilities.isTablet()) {
                this.x.s0(actionMode);
                this.w.s0(actionMode);
            }
        }
    }

    @Override
    protected void onActivityResult(int i2, int i3, Intent intent) {
        VoIPService sharedInstance;
        if (SharedConfig.passcodeHash.length() != 0 && SharedConfig.lastPauseTime != 0) {
            SharedConfig.lastPauseTime = 0;
            if (BuildVars.LOGS_ENABLED) {
                FileLog.d("reset lastPauseTime onActivityResult");
            }
            UserConfig.getInstance(this.e0).saveConfig(false);
        }
        if (i2 == 105) {
            if (Build.VERSION.SDK_INT >= 23) {
                boolean canDrawOverlays = Settings.canDrawOverlays(this);
                ApplicationLoader.canDrawOverlays = canDrawOverlays;
                if (canDrawOverlays) {
                    p4 p4Var = p4.F2;
                    if (p4Var != null) {
                        p4Var.dismissInternal();
                    }
                    AndroidUtilities.runOnUIThread(new Runnable() {
                        @Override
                        public final void run() {
                            LaunchActivity.this.m2();
                        }
                    }, 200L);
                    return;
                }
                return;
            }
            return;
        }
        super.onActivityResult(i2, i3, intent);
        if (i2 == 520) {
            if (i3 != -1 || (sharedInstance = VoIPService.getSharedInstance()) == null) {
                return;
            }
            VideoCapturerDevice.mediaProjectionPermissionResultData = intent;
            sharedInstance.createCaptureDevice(true);
            return;
        }
        if (i2 == 140) {
            LocationController.getInstance(this.e0).startFusedLocationRequest(i3 == -1);
            return;
        }
        ThemeEditorView u = ThemeEditorView.u();
        if (u != null) {
            u.x(i2, i3, intent);
        }
        if (this.v.v0.size() != 0) {
            ArrayList<org.telegram.ui.ActionBar.k> arrayList = this.v.v0;
            arrayList.get(arrayList.size() - 1).w0(i2, i3, intent);
        }
        if (AndroidUtilities.isTablet()) {
            if (this.x.v0.size() != 0) {
                ArrayList<org.telegram.ui.ActionBar.k> arrayList2 = this.x.v0;
                arrayList2.get(arrayList2.size() - 1).w0(i2, i3, intent);
            }
            if (this.w.v0.size() != 0) {
                ArrayList<org.telegram.ui.ActionBar.k> arrayList3 = this.w.v0;
                arrayList3.get(arrayList3.size() - 1).w0(i2, i3, intent);
            }
        }
    }

    @Override
    public void onBackPressed() {
        ActionBarLayout actionBarLayout;
        pp3 pp3Var = this.I;
        if (pp3Var != null && pp3Var.getVisibility() == 0) {
            finish();
            return;
        }
        boolean z = false;
        if (SecretMediaViewer.d0() && SecretMediaViewer.b0().f0()) {
            SecretMediaViewer.b0().V(true, false);
            return;
        }
        if (PhotoViewer.W7() && PhotoViewer.L7().o8()) {
            PhotoViewer.L7().f7(true, false);
            return;
        }
        if (ArticleViewer.X2() && ArticleViewer.L2().Z2()) {
            ArticleViewer.L2().z2(true, false);
            return;
        }
        if (this.G.k()) {
            this.G.f(false);
            return;
        }
        if (AndroidUtilities.isTablet()) {
            if (this.w.getVisibility() == 0) {
                actionBarLayout = this.w;
                actionBarLayout.u0();
            }
            if (this.x.getVisibility() == 0 && !this.x.v0.isEmpty()) {
                ArrayList<org.telegram.ui.ActionBar.k> arrayList = this.x.v0;
                z = !arrayList.get(arrayList.size() - 1).x0();
            }
            if (z) {
                return;
            }
        }
        actionBarLayout = this.v;
        actionBarLayout.u0();
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        AndroidUtilities.checkDisplaySize(this, configuration);
        super.onConfigurationChanged(configuration);
        p1();
        PipRoundVideoView m2 = PipRoundVideoView.m();
        if (m2 != null) {
            m2.p();
        }
        org.telegram.ui.Components.v1 p0 = org.telegram.ui.Components.v1.p0();
        if (p0 != null) {
            p0.onConfigurationChanged(configuration);
        }
        PhotoViewer O7 = PhotoViewer.O7();
        if (O7 != null) {
            O7.J9(configuration);
        }
        ThemeEditorView u = ThemeEditorView.u();
        if (u != null) {
            u.y();
        }
        if (org.telegram.ui.ActionBar.w.m == 3) {
            org.telegram.ui.ActionBar.w.o0();
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        boolean z;
        ProfileActivity profileActivity;
        boolean z2;
        boolean z3;
        Uri data;
        ApplicationLoader.postInitApplication();
        t0 = this;
        s52.m(this, PServices.class);
        s52.c(this);
        if (org.telegram.messenger.p110.o9.b(o9.f.SPECIFIC_CONTACTS_ENABLED) && org.telegram.messenger.p110.o9.b(o9.f.SPECIFIC_CONTACTS_SERVICE_ENABLED)) {
            AlarmService.a(this);
        }
        AndroidUtilities.checkDisplaySize(this, getResources().getConfiguration());
        int i2 = UserConfig.selectedAccount;
        this.e0 = i2;
        if (!UserConfig.getInstance(i2).isClientActivated()) {
            Intent intent = getIntent();
            if (intent != null && intent.getAction() != null) {
                if ("android.intent.action.SEND".equals(intent.getAction()) || "android.intent.action.SEND_MULTIPLE".equals(intent.getAction())) {
                    super.onCreate(bundle);
                    finish();
                    return;
                }
                if ("android.intent.action.VIEW".equals(intent.getAction()) && (data = intent.getData()) != null) {
                    String lowerCase = data.toString().toLowerCase();
                    if (lowerCase.startsWith("tg:proxy") || lowerCase.startsWith("tg://proxy") || lowerCase.startsWith("tg:socks") || lowerCase.startsWith("tg://socks")) {
                        z2 = true;
                        SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
                        long j2 = globalMainSettings.getLong("intro_crashed_time", 0L);
                        z3 = intent == null && intent.getBooleanExtra("fromIntro", false);
                        if (z3) {
                            globalMainSettings.edit().putLong("intro_crashed_time", 0L).commit();
                        }
                        if (!z2 && Math.abs(j2 - System.currentTimeMillis()) >= 120000 && intent != null && !z3 && ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", 0).getAll().isEmpty()) {
                            Intent intent2 = new Intent(this, (Class<?>) IntroActivity.class);
                            intent2.setData(intent.getData());
                            startActivity(intent2);
                            super.onCreate(bundle);
                            finish();
                            return;
                        }
                    }
                }
            }
            z2 = false;
            SharedPreferences globalMainSettings2 = MessagesController.getGlobalMainSettings();
            long j22 = globalMainSettings2.getLong("intro_crashed_time", 0L);
            if (intent == null) {
            }
            if (z3) {
            }
            if (!z2) {
                Intent intent22 = new Intent(this, (Class<?>) IntroActivity.class);
                intent22.setData(intent.getData());
                startActivity(intent22);
                super.onCreate(bundle);
                finish();
                return;
            }
        }
        requestWindowFeature(1);
        setTheme(2131689754);
        if (Build.VERSION.SDK_INT >= 21) {
            try {
                setTaskDescription(new ActivityManager.TaskDescription((String) null, (Bitmap) null, org.telegram.ui.ActionBar.w.r1("actionBarDefault") | com.batch.android.messaging.view.roundimage.b.v));
            } catch (Exception unused) {
            }
            try {
                getWindow().setNavigationBarColor(com.batch.android.messaging.view.roundimage.b.v);
            } catch (Exception unused2) {
            }
        }
        getWindow().setBackgroundDrawableResource(R.drawable.transparent);
        if (SharedConfig.passcodeHash.length() > 0 && !SharedConfig.allowScreenCapture) {
            try {
                getWindow().setFlags(8192, 8192);
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        }
        super.onCreate(bundle);
        int i3 = Build.VERSION.SDK_INT;
        if (i3 >= 24) {
            AndroidUtilities.isInMultiwindow = isInMultiWindowMode();
        }
        org.telegram.ui.ActionBar.w.B0();
        org.telegram.ui.ActionBar.w.I0(this);
        if (SharedConfig.passcodeHash.length() != 0 && SharedConfig.appLocked) {
            SharedConfig.lastPauseTime = (int) (SystemClock.elapsedRealtime() / 1000);
        }
        AndroidUtilities.fillStatusBarHeight(this);
        this.v = new k(this);
        FrameLayout frameLayout = new FrameLayout(this);
        this.B = frameLayout;
        char c2 = 65535;
        setContentView(frameLayout, new ViewGroup.LayoutParams(-1, -1));
        if (i3 >= 21) {
            ImageView imageView = new ImageView(this);
            this.s = imageView;
            imageView.setVisibility(8);
        }
        m mVar = new m(this, this);
        this.G = mVar;
        mVar.setBehindKeyboardColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
        this.B.addView(this.G, g52.a(-1, -1.0f));
        if (i3 >= 21) {
            n nVar = new n(this);
            this.t = nVar;
            this.B.addView(nVar, g52.a(48, 48.0f));
            this.t.setVisibility(8);
        }
        if (AndroidUtilities.isTablet()) {
            getWindow().setSoftInputMode(16);
            o oVar = new o(this);
            this.G.addView(oVar, g52.a(-1, -1.0f));
            p pVar = new p(this, this);
            this.A = pVar;
            pVar.setOccupyStatusBar(false);
            this.A.G(org.telegram.ui.ActionBar.w.o1(), org.telegram.ui.ActionBar.w.z2());
            oVar.addView(this.A, g52.p(-1, -1));
            oVar.addView(this.v);
            ActionBarLayout actionBarLayout = new ActionBarLayout(this);
            this.x = actionBarLayout;
            actionBarLayout.f0(w0);
            this.x.setDelegate(this);
            oVar.addView(this.x);
            FrameLayout frameLayout2 = new FrameLayout(this);
            this.z = frameLayout2;
            frameLayout2.setBackgroundColor(1076449908);
            oVar.addView(this.z);
            FrameLayout frameLayout3 = new FrameLayout(this);
            this.y = frameLayout3;
            frameLayout3.setVisibility(v0.isEmpty() ? 8 : 0);
            this.y.setBackgroundColor(2130706432);
            oVar.addView(this.y);
            this.y.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public final boolean onTouch(View view, MotionEvent motionEvent) {
                    boolean n2;
                    n2 = LaunchActivity.this.n2(view, motionEvent);
                    return n2;
                }
            });
            this.y.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    LaunchActivity.o2(view);
                }
            });
            ActionBarLayout actionBarLayout2 = new ActionBarLayout(this);
            this.w = actionBarLayout2;
            actionBarLayout2.setRemoveActionBarExtraHeight(true);
            this.w.setBackgroundView(this.y);
            this.w.setUseAlphaAnimations(true);
            this.w.setBackgroundResource(org.telegram.messenger.R.drawable.boxshadow);
            this.w.f0(v0);
            this.w.setDelegate(this);
            this.w.setDrawerLayoutContainer(this.G);
            this.w.setVisibility(v0.isEmpty() ? 8 : 0);
            oVar.addView(this.w);
        } else {
            this.G.addView(this.v, new ViewGroup.LayoutParams(-1, -1));
        }
        this.Z = new FrameLayout(this);
        q qVar = new q(this);
        this.T = qVar;
        oy4 oy4Var = new oy4(qVar);
        this.U = oy4Var;
        this.T.setItemAnimator(oy4Var);
        this.T.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("chats_menuBackground"));
        org.telegram.ui.Components.h6 h6Var = this.T;
        androidx.recyclerview.widget.o oVar2 = new androidx.recyclerview.widget.o(this, 1, false);
        this.r0 = oVar2;
        h6Var.setLayoutManager(oVar2);
        this.T.setAllowItemsInteractionDuringAnimation(false);
        org.telegram.ui.Components.h6 h6Var2 = this.T;
        e21 e21Var = new e21(this, this.U);
        this.H = e21Var;
        h6Var2.setAdapter(e21Var);
        this.Z.addView(this.T, g52.a(-1, -1.0f));
        this.G.setDrawerLayout(this.Z);
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.Z.getLayoutParams();
        Point realScreenSize = AndroidUtilities.getRealScreenSize();
        layoutParams.width = AndroidUtilities.isTablet() ? AndroidUtilities.dp(320.0f) : Math.min(AndroidUtilities.dp(320.0f), Math.min(realScreenSize.x, realScreenSize.y) - AndroidUtilities.dp(56.0f));
        layoutParams.height = -1;
        this.Z.setLayoutParams(layoutParams);
        this.T.setOnItemClickListener(new h6.n() {
            @Override
            public final void a(View view, int i4, float f2, float f3) {
                LaunchActivity.this.p2(view, i4, f2, f3);
            }

            @Override
            public boolean b(View view, int i4) {
                return kg4.a(this, view, i4);
            }

            @Override
            public void c(View view, int i4, float f2, float f3) {
                kg4.b(this, view, i4, f2, f3);
            }
        });
        final androidx.recyclerview.widget.m mVar2 = new androidx.recyclerview.widget.m(new s(3, 0));
        mVar2.j(this.T);
        this.T.setOnItemLongClickListener(new h6.o() {
            @Override
            public final boolean a(View view, int i4) {
                boolean q2;
                q2 = LaunchActivity.this.q2(mVar2, view, i4);
                return q2;
            }
        });
        this.G.setParentActionBarLayout(this.v);
        this.v.setDrawerLayoutContainer(this.G);
        this.v.f0(u0);
        this.v.setDelegate(this);
        org.telegram.ui.ActionBar.w.M2();
        n1();
        P3(this.e0);
        NotificationCenter globalInstance = NotificationCenter.getGlobalInstance();
        int i4 = NotificationCenter.closeOtherAppActivities;
        globalInstance.postNotificationName(i4, this);
        this.l = ConnectionsManager.getInstance(this.e0).getConnectionState();
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.needShowAlert);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.reloadInterface);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.suggestedLangpack);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetNewTheme);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.needSetDayNightTheme);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.needCheckSystemBarColors);
        NotificationCenter.getGlobalInstance().addObserver(this, i4);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetPasscode);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetNewWallpapper);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.notificationsCountUpdated);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.screenStateChanged);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.showBulletin);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.appUpdateAvailable);
        if (this.v.v0.isEmpty()) {
            if (UserConfig.getInstance(this.e0).isClientActivated()) {
                p3 p3Var = new p3(null);
                p3Var.Ua(this.T);
                this.v.O(p3Var);
                this.G.q(true, false);
            } else {
                this.v.O(new y5());
                this.G.q(false, false);
            }
            if (bundle != null) {
                try {
                    String string = bundle.getString("fragment");
                    if (string != null) {
                        Bundle bundle2 = bundle.getBundle("args");
                        switch (string.hashCode()) {
                            case -1529105743:
                                if (string.equals("wallpapers")) {
                                    c2 = 5;
                                    break;
                                }
                                break;
                            case -1349522494:
                                if (string.equals("chat_profile")) {
                                    c2 = 4;
                                    break;
                                }
                                break;
                            case 3052376:
                                if (string.equals("chat")) {
                                    c2 = 0;
                                    break;
                                }
                                break;
                            case 98629247:
                                if (string.equals("group")) {
                                    c2 = 2;
                                    break;
                                }
                                break;
                            case 738950403:
                                if (string.equals("channel")) {
                                    c2 = 3;
                                    break;
                                }
                                break;
                            case 1434631203:
                                if (string.equals("settings")) {
                                    c2 = 1;
                                    break;
                                }
                                break;
                        }
                        if (c2 != 0) {
                            if (c2 == 1) {
                                bundle2.putLong("user_id", UserConfig.getInstance(this.e0).clientUserId);
                                profileActivity = new ProfileActivity(bundle2);
                                this.v.O(profileActivity);
                            } else if (c2 != 2) {
                                if (c2 != 3) {
                                    if (c2 != 4) {
                                        if (c2 == 5) {
                                            Cif cif = new Cif(0);
                                            this.v.O(cif);
                                            cif.h3(bundle);
                                        }
                                    } else if (bundle2 != null) {
                                        profileActivity = new ProfileActivity(bundle2);
                                    }
                                } else if (bundle2 != null) {
                                    ut utVar = new ut(bundle2);
                                    if (this.v.O(utVar)) {
                                        utVar.P2(bundle);
                                    }
                                }
                            } else if (bundle2 != null) {
                                q5 q5Var = new q5(bundle2);
                                if (this.v.O(q5Var)) {
                                    q5Var.e2(bundle);
                                }
                            }
                            profileActivity.t8(bundle);
                        } else if (bundle2 != null) {
                            v0 v0Var = new v0(bundle2);
                            if (this.v.O(v0Var)) {
                                v0Var.co(bundle);
                            }
                        }
                    }
                } catch (Exception e3) {
                    FileLog.e(e3);
                }
            }
        } else {
            org.telegram.ui.ActionBar.k kVar = this.v.v0.get(0);
            if (kVar instanceof p3) {
                ((p3) kVar).Ua(this.T);
            }
            if (AndroidUtilities.isTablet()) {
                z = this.v.v0.size() <= 1 && this.w.v0.isEmpty();
                if (this.w.v0.size() == 1 && (this.w.v0.get(0) instanceof y5)) {
                    z = false;
                }
            } else {
                z = true;
            }
            if (this.v.v0.size() == 1 && (this.v.v0.get(0) instanceof y5)) {
                z = false;
            }
            this.G.q(z, false);
        }
        p1();
        r1();
        D1(getIntent(), false, bundle != null, false);
        try {
            String str = Build.DISPLAY;
            String str2 = Build.USER;
            String str3 = BuildConfig.FLAVOR;
            String lowerCase2 = str != null ? str.toLowerCase() : BuildConfig.FLAVOR;
            if (str2 != null) {
                str3 = lowerCase2.toLowerCase();
            }
            if (BuildVars.LOGS_ENABLED) {
                FileLog.d("OS name " + lowerCase2 + " " + str3);
            }
            if ((lowerCase2.contains("flyme") || str3.contains("flyme")) && Build.VERSION.SDK_INT <= 24) {
                AndroidUtilities.incorrectDisplaySizeFix = true;
                final View rootView = getWindow().getDecorView().getRootView();
                ViewTreeObserver viewTreeObserver = rootView.getViewTreeObserver();
                ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
                    @Override
                    public final void onGlobalLayout() {
                        LaunchActivity.r2(rootView);
                    }
                };
                this.m = onGlobalLayoutListener;
                viewTreeObserver.addOnGlobalLayoutListener(onGlobalLayoutListener);
            }
        } catch (Exception e4) {
            FileLog.e(e4);
        }
        MediaController.getInstance().setBaseActivity(this, true);
        AndroidUtilities.startAppCenter(this);
        O3(false);
    }

    @Override
    protected void onDestroy() {
        if (PhotoViewer.O7() != null) {
            PhotoViewer.O7().m7();
        }
        if (PhotoViewer.W7()) {
            PhotoViewer.L7().m7();
        }
        if (SecretMediaViewer.d0()) {
            SecretMediaViewer.b0().W();
        }
        if (ArticleViewer.X2()) {
            ArticleViewer.L2().E2();
        }
        if (k3.M()) {
            k3.K().J();
        }
        p4 p4Var = p4.F2;
        if (p4Var != null) {
            p4Var.dismissInternal();
        }
        PipRoundVideoView m2 = PipRoundVideoView.m();
        MediaController.getInstance().setBaseActivity(this, false);
        MediaController.getInstance().setFeedbackView(this.v, false);
        if (m2 != null) {
            m2.l(false);
        }
        org.telegram.ui.ActionBar.w.e1();
        org.telegram.ui.Components.v1 p0 = org.telegram.ui.Components.v1.p0();
        if (p0 != null) {
            p0.n0();
        }
        ThemeEditorView u = ThemeEditorView.u();
        if (u != null) {
            u.t();
        }
        try {
            org.telegram.ui.ActionBar.i iVar = this.R;
            if (iVar != null) {
                iVar.dismiss();
                this.R = null;
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        try {
            if (this.m != null) {
                getWindow().getDecorView().getRootView().getViewTreeObserver().removeOnGlobalLayoutListener(this.m);
            }
        } catch (Exception e3) {
            FileLog.e(e3);
        }
        super.onDestroy();
        o3();
    }

    @Override
    public boolean onKeyUp(int i2, KeyEvent keyEvent) {
        ActionBarLayout actionBarLayout;
        if (i2 == 82 && !SharedConfig.isWaitingForPasscodeEnter) {
            if (PhotoViewer.W7() && PhotoViewer.L7().o8()) {
                return super.onKeyUp(i2, keyEvent);
            }
            if (ArticleViewer.X2() && ArticleViewer.L2().Z2()) {
                return super.onKeyUp(i2, keyEvent);
            }
            if (AndroidUtilities.isTablet()) {
                if (this.w.getVisibility() == 0 && !this.w.v0.isEmpty()) {
                    actionBarLayout = this.w;
                } else if (this.x.getVisibility() == 0 && !this.x.v0.isEmpty()) {
                    actionBarLayout = this.x;
                }
                actionBarLayout.onKeyUp(i2, keyEvent);
            } else if (this.v.v0.size() == 1) {
                if (this.G.k()) {
                    this.G.f(false);
                } else {
                    if (getCurrentFocus() != null) {
                        AndroidUtilities.hideKeyboard(getCurrentFocus());
                    }
                    this.G.o(false);
                }
            }
            actionBarLayout = this.v;
            actionBarLayout.onKeyUp(i2, keyEvent);
        }
        return super.onKeyUp(i2, keyEvent);
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
        ActionBarLayout actionBarLayout = this.v;
        if (actionBarLayout != null) {
            actionBarLayout.w0();
            if (AndroidUtilities.isTablet()) {
                this.x.w0();
                this.w.w0();
            }
        }
    }

    @Override
    public void onMultiWindowModeChanged(boolean z) {
        AndroidUtilities.isInMultiwindow = z;
        p1();
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        D1(intent, true, false, false);
    }

    @Override
    protected void onPause() {
        super.onPause();
        s52.b(this);
        NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.stopAllHeavyOperations, 4096);
        ApplicationLoader.mainInterfacePaused = true;
        final int i2 = this.e0;
        Utilities.stageQueue.postRunnable(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.s2(i2);
            }
        });
        q3();
        this.v.y0();
        if (AndroidUtilities.isTablet()) {
            this.x.y0();
            this.w.y0();
        }
        pp3 pp3Var = this.I;
        if (pp3Var != null) {
            pp3Var.P();
        }
        ConnectionsManager.getInstance(this.e0).setAppPaused(true, false);
        if (PhotoViewer.W7() && PhotoViewer.L7().o8()) {
            PhotoViewer.L7().M9();
        }
        if (xr7.X0() != null) {
            xr7.F1();
        }
    }

    @Override
    public void onRequestPermissionsResult(int i2, String[] strArr, int[] iArr) {
        String string;
        int i3;
        String str;
        super.onRequestPermissionsResult(i2, strArr, iArr);
        if (iArr == null) {
            iArr = new int[0];
        }
        if (strArr == null) {
            strArr = new String[0];
        }
        boolean z = iArr.length > 0 && iArr[0] == 0;
        if (i2 == 104) {
            if (z) {
                p4 p4Var = p4.F2;
                if (p4Var != null) {
                    p4Var.M4();
                }
                if (this.v.v0.size() != 0) {
                    ArrayList<org.telegram.ui.ActionBar.k> arrayList = this.v.v0;
                    arrayList.get(arrayList.size() - 1).K0(i2, strArr, iArr);
                }
                if (AndroidUtilities.isTablet()) {
                    if (this.x.v0.size() != 0) {
                        ArrayList<org.telegram.ui.ActionBar.k> arrayList2 = this.x.v0;
                        arrayList2.get(arrayList2.size() - 1).K0(i2, strArr, iArr);
                    }
                    if (this.w.v0.size() != 0) {
                        ArrayList<org.telegram.ui.ActionBar.k> arrayList3 = this.w.v0;
                        arrayList3.get(arrayList3.size() - 1).K0(i2, strArr, iArr);
                    }
                }
                xr7.H1(i2, strArr, iArr);
            }
            i3 = R.string.VoipNeedCameraPermission;
            str = "VoipNeedCameraPermission";
            string = LocaleController.getString(str, i3);
        } else {
            if (i2 != 4) {
                if (i2 != 5) {
                    if (i2 == 3) {
                        int min = Math.min(strArr.length, iArr.length);
                        boolean z2 = true;
                        boolean z3 = true;
                        for (int i4 = 0; i4 < min; i4++) {
                            if ("android.permission.RECORD_AUDIO".equals(strArr[i4])) {
                                z2 = iArr[i4] == 0;
                            } else if ("android.permission.CAMERA".equals(strArr[i4])) {
                                z3 = iArr[i4] == 0;
                            }
                        }
                        if (!z2) {
                            i3 = R.string.PermissionNoAudio;
                            str = "PermissionNoAudio";
                            string = LocaleController.getString(str, i3);
                        } else if (z3) {
                            if (SharedConfig.inappCamera) {
                                CameraController.getInstance().initCamera(null);
                                return;
                            }
                            return;
                        }
                    } else if (i2 != 18 && i2 != 19 && i2 != 20 && i2 != 22) {
                        if (i2 == 2) {
                            if (z) {
                                NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.locationPermissionGranted, new Object[0]);
                            } else {
                                NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.locationPermissionDenied, new Object[0]);
                            }
                        }
                    }
                    string = LocaleController.getString("PermissionNoCamera", R.string.PermissionNoCamera);
                } else {
                    if (!z) {
                        I3(LocaleController.getString("PermissionContacts", R.string.PermissionContacts));
                        return;
                    }
                    ContactsController.getInstance(this.e0).forceImportContacts();
                }
                if (this.v.v0.size() != 0) {
                }
                if (AndroidUtilities.isTablet()) {
                }
                xr7.H1(i2, strArr, iArr);
            }
            if (z) {
                ImageLoader.getInstance().checkMediaPaths();
                if (this.v.v0.size() != 0) {
                }
                if (AndroidUtilities.isTablet()) {
                }
                xr7.H1(i2, strArr, iArr);
            }
            i3 = R.string.PermissionStorage;
            str = "PermissionStorage";
            string = LocaleController.getString(str, i3);
        }
        I3(string);
        if (this.v.v0.size() != 0) {
        }
        if (AndroidUtilities.isTablet()) {
        }
        xr7.H1(i2, strArr, iArr);
    }

    @Override
    protected void onResume() {
        MessageObject playingMessageObject;
        super.onResume();
        if (org.telegram.ui.ActionBar.w.m == 3) {
            org.telegram.ui.ActionBar.w.o0();
        }
        t1(true);
        NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startAllHeavyOperations, 4096);
        MediaController.getInstance().setFeedbackView(this.v, true);
        ApplicationLoader.mainInterfacePaused = false;
        F3(false);
        Utilities.stageQueue.postRunnable(new Runnable() {
            @Override
            public final void run() {
                LaunchActivity.t2();
            }
        });
        o1();
        MediaController.checkGallery();
        r3();
        pp3 pp3Var = this.I;
        if (pp3Var == null || pp3Var.getVisibility() != 0) {
            this.v.z0();
            if (AndroidUtilities.isTablet()) {
                this.x.z0();
                this.w.z0();
            }
        } else {
            this.v.X();
            if (AndroidUtilities.isTablet()) {
                this.x.X();
                this.w.X();
            }
            this.I.Q();
        }
        ConnectionsManager.getInstance(this.e0).setAppPaused(false, false);
        P3(this.e0);
        if (PhotoViewer.W7() && PhotoViewer.L7().o8()) {
            PhotoViewer.L7().P9();
        }
        if (PipRoundVideoView.m() != null && MediaController.getInstance().isMessagePaused() && (playingMessageObject = MediaController.getInstance().getPlayingMessageObject()) != null) {
            MediaController.getInstance().seekToProgress(playingMessageObject, playingMessageObject.audioProgress);
        }
        if (UserConfig.getInstance(UserConfig.selectedAccount).unacceptedTermsOfService != null) {
            int i2 = UserConfig.selectedAccount;
            J3(i2, UserConfig.getInstance(i2).unacceptedTermsOfService);
        } else {
            lw5 lw5Var = SharedConfig.pendingAppUpdate;
            if (lw5Var != null && lw5Var.b) {
                K3(UserConfig.selectedAccount, SharedConfig.pendingAppUpdate, true);
            }
        }
        m1(false);
        if (Build.VERSION.SDK_INT >= 23) {
            ApplicationLoader.canDrawOverlays = Settings.canDrawOverlays(this);
        }
        if (xr7.X0() != null) {
            xr7.J1();
        }
        s52.c(this);
    }

    @Override
    protected void onSaveInstanceState(Bundle bundle) {
        org.telegram.ui.ActionBar.k kVar;
        String str;
        try {
            super.onSaveInstanceState(bundle);
            org.telegram.ui.ActionBar.k kVar2 = null;
            if (AndroidUtilities.isTablet()) {
                if (!this.w.v0.isEmpty()) {
                    kVar = this.w.v0.get(r0.size() - 1);
                } else {
                    if (this.x.v0.isEmpty()) {
                        if (!this.v.v0.isEmpty()) {
                            kVar = this.v.v0.get(r0.size() - 1);
                        }
                        if (kVar2 != null) {
                            Bundle I = kVar2.I();
                            if ((kVar2 instanceof v0) && I != null) {
                                bundle.putBundle("args", I);
                                str = "chat";
                            } else if ((kVar2 instanceof q5) && I != null) {
                                bundle.putBundle("args", I);
                                str = "group";
                            } else if (kVar2 instanceof Cif) {
                                str = "wallpapers";
                            } else {
                                if (!(kVar2 instanceof ProfileActivity)) {
                                    if ((kVar2 instanceof ut) && I != null && I.getInt("step") == 0) {
                                        bundle.putBundle("args", I);
                                        str = "channel";
                                    }
                                    kVar2.a1(bundle);
                                    return;
                                }
                                ProfileActivity profileActivity = (ProfileActivity) kVar2;
                                if (!profileActivity.t7()) {
                                    if (profileActivity.r7() && I != null) {
                                        bundle.putBundle("args", I);
                                        str = "chat_profile";
                                    }
                                    kVar2.a1(bundle);
                                    return;
                                }
                                str = "settings";
                            }
                            bundle.putString("fragment", str);
                            kVar2.a1(bundle);
                            return;
                        }
                        return;
                    }
                    kVar = this.x.v0.get(r0.size() - 1);
                }
                kVar2 = kVar;
                if (kVar2 != null) {
                }
            } else {
                if (!this.v.v0.isEmpty()) {
                    kVar = this.v.v0.get(r0.size() - 1);
                    kVar2 = kVar;
                }
                if (kVar2 != null) {
                }
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        FileLog.e(e2);
    }

    @Override
    protected void onStart() {
        super.onStart();
        ok.g(this);
        ApplicationLoader.mainInterfaceStopped = false;
        org.telegram.ui.Components.m3.O(this);
        p4 p4Var = p4.F2;
        if (p4Var != null) {
            p4Var.j6();
        }
    }

    @Override
    protected void onStop() {
        super.onStop();
        ok.A(this);
        ApplicationLoader.mainInterfaceStopped = true;
        org.telegram.ui.Components.m3.O(this);
        p4 p4Var = p4.F2;
        if (p4Var != null) {
            p4Var.i6();
        }
    }

    public boolean q1() {
        if (Build.VERSION.SDK_INT < 29 || Settings.canDrawOverlays(this)) {
            return true;
        }
        new i.C0142i(this).u(LocaleController.getString("NoAdsSystem", R.string.NoAdsSystem)).l(LocaleController.getString("PermissionForAds", R.string.PermissionForAds)).s(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i2) {
                LaunchActivity.this.K1(dialogInterface, i2);
            }
        }).C();
        return false;
    }

    public void S2(org.telegram.ui.ActionBar.k kVar) {
        this.v.C0(kVar);
    }

    public ActionBarLayout x1() {
        return this.v;
    }

    public boolean x3(org.telegram.ui.ActionBar.k kVar, boolean z, boolean z2) {
        return this.v.E0(kVar, z, z2, true, false);
    }

    public ActionBarLayout y1() {
        return this.w;
    }

    public void y3(boolean z) {
        ActionBarLayout actionBarLayout = this.w;
        if (actionBarLayout == null) {
            actionBarLayout = this.v;
        }
        actionBarLayout.J0(z, z);
    }

    public int z1() {
        return u0.size();
    }

    public void z3() {
        try {
            this.T.setAdapter(null);
            this.T.setLayoutManager(null);
            this.T.getRecycledViewPool().b();
            this.T.B1(this.H, false);
            this.T.setLayoutManager(this.r0);
        } catch (Exception unused) {
        }
        this.H.j();
    }
}