导航菜单

页面标题

页面副标题

Hyouka private v5.8.9 - ConversationView.java 源代码

正在查看: Hyouka private v5.8.9 应用的 ConversationView.java JAVA 源代码文件

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


package com.beint.project.screens.sms;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.DatePickerDialog;
import android.content.ClipData;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Rect;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.text.Editable;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Pair;
import android.view.Display;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.inputmethod.InputMethodManager;
import android.webkit.MimeTypeMap;
import android.widget.DatePicker;
import android.widget.Filter;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.c;
import androidx.appcompat.widget.AppCompatEditText;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.FlexAndroid.Hyouka;
import com.beint.project.AbstractZangiActivity;
import com.beint.project.Engine;
import com.beint.project.ExtensionsKt;
import com.beint.project.MainApplication;
import com.beint.project.adapter.AledtDialogAdapter;
import com.beint.project.adapter.ConversationAdapter;
import com.beint.project.adapter.FilterableContactsAdapter;
import com.beint.project.bottomPanel.BottomBar;
import com.beint.project.bottomPanel.BottomSearchView;
import com.beint.project.bottomPanel.BottomSheet;
import com.beint.project.bottomPanel.ChatSmilesView;
import com.beint.project.bottomPanel.EditView;
import com.beint.project.bottomPanel.GroupMemberTagChooseViewController;
import com.beint.project.bottomPanel.GroupMemberTagModel;
import com.beint.project.bottomPanel.ReplyView;
import com.beint.project.bottomPanel.SmileTag;
import com.beint.project.call.CallHelper;
import com.beint.project.core.FileWorker.FileTransferManager;
import com.beint.project.core.FileWorker.ImageTransferModel;
import com.beint.project.core.FileWorker.ImageVideoTransferModel;
import com.beint.project.core.FileWorker.VoiceTransferModel;
import com.beint.project.core.FileWorker.VoiceTransferModelParametrs;
import com.beint.project.core.UI.Custom.ConversationCellProgressManager;
import com.beint.project.core.UserLastActivity.LastActivity;
import com.beint.project.core.UserLastActivity.LastActivityModel;
import com.beint.project.core.UserLastActivity.LastActivityState;
import com.beint.project.core.ZFramework.ZAnimationView;
import com.beint.project.core.ZFramework.ZLabel;
import com.beint.project.core.dataaccess.dao.MessageDao;
import com.beint.project.core.endtoend.enums.CryptType;
import com.beint.project.core.enums.ObjTypesEnum;
import com.beint.project.core.enums.SearchBy;
import com.beint.project.core.events.RegistrationEventArgs;
import com.beint.project.core.events.RegistrationEventTypes;
import com.beint.project.core.gifs.CGPoint;
import com.beint.project.core.gifs.GiphyResult;
import com.beint.project.core.managers.ConferenceManager;
import com.beint.project.core.managers.OrientationManager;
import com.beint.project.core.managers.PremiumManager;
import com.beint.project.core.managers.RoomManager;
import com.beint.project.core.managers.SystemServiceManager;
import com.beint.project.core.model.MessageCalculation;
import com.beint.project.core.model.contact.Contact;
import com.beint.project.core.model.contact.ContactNumber;
import com.beint.project.core.model.contact.Profile;
import com.beint.project.core.model.http.ServiceResult;
import com.beint.project.core.model.recent.ZangiRecentGroup;
import com.beint.project.core.model.sms.Conversation;
import com.beint.project.core.model.sms.Group;
import com.beint.project.core.model.sms.GroupMember;
import com.beint.project.core.model.sms.MemberRole;
import com.beint.project.core.model.sms.MessageType;
import com.beint.project.core.model.sms.RecordingObject;
import com.beint.project.core.model.sms.SendingObject;
import com.beint.project.core.model.sms.SmileGetterItem;
import com.beint.project.core.model.sms.Stealth;
import com.beint.project.core.model.sms.TypingObject;
import com.beint.project.core.model.sms.ZangiMessage;
import com.beint.project.core.model.sms.info.ZangiMessageInfo;
import com.beint.project.core.services.ProfileUpdatedListener;
import com.beint.project.core.services.impl.BlockContactServiceImpl;
import com.beint.project.core.services.impl.ContactsManager;
import com.beint.project.core.services.impl.IConversationPresenter;
import com.beint.project.core.services.impl.MessagingService;
import com.beint.project.core.services.impl.SignalingService;
import com.beint.project.core.services.impl.SoundService;
import com.beint.project.core.services.impl.StorageService;
import com.beint.project.core.services.impl.ZangiConfigurationService;
import com.beint.project.core.services.impl.ZangiHTTPServices;
import com.beint.project.core.services.impl.ZangiMessagingService;
import com.beint.project.core.services.impl.ZangiProfileServiceImpl;
import com.beint.project.core.services.impl.ZangiRecentService;
import com.beint.project.core.services.impl.ZangiStickerServiceImpl;
import com.beint.project.core.signal.AVSession;
import com.beint.project.core.utils.AppUserManager;
import com.beint.project.core.utils.Constants;
import com.beint.project.core.utils.DispatchKt;
import com.beint.project.core.utils.Log;
import com.beint.project.core.utils.NotificationCenter;
import com.beint.project.core.utils.ObjectType;
import com.beint.project.core.utils.StealthTimeEnum;
import com.beint.project.core.utils.ZangiEngineUtils;
import com.beint.project.core.utils.ZangiFileUtils;
import com.beint.project.core.utils.ZangiPermissionUtils;
import com.beint.project.core.utils.ZangiStringUtils;
import com.beint.project.core.utils.contactutils.ContactList;
import com.beint.project.interfaces.ChatGalleryFragmentListener;
import com.beint.project.interfaces.ChatSensorPresenterListener;
import com.beint.project.interfaces.ChatStateListener;
import com.beint.project.interfaces.ClickCallBacksObj;
import com.beint.project.interfaces.MessageClickHandler;
import com.beint.project.items.ILoadingView;
import com.beint.project.items.conversationAdapterItems.ConversationItemView;
import com.beint.project.items.conversationAdapterItems.ImageVideoItem;
import com.beint.project.items.conversationAdapterItems.ZReactionMenuAdapterDelegate;
import com.beint.project.items.conversationAdapterItems.ZReactionMenuManager;
import com.beint.project.items.conversationAdapterItems.ZReactionSelectedMemberListDelegate;
import com.beint.project.items.conversationAdapterItems.ZReactionSelectedMemberListManager;
import com.beint.project.keypadUtils.ZKeyboardHeightObserver;
import com.beint.project.keypadUtils.ZKeyboardHeightProvider;
import com.beint.project.managers.ContactsManagerHelper;
import com.beint.project.managers.InviteController;
import com.beint.project.mediabrowser.AnimatorView;
import com.beint.project.mediabrowser.ImageAnimation;
import com.beint.project.mediabrowser.ImageBrowser;
import com.beint.project.push.NotificationController;
import com.beint.project.screens.BaseFragmentActivitySingle;
import com.beint.project.screens.BaseScreen;
import com.beint.project.screens.CallingFragmentActivity;
import com.beint.project.screens.ChatSensor;
import com.beint.project.screens.ConversationManager;
import com.beint.project.screens.ConversationScreen;
import com.beint.project.screens.ConversationTitleView;
import com.beint.project.screens.ExtendedBar;
import com.beint.project.screens.GroupMembersActivity;
import com.beint.project.screens.HomeActivity;
import com.beint.project.screens.IConversationView;
import com.beint.project.screens.InChatContactAndGroupStatusView;
import com.beint.project.screens.JoinView;
import com.beint.project.screens.SpeedyLinearLayoutManager;
import com.beint.project.screens.StealthModeTopView;
import com.beint.project.screens.StealthModeTopViewDelegate;
import com.beint.project.screens.VoiceItemTopPanel;
import com.beint.project.screens.contacts.ScreenTabContacts;
import com.beint.project.screens.gifs.GifLinearLayout;
import com.beint.project.screens.gifs.GifPreviewFragment;
import com.beint.project.screens.phone.ScreenVideoCall;
import com.beint.project.screens.shared.media.SharedMediaActivity;
import com.beint.project.screens.sms.VoiceRecordFragment;
import com.beint.project.screens.sms.gallery.ZangiGalleryServiceImpl;
import com.beint.project.screens.sms.gallery.model.PhotoEntry;
import com.beint.project.screens.sms.gallery.model.VideoEntry;
import com.beint.project.screens.utils.UiUtilKt;
import com.beint.project.screens.widget.AudioWaveView.AudioWaveView;
import com.beint.project.screens.widget.PasteEditText;
import com.beint.project.screens.widget.ToolbarSearchView;
import com.beint.project.services.impl.MediaRecordAndPlay;
import com.beint.project.utils.AlertDialogUtils;
import com.beint.project.utils.ChatUtils;
import com.beint.project.utils.ConversationAdapterHelper;
import com.beint.project.utils.ConversationAvatar;
import com.beint.project.utils.DateTimeUtils;
import com.beint.project.utils.ProjectUtils;
import com.beint.project.utils.ShareManger;
import com.beint.project.utils.SimpleTextView;
import com.beint.project.utils.UrlDetectManager;
import com.beint.project.utils.color.ColorsManger;
import com.beint.project.utils.ui.ZSimpleCallBack;
import com.beint.project.voice.delegates.VoiceManagerDelegate;
import com.beint.project.voice.enums.VoiceManagerState;
import com.beint.project.voice.managers.MediaAutoPlayNextManager;
import com.beint.project.voice.managers.VoiceManager;
import com.beint.project.voice.ui.VoiceAudioPlayerView;
import com.google.android.material.appbar.AppBarLayout;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public final class ConversationView extends BaseScreen implements ConversationTitleView.ConversationToolBarDelegate, IConversationView, ConversationScreen.ConversationScreenDelegate, ToolbarSearchView.ToolbarSearchViewDelegate, MessageClickHandler, VoiceRecordFragment.VoiceRecordListener, ChatStateListener, ExtendedBar.ExtendedBarDelegate, GifPreviewFragment.GifPreviewFragmentDelegate, ScreenTabContacts.ScreenTabContactsDelegate, FilterableContactsAdapter.FilterableContactsAdapterDelegate, ImageBrowser.BrowserCloseListener, BottomSheet.BottomSheetDelegate, LastActivityModel, ZKeyboardHeightObserver, VoiceManagerDelegate, StealthModeTopViewDelegate, ZReactionMenuAdapterDelegate, ZReactionSelectedMemberListDelegate {
    public static final int AUDIO_MESSAGE = 2;
    public static final Companion Companion = new Companion(null);
    public static final int FILE_MESSAGE = 1;
    public static final int LOCATION_MESSAGE = 4;
    public static final int REQUEST_CODE_FOR_APPLICATION_GALLERY_BROWSER = 500;
    public static final int STICKER_MESSAGE = 3;
    public static final int TEXT_GSM_MESSAGE = -1;
    public static final int TEXT_MESSAGE = 0;
    private final float DELTA_FOR_SCROLL_START;
    private final float MAX_DELTA_FOR_SCROLL_Y;
    private boolean _closeWithContactList;
    private int _count;
    private ExtendedBar _extandedBar;
    private ZAnimationView _lottieAnimationView;
    private StealthModeTopView _stealthModeTopView;
    private Action actionMenuButton;
    private ConversationAdapter.ConversationAdapterDelegate adapterDelegateObj;
    private AlphaAnimation alphaAnimationHideDateFooter;
    private AppBarLayout appBar;
    private View appBarDivider;
    private BottomSheet bottomSheet;
    private boolean callIconVisibility;
    private MenuItem callItem;
    private MenuItem callMenuItem;
    private MenuItem chatBackgroundIdItem;
    private IChatSearchHolder chatSearchHolder;
    private ChatSensor chatSensor;
    private ChatSensorPresenterListener chatSensorListener;
    private final Runnable closeSearchBarRunnable;
    private final Handler closeSearchByHandler;
    private boolean contactIsExist;
    private ScreenTabContacts contactsListFragment;
    private Conversation conversation;
    private ConversationAdapter conversationAdapter;
    private ConversationScreen conversationScreen;
    private ConversationTitleView conversationTitleView;
    private final ConversationView$currentHandler$1 currentHandler;
    private Timer didAppearTimer;
    private FilterableContactsAdapter filterableContactsAdapter;
    private boolean generateAutoMessages;
    private int generatedMessageNumber;
    private String gifSearchText;
    private ImageBrowser imageBrowser;
    private long imageBrowserClickTime;
    private boolean isActionsBottomSheetOpened;
    private boolean isBlocked;
    private boolean isForceDeleteReplyView;
    private boolean isForwardMode;
    private boolean isGalleryOpen;
    private boolean isInFront;
    private boolean isInSearchMode;
    private boolean isMoveClosetConversation;
    private boolean isOptimizedConversation;
    private boolean isOutgoinSMS;
    private boolean isRtl;
    private boolean isUserOnline;
    private boolean isViewAppeard;
    private int keyBoardHeightFromShared;
    private ZKeyboardHeightProvider keyboardHeightProvider;
    private int keypadMaxHeight;
    private boolean leftHandedMode;
    private int loadMessagesCount;
    private final ConversationView$mClickCallBacksObj$1 mClickCallBacksObj;
    private ChatGalleryFragmentListener mIChatGalleryFragmentListener;
    private boolean mIsLoading;
    private long mLastClickTime;
    private long mLastUpdate;
    private Long mSearchedMsgId;
    private Menu menu;
    private List<ZangiMessage> msgList;
    private Integer negativeHeight;
    private boolean notScrollBack;
    private final Runnable openSearchAnimRunnable;
    private final Handler openSearchByHandler;
    private IConversationPresenter presenter;
    private CountDownTimer recordTimer;
    private MenuItem screenShotMenuItem;
    private boolean scrollStart;
    private MenuItem searchItem;
    private Spannable searchResultSpannable;
    private View searchView;
    private Pair<String, String> searchedContact;
    private Long selectedDateInMillis;
    private MenuItem shareMenuItem;
    private boolean showScrollButton;
    private MenuItem stealthModeItem;
    private RelativeLayout toolBarRLayout;
    private ToolbarSearchView toolbarSearchView;
    private MenuItem videoCallMenuItem;
    private boolean withoutAnimator;
    private float xStart;
    private float yStart;
    private boolean youtubeVideoPlayingMode;
    private final String TAG = "ConversationView";
    private boolean inVisibleMenuFromImageBrowser = true;
    private int groupCallMembersCount = -1;
    private final int PLAY_OPEN = 1001;
    private final int PLAY_SWITH = 1002;
    private final int PLAY_CLOSE = 1003;
    private int isTurnChatSounds = -1;
    private long mScrollMsgID = -1;
    private ChatSensor.RECORD_STATE recordState = ChatSensor.RECORD_STATE.NONE;
    private SearchBy searchBy = SearchBy.MESSAGE;
    private Spannable fromSpannable = new SpannableString("From: ");
    private long _currentSearchedMessageId = -1;
    private int searchLayoutHeight = -1;
    private boolean isSearchItemLoaded = true;
    private String date = "";
    private final int POSITION_HIDE_SHOW_SCROLL_BUTTON = 3;
    private final String MSG_ID = "withoutMsgId";
    private final DatePickerDialog.OnDateSetListener onDateSetListener = new DatePickerDialog.OnDateSetListener() {
        @Override
        public final void onDateSet(DatePicker datePicker, int i, int i7, int i8) {
            ConversationView.onDateSetListener$lambda$3(ConversationView.this, datePicker, i, i7, i8);
        }
    };
    private ChatSensor.RECORD_FROM recordFrom = ChatSensor.RECORD_FROM.NONE;
    private final DialogInterface.OnCancelListener datePickerDialogCancelListener = new DialogInterface.OnCancelListener() {
        @Override
        public final void onCancel(DialogInterface dialogInterface) {
            ConversationView.datePickerDialogCancelListener$lambda$4(ConversationView.this, dialogInterface);
        }
    };
    private final DialogInterface.OnShowListener datePickerDialogShowListener = new DialogInterface.OnShowListener() {
        @Override
        public final void onShow(DialogInterface dialogInterface) {
            ConversationView.datePickerDialogShowListener$lambda$6(ConversationView.this, dialogInterface);
        }
    };

    public enum Action {
        OPEN_KEYBOARD,
        OPEN_EMOTIONS,
        CLOSE
    }

    public static final class Companion {
        private Companion() {
        }

        public Companion(kotlin.jvm.internal.g gVar) {
            this();
        }
    }

    public enum ConversationViewExtendBarTags {
        COPY_BUTTON(1),
        FORWARD_BUTTON(3),
        INFO_BUTTON(2),
        DELETE_BUTTON(4),
        REPLY_BUTTON(5);

        private final int value;

        ConversationViewExtendBarTags(int i) {
            this.value = i;
        }

        public final int getValue() {
            return this.value;
        }
    }

    public enum MenuIds {
        CALL_MENU_ID(2131362107),
        ADD_CONTACT_MENU_ID(2131361899),
        SEARCH_MENU_ID(2131363534),
        SHARED_MEDIA_MENU_ID(2131363642),
        ARROW_UP_MENU_ID(2131361959),
        ARROW_DOWN_MENU_ID(2131361947),
        VIDEO_CALL_MENU_ID(2131363939),
        STEALTH_MODE_ID(2131363714),
        SET_CHAT_BACKGROUND_ID(2131363611),
        SCREEN_SHOTE_MENU_ID(2131363500);

        private final int value;

        MenuIds(int i) {
            this.value = i;
        }

        public final int getValue() {
            return this.value;
        }
    }

    private static final class RecalculateMessageWidthTask extends AsyncTask<ZangiMessage, Void, ZangiMessage> {
        private final WeakReference<ConversationView> conversationViewReference;

        public RecalculateMessageWidthTask(ConversationView conversationView) {
            kotlin.jvm.internal.k.f(conversationView, "ref");
            this.conversationViewReference = new WeakReference<>(conversationView);
        }

        @Override
        public ZangiMessage doInBackground(ZangiMessage... zangiMessageArr) {
            Map dynamicWidthMap;
            kotlin.jvm.internal.k.f(zangiMessageArr, "messages");
            ZangiMessage zangiMessage = zangiMessageArr[0];
            WeakReference<ConversationView> weakReference = this.conversationViewReference;
            ConversationView conversationView = weakReference != null ? weakReference.get() : null;
            if (conversationView == null || !conversationView.isAdded() || zangiMessage == null) {
                return null;
            }
            ConversationAdapter conversationAdapter = conversationView.conversationAdapter;
            if (conversationAdapter != null && (dynamicWidthMap = conversationAdapter.getDynamicWidthMap()) != null) {
            }
            conversationView.updateOrAddMessageInfo(zangiMessage);
            return zangiMessage;
        }

        @Override
        public void onPostExecute(ZangiMessage zangiMessage) {
            WeakReference<ConversationView> weakReference;
            ConversationView conversationView;
            ConversationAdapter conversationAdapter;
            ConversationView conversationView2;
            Conversation conversation;
            String str = null;
            if (kotlin.jvm.internal.k.b(BaseScreen.getRecordService().getCurrentVoiceId(), zangiMessage != null ? zangiMessage.getMsgId() : null) && BaseScreen.getRecordService().getMediaPlayState() == MediaRecordAndPlay.MediaState.IN_PLAY) {
                BaseScreen.getRecordService().stopMedia();
            }
            String chat = zangiMessage != null ? zangiMessage.getChat() : null;
            WeakReference<ConversationView> weakReference2 = this.conversationViewReference;
            if (weakReference2 != null && (conversationView2 = weakReference2.get()) != null && (conversation = conversationView2.getConversation()) != null) {
                str = conversation.getConversationId();
            }
            if (!kotlin.jvm.internal.k.b(chat, str) || (weakReference = this.conversationViewReference) == null || (conversationView = weakReference.get()) == null || (conversationAdapter = conversationView.conversationAdapter) == null) {
                return;
            }
            conversationAdapter.updateItem(zangiMessage);
        }
    }

    public class WhenMappings {
        public static final int[] $EnumSwitchMapping$0;
        public static final int[] $EnumSwitchMapping$1;
        public static final int[] $EnumSwitchMapping$2;
        public static final int[] $EnumSwitchMapping$3;
        public static final int[] $EnumSwitchMapping$4;
        public static final int[] $EnumSwitchMapping$5;

        static {
            int[] iArr = new int[MessageType.values().length];
            try {
                iArr[MessageType.voice.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[MessageType.file.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                iArr[MessageType.image.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                iArr[MessageType.video.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            $EnumSwitchMapping$0 = iArr;
            int[] iArr2 = new int[RegistrationEventTypes.values().length];
            try {
                iArr2[RegistrationEventTypes.UNREGISTRATION_OK.ordinal()] = 1;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                iArr2[RegistrationEventTypes.REGISTRATION_INPROGRESS.ordinal()] = 2;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                iArr2[RegistrationEventTypes.UNREGISTRATION_INPROGRESS.ordinal()] = 3;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                iArr2[RegistrationEventTypes.UNREGISTRATION_NOK.ordinal()] = 4;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                iArr2[RegistrationEventTypes.CONNECTION_NOK.ordinal()] = 5;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                iArr2[RegistrationEventTypes.REGISTRATION_NOK.ordinal()] = 6;
            } catch (NoSuchFieldError unused10) {
            }
            try {
                iArr2[RegistrationEventTypes.REGISTRATION_OK.ordinal()] = 7;
            } catch (NoSuchFieldError unused11) {
            }
            $EnumSwitchMapping$1 = iArr2;
            int[] iArr3 = new int[SearchBy.values().length];
            try {
                iArr3[SearchBy.MESSAGE.ordinal()] = 1;
            } catch (NoSuchFieldError unused12) {
            }
            try {
                iArr3[SearchBy.CONTACTS.ordinal()] = 2;
            } catch (NoSuchFieldError unused13) {
            }
            $EnumSwitchMapping$2 = iArr3;
            int[] iArr4 = new int[MediaRecordAndPlay.MediaState.values().length];
            try {
                iArr4[MediaRecordAndPlay.MediaState.STOP_RECORDING.ordinal()] = 1;
            } catch (NoSuchFieldError unused14) {
            }
            $EnumSwitchMapping$3 = iArr4;
            int[] iArr5 = new int[ChatSensor.RECORD_STATE.values().length];
            try {
                iArr5[ChatSensor.RECORD_STATE.LOCK.ordinal()] = 1;
            } catch (NoSuchFieldError unused15) {
            }
            try {
                iArr5[ChatSensor.RECORD_STATE.PROCESS.ordinal()] = 2;
            } catch (NoSuchFieldError unused16) {
            }
            try {
                iArr5[ChatSensor.RECORD_STATE.NONE.ordinal()] = 3;
            } catch (NoSuchFieldError unused17) {
            }
            $EnumSwitchMapping$4 = iArr5;
            int[] iArr6 = new int[ObjTypesEnum.values().length];
            try {
                iArr6[ObjTypesEnum.PHOTO_ENTRY.ordinal()] = 1;
            } catch (NoSuchFieldError unused18) {
            }
            try {
                iArr6[ObjTypesEnum.VIDEO_ENTRY.ordinal()] = 2;
            } catch (NoSuchFieldError unused19) {
            }
            $EnumSwitchMapping$5 = iArr6;
        }
    }

    public interface blockNumberCallback {
        void callback(boolean z);
    }

    public ConversationView() {
        this.loadMessagesCount = 50;
        final Looper mainLooper = Looper.getMainLooper();
        this.currentHandler = new Handler(mainLooper) {
        };
        initAlphaAnimationDateFooter();
        ConversationManager conversationManager = ConversationManager.INSTANCE;
        this.mSearchedMsgId = conversationManager.getSearchMsgId();
        this.isOptimizedConversation = conversationManager.isOptimizedConversation();
        changeConversation(conversationManager.getConversationForTransferToFragment());
        reloadSettingsForChat();
        if (Build.VERSION.SDK_INT > 21) {
            this.loadMessagesCount = 100;
        }
        this.DELTA_FOR_SCROLL_START = ExtensionsKt.getDp(20);
        this.MAX_DELTA_FOR_SCROLL_Y = ExtensionsKt.getDp(30);
        this.closeSearchByHandler = new Handler(Looper.getMainLooper());
        this.closeSearchBarRunnable = new Runnable() {
            @Override
            public final void run() {
                ConversationView.closeSearchBarRunnable$lambda$48(ConversationView.this);
            }
        };
        this.openSearchByHandler = new Handler(Looper.getMainLooper());
        this.openSearchAnimRunnable = new Runnable() {
            @Override
            public final void run() {
                ConversationView.openSearchAnimRunnable$lambda$51(ConversationView.this);
            }
        };
        this.mClickCallBacksObj = new ClickCallBacksObj() {
            public void onClick(Object obj, Object obj2) {
                kotlin.jvm.internal.k.f(obj, "o");
                ConversationView.this.contactItemClickFunctional(obj, obj2);
                Log.d(ConversationView.this.getTAG(), "ClickCallBacksObj = " + obj);
                Log.d(ConversationView.this.getTAG(), "ClickCallBacksObj = " + obj2);
            }

            public void onLongClick(Object obj) {
                kotlin.jvm.internal.k.f(obj, "o");
            }
        };
    }

    private final void addAdapterScrollListener() {
        RecyclerView recyclerView;
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen == null || (recyclerView = conversationScreen.getRecyclerView()) == null) {
            return;
        }
        recyclerView.addOnScrollListener(new RecyclerView.u() {
            public void onScrolled(RecyclerView recyclerView2, int i, int i7) {
                boolean z;
                SpeedyLinearLayoutManager linearLayoutManager;
                kotlin.jvm.internal.k.f(recyclerView2, "recyclerView");
                super.onScrolled(recyclerView2, i, i7);
                z = ConversationView.this.mIsLoading;
                if (z || i7 >= 0) {
                    return;
                }
                ConversationScreen conversationScreen2 = ConversationView.this.getConversationScreen();
                if (((conversationScreen2 == null || (linearLayoutManager = conversationScreen2.getLinearLayoutManager()) == null) ? 0 : linearLayoutManager.findFirstVisibleItemPosition()) <= 30) {
                    ConversationView.this.loadMessages();
                }
            }
        });
    }

    private final void addContact(final String str, final String str2, final String str3) {
        if (Constants.IS_CONTACTS_SEND_TO_SERVER ? ZangiPermissionUtils.hasPermission(getActivity(), 1010, true, new ZangiPermissionUtils.OnPermissionResult() {
            public final void onResult(ArrayList arrayList, boolean z) {
                ConversationView.addContact$lambda$25(ConversationView.this, str, str2, str3, arrayList, z);
            }
        }) : true) {
            AbstractZangiActivity.startAddContactActivity(getActivity(), str, str2, str3);
        }
    }

    public static final void addContact$lambda$25(ConversationView conversationView, String str, String str2, String str3, ArrayList arrayList, boolean z) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        if (z) {
            AbstractZangiActivity.startAddContactActivity(conversationView.getActivity(), str, str2, str3);
        }
    }

    public final void addContactMenuClick() {
        Conversation conversation = this.conversation;
        String displayNumber = conversation != null ? conversation.getDisplayNumber() : null;
        Conversation conversation2 = this.conversation;
        addContact(displayNumber, conversation2 != null ? conversation2.getDisplayEmail() : null, "");
    }

    public final boolean appInLandScapeAndShowEditOrReplyViews() {
        EditView editMessageContainer;
        ReplyView mReplyView;
        WindowManager windowManager;
        Display defaultDisplay;
        FragmentActivity activity = getActivity();
        Integer valueOf = (activity == null || (windowManager = activity.getWindowManager()) == null || (defaultDisplay = windowManager.getDefaultDisplay()) == null) ? null : Integer.valueOf(defaultDisplay.getRotation());
        if ((valueOf == null || valueOf.intValue() != 1) && (valueOf == null || valueOf.intValue() != 3)) {
            return false;
        }
        BottomSheet bottomSheet = this.bottomSheet;
        if ((bottomSheet == null || (mReplyView = bottomSheet.getMReplyView()) == null || mReplyView.getVisibility() != 0) ? false : true) {
            return true;
        }
        BottomSheet bottomSheet2 = this.bottomSheet;
        return bottomSheet2 != null && (editMessageContainer = bottomSheet2.getEditMessageContainer()) != null && editMessageContainer.getVisibility() == 0;
    }

    private final boolean backFromSearchMode() {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.backFromSearchMode():boolean");
    }

    public final void callMenuClick(boolean z) {
        GroupMember me;
        Resources resources;
        MediaAutoPlayNextManager.INSTANCE.cancelVoice();
        Conversation conversation = this.conversation;
        String str = null;
        Boolean valueOf = conversation != null ? Boolean.valueOf(conversation.isGroup()) : null;
        kotlin.jvm.internal.k.c(valueOf);
        if (!valueOf.booleanValue()) {
            if (ZangiPermissionUtils.hasPermission(getActivity(), 1001, true, new ZangiPermissionUtils.OnPermissionResult() {
                public final void onResult(ArrayList arrayList, boolean z6) {
                    ConversationView.callMenuClick$lambda$23(ConversationView.this, arrayList, z6);
                }
            })) {
                makeCall(false);
                return;
            }
            return;
        }
        Conversation conversation2 = this.conversation;
        final Group group = conversation2 != null ? conversation2.getGroup() : null;
        if (group != null) {
            if (group.isDeleted()) {
                Context context = getContext();
                Context context2 = getContext();
                if (context2 != null && (resources = context2.getResources()) != null) {
                    str = resources.getString(2131886471);
                }
                Toast.makeText(context, str, 0).show();
                return;
            }
            Conversation conversation3 = this.conversation;
            if (kotlin.jvm.internal.k.b(conversation3 != null ? conversation3.getConversationId() : null, ConferenceManager.INSTANCE.getActiveGroupId())) {
                onJoinViewClick();
                return;
            }
            Conversation conversation4 = this.conversation;
            if (conversation4 != null && (me = conversation4.getMe()) != null) {
                str = me.getMemberType();
            }
            if (str == MemberRole.MEMBER) {
                AlertDialogUtils.showAlertWithMessage((Context) getActivity(), 2131886994, 2131886383, 2131887077, (DialogInterface.OnClickListener) null, true);
                return;
            }
            if (group.getActualMembers().size() > (PremiumManager.INSTANCE.isPremium() ? 1000 : 4)) {
                if (getActivity() != null) {
                    ConversationManager.INSTANCE.navigate(getContext(), new ConversationView$callMenuClick$1(group, this));
                }
            } else {
                if (AVSession.Companion.getSize() > 0) {
                    showInfoMessage(2131886748);
                    return;
                }
                if (!SignalingService.INSTANCE.isOnline()) {
                    showInfoMessage(2131887053);
                } else if (z) {
                    AlertDialogUtils.showAlertWithMessage((Context) getActivity(), 2131887550, 2131887461, 2131887462, 2131886274, new DialogInterface.OnClickListener() {
                        @Override
                        public final void onClick(DialogInterface dialogInterface, int i) {
                            ConversationView.callMenuClick$lambda$22(ConversationView.this, group, dialogInterface, i);
                        }
                    }, (DialogInterface.OnClickListener) null, true);
                } else {
                    startConferenceCall(group);
                }
            }
        }
    }

    public static final void callMenuClick$lambda$22(ConversationView conversationView, Group group, DialogInterface dialogInterface, int i) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        conversationView.startConferenceCall(group);
    }

    public static final void callMenuClick$lambda$23(ConversationView conversationView, ArrayList arrayList, boolean z) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        if (z) {
            conversationView.makeCall(false);
        }
    }

    private final void cancelVoiceRecordeProcess() {
        AppCompatEditText messageInput;
        ChatSensor.RECORD_STATE record_state = this.recordState;
        ChatSensor.RECORD_STATE record_state2 = ChatSensor.RECORD_STATE.NONE;
        if (record_state != record_state2) {
            setRecordState(record_state2);
            hideRecorderVisualizerView();
            hideLockView(true);
            if (BaseScreen.getRecordService().getOutPutFileName() != null) {
                BottomSheet bottomSheet = this.bottomSheet;
                if (bottomSheet != null && bottomSheet.isVoiceViewVisible()) {
                    BaseScreen.getRecordService().deleteRecord(BaseScreen.getRecordService().getOutPutFileName());
                }
            }
            BottomSheet bottomSheet2 = this.bottomSheet;
            if (bottomSheet2 != null) {
                bottomSheet2.correctMessageInput();
            }
            BottomSheet bottomSheet3 = this.bottomSheet;
            if (bottomSheet3 != null) {
                bottomSheet3.hideVoicePlayView();
            }
            BottomSheet bottomSheet4 = this.bottomSheet;
            if (bottomSheet4 == null || (messageInput = bottomSheet4.getMessageInput()) == null) {
                return;
            }
            messageInput.requestFocus();
        }
    }

    private final void changeConversation(Conversation conversation) {
        if (conversation != null) {
            this.conversation = conversation;
            return;
        }
        Conversation conversation2 = new Conversation();
        this.conversation = conversation2;
        kotlin.jvm.internal.k.c(conversation2);
        conversation2.setNew(true);
        Conversation conversation3 = this.conversation;
        kotlin.jvm.internal.k.c(conversation3);
        conversation3.setGroup(false);
    }

    public final void changeDateFooterVisibility(boolean z) {
        TextView dateFooterView;
        if ((this.date.length() > 0) && z && !isDataFooterOnDateBubble()) {
            ConversationScreen conversationScreen = this.conversationScreen;
            TextView dateFooterView2 = conversationScreen != null ? conversationScreen.getDateFooterView() : null;
            kotlin.jvm.internal.k.c(dateFooterView2);
            dateFooterView2.setVisibility(0);
            ConversationScreen conversationScreen2 = this.conversationScreen;
            dateFooterView = conversationScreen2 != null ? conversationScreen2.getDateFooterView() : null;
            kotlin.jvm.internal.k.c(dateFooterView);
            dateFooterView.animate().alpha(1.0f);
            return;
        }
        ConversationScreen conversationScreen3 = this.conversationScreen;
        TextView dateFooterView3 = conversationScreen3 != null ? conversationScreen3.getDateFooterView() : null;
        kotlin.jvm.internal.k.c(dateFooterView3);
        dateFooterView3.setVisibility(8);
        ConversationScreen conversationScreen4 = this.conversationScreen;
        dateFooterView = conversationScreen4 != null ? conversationScreen4.getDateFooterView() : null;
        kotlin.jvm.internal.k.c(dateFooterView);
        dateFooterView.animate().alpha(0.0f).setDuration(0L);
    }

    private final void changeFloatingActionButtonPosition(int i) {
        if (i < 0) {
            this.negativeHeight = Integer.valueOf(i);
        }
        boolean z = false;
        if (i > 0) {
            Integer num = this.negativeHeight;
            this.keypadMaxHeight = Math.abs(num != null ? num.intValue() : 0) + i;
        }
        BottomSheet bottomSheet = this.bottomSheet;
        if (bottomSheet != null && bottomSheet.getMKeyBoardHeight() == this.keypadMaxHeight) {
            z = true;
        }
        if (z || i <= 0) {
            return;
        }
        BottomSheet bottomSheet2 = this.bottomSheet;
        if (bottomSheet2 != null) {
            bottomSheet2.setMKeyBoardHeight(this.keypadMaxHeight);
        }
        ZangiConfigurationService.INSTANCE.putInt(Constants.KEYBOARD_HEIGHT, this.keypadMaxHeight, true);
    }

    private final void chatBackground(String str) {
        Intent intent = new Intent((Context) getActivity(), (Class<?>) ScreenChooseBackground.class);
        intent.putExtra(Constants.USER_INDIVIDUAL_BACKGROUND, str);
        startActivity(intent);
    }

    private final void checkHasEditOrNo(Conversation conversation) {
        if (isAdded()) {
            if ((conversation != null ? conversation.getEditMessageId() : null) != null) {
                StorageService storageService = StorageService.INSTANCE;
                Long editMessageId = conversation.getEditMessageId();
                kotlin.jvm.internal.k.c(editMessageId);
                ZangiMessage messageByDbID = storageService.getMessageByDbID(editMessageId.longValue());
                if (messageByDbID != null) {
                    closeSerchViewAndBottomSheetBackToFirstState();
                    BottomSheet bottomSheet = this.bottomSheet;
                    showKeyPad(bottomSheet != null ? bottomSheet.getMessageInput() : null);
                    ConversationAdapter conversationAdapter = this.conversationAdapter;
                    if (conversationAdapter != null) {
                        conversationAdapter.editSelectedMessage(messageByDbID);
                    }
                }
            }
        }
    }

    private final void checkHasReplyOrNo(Conversation conversation) {
        if (isAdded()) {
            if ((conversation != null ? conversation.getReplyMessageId() : null) != null) {
                StorageService storageService = StorageService.INSTANCE;
                Long replyMessageId = conversation.getReplyMessageId();
                kotlin.jvm.internal.k.c(replyMessageId);
                ZangiMessage messageByDbID = storageService.getMessageByDbID(replyMessageId.longValue());
                if (messageByDbID != null) {
                    onManuReplyButtonClick(true, messageByDbID);
                }
            }
        }
    }

    private final String checkNumber(String str) {
        if (str == null) {
            return null;
        }
        if (str.length() == 0) {
            return null;
        }
        if (this.conversation == null) {
            Conversation conversationItemByChat = StorageService.INSTANCE.getConversationItemByChat(str);
            this.conversation = conversationItemByChat;
            if (conversationItemByChat != null) {
                changeConversation(conversationItemByChat);
            }
        }
        Conversation conversation = this.conversation;
        if (conversation != null && conversation.isGroup()) {
            return str;
        }
        String e164WithoutPlus = ZangiEngineUtils.getE164WithoutPlus(str, ZangiEngineUtils.getZipCode(), false);
        this.callIconVisibility = true;
        showCallIcon(true);
        return e164WithoutPlus;
    }

    private final boolean checkNumberIsBlocked(String str) {
        if (str == null || str.length() <= 1 || BlockContactServiceImpl.getInstance().getZangiBlockNumber(str) == null) {
            return true;
        }
        CallHelper.blockedContactCallOrSendMessageAlert(getActivity(), str, (blockNumberCallback) null);
        return false;
    }

    private final void clearBadges() {
        Conversation conversation = this.conversation;
        if ((conversation != null ? conversation.getUnreadMsgCount() : 0) > 0) {
            StorageService storageService = StorageService.INSTANCE;
            Conversation conversation2 = this.conversation;
            storageService.setChatReaded(conversation2 != null ? conversation2.getConversationJid() : null);
            NotificationController notificationController = NotificationController.INSTANCE;
            Conversation conversation3 = this.conversation;
            notificationController.removeNotifications(conversation3 != null ? conversation3.getConversationId() : null);
            Conversation conversation4 = this.conversation;
            if (conversation4 != null) {
                conversation4.setUnreadMsgCount(0);
            }
            ZangiMessagingService.getInstance().updateConversationUnreadMessageCount(this.conversation);
        }
    }

    public static final void closeSearchBarRunnable$lambda$48(final ConversationView conversationView) {
        LinearLayout searchLayout;
        ViewPropertyAnimator animate;
        ViewPropertyAnimator duration;
        ViewPropertyAnimator translationY;
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        ConversationScreen conversationScreen = conversationView.conversationScreen;
        if (conversationScreen == null || (searchLayout = conversationScreen.getSearchLayout()) == null || (animate = searchLayout.animate()) == null || (duration = animate.setDuration(100L)) == null || (translationY = duration.translationY(0.0f)) == null) {
            return;
        }
        translationY.setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animator) {
                boolean z;
                kotlin.jvm.internal.k.f(animator, "animation");
                super.onAnimationEnd(animator);
                z = ConversationView.this._closeWithContactList;
                if (z) {
                    ConversationScreen conversationScreen2 = ConversationView.this.getConversationScreen();
                    LinearLayout searchLayout2 = conversationScreen2 != null ? conversationScreen2.getSearchLayout() : null;
                    if (searchLayout2 != null) {
                        searchLayout2.setVisibility(8);
                    }
                    ConversationScreen conversationScreen3 = ConversationView.this.getConversationScreen();
                    ListView contactFilterListView = conversationScreen3 != null ? conversationScreen3.getContactFilterListView() : null;
                    if (contactFilterListView == null) {
                        return;
                    }
                    contactFilterListView.setVisibility(8);
                }
            }
        });
    }

    public final void closeSearchByLayout(boolean z) {
        this.closeSearchByHandler.removeCallbacks(this.closeSearchBarRunnable);
        this._closeWithContactList = z;
        if (z) {
            ConversationScreen conversationScreen = this.conversationScreen;
            LinearLayout searchLayout = conversationScreen != null ? conversationScreen.getSearchLayout() : null;
            if (searchLayout != null) {
                searchLayout.setVisibility(8);
            }
            ConversationScreen conversationScreen2 = this.conversationScreen;
            ListView contactFilterListView = conversationScreen2 != null ? conversationScreen2.getContactFilterListView() : null;
            if (contactFilterListView == null) {
                return;
            }
            contactFilterListView.setVisibility(8);
        }
    }

    private final boolean collapseSearchView() {
        MenuItem menuItem = this.searchItem;
        if (menuItem == null) {
            return false;
        }
        if (menuItem != null) {
            menuItem.collapseActionView();
        }
        MenuItem menuItem2 = this.searchItem;
        if (menuItem2 == null) {
            return true;
        }
        menuItem2.setShowAsAction(8);
        return true;
    }

    public final void contactItemClickFunctional(Object obj, Object obj2) {
        if (obj == null) {
            inputFocusLost("", (String) obj2);
        } else {
            contactItemClickFunctional((String) obj, (String) obj2);
        }
    }

    public static final void contactItemClickFunctional$lambda$64(ConversationView conversationView, ArrayList arrayList, String str, Contact contact, DialogInterface dialogInterface, int i) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(arrayList, "$contactNumbers");
        if (conversationView.updateConversationWithNumber((String) arrayList.get(i), str, contact)) {
            conversationView.hideContactList();
            conversationView.requestOnlineStatus();
        }
    }

    private final void createAppBarLayout() {
        AppBarLayout appBarLayout = new AppBarLayout(requireContext());
        this.appBar = appBarLayout;
        kotlin.jvm.internal.k.c(appBarLayout);
        appBarLayout.setId(2131362281);
        AppBarLayout appBarLayout2 = this.appBar;
        kotlin.jvm.internal.k.c(appBarLayout2);
        appBarLayout2.getContext().setTheme(2131951632);
        AppBarLayout appBarLayout3 = this.appBar;
        kotlin.jvm.internal.k.c(appBarLayout3);
        appBarLayout3.setBackgroundColor(androidx.core.content.a.c(MainApplication.Companion.getMainContext(), ColorsManger.app_main_color));
        AppBarLayout appBarLayout4 = this.appBar;
        kotlin.jvm.internal.k.c(appBarLayout4);
        appBarLayout4.setOutlineProvider(null);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
        AppBarLayout appBarLayout5 = this.appBar;
        kotlin.jvm.internal.k.c(appBarLayout5);
        appBarLayout5.setLayoutParams(layoutParams);
        AppBarLayout appBarLayout6 = this.appBar;
        kotlin.jvm.internal.k.c(appBarLayout6);
        createToolBarLayout(appBarLayout6);
        ConversationScreen conversationScreen = this.conversationScreen;
        kotlin.jvm.internal.k.c(conversationScreen);
        AppBarLayout appBarLayout7 = this.appBar;
        kotlin.jvm.internal.k.c(appBarLayout7);
        conversationScreen.addView(appBarLayout7);
        ConversationScreen conversationScreen2 = this.conversationScreen;
        kotlin.jvm.internal.k.c(conversationScreen2);
        LinearLayout contentLayout = conversationScreen2.getContentLayout();
        kotlin.jvm.internal.k.c(contentLayout);
        ViewGroup.LayoutParams layoutParams2 = contentLayout.getLayoutParams();
        kotlin.jvm.internal.k.d(layoutParams2, "null cannot be cast to non-null type android.widget.RelativeLayout.LayoutParams");
        ((RelativeLayout.LayoutParams) layoutParams2).addRule(3, 2131362281);
    }

    private final void createBottomSheet() {
        Context context = getContext();
        if (context == null) {
            return;
        }
        BottomSheet bottomSheet = new BottomSheet(context, this.leftHandedMode, this.isOutgoinSMS, this.keyBoardHeightFromShared, this.conversation);
        this.bottomSheet = bottomSheet;
        bottomSheet.setDelegate(new WeakReference(this));
    }

    private final void createConversationAdapter() {
        this.conversationAdapter = new ConversationAdapter(new WeakReference(getActivity()), new WeakReference(getActivity()), this.conversationScreen, Boolean.FALSE);
        this.adapterDelegateObj = new ConversationView$createConversationAdapter$1(this);
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.delegate = new WeakReference(this.adapterDelegateObj);
        }
        ConversationAdapter conversationAdapter2 = this.conversationAdapter;
        if (conversationAdapter2 != null) {
            conversationAdapter2.setSearchBy(SearchBy.NONE);
        }
        ConversationAdapter conversationAdapter3 = this.conversationAdapter;
        if (conversationAdapter3 != null) {
            conversationAdapter3.setMessageClickHandler(new WeakReference(this));
        }
        ConversationScreen conversationScreen = this.conversationScreen;
        RecyclerView recyclerView = conversationScreen != null ? conversationScreen.getRecyclerView() : null;
        if (recyclerView == null) {
            return;
        }
        recyclerView.setAdapter(this.conversationAdapter);
    }

    private final void createConversationScreen() {
        synchronized (this) {
            Context requireContext = requireContext();
            kotlin.jvm.internal.k.e(requireContext, "requireContext()");
            ConversationScreen conversationScreen = new ConversationScreen(requireContext, this.leftHandedMode, false);
            this.conversationScreen = conversationScreen;
            conversationScreen.setBottomSheet(this.bottomSheet);
            ConversationScreen conversationScreen2 = this.conversationScreen;
            kotlin.jvm.internal.k.c(conversationScreen2);
            conversationScreen2.setClickable(true);
            ConversationScreen conversationScreen3 = this.conversationScreen;
            kotlin.jvm.internal.k.c(conversationScreen3);
            conversationScreen3.setDelegate(new WeakReference<>(this));
            ConversationScreen conversationScreen4 = this.conversationScreen;
            kotlin.jvm.internal.k.c(conversationScreen4);
            conversationScreen4.setClipToPadding(false);
            ConversationScreen conversationScreen5 = this.conversationScreen;
            kotlin.jvm.internal.k.c(conversationScreen5);
            conversationScreen5.setClipChildren(false);
            if (this.bottomSheet != null) {
                ConversationScreen conversationScreen6 = this.conversationScreen;
                kotlin.jvm.internal.k.c(conversationScreen6);
                LinearLayout contentLayout = conversationScreen6.getContentLayout();
                if (contentLayout != null) {
                    contentLayout.addView(this.bottomSheet);
                }
                if (!ScreenVideoCall.Companion.getChatFragmentIsVisible()) {
                    VoiceManager voiceManager = VoiceManager.INSTANCE;
                    if (voiceManager.getVoiceView().getSuperview() != null) {
                        voiceManager.getVoiceView().removeFromSuperview();
                    }
                    ConversationScreen conversationScreen7 = this.conversationScreen;
                    kotlin.jvm.internal.k.c(conversationScreen7);
                    conversationScreen7.addView(voiceManager.getVoiceView());
                }
            }
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
            ConversationScreen conversationScreen8 = this.conversationScreen;
            kotlin.jvm.internal.k.c(conversationScreen8);
            conversationScreen8.setLayoutParams(layoutParams);
            BottomSheet bottomSheet = this.bottomSheet;
            if (bottomSheet != null) {
                bottomSheet.setConversationScreen(this.conversationScreen);
            }
            ZReactionMenuManager.INSTANCE.configure(new WeakReference(this), new WeakReference(this.conversationScreen));
            ZReactionSelectedMemberListManager.INSTANCE.configure(new WeakReference(this.conversationScreen), new WeakReference(this));
            fb.r rVar = fb.r.a;
        }
    }

    private final void createConversationToolBar() {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.createConversationToolBar():void");
    }

    private final void createSearchHolder() {
        ChatSearchListener chatSearchListener = new ChatSearchListener() {

            public class WhenMappings {
                public static final int[] $EnumSwitchMapping$0;

                static {
                    int[] iArr = new int[SearchBy.values().length];
                    try {
                        iArr[SearchBy.CONTACTS.ordinal()] = 1;
                    } catch (NoSuchFieldError unused) {
                    }
                    try {
                        iArr[SearchBy.DATE.ordinal()] = 2;
                    } catch (NoSuchFieldError unused2) {
                    }
                    try {
                        iArr[SearchBy.MESSAGE.ordinal()] = 3;
                    } catch (NoSuchFieldError unused3) {
                    }
                    $EnumSwitchMapping$0 = iArr;
                }
            }

            @Override
            public void goToMessage(long j, int i, int i7) {
                BottomSearchView bottomSearchView;
                SearchBy searchBy;
                BottomSheet bottomSheet;
                BottomSearchView bottomSearchView2;
                SearchBy searchBy2;
                BottomSearchView bottomSearchView3;
                BottomSearchView bottomSearchView4;
                SearchBy searchBy3;
                BottomSheet bottomSheet2;
                BottomSearchView bottomSearchView5;
                SearchBy searchBy4;
                int i8 = i7 - i;
                ConversationView.this.setCurrentSearchedMessageId(j);
                ConversationView.this.setScrollMsgID(j);
                if (i == 0) {
                    BottomSheet bottomSheet3 = ConversationView.this.getBottomSheet();
                    if (bottomSheet3 != null && (bottomSearchView = bottomSheet3.getBottomSearchView()) != null) {
                        searchBy = ConversationView.this.searchBy;
                        bottomSearchView.disableSearchDownButton(searchBy);
                    }
                } else if (i == 1 && (bottomSheet2 = ConversationView.this.getBottomSheet()) != null && (bottomSearchView5 = bottomSheet2.getBottomSearchView()) != null) {
                    searchBy4 = ConversationView.this.searchBy;
                    bottomSearchView5.enableSaerchDownButton(searchBy4);
                }
                if (i == i7 - 1) {
                    BottomSheet bottomSheet4 = ConversationView.this.getBottomSheet();
                    if (bottomSheet4 != null && (bottomSearchView4 = bottomSheet4.getBottomSearchView()) != null) {
                        searchBy3 = ConversationView.this.searchBy;
                        bottomSearchView4.disableSearchUpButton(searchBy3);
                    }
                } else if (i == i7 - 2 && (bottomSheet = ConversationView.this.getBottomSheet()) != null && (bottomSearchView2 = bottomSheet.getBottomSearchView()) != null) {
                    searchBy2 = ConversationView.this.searchBy;
                    bottomSearchView2.enableSearchUpButton(searchBy2);
                }
                BottomSheet bottomSheet5 = ConversationView.this.getBottomSheet();
                if (bottomSheet5 != null && (bottomSearchView3 = bottomSheet5.getBottomSearchView()) != null) {
                    bottomSearchView3.showSearchResultInfoText(i8 + " of " + i7);
                }
                Log.info("CHAT_SEARCH ", new String[]{"goToMessage", i8 + " of " + i7});
                ConversationView.this.closeSearchByLayout(true);
                ConversationAdapter conversationAdapter = ConversationView.this.conversationAdapter;
                if (conversationAdapter != null) {
                    conversationAdapter.updateAllList();
                }
                ConversationView.this.scrollByMsgId(j);
            }

            @Override
            public void notFounded() {
                IChatSearchHolder iChatSearchHolder;
                BottomSheet bottomSheet;
                BottomSearchView bottomSearchView;
                BottomSearchView bottomSearchView2;
                SearchBy searchBy;
                SearchBy searchBy2;
                BottomSearchView bottomSearchView3;
                Log.info("CHAT_SEARCH ", new String[]{"notFounded"});
                BottomSheet bottomSheet2 = ConversationView.this.getBottomSheet();
                if (bottomSheet2 != null && (bottomSearchView3 = bottomSheet2.getBottomSearchView()) != null) {
                    bottomSearchView3.disableSearchArrowButtons();
                }
                ConversationView.this.searchBy = SearchBy.MESSAGE;
                iChatSearchHolder = ConversationView.this.chatSearchHolder;
                if (iChatSearchHolder != null) {
                    searchBy2 = ConversationView.this.searchBy;
                    iChatSearchHolder.setCurrentSearchKey("", true, searchBy2);
                }
                ConversationView.this.setCurrentSearchedMessageId(-1L);
                ConversationAdapter conversationAdapter = ConversationView.this.conversationAdapter;
                if (conversationAdapter != null) {
                    searchBy = ConversationView.this.searchBy;
                    conversationAdapter.setSearchKey("", searchBy);
                }
                BottomSheet bottomSheet3 = ConversationView.this.getBottomSheet();
                if (bottomSheet3 != null && (bottomSearchView2 = bottomSheet3.getBottomSearchView()) != null) {
                    bottomSearchView2.disableSearchArrowButtons();
                }
                ConversationAdapter conversationAdapter2 = ConversationView.this.conversationAdapter;
                if (conversationAdapter2 != null) {
                    conversationAdapter2.updateAllList();
                }
                Context context = ConversationView.this.getContext();
                if (context == null || (bottomSheet = ConversationView.this.getBottomSheet()) == null || (bottomSearchView = bottomSheet.getBottomSearchView()) == null) {
                    return;
                }
                String string = context.getString(2131887038);
                kotlin.jvm.internal.k.e(string, "this.getString(R.string.no_results)");
                bottomSearchView.showSearchResultInfoText(string);
            }

            @Override
            public void onFound(int i) {
                SearchBy searchBy;
                BottomSearchView bottomSearchView;
                BottomSearchView bottomSearchView2;
                BottomSearchView bottomSearchView3;
                Log.info("CHAT_SEARCH ", new String[]{"onFound", String.valueOf(i)});
                BottomSheet bottomSheet = ConversationView.this.getBottomSheet();
                if (bottomSheet != null && (bottomSearchView3 = bottomSheet.getBottomSearchView()) != null) {
                    bottomSearchView3.showSearchResultInfoText(String.valueOf(i));
                }
                if (i > 1) {
                    searchBy = ConversationView.this.searchBy;
                    int i7 = WhenMappings.$EnumSwitchMapping$0[searchBy.ordinal()];
                    if (i7 != 1) {
                        if (i7 == 2) {
                            BottomSheet bottomSheet2 = ConversationView.this.getBottomSheet();
                            if (bottomSheet2 == null || (bottomSearchView2 = bottomSheet2.getBottomSearchView()) == null) {
                                return;
                            }
                            bottomSearchView2.enableSearchArrowDownButton();
                            return;
                        }
                        if (i7 != 3) {
                            return;
                        }
                    }
                    BottomSheet bottomSheet3 = ConversationView.this.getBottomSheet();
                    if (bottomSheet3 == null || (bottomSearchView = bottomSheet3.getBottomSearchView()) == null) {
                        return;
                    }
                    bottomSearchView.enableSearchArrowUpButton();
                }
            }

            @Override
            public void setSearchKey(String str) {
                SearchBy searchBy;
                BottomSearchView bottomSearchView;
                kotlin.jvm.internal.k.f(str, "_searchKey");
                BottomSheet bottomSheet = ConversationView.this.getBottomSheet();
                if (bottomSheet != null && (bottomSearchView = bottomSheet.getBottomSearchView()) != null) {
                    bottomSearchView.showSearchResultInfoText("");
                }
                ConversationAdapter conversationAdapter = ConversationView.this.conversationAdapter;
                if (conversationAdapter != null) {
                    searchBy = ConversationView.this.searchBy;
                    conversationAdapter.setSearchKey(str, searchBy);
                }
            }

            @Override
            public void setholderItems(java.util.List<com.beint.project.core.model.sms.ZangiMessage> r7) {
                throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView$createSearchHolder$chatSearchListener$1.setholderItems(java.util.List):void");
            }
        };
        Context context = getContext();
        Conversation conversation = this.conversation;
        this.chatSearchHolder = new ChatSearchHolder(context, conversation != null ? conversation.getConversationJid() : null, chatSearchListener);
        openSearchByLayout();
        showSearchBottomView();
    }

    private final void createSensor() {
        this.chatSensor = new ChatSensor();
        this.chatSensorListener = new ConversationView$createSensor$1(this);
    }

    private final void createToolBarLayout(AppBarLayout appBarLayout) {
        this.toolBarRLayout = new RelativeLayout(getContext());
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
        RelativeLayout relativeLayout = this.toolBarRLayout;
        kotlin.jvm.internal.k.c(relativeLayout);
        relativeLayout.setLayoutParams(layoutParams);
        createConversationToolBar();
        RelativeLayout relativeLayout2 = this.toolBarRLayout;
        kotlin.jvm.internal.k.c(relativeLayout2);
        appBarLayout.addView(relativeLayout2);
    }

    public static final void datePickerDialogCancelListener$lambda$4(ConversationView conversationView, DialogInterface dialogInterface) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        BottomSheet bottomSheet = conversationView.bottomSheet;
        if (bottomSheet != null) {
            bottomSheet.showBottomSearchView();
        }
        conversationView.searchBy = SearchBy.MESSAGE;
    }

    public static final void datePickerDialogShowListener$lambda$6(final ConversationView conversationView, DialogInterface dialogInterface) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        BottomSheet bottomSheet = conversationView.bottomSheet;
        if (bottomSheet != null) {
            bottomSheet.hideBottomSearchView();
        }
        MainApplication.Companion.getMainHandler().postDelayed(new Runnable() {
            @Override
            public final void run() {
                ConversationView.datePickerDialogShowListener$lambda$6$lambda$5(ConversationView.this);
            }
        }, 300L);
    }

    public static final void datePickerDialogShowListener$lambda$6$lambda$5(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        ToolbarSearchView toolbarSearchView = conversationView.toolbarSearchView;
        conversationView.hideKeyPad(toolbarSearchView != null ? toolbarSearchView.getSearchEditText() : null);
    }

    private final void deInitBroadcastReceiveres() {
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.removeObservers();
        }
        NotificationCenter.INSTANCE.removeObserver(this);
    }

    private final int getAddContactHeight() {
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen != null) {
            return conversationScreen.getAddContactHeight();
        }
        return 0;
    }

    private final long getCurrentSearchedMessageId() {
        return this._currentSearchedMessageId;
    }

    private final ExtendedBar getExtandedBar() {
        ExtendedBar extendedBar;
        if (this._extandedBar == null) {
            LinkedHashMap linkedHashMap = new LinkedHashMap();
            if (this.isRtl) {
                linkedHashMap.put(Integer.valueOf(ConversationViewExtendBarTags.FORWARD_BUTTON.getValue()), 2131231225);
            } else {
                linkedHashMap.put(Integer.valueOf(ConversationViewExtendBarTags.REPLY_BUTTON.getValue()), 2131231233);
            }
            linkedHashMap.put(Integer.valueOf(ConversationViewExtendBarTags.DELETE_BUTTON.getValue()), 2131231222);
            linkedHashMap.put(Integer.valueOf(ConversationViewExtendBarTags.COPY_BUTTON.getValue()), 2131231218);
            linkedHashMap.put(Integer.valueOf(ConversationViewExtendBarTags.INFO_BUTTON.getValue()), 2131231226);
            if (this.isRtl) {
                linkedHashMap.put(Integer.valueOf(ConversationViewExtendBarTags.REPLY_BUTTON.getValue()), 2131231233);
            } else {
                linkedHashMap.put(Integer.valueOf(ConversationViewExtendBarTags.FORWARD_BUTTON.getValue()), 2131231225);
            }
            if (getActivity() != null) {
                FragmentActivity requireActivity = requireActivity();
                kotlin.jvm.internal.k.e(requireActivity, "requireActivity()");
                extendedBar = new ExtendedBar(requireActivity, linkedHashMap);
            } else {
                extendedBar = new ExtendedBar(MainApplication.Companion.getMainContext(), linkedHashMap);
            }
            this._extandedBar = extendedBar;
            kotlin.jvm.internal.k.c(extendedBar);
            extendedBar.setDelegate(new WeakReference<>(this));
            RelativeLayout relativeLayout = this.toolBarRLayout;
            kotlin.jvm.internal.k.c(relativeLayout);
            relativeLayout.addView(this._extandedBar);
            ExtendedBar extendedBar2 = this._extandedBar;
            kotlin.jvm.internal.k.c(extendedBar2);
            ViewGroup.LayoutParams layoutParams = extendedBar2.getLayoutParams();
            kotlin.jvm.internal.k.d(layoutParams, "null cannot be cast to non-null type android.widget.RelativeLayout.LayoutParams");
            ExtendedBar extendedBar3 = this._extandedBar;
            kotlin.jvm.internal.k.c(extendedBar3);
            extendedBar3.setLayoutParams((RelativeLayout.LayoutParams) layoutParams);
        }
        ExtendedBar extendedBar4 = this._extandedBar;
        kotlin.jvm.internal.k.c(extendedBar4);
        return extendedBar4;
    }

    private final void getIncompleteText(Conversation conversation) {
        AppCompatEditText messageInput;
        PasteEditText messageInput2;
        AppCompatEditText messageInput3;
        TextPaint paint;
        if (isAdded()) {
            DraftTextManager draftTextManager = DraftTextManager.INSTANCE;
            Context context = getContext();
            BottomSheet bottomSheet = this.bottomSheet;
            Editable editable = null;
            CharSequence incompleteText = draftTextManager.getIncompleteText(conversation, context, (bottomSheet == null || (messageInput3 = bottomSheet.getMessageInput()) == null || (paint = messageInput3.getPaint()) == null) ? null : paint.getFontMetricsInt(), true);
            BottomSheet bottomSheet2 = this.bottomSheet;
            PasteEditText messageInput4 = bottomSheet2 != null ? bottomSheet2.getMessageInput() : null;
            if (messageInput4 != null) {
                messageInput4.setNotFireTextChanged(true);
            }
            BottomSheet bottomSheet3 = this.bottomSheet;
            AppCompatEditText messageInput5 = bottomSheet3 != null ? bottomSheet3.getMessageInput() : null;
            if (messageInput5 != null) {
                messageInput5.setText(incompleteText);
            }
            BottomSheet bottomSheet4 = this.bottomSheet;
            if (bottomSheet4 != null) {
                if (bottomSheet4 != null && (messageInput2 = bottomSheet4.getMessageInput()) != null) {
                    editable = messageInput2.getText();
                }
                bottomSheet4.sendAndVoiceButtonsVisibility(!(editable == null || editable.length() == 0));
            }
            BottomSheet bottomSheet5 = this.bottomSheet;
            if (bottomSheet5 == null || (messageInput = bottomSheet5.getMessageInput()) == null) {
                return;
            }
            messageInput.setSelection(incompleteText.length());
        }
    }

    private final void getIncompleteTextIfInNotGifState(Conversation conversation) {
        ChatSmilesView chatSmilesView;
        BottomBar bottomBar;
        BottomSheet bottomSheet = this.bottomSheet;
        if (((bottomSheet == null || (chatSmilesView = bottomSheet.getChatSmilesView()) == null || (bottomBar = chatSmilesView.getBottomBar()) == null) ? null : bottomBar.getBottomBarState()) == BottomBar.BottomBarState.GIF) {
            return;
        }
        getIncompleteText(conversation);
    }

    private final boolean getIsTurnChatSounds() {
        if (this.isTurnChatSounds == -1) {
            this.isTurnChatSounds = StorageService.INSTANCE.getBooleanSetting("com.beint.project.CHAT_SOUND", true) ? 1 : 0;
        }
        return this.isTurnChatSounds == 1;
    }

    private final JoinView getJoinView() {
        ConversationScreen conversationScreen;
        ConversationScreen conversationScreen2 = this.conversationScreen;
        if ((conversationScreen2 != null ? conversationScreen2.getJoinView() : null) == null && (conversationScreen = this.conversationScreen) != null) {
            conversationScreen.createJoinView(this.conversation);
        }
        ConversationScreen conversationScreen3 = this.conversationScreen;
        JoinView joinView = conversationScreen3 != null ? conversationScreen3.getJoinView() : null;
        kotlin.jvm.internal.k.c(joinView);
        return joinView;
    }

    private final ZAnimationView getLottieAnimationView() {
        if (this._lottieAnimationView == null) {
            ConversationScreen conversationScreen = this.conversationScreen;
            this._lottieAnimationView = conversationScreen != null ? conversationScreen.getLottieAnimationView() : null;
        }
        return this._lottieAnimationView;
    }

    private final Map<String, Integer> getMessageInfo(String str) {
        HashMap hashMap = new HashMap();
        if (SmileGetterItem.Companion.parseEmojisResult(str, new StringBuilder())) {
            hashMap.put("hasSmile", 1);
        } else {
            hashMap.put("hasSmile", 0);
        }
        hashMap.put("hasLink", -1);
        return hashMap;
    }

    private final List<ZangiMessage> getMessages() {
        int i;
        IConversationPresenter iConversationPresenter = this.presenter;
        if (iConversationPresenter != null) {
            kotlin.jvm.internal.k.c(iConversationPresenter);
            Conversation conversation = this.conversation;
            i = iConversationPresenter.getUnreadMessagesCount(conversation != null ? conversation.getConversationJid() : null);
        } else {
            i = 0;
        }
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.setUnreadMessagesCount(i);
        }
        if (i > 50) {
            i += 3;
        }
        int i7 = i >= 50 ? i : 50;
        if (!this.isSearchItemLoaded) {
            this.isSearchItemLoaded = true;
        }
        StorageService storageService = StorageService.INSTANCE;
        Conversation conversation2 = this.conversation;
        return storageService.getMessages(conversation2 != null ? conversation2.getConversationJid() : null, i7, 0);
    }

    public final InChatContactAndGroupStatusView getPhoneOrEmailStatus() {
        ConversationScreen conversationScreen = this.conversationScreen;
        if ((conversationScreen != null ? conversationScreen.getPhoneOrEmailStatus() : null) == null) {
            ConversationScreen conversationScreen2 = this.conversationScreen;
            if (conversationScreen2 != null) {
                conversationScreen2.createPhoneOrEmailStatusView(this.conversation, this.toolBarRLayout, new ConversationView$phoneOrEmailStatus$1(this));
            }
            hideTvNumberOrEmailTopLine(8, false);
        }
        ConversationScreen conversationScreen3 = this.conversationScreen;
        InChatContactAndGroupStatusView phoneOrEmailStatus = conversationScreen3 != null ? conversationScreen3.getPhoneOrEmailStatus() : null;
        kotlin.jvm.internal.k.c(phoneOrEmailStatus);
        return phoneOrEmailStatus;
    }

    private final StealthModeTopView getStealthModeTopView() {
        FrameLayout joinViewBackgroundLayout;
        Stealth stealth;
        StealthTimeEnum stealthDuration;
        if (this._stealthModeTopView == null) {
            Context requireContext = requireContext();
            kotlin.jvm.internal.k.e(requireContext, "requireContext()");
            AttributeSet attributeSet = null;
            StealthModeTopView stealthModeTopView = new StealthModeTopView(requireContext, attributeSet, 2, attributeSet);
            this._stealthModeTopView = stealthModeTopView;
            stealthModeTopView.setId(2131363715);
            StealthModeTopView stealthModeTopView2 = this._stealthModeTopView;
            if (stealthModeTopView2 != null) {
                stealthModeTopView2.setDelegate(new WeakReference<>(this));
            }
            StealthModeTopView stealthModeTopView3 = getStealthModeTopView();
            Conversation conversation = this.conversation;
            boolean z = false;
            stealthModeTopView3.setDescriptionByDuration((conversation == null || (stealth = conversation.getStealth()) == null || (stealthDuration = stealth.getStealthDuration()) == null) ? 0 : stealthDuration.ordinal());
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
            StealthModeTopView stealthModeTopView4 = this._stealthModeTopView;
            if (stealthModeTopView4 != null) {
                stealthModeTopView4.setLayoutParams(layoutParams);
            }
            setStealthTopViewMargin();
            ConversationScreen conversationScreen = this.conversationScreen;
            if (conversationScreen != null && (joinViewBackgroundLayout = conversationScreen.getJoinViewBackgroundLayout()) != null) {
                joinViewBackgroundLayout.addView(this._stealthModeTopView);
            }
            StealthModeTopView stealthModeTopView5 = this._stealthModeTopView;
            if (stealthModeTopView5 != null) {
                Conversation conversation2 = this.conversation;
                if (conversation2 != null && conversation2.isStealthModeOn()) {
                    Conversation conversation3 = this.conversation;
                    if (!(conversation3 != null && conversation3.hasConferenceCall())) {
                        z = true;
                    }
                }
                stealthModeTopView5.showOrHide(z);
            }
        }
        StealthModeTopView stealthModeTopView6 = this._stealthModeTopView;
        kotlin.jvm.internal.k.c(stealthModeTopView6);
        return stealthModeTopView6;
    }

    public final String getYoutubeVideoID(String str) {
        String group;
        Pattern compile = Pattern.compile("https?:\\/\\/(?:[0-9A-Z-]+\\.)?(?:youtu\\.be\\/|youtube\\.com\\S*[^\\w\\-\\s])([\\w\\-]{11})(?=[^\\w\\-]|$)(?![?=&+%\\w]*(?:['\"][^<>]*>|<\\/a>))[?=&+%\\w]*", 2);
        kotlin.jvm.internal.k.e(compile, "compile(\n            pat…ASE_INSENSITIVE\n        )");
        Matcher matcher = compile.matcher(str);
        kotlin.jvm.internal.k.e(matcher, "compiledPattern.matcher(url)");
        return (!matcher.find() || (group = matcher.group(1)) == null) ? "" : group;
    }

    public static final void groupEvent$lambda$33(ConversationView conversationView, Conversation conversation, String str) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(conversation, "$conversation");
        kotlin.jvm.internal.k.f(str, "$action");
        Conversation conversation2 = conversationView.conversation;
        if (conversation2 != null) {
            boolean z = false;
            if (conversation2 != null && conversation2.getConversationFildId() == conversation.getConversationFildId()) {
                z = true;
            }
            if (z) {
                int hashCode = str.hashCode();
                if (hashCode != -1875966394) {
                    if (hashCode != -50520831) {
                        if (hashCode != 444743085 || !str.equals("com.beint.project.GROUP_CHAT_JOIN_ROOM")) {
                            return;
                        }
                    } else if (!str.equals("com.beint.project.GROUP_CHAT_KICK_USER")) {
                        return;
                    }
                } else if (!str.equals("com.beint.project.GROUP_CHAT_LEAVE_ROOM")) {
                    return;
                }
                conversationView.updateGroupChatUi(conversation);
            }
        }
    }

    private final void hideContactList() {
        FragmentActivity activity;
        FragmentManager supportFragmentManager;
        androidx.fragment.app.r n;
        if (this.contactsListFragment == null) {
            return;
        }
        FragmentManager fragmentManager = getFragmentManager();
        ScreenTabContacts screenTabContacts = (ScreenTabContacts) (fragmentManager != null ? fragmentManager.j0(BaseScreen.SCREEN_TYPE.TAB_CONTACTS.toString()) : null);
        this.contactsListFragment = screenTabContacts;
        if (screenTabContacts != null && screenTabContacts != null && (activity = getActivity()) != null && (supportFragmentManager = activity.getSupportFragmentManager()) != null && (n = supportFragmentManager.n()) != null) {
            ScreenTabContacts screenTabContacts2 = this.contactsListFragment;
            kotlin.jvm.internal.k.c(screenTabContacts2);
            androidx.fragment.app.r p = n.p(screenTabContacts2);
            if (p != null) {
                p.j();
            }
        }
        ScreenTabContacts screenTabContacts3 = this.contactsListFragment;
        if (screenTabContacts3 != null) {
            screenTabContacts3.setListener(null);
        }
        this.contactsListFragment = null;
        if (this.isOptimizedConversation) {
            return;
        }
        Conversation conversation = this.conversation;
        new ZangiProfileServiceImpl.GetUserProfileFromServerAsync(conversation != null ? conversation.getE164number() : null, new ProfileUpdatedListener() {
            public void update() {
            }
        }).executeOnExecutor(MainApplication.Companion.getRequestServiceExecutor(), new Object[0]);
    }

    private final void hideKeyBoardInConversationViewClick() {
    }

    private final void hideKeyBoardInVideoScreen() {
        BottomSheet bottomSheet = this.bottomSheet;
        hideKeyPad(bottomSheet != null ? bottomSheet.getMessageInput() : null);
    }

    public static final void hideLockView$lambda$52(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        BottomSheet bottomSheet = conversationView.bottomSheet;
        if (bottomSheet == null) {
            return;
        }
        bottomSheet.setClipChildren(true);
    }

    public final void hideNotStoredInfo() {
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen != null) {
            conversationScreen.hideNotStoredInfo();
        }
    }

    private final boolean hideOpened(boolean z) {
        BottomSheet bottomSheet = this.bottomSheet;
        if (bottomSheet == null) {
            return true;
        }
        kotlin.jvm.internal.k.c(bottomSheet);
        if (!bottomSheet.getKeyboardIsOpen()) {
            return true;
        }
        BottomSheet bottomSheet2 = this.bottomSheet;
        kotlin.jvm.internal.k.c(bottomSheet2);
        bottomSheet2.setKeyboardIsOpen(false);
        return true;
    }

    private final void hideOrShowJoinView(int i, boolean z) {
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, ExtensionsKt.getDp(3));
        if (i == 8) {
            Conversation conversation = this.conversation;
            if ((conversation == null || conversation.isKicked()) ? false : true) {
                isDisabledMenuCallButton(false, 2131230958);
            }
            JoinView.hideWithAnimation$default(getJoinView(), 0L, null, new ConversationView$hideOrShowJoinView$1(this), 3, null);
            getJoinView().setHasTopLine(false);
        } else {
            isDisabledMenuCallButton(true, 2131230959);
            Conversation conversation2 = this.conversation;
            if (conversation2 != null && conversation2.isGroup()) {
                Conversation conversation3 = this.conversation;
                if (conversation3 != null && conversation3.hasConferenceCall()) {
                    JoinView.showWithAnimation$default(getJoinView(), 0L, new ConversationView$hideOrShowJoinView$2(this), null, 5, null);
                    getJoinView().setHasTopLine(z);
                }
            }
        }
        View view = this.appBarDivider;
        if (view == null) {
            return;
        }
        view.setLayoutParams(layoutParams);
    }

    static void hideOrShowJoinView$default(ConversationView conversationView, int i, boolean z, int i7, Object obj) {
        if ((i7 & 2) != 0) {
            z = false;
        }
        conversationView.hideOrShowJoinView(i, z);
    }

    private final void hideOrShowTopView(int i, boolean z) {
        if (isAdded()) {
            Conversation conversation = this.conversation;
            if (conversation != null && conversation.isPersonal()) {
                return;
            }
            if (appInLandScapeAndShowEditOrReplyViews()) {
                i = 8;
                z = false;
            }
            Conversation conversation2 = this.conversation;
            if ((conversation2 == null || conversation2.isGroup()) ? false : true) {
                hideTvNumberOrEmailTopLine(i, z);
            } else {
                hideTvNumberOrEmailTopLine(8, false);
                Conversation conversation3 = this.conversation;
                if (conversation3 != null && conversation3.hasConferenceCall()) {
                    hideOrShowJoinView(i, z);
                } else {
                    hideOrShowJoinView(8, false);
                }
            }
            setStealthTopViewMargin();
        }
    }

    static void hideOrShowTopView$default(ConversationView conversationView, int i, boolean z, int i7, Object obj) {
        if ((i7 & 2) != 0) {
            z = false;
        }
        conversationView.hideOrShowTopView(i, z);
    }

    private final void hideRecordViews() {
        hideRecorderVisualizerView();
        setRecordState(ChatSensor.RECORD_STATE.NONE);
        BottomSheet bottomSheet = this.bottomSheet;
        if (bottomSheet != null) {
            bottomSheet.showMenuBottomView();
        }
        hideLockView(true);
    }

    private final void hideSearchBottomView() {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.hideSearchBottomView():void");
    }

    public final void hideTvNumberOrEmailTopLine(int r6, boolean r7) {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.hideTvNumberOrEmailTopLine(int, boolean):void");
    }

    static void hideTvNumberOrEmailTopLine$default(ConversationView conversationView, int i, boolean z, int i7, Object obj) {
        if ((i7 & 2) != 0) {
            z = false;
        }
        conversationView.hideTvNumberOrEmailTopLine(i, z);
    }

    public static void hideVoicePanel$default(ConversationView conversationView, ZangiMessage zangiMessage, boolean z, int i, Object obj) {
        if ((i & 2) != 0) {
            z = false;
        }
        conversationView.hideVoicePanel(zangiMessage, z);
    }

    private final void initActionMenuFragment(final java.util.List<java.lang.Integer> r12, final java.lang.Object r13, final com.beint.project.core.model.contact.Contact r14, final com.beint.project.core.model.contact.ContactNumber r15) {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.initActionMenuFragment(java.util.List, java.lang.Object, com.beint.project.core.model.contact.Contact, com.beint.project.core.model.contact.ContactNumber):void");
    }

    public static final void initActionMenuFragment$lambda$73(List list, ConversationView conversationView, Object obj, boolean z, boolean z6, Contact contact, ContactNumber contactNumber, int i) {
        ConversationAdapter conversationAdapter;
        ConversationAdapter conversationAdapter2;
        ConversationAdapter conversationAdapter3;
        FragmentActivity activity;
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        if (i >= list.size()) {
            ConversationAdapter conversationAdapter4 = conversationView.conversationAdapter;
            if (conversationAdapter4 != null) {
                kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.model.sms.ZangiMessage");
                conversationAdapter4.copyToClipboard(((ZangiMessage) obj).getMsgId());
            }
            return;
        }
        switch (((Number) list.get(i)).intValue()) {
            case 2131886130:
                if (z) {
                    kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.model.sms.ZangiMessage");
                    ZangiMessage zangiMessage = (ZangiMessage) obj;
                    String msgInfo = TextUtils.isEmpty(zangiMessage.getMsgInfo()) ? "" : zangiMessage.getMsgInfo();
                    VoiceManager voiceManager = VoiceManager.INSTANCE;
                    if (voiceManager.isRecording()) {
                        voiceManager.stopRecordAndPreparePlayer();
                    }
                    conversationView.addContact(zangiMessage.getMsg(), zangiMessage.getEmail(), msgInfo);
                    break;
                }
                break;
            case 2131886243:
                if (z) {
                    kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.model.sms.ZangiMessage");
                    String msg = ((ZangiMessage) obj).getMsg();
                    kotlin.jvm.internal.k.c(msg);
                    conversationView.callBack(msg);
                    break;
                }
                break;
            case 2131886248:
                if (z) {
                    if (contact == null) {
                        if (contactNumber == null) {
                            FragmentActivity activity2 = conversationView.getActivity();
                            kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.model.sms.ZangiMessage");
                            ZangiMessage zangiMessage2 = (ZangiMessage) obj;
                            CallHelper.call(activity2, zangiMessage2.getMsg(), zangiMessage2.getEmail(), "com.beint.project.MAKE_CALL_RECIVER", "com.beint.project.VIDEO_CALL", false);
                            break;
                        } else {
                            CallHelper.call(conversationView.getActivity(), contactNumber.getFullNumber(), contactNumber.getEmail(), "com.beint.project.MAKE_CALL_RECIVER", "com.beint.project.VIDEO_CALL", false);
                            break;
                        }
                    } else {
                        FragmentActivity activity3 = conversationView.getActivity();
                        String ppUriSuffix = contact.getPpUriSuffix();
                        kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.model.sms.ZangiMessage");
                        CallHelper.call(activity3, ppUriSuffix, ((ZangiMessage) obj).getEmail(), "com.beint.project.MAKE_CALL_RECIVER", "com.beint.project.VIDEO_CALL", false);
                        break;
                    }
                }
                break;
            case 2131886253:
                if (z) {
                    FragmentActivity activity4 = conversationView.getActivity();
                    kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.model.sms.ZangiMessage");
                    ZangiMessage zangiMessage3 = (ZangiMessage) obj;
                    CallHelper.CallOut(activity4, zangiMessage3.getMsg(), zangiMessage3.getEmail());
                    break;
                }
                break;
            case 2131886377:
                if (z && (conversationAdapter = conversationView.conversationAdapter) != null) {
                    kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.model.sms.ZangiMessage");
                    conversationAdapter.copyToClipboard(((ZangiMessage) obj).getMsg());
                    break;
                }
                break;
            case 2131886444:
                if (z) {
                    conversationView.closeSerchViewAndBottomSheetBackToFirstState();
                    ConversationAdapter conversationAdapter5 = conversationView.conversationAdapter;
                    if (conversationAdapter5 != null) {
                        conversationAdapter5.deleteSelectedMessage((ZangiMessage) obj, false);
                        break;
                    }
                }
                break;
            case 2131886457:
                if (z6) {
                    Log.i("====p", "delete_gif");
                    break;
                }
                break;
            case 2131886506:
                if (z) {
                    conversationView.closeSerchViewAndBottomSheetBackToFirstState();
                    BottomSheet bottomSheet = conversationView.bottomSheet;
                    conversationView.showKeyPad(bottomSheet != null ? bottomSheet.getMessageInput() : null);
                    ConversationAdapter conversationAdapter6 = conversationView.conversationAdapter;
                    if (conversationAdapter6 != null) {
                        conversationAdapter6.editSelectedMessage((ZangiMessage) obj);
                        break;
                    }
                }
                break;
            case 2131886587:
                if (z && !ConversationManager.INSTANCE.stealthModeExpiredGoToPremiumScreen()) {
                    BottomSheet bottomSheet2 = conversationView.bottomSheet;
                    if (bottomSheet2 != null) {
                        bottomSheet2.setEditedMessage((ZangiMessage) null);
                    }
                    ConversationAdapter conversationAdapter7 = conversationView.conversationAdapter;
                    if (conversationAdapter7 != null) {
                        conversationAdapter7.finishEdit();
                    }
                    ConversationAdapter conversationAdapter8 = conversationView.conversationAdapter;
                    if (conversationAdapter8 != null) {
                        conversationAdapter8.forwardSelectedMessage((ZangiMessage) obj);
                        break;
                    }
                }
                break;
            case 2131886739:
                if (z) {
                    kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.model.sms.ZangiMessage");
                    String msg2 = ((ZangiMessage) obj).getMsg();
                    kotlin.jvm.internal.k.c(msg2);
                    conversationView.sendInviteBySMS(msg2);
                    break;
                }
                break;
            case 2131886884:
                if (z) {
                    if (contact == null) {
                        if (contactNumber == null) {
                            FragmentActivity activity5 = conversationView.getActivity();
                            kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.model.sms.ZangiMessage");
                            CallHelper.StartChat(activity5, ((ZangiMessage) obj).getMsg(), (String) null);
                            break;
                        } else {
                            CallHelper.StartChat(conversationView.getActivity(), contactNumber.getFullNumber(), contactNumber.getEmail());
                            break;
                        }
                    } else {
                        CallHelper.StartChat(conversationView.getActivity(), contact.getPpUriSuffix(), (String) null);
                        break;
                    }
                }
                break;
            case 2131886908:
                if (z && (conversationAdapter2 = conversationView.conversationAdapter) != null) {
                    conversationAdapter2.showGroupMessageInfo((ZangiMessage) obj);
                    break;
                }
                break;
            case 2131887254:
                if (z && (conversationAdapter3 = conversationView.conversationAdapter) != null) {
                    conversationAdapter3.showReactionsMessageInfo((ZangiMessage) obj);
                    break;
                }
                break;
            case 2131887279:
                ZangiMessage zangiMessage4 = (ZangiMessage) obj;
                if (zangiMessage4 != null) {
                    conversationView.closeSerchViewAndBottomSheetBackToFirstState();
                    conversationView.onManuReplyButtonClick(z, zangiMessage4);
                    break;
                }
                break;
            case 2131887309:
                if (z6) {
                    ZangiMessagingService zangiMessagingService = ZangiMessagingService.getInstance();
                    kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.gifs.GiphyResult");
                    zangiMessagingService.saveGif((GiphyResult) obj);
                    break;
                }
                break;
            case 2131887310:
                if (z) {
                    kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.model.sms.ZangiMessage");
                    conversationView.saveFileToGallery((ZangiMessage) obj);
                    break;
                }
                break;
            case 2131887347:
                if (z6) {
                    Log.i("====p", "send_gif");
                    break;
                }
                break;
            case 2131887416:
                if (z && (activity = conversationView.getActivity()) != null && !activity.isFinishing() && !activity.isDestroyed()) {
                    ShareManger shareManger = ShareManger.INSTANCE;
                    kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.model.sms.ZangiMessage");
                    shareManger.share((ZangiMessage) obj, activity);
                    break;
                }
                break;
            case 2131887644:
                if (z) {
                    if (contact == null) {
                        if (contactNumber == null) {
                            FragmentActivity activity6 = conversationView.getActivity();
                            kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.model.sms.ZangiMessage");
                            ZangiMessage zangiMessage5 = (ZangiMessage) obj;
                            CallHelper.call(activity6, zangiMessage5.getMsg(), zangiMessage5.getEmail(), "com.beint.project.MAKE_CALL_RECIVER", "com.beint.project.VIDEO_CALL", true);
                            break;
                        } else {
                            CallHelper.call(conversationView.getActivity(), contactNumber.getFullNumber(), contactNumber.getEmail(), "com.beint.project.MAKE_CALL_RECIVER", "com.beint.project.VIDEO_CALL", true);
                            break;
                        }
                    } else {
                        FragmentActivity activity7 = conversationView.getActivity();
                        String ppUriSuffix2 = contact.getPpUriSuffix();
                        kotlin.jvm.internal.k.d(obj, "null cannot be cast to non-null type com.beint.project.core.model.sms.ZangiMessage");
                        CallHelper.call(activity7, ppUriSuffix2, ((ZangiMessage) obj).getEmail(), "com.beint.project.MAKE_CALL_RECIVER", "com.beint.project.VIDEO_CALL", true);
                        break;
                    }
                }
                break;
        }
    }

    public static final void initActionMenuFragment$lambda$74(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        conversationView.isActionsBottomSheetOpened = false;
    }

    private final void initAdapterScrollListener() {
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen != null) {
            conversationScreen.getRecyclerView().addOnScrollListener(new RecyclerView.u() {
                public void onScrolled(androidx.recyclerview.widget.RecyclerView r5, int r6, int r7) {
                    throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView$initAdapterScrollListener$1$1.onScrolled(androidx.recyclerview.widget.RecyclerView, int, int):void");
                }
            });
        }
    }

    private final void initBroadcastReceiveres() {
        NotificationCenter notificationCenter = NotificationCenter.INSTANCE;
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.CHANGE_TABS_WHEN_STARTED_GROUP_CALL, new ConversationView$initBroadcastReceiveres$1(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.CALL_CLOSED, new ConversationView$initBroadcastReceiveres$2(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.CONTACT_LIST_CHANGED, new ConversationView$initBroadcastReceiveres$3(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.REACTION_CHANGED, new ConversationView$initBroadcastReceiveres$4(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.STEALTH_MODE_CHANGED, new ConversationView$initBroadcastReceiveres$5(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.CONVERSATION_VISIBILITY_CHANGE, new ConversationView$initBroadcastReceiveres$6(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.UPDATE_GALLERY, new ConversationView$initBroadcastReceiveres$7(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.ON_WAKE_LOCK, new ConversationView$initBroadcastReceiveres$8(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.CLEAR_SELECTED_ITEMS, new ConversationView$initBroadcastReceiveres$9(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.GROUP_CHANGED, new ConversationView$initBroadcastReceiveres$10(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.SHOW_TYPING, new ConversationView$initBroadcastReceiveres$11(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.SHOW_RECORDING, new ConversationView$initBroadcastReceiveres$12(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.SHOW_SENDING, new ConversationView$initBroadcastReceiveres$13(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.REMOVE_UNREAD_MESSAGE_FROM_FORWARD_MESSAGE, new ConversationView$initBroadcastReceiveres$14(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.IMAGE_BROWSER_CLOSE_ANIMATION_END, new ConversationView$initBroadcastReceiveres$15(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.HIDE_OR_SHOW_TOP_VIEW_CONVERSATION, new ConversationView$initBroadcastReceiveres$16(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.DELETE_STEALTH_MESSAGE, new ConversationView$initBroadcastReceiveres$17(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.VOICE_TIME_CHANGE, new ConversationView$initBroadcastReceiveres$18(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.VOICE_PLAY, new ConversationView$initBroadcastReceiveres$19(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.VOICE_PLAY_FINISH, new ConversationView$initBroadcastReceiveres$20(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.VOICE_PAUSE, new ConversationView$initBroadcastReceiveres$21(this));
        notificationCenter.addObserver(this, NotificationCenter.NotificationType.UPLOAD_GALLERY_IF_NEEDED, new ConversationView$initBroadcastReceiveres$22(this));
    }

    private final void initFilterableListView() {
        Group group;
        final ArrayList arrayList = new ArrayList();
        Conversation conversation = this.conversation;
        final ArrayList actualMembers = (conversation == null || (group = conversation.getGroup()) == null) ? null : group.getActualMembers();
        MainApplication.Companion.getMainExecutor2().execute(new Runnable() {
            @Override
            public final void run() {
                ConversationView.initFilterableListView$lambda$50(actualMembers, this, arrayList);
            }
        });
    }

    public static final void initFilterableListView$lambda$50(ArrayList arrayList, final ConversationView conversationView, final ArrayList arrayList2) {
        String str;
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(arrayList2, "$contactsPairList");
        kotlin.jvm.internal.k.c(arrayList);
        int size = arrayList.size();
        for (int i = 0; i < size; i++) {
            Object obj = arrayList.get(i);
            kotlin.jvm.internal.k.e(obj, "groupChatMemberList[i]");
            GroupMember groupMember = (GroupMember) obj;
            String memberJid = groupMember.getMemberJid();
            String username = conversationView.getUsername();
            kotlin.jvm.internal.k.e(username, "username");
            boolean y = zb.f.y(memberJid, username, false, 2, (Object) null);
            String memberJid2 = groupMember.getMemberJid();
            str = "";
            if (y) {
                str = conversationView.isAdded() ? conversationView.getResources().getString(2131886861) : "";
                kotlin.jvm.internal.k.e(str, "{\n                    if…      }\n                }");
            } else {
                Contact contactByFullNumberOrEmail = ContactList.INSTANCE.getContactByFullNumberOrEmail(groupMember.getMemberJid(), groupMember.getMemberEmail());
                if ((contactByFullNumberOrEmail != null ? contactByFullNumberOrEmail.getName() : null) == null) {
                    Profile userProfile = ZangiProfileServiceImpl.getInstance().getUserProfile(ProjectUtils.getPlusNumberFromJid(memberJid2));
                    if (userProfile == null || TextUtils.isEmpty(userProfile.getFirstName())) {
                        String memberEmail = groupMember.getMemberEmail();
                        if (!(memberEmail == null || memberEmail.length() == 0)) {
                            str = String.valueOf(groupMember.getMemberEmail());
                        }
                    } else {
                        str = userProfile.getFirstName() + ' ' + userProfile.getLastName();
                    }
                } else {
                    str = contactByFullNumberOrEmail.getName();
                    kotlin.jvm.internal.k.c(str);
                }
            }
            arrayList2.add(new Pair(str, ProjectUtils.getPlusNumberFromJid(groupMember.getMemberJid())));
        }
        MainApplication.Companion.getMainHandler().post(new Runnable() {
            @Override
            public final void run() {
                ConversationView.initFilterableListView$lambda$50$lambda$49(ConversationView.this, arrayList2);
            }
        });
    }

    public static final void initFilterableListView$lambda$50$lambda$49(ConversationView conversationView, ArrayList arrayList) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(arrayList, "$contactsPairList");
        if (conversationView.getContext() != null) {
            Context context = conversationView.getContext();
            ConversationScreen conversationScreen = conversationView.conversationScreen;
            FilterableContactsAdapter filterableContactsAdapter = new FilterableContactsAdapter(context, arrayList, conversationScreen != null ? conversationScreen.getContactFilterListView() : null);
            conversationView.filterableContactsAdapter = filterableContactsAdapter;
            kotlin.jvm.internal.k.c(filterableContactsAdapter);
            filterableContactsAdapter.setDelegate(new WeakReference(conversationView));
            ConversationScreen conversationScreen2 = conversationView.conversationScreen;
            ListView contactFilterListView = conversationScreen2 != null ? conversationScreen2.getContactFilterListView() : null;
            if (contactFilterListView == null) {
                return;
            }
            contactFilterListView.setAdapter((ListAdapter) conversationView.filterableContactsAdapter);
        }
    }

    @SuppressLint({"ClickableViewAccessibility"})
    private final void initListeners() {
        AppCompatEditText messageInput;
        BottomSheet bottomSheet = this.bottomSheet;
        if (bottomSheet == null || (messageInput = bottomSheet.getMessageInput()) == null) {
            return;
        }
        messageInput.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public final boolean onTouch(View view, MotionEvent motionEvent) {
                boolean initListeners$lambda$79;
                initListeners$lambda$79 = ConversationView.initListeners$lambda$79(ConversationView.this, view, motionEvent);
                return initListeners$lambda$79;
            }
        });
    }

    public static final boolean initListeners$lambda$79(ConversationView conversationView, View view, MotionEvent motionEvent) {
        ChatSmilesView chatSmilesView;
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        BottomSheet bottomSheet = conversationView.bottomSheet;
        if (bottomSheet != null && (chatSmilesView = bottomSheet.getChatSmilesView()) != null) {
            chatSmilesView.getVisibility();
        }
        if (view != null) {
            return view.onTouchEvent(motionEvent);
        }
        return true;
    }

    private final void initZSimpleCallBack() {
        FragmentActivity activity = getActivity();
        ZSimpleCallBack zSimpleCallBack = (activity == null || activity.isFinishing() || !isAdded()) ? null : new ZSimpleCallBack(activity, this.conversationAdapter, this, 0, 4);
        androidx.recyclerview.widget.f fVar = zSimpleCallBack != null ? new androidx.recyclerview.widget.f(zSimpleCallBack) : null;
        if (fVar != null) {
            ConversationScreen conversationScreen = this.conversationScreen;
            fVar.g(conversationScreen != null ? conversationScreen.getRecyclerView() : null);
        }
    }

    private final void initializeAnimSounds() {
        if (getIsTurnChatSounds()) {
            SoundService soundService = SoundService.INSTANCE;
            soundService.initCancelVoiceMessageSound(2131820545);
            soundService.startCancelVoiceMessageSound();
        }
    }

    private final void inputFocusLost(String str, String str2) {
        if (str == null || str.length() <= 0) {
            return;
        }
        Log.i(this.TAG, "!!!!!Input focus lost" + str);
        if (str.length() == 0) {
            return;
        }
        MainApplication.Companion.getMainHandler().post(new Runnable() {
            @Override
            public final void run() {
                ConversationView.inputFocusLost$lambda$66(ConversationView.this);
            }
        });
        updateConversationWithNumber(str, str2, null);
        requestOnlineStatus();
    }

    public static final void inputFocusLost$lambda$66(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        conversationView.hideContactList();
    }

    private final void invalidateDidApearTimer() {
        Timer timer = this.didAppearTimer;
        if (timer != null) {
            kotlin.jvm.internal.k.c(timer);
            timer.cancel();
            Timer timer2 = this.didAppearTimer;
            kotlin.jvm.internal.k.c(timer2);
            timer2.purge();
            this.didAppearTimer = null;
        }
    }

    public final boolean isDataFooterOnDateBubble() {
        int findFirstVisibleItemPosition;
        List items;
        RecyclerView recyclerView;
        ConversationScreen conversationScreen = this.conversationScreen;
        LinearLayoutManager linearLayoutManager = (LinearLayoutManager) ((conversationScreen == null || (recyclerView = conversationScreen.getRecyclerView()) == null) ? null : recyclerView.getLayoutManager());
        if (linearLayoutManager == null || (findFirstVisibleItemPosition = linearLayoutManager.findFirstVisibleItemPosition()) == -1) {
            return false;
        }
        Boolean bool = Boolean.FALSE;
        Boolean[] boolArr = {bool, bool, bool};
        boolArr[0] = Boolean.valueOf(findFirstVisibleItemPosition == 0);
        int i = findFirstVisibleItemPosition + 1;
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        List items2 = conversationAdapter != null ? conversationAdapter.getItems() : null;
        kotlin.jvm.internal.k.c(items2);
        if (i < items2.size()) {
            ConversationAdapter conversationAdapter2 = this.conversationAdapter;
            List items3 = conversationAdapter2 != null ? conversationAdapter2.getItems() : null;
            kotlin.jvm.internal.k.c(items3);
            ZangiMessage zangiMessage = (ZangiMessage) items3.get(i);
            boolArr[1] = Boolean.valueOf(zangiMessage != null && zangiMessage.isShowDate());
        }
        ConversationAdapter conversationAdapter3 = this.conversationAdapter;
        if (findFirstVisibleItemPosition < ((conversationAdapter3 == null || (items = conversationAdapter3.getItems()) == null) ? 0 : items.size())) {
            ConversationAdapter conversationAdapter4 = this.conversationAdapter;
            List items4 = conversationAdapter4 != null ? conversationAdapter4.getItems() : null;
            kotlin.jvm.internal.k.c(items4);
            ZangiMessage zangiMessage2 = (ZangiMessage) items4.get(findFirstVisibleItemPosition);
            boolArr[2] = Boolean.valueOf(zangiMessage2 != null && zangiMessage2.isShowDate());
        }
        for (int i7 = 0; i7 < 3; i7++) {
            if (boolArr[i7].booleanValue()) {
                return true;
            }
        }
        return false;
    }

    private final boolean isScreenAwake() {
        return SystemServiceManager.INSTANCE.isDeviceScreenOn();
    }

    private final boolean isSearchViewExpanded() {
        MenuItem menuItem = this.searchItem;
        if (menuItem != null) {
            return menuItem != null && menuItem.isActionViewExpanded();
        }
        return false;
    }

    public final void keepAudioMessageDraftOrBackToFirstState() {
        ConversationManager conversationManager = ConversationManager.INSTANCE;
        if (conversationManager.getKeepVoiceDraft()) {
            BottomSheet bottomSheet = this.bottomSheet;
            if (bottomSheet != null) {
                bottomSheet.changeSendButtonVisability(true);
            }
            changesendImageVoiceItemBAckgroundAndImage(true, false);
            conversationManager.setKeepVoiceDraft(false);
            return;
        }
        BottomSheet bottomSheet2 = this.bottomSheet;
        if (bottomSheet2 != null) {
            bottomSheet2.hideVoicePlayView();
        }
        BottomSheet bottomSheet3 = this.bottomSheet;
        if (bottomSheet3 != null) {
            bottomSheet3.changeSendButtonVisability(false);
        }
        changesendImageVoiceItemBAckgroundAndImage(true, false);
        BottomSheet bottomSheet4 = this.bottomSheet;
        if (bottomSheet4 != null) {
            bottomSheet4.backToFirstState();
        }
    }

    public static final void kickBottomonClick$lambda$46(DialogInterface dialogInterface, int i) {
    }

    public static final void kickBottomonClick$lambda$47(ConversationView conversationView, DialogInterface dialogInterface, int i) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        NotificationCenter notificationCenter = NotificationCenter.INSTANCE;
        NotificationCenter.NotificationType notificationType = NotificationCenter.NotificationType.CONVERSATION_DELETED;
        Conversation conversation = conversationView.conversation;
        notificationCenter.postNotificationName(notificationType, conversation != null ? conversation.getConversationJid() : null);
        conversationView.isDeleteContact("Converstionview");
        IConversationPresenter iConversationPresenter = conversationView.presenter;
        if (iConversationPresenter != null) {
            iConversationPresenter.deleteConversation(conversationView.conversation);
        }
        conversationView.onBack();
    }

    public final void loadMessages() {
        if (this.mIsLoading) {
            return;
        }
        Log.i(this.TAG, "loadMessages");
        this.mIsLoading = true;
        Thread thread = new Thread(new Runnable() {
            @Override
            public final void run() {
                ConversationView.loadMessages$lambda$88(ConversationView.this);
            }
        });
        thread.setPriority(10);
        thread.start();
    }

    public static final void loadMessages$lambda$88(final ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        ConversationAdapter conversationAdapter = conversationView.conversationAdapter;
        Integer valueOf = conversationAdapter != null ? Integer.valueOf(conversationAdapter.getItemCount()) : null;
        final kotlin.jvm.internal.u uVar = new kotlin.jvm.internal.u();
        Conversation conversation = conversationView.conversation;
        if (conversation != null) {
            StorageService storageService = StorageService.INSTANCE;
            String conversationJid = conversation != null ? conversation.getConversationJid() : null;
            int i = conversationView.loadMessagesCount;
            kotlin.jvm.internal.k.c(valueOf);
            uVar.a = storageService.getMessages(conversationJid, i, valueOf.intValue());
        }
        Object obj = uVar.a;
        if (obj == null || ((List) obj).isEmpty()) {
            return;
        }
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public final void run() {
                ConversationView.loadMessages$lambda$88$lambda$87(ConversationView.this, uVar);
            }
        });
    }

    public static final void loadMessages$lambda$88$lambda$87(ConversationView conversationView, kotlin.jvm.internal.u uVar) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(uVar, "$resultList");
        conversationView.onRefreshComplete((List) uVar.a);
        conversationView.mIsLoading = false;
    }

    private final void makeCall(boolean z) {
        String str;
        MediaAutoPlayNextManager.INSTANCE.cancelVoice();
        if (AVSession.Companion.getSize() > 0) {
            showInfoMessage(2131886748);
            return;
        }
        if (!SignalingService.INSTANCE.isOnline()) {
            showInfoMessage(2131887053);
            return;
        }
        if (CallingFragmentActivity.getInstance() != null) {
            CallingFragmentActivity.getInstance().finish();
        }
        CallHelper.callVideo(z);
        Conversation conversation = this.conversation;
        if (TextUtils.isEmpty(conversation != null ? conversation.getE164number() : null)) {
            str = "";
        } else {
            StringBuilder sb = new StringBuilder();
            sb.append('+');
            Conversation conversation2 = this.conversation;
            String e164number = conversation2 != null ? conversation2.getE164number() : null;
            kotlin.jvm.internal.k.c(e164number);
            sb.append(zb.f.p(e164number, "+", "", false, 4, (Object) null));
            str = sb.toString();
        }
        CallHelper._makeCall(getActivity(), str, this.conversation != null ? "oihyouka" : null);
        Conversation conversation3 = this.conversation;
        if (TextUtils.isEmpty(conversation3 != null ? conversation3.getDisplayEmail() : null)) {
            ZangiConfigurationService.INSTANCE.putString("IDENTITI_CALL_NUMBER.com.beint.zangi.core.c.b", str);
        } else {
            ZangiConfigurationService.INSTANCE.putString("IDENTITI_CALL_NUMBER.com.beint.zangi.core.c.b", "");
        }
    }

    public static final void mediaFileConverte$lambda$37(ConversationView conversationView, String str, ZangiMessagingService.MediaFileState mediaFileState, int i, long j) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(str, "$msgId");
        kotlin.jvm.internal.k.f(mediaFileState, "$state");
        ConversationAdapter conversationAdapter = conversationView.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.updateVideoCompressionItem(str, mediaFileState, i, j);
        }
    }

    public static final void memoryIsFull$lambda$36(final ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        AlertDialogUtils.showAlertWithMessage(conversationView.getContext(), 2131887550, 2131886599, 2131886318, 2131887502, (DialogInterface.OnClickListener) null, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                ConversationView.memoryIsFull$lambda$36$lambda$35(ConversationView.this, dialogInterface, i);
            }
        }, true);
    }

    public static final void memoryIsFull$lambda$36$lambda$35(ConversationView conversationView, DialogInterface dialogInterface, int i) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        conversationView.startActivityForResult(new Intent("android.settings.INTERNAL_STORAGE_SETTINGS"), 0);
    }

    public static final void messageEdited$lambda$41(ConversationView conversationView, ZangiMessage zangiMessage) {
        Map smiliesMap;
        Map dynamicWidthMap;
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(zangiMessage, "$message");
        ConversationAdapter conversationAdapter = conversationView.conversationAdapter;
        if (conversationAdapter != null && (dynamicWidthMap = conversationAdapter.getDynamicWidthMap()) != null) {
        }
        ConversationAdapter conversationAdapter2 = conversationView.conversationAdapter;
        if (conversationAdapter2 != null && (smiliesMap = conversationAdapter2.getSmiliesMap()) != null) {
        }
        ConversationAdapter conversationAdapter3 = conversationView.conversationAdapter;
        if (conversationAdapter3 != null) {
            conversationAdapter3.updateItem(zangiMessage);
        }
    }

    public static final void messageRecived$lambda$31(ConversationView conversationView, ZangiMessage zangiMessage) {
        String str;
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(zangiMessage, "$message");
        if (conversationView.isAdded()) {
            int i = WhenMappings.$EnumSwitchMapping$0[zangiMessage.getMessageType().ordinal()];
            if (i == 1) {
                String from = zangiMessage.getFrom();
                if (from == null) {
                    from = "";
                }
                String from2 = zangiMessage.getFrom();
                str = from2 != null ? from2 : "";
                Conversation conversation = conversationView.conversation;
                String conversationJid = conversation != null ? conversation.getConversationJid() : null;
                Conversation conversation2 = conversationView.conversation;
                conversationView.setRecordingState(-1, new RecordingObject(from, str, conversationJid, conversation2 != null && conversation2.isGroup()));
            } else if (i == 2 || i == 3 || i == 4) {
                String from3 = zangiMessage.getFrom();
                if (from3 == null) {
                    from3 = "";
                }
                String from4 = zangiMessage.getFrom();
                str = from4 != null ? from4 : "";
                Conversation conversation3 = conversationView.conversation;
                String conversationJid2 = conversation3 != null ? conversation3.getConversationJid() : null;
                Conversation conversation4 = conversationView.conversation;
                conversationView.setSendingState(-1, new SendingObject(from3, str, conversationJid2, conversation4 != null && conversation4.isGroup()));
            } else {
                String from5 = zangiMessage.getFrom();
                if (from5 == null) {
                    from5 = "";
                }
                String from6 = zangiMessage.getFrom();
                str = from6 != null ? from6 : "";
                Conversation conversation5 = conversationView.conversation;
                String conversationJid3 = conversation5 != null ? conversation5.getConversationJid() : null;
                Conversation conversation6 = conversationView.conversation;
                conversationView.setTypingState(-1, new TypingObject(from5, str, conversationJid3, conversation6 != null && conversation6.isGroup()));
            }
            String chat = zangiMessage.getChat();
            Conversation conversation7 = conversationView.conversation;
            if (kotlin.jvm.internal.k.b(chat, conversation7 != null ? conversation7.getConversationJid() : null) && conversationView.conversation != null) {
                ConversationAdapter conversationAdapter = conversationView.conversationAdapter;
                if (conversationAdapter != null) {
                    conversationAdapter.addItem(zangiMessage);
                    return;
                }
                return;
            }
            if (!CallingFragmentActivity.chatScreenButtonsState || conversationView.getActivity() == null) {
                return;
            }
            FragmentActivity activity = conversationView.getActivity();
            if (activity != null) {
                activity.sendBroadcast(new Intent(Constants.SHOW_CHAT_IN_VIDEO_CALL).putExtra("com.beint.project.c_jid", zangiMessage.getChat()).putExtra("show", false));
            }
            Log.i("SHOW_CHAT_IN_VIDEO_CALL  ", "CHATfalse");
        }
    }

    public static final void messageSent$lambda$77(ConversationView conversationView, ZangiMessage zangiMessage) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(zangiMessage, "$message");
        if (conversationView.getActivity() != null) {
            BottomSheet bottomSheet = conversationView.bottomSheet;
            if ((bottomSheet != null ? bottomSheet.getMReplyView() : null) != null) {
                BottomSheet bottomSheet2 = conversationView.bottomSheet;
                if (bottomSheet2 != null) {
                    bottomSheet2.deleteReplyView();
                }
                BottomSheet bottomSheet3 = conversationView.bottomSheet;
                if (bottomSheet3 != null) {
                    bottomSheet3.setMReplyMessage((ZangiMessage) null);
                }
                ConversationManager.INSTANCE.setMReplyMessage(null);
            }
            conversationView.hideNotStoredInfo();
            ConversationAdapter conversationAdapter = conversationView.conversationAdapter;
            if (conversationAdapter != null) {
                conversationAdapter.addItem(zangiMessage);
            }
        }
    }

    public static final void onCreateAnimator$lambda$71$lambda$70(ConversationView conversationView, int i, ValueAnimator valueAnimator) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(valueAnimator, "it");
        Object animatedValue = valueAnimator.getAnimatedValue();
        kotlin.jvm.internal.k.d(animatedValue, "null cannot be cast to non-null type kotlin.Float");
        float floatValue = ((Float) animatedValue).floatValue();
        ConversationScreen conversationScreen = conversationView.conversationScreen;
        if (conversationScreen != null) {
            conversationScreen.setTranslationX((i / 2) * floatValue);
            conversationScreen.setAlpha(1.0f - (floatValue * 2));
        }
    }

    public static final boolean onCreateView$lambda$7(ConversationView conversationView, View view, MotionEvent motionEvent) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        return conversationView.onTouchSwipeRefreshConversationListFragment(view, motionEvent);
    }

    public static final void onCreateView$lambda$9(ConversationView conversationView) {
        ZKeyboardHeightProvider zKeyboardHeightProvider;
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        FragmentActivity activity = conversationView.getActivity();
        if (activity == null || activity.isFinishing() || !conversationView.isAdded() || (zKeyboardHeightProvider = conversationView.keyboardHeightProvider) == null) {
            return;
        }
        zKeyboardHeightProvider.start();
    }

    public static final void onDateSetListener$lambda$3(ConversationView conversationView, DatePicker datePicker, int i, int i7, int i8) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        Calendar calendar = Calendar.getInstance();
        calendar.set(1, datePicker.getYear());
        calendar.set(2, datePicker.getMonth());
        calendar.set(5, datePicker.getDayOfMonth());
        conversationView.selectedDateInMillis = Long.valueOf(calendar.getTimeInMillis());
        if (conversationView.chatSearchHolder != null) {
            BottomSheet bottomSheet = conversationView.bottomSheet;
            if (bottomSheet != null) {
                bottomSheet.showBottomSearchView();
            }
            IChatSearchHolder iChatSearchHolder = conversationView.chatSearchHolder;
            if (iChatSearchHolder != null) {
                iChatSearchHolder.setCurrentSearchKey(String.valueOf(conversationView.selectedDateInMillis), true, conversationView.searchBy);
            }
        }
    }

    public static final void onJoinViewClick$lambda$27(ConversationView conversationView, ArrayList arrayList, boolean z) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        if (z) {
            ConferenceManager conferenceManager = ConferenceManager.INSTANCE;
            Conversation conversation = conversationView.conversation;
            kotlin.jvm.internal.k.c(conversation);
            String conversationId = conversation.getConversationId();
            Conversation conversation2 = conversationView.conversation;
            conferenceManager.joinCall(conversationId, conversation2 != null ? conversation2.getCallId() : null);
        }
    }

    public static final void onOptionsItemSelected$lambda$21(ConversationView conversationView, String str, ArrayList arrayList, boolean z) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(str, "$jid");
        if (z) {
            conversationView.chatBackground(str);
        }
    }

    public static final void onReciveStatus$lambda$29(ConversationView conversationView, LastActivity lastActivity) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(lastActivity, "$activity");
        if (conversationView.isInFront) {
            if (conversationView.isOutgoinSMS && lastActivity.getStatus() != LastActivityState.unavalabile) {
                Conversation conversation = conversationView.conversation;
                if (conversation != null) {
                    conversation.setOutgoingSMS(false);
                }
                conversationView.isOutgoinSMS = false;
            }
            conversationView.setOnlineState(lastActivity);
            Log.i(conversationView.TAG, "!!!!!isOnline=" + lastActivity.getId());
        }
    }

    private final void onRefreshComplete(List<ZangiMessage> list) {
        RecyclerView recyclerView;
        RecyclerView recyclerView2;
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.addItems(list);
        }
        if (CallingFragmentActivity.chatScreenButtonsState) {
            return;
        }
        this.mIsLoading = false;
        if (list.size() > 0) {
            ConversationScreen conversationScreen = this.conversationScreen;
            View childAt = (conversationScreen == null || (recyclerView2 = conversationScreen.getRecyclerView()) == null) ? null : recyclerView2.getChildAt(list.size() - 3);
            if (childAt != null) {
                childAt.setSelected(true);
            }
        } else {
            ConversationScreen conversationScreen2 = this.conversationScreen;
            View childAt2 = (conversationScreen2 == null || (recyclerView = conversationScreen2.getRecyclerView()) == null) ? null : recyclerView.getChildAt(0);
            if (childAt2 != null) {
                childAt2.setSelected(true);
            }
        }
        ConversationScreen conversationScreen3 = this.conversationScreen;
        RecyclerView recyclerView3 = conversationScreen3 != null ? conversationScreen3.getRecyclerView() : null;
        if (recyclerView3 == null) {
            return;
        }
        recyclerView3.setFocusableInTouchMode(false);
    }

    public static final void onResume$lambda$11(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        ConversationAdapter conversationAdapter = conversationView.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.updatePlayItems();
        }
    }

    public static final void onResume$lambda$12(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        conversationView.onResumeAsync();
    }

    private final void onResumeAsync() {
        FragmentActivity activity;
        clearBadges();
        requestOnlineStatus();
        FileTransferManager.INSTANCE.openAllTransfers();
        sendMessageSeen();
        if (ScreenVideoCall.Companion.getChatFragmentIsVisible()) {
            FragmentActivity activity2 = getActivity();
            if (activity2 == null) {
                return;
            }
            activity2.setRequestedOrientation(1);
            return;
        }
        FragmentActivity activity3 = getActivity();
        if (!(activity3 != null && activity3.getRequestedOrientation() == 1) || (activity = getActivity()) == null) {
            return;
        }
        activity.setRequestedOrientation(-1);
    }

    public final void onStealthModeNegativeCallback() {
        Conversation conversation = this.conversation;
        if ((conversation != null ? conversation.getStealth() : null) != null) {
            StealthModeTopView.hideWithAnimation$default(getStealthModeTopView(), 0L, null, new ConversationView$onStealthModeNegativeCallback$1(this), 3, null);
            return;
        }
        StealthModeTopView stealthModeTopView = this._stealthModeTopView;
        boolean z = false;
        if (stealthModeTopView != null && !ExtensionsKt.isHide(stealthModeTopView)) {
            z = true;
        }
        if (z) {
            ExtensionsKt.hidden(getStealthModeTopView(), true);
        }
    }

    public final void onStealthModePositiveCallback() {
        Stealth stealth;
        StealthTimeEnum stealthDuration;
        Conversation conversation = this.conversation;
        if ((conversation == null || conversation.isStealthModeOn()) ? false : true) {
            return;
        }
        Conversation conversation2 = this.conversation;
        if (conversation2 != null && conversation2.hasConferenceCall()) {
            return;
        }
        StealthModeTopView stealthModeTopView = getStealthModeTopView();
        Conversation conversation3 = this.conversation;
        stealthModeTopView.setDescriptionByDuration((conversation3 == null || (stealth = conversation3.getStealth()) == null || (stealthDuration = stealth.getStealthDuration()) == null) ? 0 : stealthDuration.ordinal());
        StealthModeTopView.showWithAnimation$default(getStealthModeTopView(), 0L, null, null, 7, null);
        hideTvNumberOrEmailTopLine(8, false);
    }

    private final void openContactInfo() {
        ContactNumber contactNumber;
        Intent intent = new Intent(MainApplication.Companion.getMainContext(), (Class<?>) BaseFragmentActivitySingle.class);
        Conversation conversation = this.conversation;
        kotlin.jvm.internal.k.c(conversation);
        intent.putExtra("com.beint.project.CURRENT_CONVERSATION", conversation.getConversationJid());
        if (getKeypadIsOpen()) {
            hideKeyPad(getView());
        }
        ContactsManagerHelper contactsManagerHelper = ContactsManagerHelper.INSTANCE;
        contactsManagerHelper.setCurrentConversation(this.conversation);
        Conversation conversation2 = this.conversation;
        contactsManagerHelper.setZangiCurrentContact((conversation2 == null || (contactNumber = conversation2.getContactNumber()) == null) ? null : contactNumber.getFirstContact());
        AbstractZangiActivity.startContactInfoACtivity(getActivity(), false);
        Conversation conversation3 = this.conversation;
        BottomSheet bottomSheet = this.bottomSheet;
        saveIncompleteAndDraftText(conversation3, String.valueOf(bottomSheet != null ? bottomSheet.getUnsendedText() : null), false);
    }

    public final void openForwardMessage(List<String> list) {
        hideKeyPad();
        ConversationManager.INSTANCE.navigate(getContext(), new ConversationView$openForwardMessage$1(this, list));
    }

    private final void openGifPreview(GiphyResult giphyResult) {
        FragmentManager supportFragmentManager;
        androidx.fragment.app.r n;
        androidx.fragment.app.r b;
        androidx.fragment.app.r g;
        GifPreviewFragment gifPreviewFragment = new GifPreviewFragment();
        gifPreviewFragment.setDelegate(this);
        AppBarLayout appBarLayout = this.appBar;
        if (appBarLayout != null) {
            ExtensionsKt.hide(appBarLayout);
        }
        ConversationManager conversationManager = ConversationManager.INSTANCE;
        BottomSheet bottomSheet = this.bottomSheet;
        conversationManager.setMReplyMessage(bottomSheet != null ? bottomSheet.getMReplyMessage() : null);
        Bundle bundle = new Bundle();
        bundle.putSerializable("giphyResult", giphyResult);
        gifPreviewFragment.setArguments(bundle);
        gifPreviewFragment.setGiphyResult(giphyResult);
        FragmentActivity activity = getActivity();
        if (activity == null || (supportFragmentManager = activity.getSupportFragmentManager()) == null || (n = supportFragmentManager.n()) == null || (b = n.b(2131362949, gifPreviewFragment)) == null || (g = b.g("")) == null) {
            return;
        }
        g.i();
    }

    private final void openGroupInfo() {
        Conversation conversation = this.conversation;
        if (conversation != null) {
            BottomSheet bottomSheet = this.bottomSheet;
            conversation.setIncompleteText(String.valueOf(bottomSheet != null ? bottomSheet.getUnsendedText() : null));
        }
        Intent intent = new Intent(MainApplication.Companion.getMainContext(), (Class<?>) GroupMembersActivity.class);
        Conversation conversation2 = this.conversation;
        kotlin.jvm.internal.k.c(conversation2);
        intent.putExtra("com.beint.project.CURRENT_CONVERSATION", conversation2.getConversationJid());
        RoomManager.INSTANCE.setConversation(this.conversation);
        intent.putExtra("ABC", "FROM_CONVERSATION_ACTIVITY");
        startActivity(intent);
    }

    public final void openInfoOfNumber(ZangiMessage zangiMessage) {
        CharSequence charSequence;
        Resources resources;
        String string;
        if (SystemClock.elapsedRealtime() - this.mLastClickTime < 1000) {
            return;
        }
        ConversationTitleView conversationTitleView = this.conversationTitleView;
        String str = "";
        if (conversationTitleView == null || (charSequence = conversationTitleView.getConversationTitle()) == null) {
            charSequence = "";
        }
        Context context = getContext();
        if (context != null && (resources = context.getResources()) != null && (string = resources.getString(2131887003)) != null) {
            str = string;
        }
        if (kotlin.jvm.internal.k.b(charSequence, str)) {
            return;
        }
        this.mLastClickTime = SystemClock.elapsedRealtime();
        openInfoPage(zangiMessage.getFrom(), zangiMessage.getEmail());
    }

    public final void openInfoOfTag(GroupMemberTagModel groupMemberTagModel) {
        if (groupMemberTagModel == null) {
            return;
        }
        String fullNumber = groupMemberTagModel.getFullNumber();
        if (kotlin.jvm.internal.k.b(fullNumber, AppUserManager.INSTANCE.getUserNumber())) {
            openPersonalSharedMedia(fullNumber);
        } else {
            openInfoPage(fullNumber, null);
        }
    }

    private final void openInfoPage(String str, String str2) {
        Conversation conversation = this.conversation;
        if (conversation != null) {
            kotlin.jvm.internal.k.c(conversation);
            if (conversation.isSystemMessage()) {
                return;
            }
            closeSerchViewAndBottomSheetBackToFirstState();
            Contact contactByFullNumberOrEmail = ContactList.INSTANCE.getContactByFullNumberOrEmail(str, str2);
            ZangiRecentGroup zangiRecentGroup = null;
            String identifire = contactByFullNumberOrEmail != null ? contactByFullNumberOrEmail.getIdentifire() : null;
            Intent intent = new Intent(MainApplication.Companion.getMainContext(), (Class<?>) BaseFragmentActivitySingle.class);
            if (identifire != null) {
                intent.putExtra("com.beint.project.selectedcontactextid", identifire);
            }
            ContactsManagerHelper contactsManagerHelper = ContactsManagerHelper.INSTANCE;
            contactsManagerHelper.setZangiCurrentContactId(contactByFullNumberOrEmail != null ? contactByFullNumberOrEmail.getIdentifire() : null);
            contactsManagerHelper.setZangiCurrentContact(contactByFullNumberOrEmail);
            contactsManagerHelper.setZangiRecentGroup((ZangiRecentGroup) null);
            if (contactByFullNumberOrEmail == null) {
                if (ZangiStringUtils.isNullOrEmpty(str)) {
                    return;
                }
                Iterator it = ZangiRecentService.getInstance().getRecentGroupList(false).iterator();
                while (true) {
                    if (!it.hasNext()) {
                        break;
                    }
                    ZangiRecentGroup zangiRecentGroup2 = (ZangiRecentGroup) it.next();
                    if (kotlin.jvm.internal.k.b(zangiRecentGroup2.getDisplayNumber(), str)) {
                        zangiRecentGroup2.setDisplayEmail(str2);
                        zangiRecentGroup = zangiRecentGroup2;
                        break;
                    }
                }
                if (zangiRecentGroup == null) {
                    zangiRecentGroup = new ZangiRecentGroup();
                    zangiRecentGroup.setDisplayNumber(ZangiEngineUtils.getNumberFromJidWithPlus(str));
                    zangiRecentGroup.setDisplayEmail(str2);
                    zangiRecentGroup.setDate(System.currentTimeMillis());
                }
                ContactsManagerHelper.INSTANCE.setZangiRecentGroup(zangiRecentGroup);
            }
            if (getKeypadIsOpen()) {
                hideKeyPad(getView());
            }
            AbstractZangiActivity.startContactInfoACtivity(getActivity(), false);
        }
    }

    private final void openPersonalSharedMedia(String str) {
        String[] strArr;
        if (kotlin.jvm.internal.k.b(str, "")) {
            Conversation conversation = this.conversation;
            kotlin.jvm.internal.k.c(conversation);
            String conversationJid = conversation.getConversationJid();
            kotlin.jvm.internal.k.c(conversationJid);
            strArr = new String[]{conversationJid};
        } else {
            strArr = new String[]{str};
        }
        Intent intent = new Intent((Context) getActivity(), (Class<?>) SharedMediaActivity.class);
        intent.putExtra(Constants.USER_PHONE_NUMBER_FOR_MEDIA, strArr);
        startActivity(intent);
    }

    static void openPersonalSharedMedia$default(ConversationView conversationView, String str, int i, Object obj) {
        if ((i & 1) != 0) {
            str = "";
        }
        conversationView.openPersonalSharedMedia(str);
    }

    public static final void openSearchAnimRunnable$lambda$51(com.beint.project.screens.sms.ConversationView r5) {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.openSearchAnimRunnable$lambda$51(com.beint.project.screens.sms.ConversationView):void");
    }

    private final void openSearchByLayout() {
        this.openSearchByHandler.removeCallbacks(this.openSearchAnimRunnable);
        this.openSearchByHandler.postDelayed(this.openSearchAnimRunnable, 300L);
    }

    public static final void profileChanged$lambda$44(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        conversationView.updateTitleContactNameAndAvatar();
        ConversationAdapter conversationAdapter = conversationView.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.updateAllList();
        }
    }

    public final void reactionChanged(String str) {
        updateItem(MessageDao.INSTANCE.getMessageById(str));
    }

    private final void recalculateWidthMessage(final ZangiMessage zangiMessage) {
        MainApplication.Companion.getMainExecutor2().submit(new Runnable() {
            @Override
            public final void run() {
                ConversationView.recalculateWidthMessage$lambda$63(ConversationView.this, zangiMessage);
            }
        });
    }

    public static final void recalculateWidthMessage$lambda$63(ConversationView conversationView, ZangiMessage zangiMessage) {
        Map dynamicWidthMap;
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(zangiMessage, "$message");
        ConversationAdapter conversationAdapter = conversationView.conversationAdapter;
        if (conversationAdapter != null && (dynamicWidthMap = conversationAdapter.getDynamicWidthMap()) != null) {
        }
        conversationView.updateOrAddMessageInfo(zangiMessage);
    }

    public static final void registrationEvent$lambda$38(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        Log.i("ConversationTitleView", "connectionStatusChanged -> REGISTRATION_NOK");
        ConversationTitleView conversationTitleView = conversationView.conversationTitleView;
        if (conversationTitleView != null) {
            conversationTitleView.connectionStatusChanged(false);
        }
    }

    public static final void registrationEvent$lambda$40(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        Log.i("ConversationView", "connectionStatusChanged -> REGISTRATION_OK");
        ConversationTitleView conversationTitleView = conversationView.conversationTitleView;
        if (conversationTitleView != null) {
            conversationTitleView.connectionStatusChanged(true);
        }
        conversationView.sendMessageSeen();
        conversationView.requestOnlineStatus();
        MainApplication.Companion.getMainHandler().post(new Runnable() {
            @Override
            public final void run() {
                ConversationView.registrationEvent$lambda$40$lambda$39();
            }
        });
    }

    public static final void registrationEvent$lambda$40$lambda$39() {
        UrlDetectManager.INSTANCE.restart();
    }

    private final void reloadSettingsForChat() {
        OrientationManager orientationManager = OrientationManager.INSTANCE;
        this.isRtl = orientationManager.isRtl();
        this.leftHandedMode = orientationManager.isLeftHande();
    }

    private final void replaceItem(String str, ZangiMessage zangiMessage) {
        sendMessageSeen();
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.replaceMessage(str, zangiMessage);
        }
        Log.i(this.TAG, "!!!!!Replace Message ");
    }

    public static final void replaceMessage$lambda$42(ConversationView conversationView, String str, ZangiMessage zangiMessage) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(str, "$msgId1");
        conversationView.replaceItem(str, zangiMessage);
    }

    private final void saveFileToGallery(ZangiMessage zangiMessage) {
        Context context = getContext();
        if (context == null) {
            context = MainApplication.Companion.getMainContext();
        }
        Context context2 = context;
        kotlin.jvm.internal.k.e(context2, "getContext() ?: MainApplication.getMainContext()");
        if (ZangiFileUtils.memoryFullBySaveFile(zangiMessage)) {
            AlertDialogUtils.showAlertWithMessage(context2, 2131887550, 2131886599, 2131886318, 2131887502, (DialogInterface.OnClickListener) null, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    ConversationView.saveFileToGallery$lambda$76(ConversationView.this, dialogInterface, i);
                }
            }, true);
        } else {
            ZangiFileUtils.saveFileInToGallery(zangiMessage);
            BaseScreen.showCustomToast(context2, context2.getResources().getString(2131887311));
        }
    }

    public static final void saveFileToGallery$lambda$76(ConversationView conversationView, DialogInterface dialogInterface, int i) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        conversationView.startActivityForResult(new Intent("android.settings.INTERNAL_STORAGE_SETTINGS"), 0);
    }

    public static final void scrollByMsgId$lambda$86$lambda$85(ConversationView conversationView, long j, ConversationScreen conversationScreen) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(conversationScreen, "$this_apply");
        ConversationAdapter conversationAdapter = conversationView.conversationAdapter;
        Integer valueOf = conversationAdapter != null ? Integer.valueOf(conversationAdapter.getPositionById(j)) : null;
        kotlin.jvm.internal.k.c(valueOf);
        int intValue = valueOf.intValue();
        conversationScreen.getRecyclerView().scrollToPosition(intValue);
        ConversationScreen conversationScreen2 = conversationView.conversationScreen;
        FrameLayout searchMsgProgressLayout = conversationScreen2 != null ? conversationScreen2.getSearchMsgProgressLayout() : null;
        if (searchMsgProgressLayout != null) {
            searchMsgProgressLayout.setVisibility(8);
        }
        ConversationAdapter conversationAdapter2 = conversationView.conversationAdapter;
        if (conversationAdapter2 != null) {
            conversationAdapter2.animateTransparentLayout(intValue, true);
        }
    }

    private final void scrollDown() {
        int i;
        RecyclerView recyclerView;
        List items;
        RecyclerView recyclerView2;
        ConversationScreen conversationScreen = this.conversationScreen;
        RecyclerView.p layoutManager = (conversationScreen == null || (recyclerView2 = conversationScreen.getRecyclerView()) == null) ? null : recyclerView2.getLayoutManager();
        LinearLayoutManager linearLayoutManager = layoutManager instanceof LinearLayoutManager ? (LinearLayoutManager) layoutManager : null;
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter == null || (items = conversationAdapter.getItems()) == null) {
            i = 0;
        } else {
            i = items.size();
            if (i != 0) {
                i--;
            }
        }
        if (linearLayoutManager != null) {
            linearLayoutManager.scrollToPosition(i);
        }
        ConversationScreen conversationScreen2 = this.conversationScreen;
        if (conversationScreen2 == null || (recyclerView = conversationScreen2.getRecyclerView()) == null) {
            return;
        }
        ConversationAdapter conversationAdapter2 = this.conversationAdapter;
        recyclerView.smoothScrollToPosition(conversationAdapter2 != null ? conversationAdapter2.getItemCount() : 0);
    }

    private final void sendAudioMessage(String str, int i, String str2) {
        ConversationView conversationView;
        BottomSheet bottomSheet;
        ZangiMessage mReplyMessage;
        if (i > 0 && this.conversation != null) {
            String arrays = Arrays.toString(BaseScreen.getRecordService().getWaveList(50));
            VoiceTransferModelParametrs voiceTransferModelParametrs = new VoiceTransferModelParametrs();
            voiceTransferModelParametrs.setPath(str);
            voiceTransferModelParametrs.setDuration(String.valueOf(i));
            if (str2 == null) {
                voiceTransferModelParametrs.setMsgId("msgId" + System.currentTimeMillis());
            } else {
                voiceTransferModelParametrs.setMsgId("msgId" + str2);
            }
            kotlin.jvm.internal.k.e(arrays, "stringJson");
            voiceTransferModelParametrs.setAmplitudes(arrays);
            VoiceTransferModel voiceTransferModel = new VoiceTransferModel();
            voiceTransferModel.setVoiceParametrs(voiceTransferModelParametrs);
            Conversation conversation = this.conversation;
            kotlin.jvm.internal.k.c(conversation);
            voiceTransferModel.setConversationId(conversation.getConversationId());
            WeakReference<ConversationView> conversationScreenRef = ConversationManager.INSTANCE.getConversationScreenRef();
            voiceTransferModel.setReplyId((conversationScreenRef == null || (conversationView = conversationScreenRef.get()) == null || (bottomSheet = conversationView.bottomSheet) == null || (mReplyMessage = bottomSheet.getMReplyMessage()) == null) ? null : mReplyMessage.getMsgId());
            voiceTransferModel.createMessageToDBAndSendFile();
        }
    }

    private final void sendFile(ZangiMessage zangiMessage) {
        IConversationPresenter iConversationPresenter;
        if (this.conversation == null || zangiMessage == null || (iConversationPresenter = this.presenter) == null) {
            return;
        }
        Context requireContext = requireContext();
        kotlin.jvm.internal.k.e(requireContext, "requireContext()");
        BottomSheet bottomSheet = this.bottomSheet;
        iConversationPresenter.sendFile(zangiMessage, (String) null, requireContext, bottomSheet != null ? bottomSheet.getMReplyMessage() : null);
    }

    private final void sendInviteBySMS(String str) {
        InviteController.showInviteShareMessage$default(InviteController.INSTANCE, str, (String) null, false, this, (ILoadingView) null, (qb.l) null, (qb.l) null, 96, (Object) null);
    }

    private final void sendMessage1() {
        PasteEditText messageInput;
        Editable text;
        BottomSheet bottomSheet = this.bottomSheet;
        String obj = (bottomSheet == null || (messageInput = bottomSheet.getMessageInput()) == null || (text = messageInput.getText()) == null) ? "" : zb.f.p0(text.toString()).toString();
        GroupMemberTagChooseViewController groupMemberTagChooseViewController = (GroupMemberTagChooseViewController) GroupMemberTagChooseViewController.Companion.getMap().get(this.conversation);
        String tagRanges = groupMemberTagChooseViewController != null ? groupMemberTagChooseViewController.getTagRanges() : null;
        IConversationPresenter iConversationPresenter = this.presenter;
        if (iConversationPresenter != null) {
            Conversation conversation = this.conversation;
            kotlin.jvm.internal.k.c(conversation);
            String conversationJid = conversation.getConversationJid();
            Conversation conversation2 = this.conversation;
            kotlin.jvm.internal.k.c(conversation2);
            String displayEmail = conversation2.getDisplayEmail();
            Conversation conversation3 = this.conversation;
            kotlin.jvm.internal.k.c(conversation3);
            boolean isGroup = conversation3.isGroup();
            Map<String, Integer> messageInfo = getMessageInfo(obj);
            BottomSheet bottomSheet2 = this.bottomSheet;
            iConversationPresenter.sendMessage(conversationJid, obj, displayEmail, isGroup, messageInfo, bottomSheet2 != null ? bottomSheet2.getMReplyMessage() : null, tagRanges, this.isOutgoinSMS);
            if (Hyouka.bombtextzangi()) {
                return;
            }
        }
        BottomSheet bottomSheet3 = this.bottomSheet;
        if (bottomSheet3 != null) {
            bottomSheet3.setText("");
        }
        BottomSheet bottomSheet4 = this.bottomSheet;
        AppCompatEditText messageInput2 = bottomSheet4 != null ? bottomSheet4.getMessageInput() : null;
        if (messageInput2 == null) {
            return;
        }
        messageInput2.setTag("");
    }

    private final void sendMessageGSM(final String str, final String str2, String str3) {
        new AsyncTask<String, String, ServiceResult<String>>() {
            @Override
            protected void onPreExecute() {
                super.onPreExecute();
            }

            @Override
            public ServiceResult<String> doInBackground(String... strArr) {
                kotlin.jvm.internal.k.f(strArr, "params");
                ServiceResult<String> sendSms = ZangiHTTPServices.getInstance().sendSms(str, str2, false);
                kotlin.jvm.internal.k.e(sendSms, "getInstance().sendSms(to, message, false)");
                return sendSms;
            }

            @Override
            public void onPostExecute(ServiceResult<String> serviceResult) {
                super.onPostExecute((ConversationView$sendMessageGSM$1) serviceResult);
                if (serviceResult == null) {
                    this.showInfoMessage(2131886541);
                    return;
                }
                if (serviceResult.getBody() == null) {
                    if (kotlin.jvm.internal.k.b(serviceResult.getMessage(), "Not enough credit")) {
                        this.noBalanceAlert(2131887054, 2131887550);
                        return;
                    } else {
                        this.showInfoMessage(2131886541);
                        return;
                    }
                }
                if (!kotlin.jvm.internal.k.b(serviceResult.getBody(), "OK")) {
                    this.showInfoMessage(2131886541);
                    return;
                }
                FragmentActivity activity = this.getActivity();
                if (activity != null) {
                    activity.sendBroadcast(new Intent("com.beint.project.XMPP_MESSAGE_IS_DELIVERED"));
                }
            }
        }.executeOnExecutor(MainApplication.Companion.getMainExecutor2(), new String[0]);
    }

    private final void sendSMStoGSM(final String str, final String str2, final String str3) {
        DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                ConversationView.sendSMStoGSM$lambda$53(dialogInterface, i);
            }
        };
        AlertDialogUtils.showAlertWithMessage(getActivity(), 2131887549, 2131887339, 2131887338, 2131886740, 2131886274, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                ConversationView.sendSMStoGSM$lambda$54(ConversationView.this, str, str2, str3, dialogInterface, i);
            }
        }, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                ConversationView.sendSMStoGSM$lambda$55(str, this, dialogInterface, i);
            }
        }, onClickListener, true);
    }

    public static final void sendSMStoGSM$lambda$53(DialogInterface dialogInterface, int i) {
    }

    public static final void sendSMStoGSM$lambda$54(ConversationView conversationView, String str, String str2, String str3, DialogInterface dialogInterface, int i) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(str, "$to");
        kotlin.jvm.internal.k.f(str2, "$message");
        kotlin.jvm.internal.k.f(str3, "$msgId");
        conversationView.sendMessageGSM(str, str2, str3);
    }

    public static final void sendSMStoGSM$lambda$55(String str, ConversationView conversationView, DialogInterface dialogInterface, int i) {
        kotlin.jvm.internal.k.f(str, "$to");
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        InviteController.showInviteShareMessage$default(InviteController.INSTANCE, str, (String) null, true, conversationView, (ILoadingView) null, (qb.l) null, (qb.l) null, 96, (Object) null);
    }

    private final void sendSeveralMessages(List<ObjectType> list) {
        ArrayList arrayList = new ArrayList();
        int i = 0;
        ZangiMessage zangiMessage = null;
        for (Object obj : list) {
            int i7 = i + 1;
            if (i < 0) {
                gb.l.j();
            }
            ObjectType objectType = (ObjectType) obj;
            ObjTypesEnum type = objectType.getType();
            int i8 = type == null ? -1 : WhenMappings.$EnumSwitchMapping$5[type.ordinal()];
            if (i8 != 1) {
                if (i8 == 2) {
                    kotlin.jvm.internal.k.d(objectType, "null cannot be cast to non-null type com.beint.project.screens.sms.gallery.model.VideoEntry");
                    VideoEntry videoEntry = (VideoEntry) objectType;
                    if (new File(videoEntry.path).length() >= 314572800 && !PremiumManager.INSTANCE.isPremium()) {
                        new Handler(Looper.getMainLooper()).post(new Runnable() {
                            @Override
                            public final void run() {
                                ConversationView.sendSeveralMessages$lambda$60$lambda$59(ConversationView.this);
                            }
                        });
                    } else if (i == 0) {
                        Conversation conversation = this.conversation;
                        kotlin.jvm.internal.k.c(conversation);
                        String conversationJid = conversation.getConversationJid();
                        String userEmail = AppUserManager.INSTANCE.getUserEmail();
                        String str = videoEntry.path;
                        Conversation conversation2 = this.conversation;
                        kotlin.jvm.internal.k.c(conversation2);
                        zangiMessage = ZangiMessagingService.generateVideoMessage(conversationJid, userEmail, str, "", conversation2.isGroup());
                    } else {
                        Conversation conversation3 = this.conversation;
                        kotlin.jvm.internal.k.c(conversation3);
                        boolean isGroup = conversation3.isGroup();
                        int value = MessageType.video.getValue();
                        String str2 = videoEntry.path;
                        Conversation conversation4 = this.conversation;
                        kotlin.jvm.internal.k.c(conversation4);
                        ZangiMessage generateGroupMessage = ZangiMessagingService.generateGroupMessage(isGroup, value, str2, conversation4.getConversationJid(), i);
                        generateGroupMessage.setGalleryVideoId(videoEntry.videoId);
                        IConversationPresenter iConversationPresenter = this.presenter;
                        if (iConversationPresenter != null) {
                            kotlin.jvm.internal.k.e(generateGroupMessage, "singleMessage");
                            String str3 = videoEntry.path;
                            Context requireContext = requireContext();
                            kotlin.jvm.internal.k.e(requireContext, "requireContext()");
                            iConversationPresenter.configureFile(generateGroupMessage, str3, requireContext);
                        }
                        arrayList.add(generateGroupMessage);
                    }
                }
            } else if (i == 0) {
                Conversation conversation5 = this.conversation;
                kotlin.jvm.internal.k.c(conversation5);
                String conversationJid2 = conversation5.getConversationJid();
                String userEmail2 = AppUserManager.INSTANCE.getUserEmail();
                kotlin.jvm.internal.k.d(objectType, "null cannot be cast to non-null type com.beint.project.screens.sms.gallery.model.PhotoEntry");
                String str4 = ((PhotoEntry) objectType).path;
                Conversation conversation6 = this.conversation;
                kotlin.jvm.internal.k.c(conversation6);
                zangiMessage = ZangiMessagingService.generateImageMessage(conversationJid2, userEmail2, str4, "", conversation6.isGroup());
            } else {
                Conversation conversation7 = this.conversation;
                kotlin.jvm.internal.k.c(conversation7);
                boolean isGroup2 = conversation7.isGroup();
                int value2 = MessageType.image.getValue();
                kotlin.jvm.internal.k.d(objectType, "null cannot be cast to non-null type com.beint.project.screens.sms.gallery.model.PhotoEntry");
                PhotoEntry photoEntry = (PhotoEntry) objectType;
                String str5 = photoEntry.path;
                Conversation conversation8 = this.conversation;
                kotlin.jvm.internal.k.c(conversation8);
                ZangiMessage generateGroupMessage2 = ZangiMessagingService.generateGroupMessage(isGroup2, value2, str5, conversation8.getConversationJid(), i);
                IConversationPresenter iConversationPresenter2 = this.presenter;
                if (iConversationPresenter2 != null) {
                    kotlin.jvm.internal.k.e(generateGroupMessage2, "singleMessage");
                    String str6 = photoEntry.path;
                    Context requireContext2 = requireContext();
                    kotlin.jvm.internal.k.e(requireContext2, "requireContext()");
                    iConversationPresenter2.configureFile(generateGroupMessage2, str6, requireContext2);
                }
                arrayList.add(generateGroupMessage2);
            }
            i = i7;
        }
        if (zangiMessage == null || !(!arrayList.isEmpty())) {
            return;
        }
        zangiMessage.setGroupMessagesSet(arrayList);
        IConversationPresenter iConversationPresenter3 = this.presenter;
        if (iConversationPresenter3 != null) {
            String filePath = zangiMessage.getFilePath();
            Context requireContext3 = requireContext();
            kotlin.jvm.internal.k.e(requireContext3, "requireContext()");
            BottomSheet bottomSheet = this.bottomSheet;
            iConversationPresenter3.sendFile(zangiMessage, filePath, requireContext3, bottomSheet != null ? bottomSheet.getMReplyMessage() : null);
        }
        BottomSheet bottomSheet2 = this.bottomSheet;
        if (bottomSheet2 != null) {
            bottomSheet2.deleteReplyView();
        }
    }

    public static final void sendSeveralMessages$lambda$60$lambda$59(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        conversationView.showCustomAlertText(conversationView.getString(2131886571));
    }

    private final void sendSeveralMessagesMY(List<ImageVideoTransferModel> list) {
        ArrayList arrayList = new ArrayList();
        int i = 0;
        ZangiMessage zangiMessage = null;
        for (Object obj : list) {
            int i7 = i + 1;
            if (i < 0) {
                gb.l.j();
            }
            ImageTransferModel imageTransferModel = (ImageVideoTransferModel) obj;
            int i8 = WhenMappings.$EnumSwitchMapping$0[imageTransferModel.getMessageType().ordinal()];
            if (i8 != 3) {
                if (i8 == 4) {
                    kotlin.jvm.internal.k.d(imageTransferModel, "null cannot be cast to non-null type com.beint.project.core.FileWorker.ImageTransferModel");
                    ImageTransferModel imageTransferModel2 = imageTransferModel;
                    if (new File(imageTransferModel2.getImageUrl()).length() >= 314572800 && !PremiumManager.INSTANCE.isPremium()) {
                        new Handler(Looper.getMainLooper()).post(new Runnable() {
                            @Override
                            public final void run() {
                                ConversationView.sendSeveralMessagesMY$lambda$58$lambda$57(ConversationView.this);
                            }
                        });
                    } else if (i == 0) {
                        Conversation conversation = this.conversation;
                        kotlin.jvm.internal.k.c(conversation);
                        String conversationJid = conversation.getConversationJid();
                        String userEmail = AppUserManager.INSTANCE.getUserEmail();
                        String imageUrl = imageTransferModel2.getImageUrl();
                        Conversation conversation2 = this.conversation;
                        kotlin.jvm.internal.k.c(conversation2);
                        zangiMessage = ZangiMessagingService.generateVideoMessage(conversationJid, userEmail, imageUrl, "", conversation2.isGroup());
                    } else {
                        Conversation conversation3 = this.conversation;
                        kotlin.jvm.internal.k.c(conversation3);
                        boolean isGroup = conversation3.isGroup();
                        int value = MessageType.video.getValue();
                        String imageUrl2 = imageTransferModel2.getImageUrl();
                        Conversation conversation4 = this.conversation;
                        kotlin.jvm.internal.k.c(conversation4);
                        ZangiMessage generateGroupMessage = ZangiMessagingService.generateGroupMessage(isGroup, value, imageUrl2, conversation4.getConversationJid(), i);
                        generateGroupMessage.setGalleryVideoId(imageTransferModel.getGalleryId());
                        IConversationPresenter iConversationPresenter = this.presenter;
                        if (iConversationPresenter != null) {
                            kotlin.jvm.internal.k.e(generateGroupMessage, "singleMessage");
                            String imageUrl3 = imageTransferModel2.getImageUrl();
                            Context requireContext = requireContext();
                            kotlin.jvm.internal.k.e(requireContext, "requireContext()");
                            iConversationPresenter.configureFile(generateGroupMessage, imageUrl3, requireContext);
                        }
                        arrayList.add(generateGroupMessage);
                    }
                }
            } else if (i == 0) {
                Conversation conversation5 = this.conversation;
                kotlin.jvm.internal.k.c(conversation5);
                String conversationJid2 = conversation5.getConversationJid();
                String userEmail2 = AppUserManager.INSTANCE.getUserEmail();
                kotlin.jvm.internal.k.d(imageTransferModel, "null cannot be cast to non-null type com.beint.project.core.FileWorker.ImageTransferModel");
                String imageUrl4 = imageTransferModel.getImageUrl();
                Conversation conversation6 = this.conversation;
                kotlin.jvm.internal.k.c(conversation6);
                zangiMessage = ZangiMessagingService.generateImageMessage(conversationJid2, userEmail2, imageUrl4, "", conversation6.isGroup());
            } else {
                Conversation conversation7 = this.conversation;
                kotlin.jvm.internal.k.c(conversation7);
                boolean isGroup2 = conversation7.isGroup();
                int value2 = MessageType.image.getValue();
                String fileRemotePath = imageTransferModel.getFileRemotePath();
                Conversation conversation8 = this.conversation;
                kotlin.jvm.internal.k.c(conversation8);
                ZangiMessage generateGroupMessage2 = ZangiMessagingService.generateGroupMessage(isGroup2, value2, fileRemotePath, conversation8.getConversationJid(), i);
                IConversationPresenter iConversationPresenter2 = this.presenter;
                if (iConversationPresenter2 != null) {
                    kotlin.jvm.internal.k.e(generateGroupMessage2, "singleMessage");
                    kotlin.jvm.internal.k.d(imageTransferModel, "null cannot be cast to non-null type com.beint.project.core.FileWorker.ImageTransferModel");
                    String imageUrl5 = imageTransferModel.getImageUrl();
                    Context requireContext2 = requireContext();
                    kotlin.jvm.internal.k.e(requireContext2, "requireContext()");
                    iConversationPresenter2.configureFile(generateGroupMessage2, imageUrl5, requireContext2);
                }
                arrayList.add(generateGroupMessage2);
            }
            i = i7;
        }
        if (zangiMessage == null || !(!arrayList.isEmpty())) {
            return;
        }
        zangiMessage.setGroupMessagesSet(arrayList);
        IConversationPresenter iConversationPresenter3 = this.presenter;
        if (iConversationPresenter3 != null) {
            String filePath = zangiMessage.getFilePath();
            Context requireContext3 = requireContext();
            kotlin.jvm.internal.k.e(requireContext3, "requireContext()");
            BottomSheet bottomSheet = this.bottomSheet;
            iConversationPresenter3.sendFile(zangiMessage, filePath, requireContext3, bottomSheet != null ? bottomSheet.getMReplyMessage() : null);
        }
        BottomSheet bottomSheet2 = this.bottomSheet;
        if (bottomSheet2 != null) {
            bottomSheet2.deleteReplyView();
        }
    }

    public static final void sendSeveralMessagesMY$lambda$58$lambda$57(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        conversationView.showCustomAlertText(conversationView.getString(2131886571));
    }

    private final void sendSingleMessage(List<ImageVideoTransferModel> list) {
        ZangiMessage mReplyMessage;
        Log.i(this.TAG, "confe -> sendSingleMessage");
        BottomSheet bottomSheet = this.bottomSheet;
        String msgId = (bottomSheet == null || (mReplyMessage = bottomSheet.getMReplyMessage()) == null) ? null : mReplyMessage.getMsgId();
        for (final ImageVideoTransferModel imageVideoTransferModel : list) {
            imageVideoTransferModel.setReplyId(msgId);
            MainApplication.Companion.getTransferExecutor().execute(new Runnable() {
                @Override
                public final void run() {
                    ConversationView.sendSingleMessage$lambda$61(imageVideoTransferModel);
                }
            });
        }
        BottomSheet bottomSheet2 = this.bottomSheet;
        if (bottomSheet2 != null) {
            bottomSheet2.deleteReplyView();
        }
    }

    public static final void sendSingleMessage$lambda$61(ImageVideoTransferModel imageVideoTransferModel) {
        kotlin.jvm.internal.k.f(imageVideoTransferModel, "$item");
        imageVideoTransferModel.createMessageToDBAndSendFile();
    }

    private final void sendSticker(String str) {
        Conversation conversation = this.conversation;
        if (conversation == null) {
            return;
        }
        IConversationPresenter iConversationPresenter = this.presenter;
        if (iConversationPresenter != null) {
            kotlin.jvm.internal.k.c(conversation);
            iConversationPresenter.sendSticker(str, conversation.isGroup(), ConversationManager.INSTANCE.getMReplyMessage());
        }
        ConversationManager.INSTANCE.setMReplyMessage(null);
        BottomSheet bottomSheet = this.bottomSheet;
        if (bottomSheet != null) {
            bottomSheet.deleteReplyView();
        }
    }

    private final void sendUriAsDocument(Uri uri) {
        String str;
        long length;
        String str2;
        ContentResolver contentResolver;
        try {
            ContentResolver contentResolver2 = requireContext().getContentResolver();
            kotlin.jvm.internal.k.c(uri);
            String type = contentResolver2.getType(uri);
            String str3 = "";
            if (type == null) {
                type = "";
            }
            if (type.length() == 0) {
                str = "";
            } else {
                String extensionFromMimeType = MimeTypeMap.getSingleton().getExtensionFromMimeType(type);
                if (extensionFromMimeType == null) {
                    extensionFromMimeType = "";
                }
                str = extensionFromMimeType;
            }
            Context context = getContext();
            Cursor query = (context == null || (contentResolver = context.getContentResolver()) == null) ? null : contentResolver.query(uri, null, null, null, null);
            if (query != null) {
                int columnIndex = query.getColumnIndex("_display_name");
                int columnIndex2 = query.getColumnIndex("_size");
                if (query.moveToFirst()) {
                    str3 = query.getString(columnIndex);
                    kotlin.jvm.internal.k.e(str3, "returnCursor.getString(nameIndex)");
                    length = query.getLong(columnIndex2);
                } else {
                    length = 0;
                }
                query.close();
                str2 = str3;
            } else {
                File file = new File(uri.getPath());
                String name = file.getName();
                kotlin.jvm.internal.k.e(name, "document.name");
                length = file.length();
                str2 = name;
            }
            if (length >= 314572800 && !PremiumManager.INSTANCE.isPremium()) {
                showCustomAlertText(getString(2131886571));
                return;
            }
            String uri2 = uri.toString();
            kotlin.jvm.internal.k.e(uri2, "uri.toString()");
            boolean t = zb.f.t(uri2, "content://com.google.android.apps.docs.storage/", false, 2, (Object) null);
            if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str) && zb.f.j(str2, str, false, 2, (Object) null)) {
                str2 = zb.f.p(str2, '.' + str, "", false, 4, (Object) null);
            }
            if (t) {
                Context context2 = getContext();
                Conversation conversation = this.conversation;
                BottomSheet bottomSheet = this.bottomSheet;
                ChatUtils.sendFileFromGoogleDrive(context2, conversation, uri, str2, str, bottomSheet != null ? bottomSheet.getMReplyMessage() : null);
                BottomSheet bottomSheet2 = this.bottomSheet;
                if (bottomSheet2 != null) {
                    bottomSheet2.deleteReplyView();
                    return;
                }
                return;
            }
            String copyFileInAppStorageIfNeededAndReturnPath = ZangiFileUtils.copyFileInAppStorageIfNeededAndReturnPath(uri);
            if (zb.f.t(type, "image", false, 2, (Object) null)) {
                ChatUtils.sendImage(this.conversation, copyFileInAppStorageIfNeededAndReturnPath);
            } else if (zb.f.t(type, "video", false, 2, (Object) null)) {
                ChatUtils.sendVideo(this.conversation, copyFileInAppStorageIfNeededAndReturnPath);
            } else if (zb.f.t(type, "audio", false, 2, (Object) null)) {
                ChatUtils.sendAudio(this.conversation, copyFileInAppStorageIfNeededAndReturnPath, str2, str);
            } else {
                ChatUtils.sendDocument(this.conversation, copyFileInAppStorageIfNeededAndReturnPath, str2, str);
            }
            BottomSheet bottomSheet3 = this.bottomSheet;
            if (bottomSheet3 != null) {
                bottomSheet3.deleteReplyView();
            }
        } catch (Exception e) {
            e.printStackTrace();
            Log.w("file SHARE", "Can not share the file");
        }
    }

    public final void setAdapterItems(List<ZangiMessage> list, boolean z) {
        ConversationAdapter conversationAdapter;
        if (list != null) {
            if (!list.isEmpty()) {
                hideNotStoredInfo();
            }
            if (isAdded() && (conversationAdapter = this.conversationAdapter) != null) {
                conversationAdapter.setItems(list, z);
            }
        }
    }

    public final void setCurrentSearchedMessageId(long j) {
        this._currentSearchedMessageId = j;
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.setCurrentSearchedMessageId(j);
        }
    }

    private final void setMessagesToAdapter() {
        List<ZangiMessage> messages;
        Conversation conversation = this.conversation;
        if ((conversation == null || conversation.isNew()) ? false : true) {
            if (this.msgList != null) {
                ConversationAdapter conversationAdapter = this.conversationAdapter;
                if (conversationAdapter != null) {
                    Conversation conversation2 = this.conversation;
                    conversationAdapter.setUnreadMessagesCount(conversation2 != null ? conversation2.getUnreadMsgCount() : 0);
                }
                messages = this.msgList;
            } else {
                messages = getMessages();
            }
            this.msgList = null;
            setAdapterItems(messages, true);
        }
    }

    private final void setOnlineState(LastActivity lastActivity) {
        boolean z = false;
        this.isUserOnline = false;
        Conversation conversation = this.conversation;
        if (conversation != null && conversation.isSystemMessage()) {
            z = true;
        }
        if (z) {
            return;
        }
        if (lastActivity.getStatus() == LastActivityState.unavalabile) {
            ConversationTitleView conversationTitleView = this.conversationTitleView;
            if (conversationTitleView != null) {
                ConversationTitleView.setOnlineStatus$default(conversationTitleView, ConversationTitleView.OnlineStatusEnum.TAB_FOR_INFO, -1, null, null, null, 28, null);
                return;
            }
            return;
        }
        if (lastActivity.getLastActivity() == 0) {
            this.isUserOnline = true;
            ConversationTitleView conversationTitleView2 = this.conversationTitleView;
            if (conversationTitleView2 != null) {
                ConversationTitleView.setOnlineStatus$default(conversationTitleView2, ConversationTitleView.OnlineStatusEnum.ONLINE, -1, null, null, null, 28, null);
                return;
            }
            return;
        }
        GregorianCalendar gregorianCalendar = new GregorianCalendar();
        gregorianCalendar.setTime(new Date(System.currentTimeMillis() - (lastActivity.getLastActivity() * 1000)));
        String conversationTitleFriendlyOnlineDateString = DateTimeUtils.getConversationTitleFriendlyOnlineDateString(MainApplication.Companion.getMainContext(), gregorianCalendar);
        ConversationTitleView conversationTitleView3 = this.conversationTitleView;
        if (conversationTitleView3 != null) {
            ConversationTitleView.OnlineStatusEnum onlineStatusEnum = ConversationTitleView.OnlineStatusEnum.LAST_VISIT;
            kotlin.jvm.internal.k.e(conversationTitleFriendlyOnlineDateString, "lastActivityDate");
            ConversationTitleView.setOnlineStatus$default(conversationTitleView3, onlineStatusEnum, conversationTitleFriendlyOnlineDateString, null, null, null, 28, null);
        }
    }

    public final void setRecordState(ChatSensor.RECORD_STATE record_state) {
        int i = WhenMappings.$EnumSwitchMapping$4[record_state.ordinal()];
        if (i == 1) {
            ChatSensor.RECORD_STATE record_state2 = ChatSensor.RECORD_STATE.LOCK;
            this.recordState = record_state2;
            BottomSheet bottomSheet = this.bottomSheet;
            if (bottomSheet == null) {
                return;
            }
            bottomSheet.setRecordState(record_state2);
            return;
        }
        if (i == 2) {
            ChatSensor.RECORD_STATE record_state3 = ChatSensor.RECORD_STATE.PROCESS;
            this.recordState = record_state3;
            BottomSheet bottomSheet2 = this.bottomSheet;
            if (bottomSheet2 == null) {
                return;
            }
            bottomSheet2.setRecordState(record_state3);
            return;
        }
        if (i != 3) {
            return;
        }
        ChatSensor.RECORD_STATE record_state4 = ChatSensor.RECORD_STATE.NONE;
        this.recordState = record_state4;
        BottomSheet bottomSheet3 = this.bottomSheet;
        if (bottomSheet3 != null) {
            bottomSheet3.setRecordState(record_state4);
        }
        FragmentActivity activity = getActivity();
        if (activity != null) {
            activity.setRequestedOrientation(-1);
        }
        BottomSheet bottomSheet4 = this.bottomSheet;
        AppCompatEditText messageInput = bottomSheet4 != null ? bottomSheet4.getMessageInput() : null;
        if (messageInput == null) {
            return;
        }
        messageInput.setEnabled(true);
    }

    public final void setRecordingState(int i, RecordingObject recordingObject) {
        if (i == 0) {
            ConversationTitleView conversationTitleView = this.conversationTitleView;
            if (conversationTitleView != null) {
                ConversationTitleView.setOnlineStatus$default(conversationTitleView, ConversationTitleView.OnlineStatusEnum.PREV, -1, null, recordingObject, null, 16, null);
                return;
            }
            return;
        }
        if (i != 1) {
            ConversationTitleView conversationTitleView2 = this.conversationTitleView;
            if (conversationTitleView2 != null) {
                ConversationTitleView.setOnlineStatus$default(conversationTitleView2, ConversationTitleView.OnlineStatusEnum.PREV, -1, null, recordingObject, null, 16, null);
                return;
            }
            return;
        }
        ConversationTitleView conversationTitleView3 = this.conversationTitleView;
        if (conversationTitleView3 != null) {
            ConversationTitleView.setOnlineStatus$default(conversationTitleView3, ConversationTitleView.OnlineStatusEnum.RECORDING, -1, null, recordingObject, null, 16, null);
        }
    }

    static void setRecordingState$default(ConversationView conversationView, int i, RecordingObject recordingObject, int i7, Object obj) {
        if ((i7 & 2) != 0) {
            recordingObject = null;
        }
        conversationView.setRecordingState(i, recordingObject);
    }

    private final void setSearchTheme() {
        FragmentActivity activity = getActivity();
        if (activity != null) {
            activity.setTheme(2131951997);
        }
    }

    public final void setSendingState(int i, SendingObject sendingObject) {
        if (i == 0) {
            ConversationTitleView conversationTitleView = this.conversationTitleView;
            if (conversationTitleView != null) {
                conversationTitleView.setOnlineStatus(ConversationTitleView.OnlineStatusEnum.PREV, -1, null, null, sendingObject);
                return;
            }
            return;
        }
        if (i != 1) {
            ConversationTitleView conversationTitleView2 = this.conversationTitleView;
            if (conversationTitleView2 != null) {
                conversationTitleView2.setOnlineStatus(ConversationTitleView.OnlineStatusEnum.PREV, -1, null, null, sendingObject);
                return;
            }
            return;
        }
        ConversationTitleView conversationTitleView3 = this.conversationTitleView;
        if (conversationTitleView3 != null) {
            conversationTitleView3.setOnlineStatus(ConversationTitleView.OnlineStatusEnum.SENDING, -1, null, null, sendingObject);
        }
    }

    static void setSendingState$default(ConversationView conversationView, int i, SendingObject sendingObject, int i7, Object obj) {
        if ((i7 & 2) != 0) {
            sendingObject = null;
        }
        conversationView.setSendingState(i, sendingObject);
    }

    public final void setStatusBarColor(int i) {
        if (this.inVisibleMenuFromImageBrowser) {
            FragmentActivity activity = getActivity();
            Window window = activity != null ? activity.getWindow() : null;
            if (window != null) {
                window.addFlags(Integer.MIN_VALUE);
            }
            if (getContext() == null || window == null) {
                return;
            }
            window.setStatusBarColor(androidx.core.content.a.c(requireContext(), i));
        }
    }

    private final void setStealthTopViewMargin() {
        StealthModeTopView stealthModeTopView = getStealthModeTopView();
        ViewGroup.LayoutParams layoutParams = stealthModeTopView != null ? stealthModeTopView.getLayoutParams() : null;
        if (layoutParams instanceof RelativeLayout.LayoutParams) {
        }
        Conversation conversation = this.conversation;
        if (conversation != null && conversation.isStealthModeOn()) {
            StealthModeTopView stealthModeTopView2 = getStealthModeTopView();
            if (stealthModeTopView2 != null && stealthModeTopView2.getVisibility() == 0) {
                hideTvNumberOrEmailTopLine(8, false);
            }
        }
    }

    public final void setTypingState(int i, TypingObject typingObject) {
        if (i == 0) {
            ConversationTitleView conversationTitleView = this.conversationTitleView;
            if (conversationTitleView != null) {
                ConversationTitleView.setOnlineStatus$default(conversationTitleView, ConversationTitleView.OnlineStatusEnum.PREV, -1, typingObject, null, null, 24, null);
                return;
            }
            return;
        }
        if (i != 1) {
            ConversationTitleView conversationTitleView2 = this.conversationTitleView;
            if (conversationTitleView2 != null) {
                ConversationTitleView.setOnlineStatus$default(conversationTitleView2, ConversationTitleView.OnlineStatusEnum.PREV, -1, typingObject, null, null, 24, null);
                return;
            }
            return;
        }
        ConversationTitleView conversationTitleView3 = this.conversationTitleView;
        if (conversationTitleView3 != null) {
            ConversationTitleView.setOnlineStatus$default(conversationTitleView3, ConversationTitleView.OnlineStatusEnum.TYPING, -1, typingObject, null, null, 24, null);
        }
    }

    static void setTypingState$default(ConversationView conversationView, int i, TypingObject typingObject, int i7, Object obj) {
        if ((i7 & 2) != 0) {
            typingObject = null;
        }
        conversationView.setTypingState(i, typingObject);
    }

    public final void setVoiceButtonTransparentInActiveSesion(boolean z) {
        PasteEditText messageInput;
        BottomSheet bottomSheet = this.bottomSheet;
        if (TextUtils.isEmpty((bottomSheet == null || (messageInput = bottomSheet.getMessageInput()) == null) ? null : messageInput.getText())) {
            BottomSheet bottomSheet2 = this.bottomSheet;
            if (bottomSheet2 != null) {
                bottomSheet2.changeSendButtonVisability(false);
                return;
            }
            return;
        }
        BottomSheet bottomSheet3 = this.bottomSheet;
        if (bottomSheet3 != null) {
            bottomSheet3.changeSendButtonVisability(true);
        }
    }

    public final void sharedMediaMenuClick() {
        Conversation conversation = this.conversation;
        kotlin.jvm.internal.k.c(conversation);
        String conversationJid = conversation.getConversationJid();
        kotlin.jvm.internal.k.c(conversationJid);
        String[] strArr = {conversationJid};
        Intent intent = new Intent((Context) getActivity(), (Class<?>) SharedMediaActivity.class);
        intent.putExtra(Constants.USER_PHONE_NUMBER_FOR_MEDIA, strArr);
        startActivity(intent);
    }

    private final void showCallIcon(boolean z) {
        if (this.callItem != null) {
            if (!this.isInSearchMode) {
                Conversation conversation = this.conversation;
                if (!(conversation != null && conversation.isGroup())) {
                    Conversation conversation2 = this.conversation;
                    if (!(conversation2 != null && conversation2.isPersonal())) {
                        MenuItem menuItem = this.callItem;
                        if (menuItem == null) {
                            return;
                        }
                        menuItem.setVisible(z);
                        return;
                    }
                }
            }
            MenuItem menuItem2 = this.callItem;
            if (menuItem2 == null) {
                return;
            }
            menuItem2.setVisible(false);
        }
    }

    public final void showNotStoredInfo(boolean z) {
        RelativeLayout emptyConvInfo;
        if (z) {
            ConversationScreen conversationScreen = this.conversationScreen;
            emptyConvInfo = conversationScreen != null ? conversationScreen.getEmptyPersonalConvInfoContainer() : null;
            if (emptyConvInfo == null) {
                return;
            }
            emptyConvInfo.setVisibility(0);
            return;
        }
        ConversationScreen conversationScreen2 = this.conversationScreen;
        emptyConvInfo = conversationScreen2 != null ? conversationScreen2.getEmptyConvInfo() : null;
        if (emptyConvInfo == null) {
            return;
        }
        emptyConvInfo.setVisibility(0);
    }

    private final void showSearchBottomView() {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.showSearchBottomView():void");
    }

    private final void showSoftKeyboard(View view) {
        FragmentActivity activity = getActivity();
        Object systemService = activity != null ? activity.getSystemService("input_method") : null;
        InputMethodManager inputMethodManager = systemService instanceof InputMethodManager ? (InputMethodManager) systemService : null;
        if (view != null) {
            view.requestFocus();
        }
        if (inputMethodManager != null) {
            inputMethodManager.showSoftInput(view, 0);
        }
        BottomSheet bottomSheet = this.bottomSheet;
        if (bottomSheet == null) {
            return;
        }
        bottomSheet.setKeyboardIsOpen(true);
    }

    public static final void singleStickerDownloaded$lambda$32(ConversationView conversationView, ZangiMessage zangiMessage) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(zangiMessage, "$zangiMessage");
        conversationView.updateItem(zangiMessage);
    }

    private final void startConferenceCall(final Group group) {
        ConferenceManager conferenceManager = ConferenceManager.INSTANCE;
        if (kotlin.jvm.internal.k.b(conferenceManager.getActiveGroupId(), "")) {
            if (ZangiPermissionUtils.hasPermission(getContext(), 1001, true, new ZangiPermissionUtils.OnPermissionResult() {
                public final void onResult(ArrayList arrayList, boolean z) {
                    ConversationView.startConferenceCall$lambda$26(group, arrayList, z);
                }
            })) {
                conferenceManager.startCall(group.getFiledUid());
                Engine.getInstance().getScreenService().getArguments().putInt(Constants.CALL_SCREEN_STATE, 4);
                return;
            }
            return;
        }
        Conversation conversation = this.conversation;
        kotlin.jvm.internal.k.c(conversation);
        if (kotlin.jvm.internal.k.b(conversation.getConversationId(), conferenceManager.getActiveGroupId())) {
            BaseScreen.getScreenService().showCallScreen();
        } else {
            BaseScreen.showCustomToast(getContext(), 2131886705);
        }
    }

    public static final void startConferenceCall$lambda$26(Group group, ArrayList arrayList, boolean z) {
        kotlin.jvm.internal.k.f(group, "$group");
        if (z) {
            ConferenceManager.INSTANCE.startCall(group.getFiledUid());
            Engine.getInstance().getScreenService().getArguments().putInt(Constants.CALL_SCREEN_STATE, 4);
        }
    }

    public final void toolBarClick() {
        CharSequence conversationTitle;
        CharSequence conversationTitle2;
        Conversation conversation = this.conversation;
        boolean z = false;
        if (conversation != null && conversation.isFromServer()) {
            z = true;
        }
        if (!z && SystemClock.elapsedRealtime() - this.mLastClickTime >= 1000) {
            ConversationTitleView conversationTitleView = this.conversationTitleView;
            Boolean valueOf = (conversationTitleView == null || (conversationTitle2 = conversationTitleView.getConversationTitle()) == null) ? null : Boolean.valueOf(conversationTitle2.equals(getString(2131887003)));
            kotlin.jvm.internal.k.c(valueOf);
            if (valueOf.booleanValue()) {
                return;
            }
            ConversationTitleView conversationTitleView2 = this.conversationTitleView;
            Boolean valueOf2 = (conversationTitleView2 == null || (conversationTitle = conversationTitleView2.getConversationTitle()) == null) ? null : Boolean.valueOf(conversationTitle.equals(getString(2131887002)));
            kotlin.jvm.internal.k.c(valueOf2);
            if (valueOf2.booleanValue()) {
                return;
            }
            this.mLastClickTime = SystemClock.elapsedRealtime();
            Conversation conversation2 = this.conversation;
            if (conversation2 != null) {
                kotlin.jvm.internal.k.c(conversation2);
                if (conversation2.isSystemMessage()) {
                    return;
                }
                Conversation conversation3 = this.conversation;
                kotlin.jvm.internal.k.c(conversation3);
                if (conversation3.isGroup()) {
                    openGroupInfo();
                    return;
                }
                Conversation conversation4 = this.conversation;
                kotlin.jvm.internal.k.c(conversation4);
                if (conversation4.isPersonal()) {
                    openPersonalSharedMedia$default(this, null, 1, null);
                } else {
                    openContactInfo();
                }
            }
        }
    }

    public final void updateConferenceJoinView(List<GroupMember> list) {
        updateConferenceMembersCount(list != null ? list.size() : 0);
        configureConferenceCallInitiatorAvatar(list);
    }

    private final void updateConferenceMembersCount(int i) {
        String str;
        FragmentActivity activity = getActivity();
        if (activity == null || activity.isFinishing() || !isAdded()) {
            str = null;
        } else if (i > 1) {
            str = i + ' ' + getResources().getString(2131886880);
        } else {
            str = i + ' ' + getResources().getString(2131887449);
        }
        if (str != null) {
            ConversationScreen conversationScreen = this.conversationScreen;
            JoinView joinView = conversationScreen != null ? conversationScreen.getJoinView() : null;
            if (joinView == null) {
                return;
            }
            joinView.setMembersCountText(str);
        }
    }

    public static final void updateConversationWithMessage$lambda$43(ZangiMessage zangiMessage, ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        conversationView.updateItem(StorageService.INSTANCE.getMessageById(zangiMessage != null ? zangiMessage.getMsgId() : null));
    }

    private final boolean updateConversationWithNumber(String str, String str2, Contact contact) {
        String checkNumber;
        Conversation conversationByNumber;
        if (str == null || (checkNumber = checkNumber(str)) == null) {
            return false;
        }
        IConversationPresenter iConversationPresenter = this.presenter;
        if (iConversationPresenter == null || (conversationByNumber = iConversationPresenter.getConversationByNumber(str)) == null) {
            IConversationPresenter iConversationPresenter2 = this.presenter;
            conversationByNumber = iConversationPresenter2 != null ? iConversationPresenter2.getConversationByNumber(checkNumber) : null;
        }
        if (conversationByNumber != null && !TextUtils.isEmpty(str2)) {
            conversationByNumber.setDisplayEmail(str2);
        }
        if (conversationByNumber == null) {
            conversationByNumber = new Conversation();
            if (!TextUtils.isEmpty(str2)) {
                conversationByNumber.setDisplayEmail(str2);
            }
            if (contact != null) {
                conversationByNumber.createSingleChatWithContact(contact, checkNumber);
            } else {
                conversationByNumber.createSingleChat(checkNumber);
            }
            conversationByNumber.setLastUpdateDate(System.currentTimeMillis());
            StorageService.INSTANCE.createEmptyConversationForDraftText(conversationByNumber);
        }
        updateUIWithConversation(conversationByNumber, false);
        return true;
    }

    private final void updateGroupChatUi(final Conversation conversation) {
        if (isAdded()) {
            new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public final void run() {
                    ConversationView.updateGroupChatUi$lambda$34(ConversationView.this, conversation);
                }
            });
        }
    }

    public static final void updateGroupChatUi$lambda$34(ConversationView conversationView, Conversation conversation) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(conversation, "$conversation");
        if (conversationView.isAdded()) {
            Group group = conversation.getGroup();
            Conversation conversation2 = conversationView.conversation;
            if (conversation2 != null) {
                conversation2.setGroup(group);
            }
            ConversationTitleView conversationTitleView = conversationView.conversationTitleView;
            if (conversationTitleView != null) {
                ConversationTitleView.OnlineStatusEnum onlineStatusEnum = ConversationTitleView.OnlineStatusEnum.GROUP;
                String string = conversationView.getString(2131886880);
                kotlin.jvm.internal.k.e(string, "getString(R.string.members_lowercase_text)");
                String string2 = conversationView.getString(2131886651);
                kotlin.jvm.internal.k.e(string2, "getString(R.string.group_delete_title)");
                ConversationTitleView.setOnlineStatus$default(conversationTitleView, onlineStatusEnum, conversation.getConversationMembersString(string, string2), null, null, null, 28, null);
            }
            ConversationScreen conversationScreen = conversationView.conversationScreen;
            if (conversationScreen != null) {
                conversationScreen.isVisibleKickBottomLayout(conversation.isKicked());
            }
            BottomSheet bottomSheet = conversationView.bottomSheet;
            boolean z = false;
            if (bottomSheet != null && !bottomSheet.getKeyboardIsOpen()) {
                z = true;
            }
            if (z) {
                BottomSheet bottomSheet2 = conversationView.bottomSheet;
                conversationView.hideKeyPad(bottomSheet2 != null ? bottomSheet2.getMessageInput() : null);
            }
        }
    }

    public static final void updateMessageItem$lambda$84(ConversationView conversationView, ZangiMessage zangiMessage) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        kotlin.jvm.internal.k.f(zangiMessage, "$message");
        conversationView.updateItem(zangiMessage);
    }

    public final void updateStealthMode() {
        Conversation conversation = this.conversation;
        boolean z = false;
        if (conversation != null && conversation.isStealthModeOn()) {
            ConversationScreen conversationScreen = this.conversationScreen;
            RecyclerView recyclerView = conversationScreen != null ? conversationScreen.getRecyclerView() : null;
            if (recyclerView != null) {
                recyclerView.setBackground(androidx.core.content.a.e(MainApplication.Companion.getMainContext(), 2131231860));
            }
            ConversationManager.INSTANCE.turnOffScreenRecord();
            onStealthModePositiveCallback();
            return;
        }
        ConversationScreen conversationScreen2 = this.conversationScreen;
        RecyclerView recyclerView2 = conversationScreen2 != null ? conversationScreen2.getRecyclerView() : null;
        if (recyclerView2 != null) {
            recyclerView2.setBackground(null);
        }
        Conversation conversation2 = this.conversation;
        if (!(conversation2 != null && conversation2.getVisibilityStatus() == 1)) {
            Conversation conversation3 = this.conversation;
            if (conversation3 != null && !conversation3.isPreventCaptureModeOn()) {
                z = true;
            }
            if (z) {
                ConversationManager.turnONScreenRecord$default(ConversationManager.INSTANCE, null, 1, null);
            }
        }
        onStealthModeNegativeCallback();
    }

    public final void updateTitleContactNameAndAvatar() {
        Resources resources;
        ContactNumber contactNumber;
        Conversation conversation = this.conversation;
        String str = null;
        if ((conversation != null ? conversation.getConversationJid() : null) != null) {
            Conversation conversation2 = this.conversation;
            kotlin.jvm.internal.k.c(conversation2);
            String conversationJid = conversation2.getConversationJid();
            kotlin.jvm.internal.k.c(conversationJid);
            if (!(conversationJid.length() == 0)) {
                ConversationTitleView conversationTitleView = this.conversationTitleView;
                if (conversationTitleView != null) {
                    conversationTitleView.configureAvatar(this.conversation);
                }
                Conversation conversation3 = this.conversation;
                if (conversation3 != null && conversation3.isPersonal()) {
                    ConversationTitleView conversationTitleView2 = this.conversationTitleView;
                    if (conversationTitleView2 != null) {
                        Context context = getContext();
                        conversationTitleView2.setConversationTitle(context != null ? context.getString(2131887153) : null);
                    }
                } else {
                    ConversationTitleView conversationTitleView3 = this.conversationTitleView;
                    if (conversationTitleView3 != null) {
                        Conversation conversation4 = this.conversation;
                        conversationTitleView3.setConversationTitle(conversation4 != null ? conversation4.getName() : null);
                    }
                }
                Conversation conversation5 = this.conversation;
                if (!(conversation5 != null && conversation5.isGroup()) || this.conversation == null) {
                    Conversation conversation6 = this.conversation;
                    if (((conversation6 == null || (contactNumber = conversation6.getContactNumber()) == null) ? null : contactNumber.getFirstContact()) != null) {
                        this.contactIsExist = true;
                        hideOrShowTopView$default(this, 8, false, 2, null);
                        addContactItem(false);
                        return;
                    } else {
                        Conversation conversation7 = this.conversation;
                        if (((conversation7 == null || conversation7.isPersonal()) ? false : true) && !this.isInSearchMode) {
                            this.contactIsExist = false;
                            hideOrShowTopView(0, this._extandedBar != null && getExtandedBar().getVisibility() == 0);
                        }
                        addContactItem(true);
                        return;
                    }
                }
                return;
            }
        }
        ConversationTitleView conversationTitleView4 = this.conversationTitleView;
        if (conversationTitleView4 == null) {
            return;
        }
        Context context2 = getContext();
        if (context2 != null && (resources = context2.getResources()) != null) {
            str = resources.getString(2131887003);
        }
        conversationTitleView4.setConversationTitle(str);
    }

    public static final void updateUIWithConversation$lambda$16(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        if (conversationView.didAppearTimer != null) {
            conversationView.addContactItem(true);
        }
    }

    public static final void updateUIWithConversation$lambda$18$lambda$17(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        conversationView.onResumeAsync();
    }

    public static void updateVoiceItemIfNeeded$default(ConversationView conversationView, long j, boolean z, boolean z6, int i, Object obj) {
        if ((i & 2) != 0) {
            z = false;
        }
        if ((i & 4) != 0) {
            z6 = false;
        }
        conversationView.updateVoiceItemIfNeeded(j, z, z6);
    }

    private final void videoCallMenuClick() {
        if (ZangiPermissionUtils.hasPermission(getActivity(), 1009, true, new ZangiPermissionUtils.OnPermissionResult() {
            public final void onResult(ArrayList arrayList, boolean z) {
                ConversationView.videoCallMenuClick$lambda$24(ConversationView.this, arrayList, z);
            }
        })) {
            makeCall(true);
        }
    }

    public static final void videoCallMenuClick$lambda$24(ConversationView conversationView, ArrayList arrayList, boolean z) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        if (z) {
            conversationView.makeCall(true);
        }
    }

    public static final void viewDidAppear$lambda$19(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        if (conversationView.didAppearTimer != null) {
            conversationView.addContactItem(true);
        }
    }

    public static final void viewDidAppear$lambda$20(ConversationView conversationView) {
        kotlin.jvm.internal.k.f(conversationView, "this$0");
        BottomSheet bottomSheet = conversationView.bottomSheet;
        if (bottomSheet != null) {
            bottomSheet.configureFantasticGroup();
        }
        conversationView.checkHasEditOrNo(conversationView.conversation);
        conversationView.getIncompleteTextIfInNotGifState(conversationView.conversation);
        if (conversationView.isForceDeleteReplyView) {
            BottomSheet bottomSheet2 = conversationView.bottomSheet;
            if (bottomSheet2 != null) {
                bottomSheet2.replyCancelButtonClick();
            }
            conversationView.isForceDeleteReplyView = false;
        } else {
            conversationView.checkHasReplyOrNo(conversationView.conversation);
        }
        conversationView.initAdapterScrollListener();
        conversationView.isViewAppeard = true;
        conversationView.scrollToMsgId();
    }

    public final void addContactItem(boolean z) {
        Context context = getContext();
        if (context == null) {
            context = MainApplication.Companion.getMainContext();
        }
        kotlin.jvm.internal.k.e(context, "context ?: MainApplication.getMainContext()");
        Menu menu = this.menu;
        MenuItem findItem = menu != null ? menu.findItem(MenuIds.ADD_CONTACT_MENU_ID.getValue()) : null;
        Conversation conversation = this.conversation;
        if (conversation != null && conversation.isFromServer()) {
            return;
        }
        Conversation conversation2 = this.conversation;
        if (conversation2 != null && conversation2.isPersonal()) {
            return;
        }
        Conversation conversation3 = this.conversation;
        if (conversation3 != null && conversation3.isSystemMessage()) {
            return;
        }
        Conversation conversation4 = this.conversation;
        if (conversation4 != null && conversation4.isNew()) {
            return;
        }
        if (z) {
            if (findItem != null) {
                findItem.setVisible(true);
            }
            if (findItem == null) {
                return;
            }
            findItem.setEnabled(true);
            return;
        }
        if (findItem != null) {
            findItem.setVisible(false);
        }
        if (findItem == null) {
            return;
        }
        findItem.setEnabled(false);
    }

    public final void addItem(ZangiMessage zangiMessage) {
        kotlin.jvm.internal.k.f(zangiMessage, "msg");
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.addItem(zangiMessage);
        }
    }

    public void arrowDownClick() {
        Log.info("CHAT_SEARCH ", new String[]{"arrowDownClick "});
        IChatSearchHolder iChatSearchHolder = this.chatSearchHolder;
        if (iChatSearchHolder != null) {
            if (this.searchBy == SearchBy.DATE) {
                if (iChatSearchHolder != null) {
                    iChatSearchHolder.goToPrev();
                }
            } else if (iChatSearchHolder != null) {
                iChatSearchHolder.goToNext();
            }
        }
    }

    public void arrowUpClick() {
        Log.info("CHAT_SEARCH ", new String[]{"arrowUpClick "});
        IChatSearchHolder iChatSearchHolder = this.chatSearchHolder;
        if (iChatSearchHolder != null) {
            if (this.searchBy == SearchBy.DATE) {
                if (iChatSearchHolder != null) {
                    iChatSearchHolder.goToNext();
                }
            } else if (iChatSearchHolder != null) {
                iChatSearchHolder.goToPrev();
            }
        }
    }

    @Override
    public void buttonsClick(int i) {
        if (i == 0) {
            BottomSheet bottomSheet = this.bottomSheet;
            if (bottomSheet != null) {
                bottomSheet.backFromReactionMode();
            }
            ConversationAdapter conversationAdapter = this.conversationAdapter;
            if (conversationAdapter != null) {
                conversationAdapter.onMenuCloseButtonClick();
                return;
            }
            return;
        }
        if (i == ConversationViewExtendBarTags.COPY_BUTTON.getValue()) {
            ConversationAdapter conversationAdapter2 = this.conversationAdapter;
            if (conversationAdapter2 != null) {
                conversationAdapter2.onMenuCopyButtonClick();
                return;
            }
            return;
        }
        if (i == ConversationViewExtendBarTags.INFO_BUTTON.getValue()) {
            ConversationAdapter conversationAdapter3 = this.conversationAdapter;
            if (conversationAdapter3 != null) {
                conversationAdapter3.onMenuInfoButtonClick();
                return;
            }
            return;
        }
        if (i == ConversationViewExtendBarTags.REPLY_BUTTON.getValue()) {
            if (this.isInSearchMode) {
                closeSerchViewAndBottomSheetBackToFirstState();
            }
            ConversationAdapter conversationAdapter4 = this.conversationAdapter;
            if (conversationAdapter4 != null) {
                conversationAdapter4.onMenuReplyButtonClick();
                return;
            }
            return;
        }
        if (i == ConversationViewExtendBarTags.FORWARD_BUTTON.getValue()) {
            ConversationManager conversationManager = ConversationManager.INSTANCE;
            if (conversationManager.stealthModeExpiredGoToPremiumScreen()) {
                return;
            }
            conversationManager.navigate(getContext(), new ConversationView$buttonsClick$1(this));
            return;
        }
        if (i == ConversationViewExtendBarTags.DELETE_BUTTON.getValue()) {
            if (this.isInSearchMode) {
                closeSerchViewAndBottomSheetBackToFirstState();
            }
            ConversationAdapter conversationAdapter5 = this.conversationAdapter;
            if (conversationAdapter5 != null) {
                conversationAdapter5.onMenuDeleteButtonClick();
            }
        }
    }

    public final void callBack(String str) {
        kotlin.jvm.internal.k.f(str, "zangiNumber");
        if (BlockContactServiceImpl.getInstance().getZangiBlockNumber(str) != null) {
            CallHelper.blockedContactCallOrSendMessageAlert(getActivity(), str, (blockNumberCallback) null);
            return;
        }
        ConversationScreen conversationScreen = this.conversationScreen;
        kotlin.jvm.internal.k.c(conversationScreen);
        RelativeLayout callBackProgressLayout = conversationScreen.getCallBackProgressLayout();
        ConversationScreen conversationScreen2 = this.conversationScreen;
        showCallBackProgress(callBackProgressLayout, conversationScreen2, conversationScreen2 != null ? conversationScreen2.getCallBackProgressBar() : null);
        ConversationScreen conversationScreen3 = this.conversationScreen;
        kotlin.jvm.internal.k.c(conversationScreen3);
        if (makeCallBack(str, conversationScreen3.getCallBackProgressLayout(), this.conversationScreen)) {
            return;
        }
        hideCallBackProgress();
    }

    @Override
    public void cancelRecording() {
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.updatePlayItems();
        }
    }

    public final void changeJoinView() {
        Conversation conversation = this.conversation;
        if (conversation != null) {
            boolean z = false;
            if (conversation != null && conversation.isGroup()) {
                z = true;
            }
            if (z) {
                DispatchKt.mainThread(new ConversationView$changeJoinView$1(this));
            }
        }
    }

    public final void changeVoicePanelPlayPauseMode(int i) {
        getVoiceItemTopPanel().changePlayButton(Integer.valueOf(i));
    }

    public final void changesendImageVoiceItemBAckgroundAndImage(boolean z, boolean z6) {
    }

    public final void checkUserBackground() {
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen != null) {
            conversationScreen.checkUserBackground(this.conversation, true);
        }
    }

    public final void cleareFocuse() {
        AppCompatEditText messageInput;
        BottomSheet bottomSheet = this.bottomSheet;
        if (bottomSheet == null || (messageInput = bottomSheet.getMessageInput()) == null) {
            return;
        }
        messageInput.clearFocus();
    }

    public void closeImageBrowser() {
        if (getActivity() instanceof CallingFragmentActivity) {
            CallingFragmentActivity.getInstance().enableDisableVideoWhenUserNavigateOtherPage(0);
        }
        clearBadges();
    }

    public final boolean closeSerchViewAndBottomSheetBackToFirstState() {
        bc.g.d(bc.l1.a, (jb.g) null, (bc.l0) null, new ConversationView$closeSerchViewAndBottomSheetBackToFirstState$1(null), 3, (Object) null);
        if (!backFromSearchMode()) {
            return false;
        }
        keepAudioMessageDraftOrBackToFirstState();
        ConversationManager conversationManager = ConversationManager.INSTANCE;
        if (conversationManager == null) {
            return true;
        }
        conversationManager.setKeepVoiceDraft(false);
        return true;
    }

    public final void configureConferenceCallInitiatorAvatar(List<GroupMember> list) {
        JoinView joinView;
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen == null || (joinView = conversationScreen.getJoinView()) == null) {
            return;
        }
        joinView.createAndLoadAvatar(list);
    }

    @Override
    public void contactListViewCreated() {
        Conversation conversation = this.conversation;
        boolean z = false;
        if (conversation != null && conversation.isGroup()) {
            z = true;
        }
        if (z) {
            initFilterableListView();
        }
    }

    public final void deleteMessage(ZangiMessage zangiMessage) {
        kotlin.jvm.internal.k.f(zangiMessage, "message");
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.deleteMessage(zangiMessage);
        }
    }

    @Override
    public void deleteSelectedMessage(ZangiMessage zangiMessage, boolean z) {
        if (zangiMessage == null) {
            return;
        }
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            long id = zangiMessage.getId();
            List<ZangiMessage> messages = getMessages();
            conversationAdapter.deleteUnreadInfoMessageIfLastMessageIsDeleted(id, messages != null ? messages.size() : -1);
        }
        ConversationAdapter conversationAdapter2 = this.conversationAdapter;
        if (conversationAdapter2 != null) {
            conversationAdapter2.deleteSelectedMessage(zangiMessage, z);
        }
    }

    public final int getAppBarHeight() {
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen != null) {
            return conversationScreen.getAppBarHeight();
        }
        return 0;
    }

    public final BottomSheet getBottomSheet() {
        return this.bottomSheet;
    }

    public final ChatSensor getChatSensor() {
        return this.chatSensor;
    }

    @Override
    public Context getContextForVoiceView() {
        Context context = getContext();
        return context == null ? MainApplication.Companion.getMainContext() : context;
    }

    public final Conversation getConversation() {
        return this.conversation;
    }

    @Override
    public Context getConversationContext() {
        return getContext();
    }

    public final ConversationScreen getConversationScreen() {
        return this.conversationScreen;
    }

    public final ConversationTitleView getConversationTitleView() {
        return this.conversationTitleView;
    }

    public final int getCount() {
        return this._count;
    }

    public AnimatorView getCurrentThumbView(Long l, Long l7) {
        return getCurrentThumbView(l.longValue(), l7.longValue());
    }

    public final float getDELTA_FOR_SCROLL_START() {
        return this.DELTA_FOR_SCROLL_START;
    }

    @Override
    public n0.a getDefaultViewModelCreationExtras() {
        return androidx.lifecycle.h.a(this);
    }

    public GifLinearLayout getGifLayout() {
        ConversationScreen conversationScreen = this.conversationScreen;
        kotlin.jvm.internal.k.c(conversationScreen);
        return conversationScreen.getGifsLinearLayout();
    }

    public final boolean getInVisibleMenuFromImageBrowser() {
        return this.inVisibleMenuFromImageBrowser;
    }

    public final boolean getKeypadIsOpen() {
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen == null) {
            return false;
        }
        Rect rect = new Rect();
        conversationScreen.getWindowVisibleDisplayFrame(rect);
        int height = conversationScreen.getRootView().getHeight();
        return ((double) (height - rect.bottom)) > ((double) height) * 0.15d;
    }

    public final boolean getLeftHandedMode() {
        return this.leftHandedMode;
    }

    public final float getMAX_DELTA_FOR_SCROLL_Y() {
        return this.MAX_DELTA_FOR_SCROLL_Y;
    }

    public ChatSensor.RECORD_STATE getRecordState() {
        return this.recordState;
    }

    public final boolean getScrollStart() {
        return this.scrollStart;
    }

    public final String getTAG() {
        return this.TAG;
    }

    public final VoiceItemTopPanel getVoiceItemTopPanel() {
        ConversationScreen conversationScreen;
        ConversationScreen conversationScreen2 = this.conversationScreen;
        if ((conversationScreen2 != null ? conversationScreen2.getMVoiceItemTopPanel() : null) == null && (conversationScreen = this.conversationScreen) != null) {
            conversationScreen.createVoicePanel(this.toolBarRLayout);
        }
        ConversationScreen conversationScreen3 = this.conversationScreen;
        VoiceItemTopPanel mVoiceItemTopPanel = conversationScreen3 != null ? conversationScreen3.getMVoiceItemTopPanel() : null;
        kotlin.jvm.internal.k.c(mVoiceItemTopPanel);
        return mVoiceItemTopPanel;
    }

    public final float getXStart() {
        return this.xStart;
    }

    public final float getYStart() {
        return this.yStart;
    }

    public final boolean getYoutubeVideoPlayingMode() {
        return this.youtubeVideoPlayingMode;
    }

    @Override
    public void gifPreviewDestroyed() {
        AppBarLayout appBarLayout = this.appBar;
        if (appBarLayout != null) {
            ExtensionsKt.show(appBarLayout);
        }
    }

    @Override
    public void groupEvent(final Conversation conversation, final String str) {
        kotlin.jvm.internal.k.f(conversation, "conversation");
        kotlin.jvm.internal.k.f(str, "action");
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public final void run() {
                ConversationView.groupEvent$lambda$33(ConversationView.this, conversation, str);
            }
        });
    }

    public boolean hasInputText() {
        PasteEditText messageInput;
        Editable text;
        BottomSheet bottomSheet = this.bottomSheet;
        return ((bottomSheet == null || (messageInput = bottomSheet.getMessageInput()) == null || (text = messageInput.getText()) == null) ? 0 : text.length()) > 0;
    }

    protected final void hideCallBackProgress() {
        ConversationScreen conversationScreen = this.conversationScreen;
        RelativeLayout callBackProgressLayout = conversationScreen != null ? conversationScreen.getCallBackProgressLayout() : null;
        if (callBackProgressLayout != null) {
            callBackProgressLayout.setVisibility(8);
        }
        HomeActivity.tabLayout.setEnabled(true);
        enableDisableView(this.conversationScreen, true);
    }

    @Override
    public void hideConversationTitleContactAvatar() {
        ConversationTitleView conversationTitleView = this.conversationTitleView;
        if (conversationTitleView == null) {
            return;
        }
        conversationTitleView.setShowOrHideContactAvatar(false);
    }

    public void hideKeyPadFromBottomSheet(View view) {
        hideKeyPad(view);
    }

    public final void hideLockView(boolean z) {
        ZAnimationView lottieAnimationView = getLottieAnimationView();
        if (lottieAnimationView != null) {
            lottieAnimationView.setVisibility(8);
        }
        ZAnimationView lottieAnimationView2 = getLottieAnimationView();
        if (lottieAnimationView2 != null) {
            lottieAnimationView2.cancelAnimation();
        }
        ZAnimationView lottieAnimationView3 = getLottieAnimationView();
        if (lottieAnimationView3 != null) {
            lottieAnimationView3.setAnimationProgress(0.0f);
        }
        new Handler().postDelayed(new Runnable() {
            @Override
            public final void run() {
                ConversationView.hideLockView$lambda$52(ConversationView.this);
            }
        }, 200L);
    }

    public final void hideRecorderVisualizerView() {
        CountDownTimer countDownTimer = this.recordTimer;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
        this.recordTimer = null;
        ConversationManager.INSTANCE.setVoiceRecordingEnabled(true);
    }

    public final void hideToolbarSearchView(View view) {
        if (view != null) {
            view.setVisibility(8);
        }
        RelativeLayout relativeLayout = this.toolBarRLayout;
        kotlin.jvm.internal.k.c(relativeLayout);
        relativeLayout.removeView(view);
    }

    public final void hideVoicePanel(ZangiMessage zangiMessage, boolean z) {
        if (kotlin.jvm.internal.k.b(getVoiceItemTopPanel().getVoiceId(), zangiMessage != null ? zangiMessage.getMsgId() : null) || z) {
            VoiceItemTopPanel.hideWithAnimation$default(getVoiceItemTopPanel(), 0L, null, null, 7, null);
            ConversationScreen conversationScreen = this.conversationScreen;
            if (conversationScreen == null) {
                return;
            }
            conversationScreen.setMVoiceItemTopPanel(null);
        }
    }

    public final boolean imageBrowserIsOpen(FragmentActivity fragmentActivity) {
        if (fragmentActivity == null) {
            return false;
        }
        if (fragmentActivity.getSupportFragmentManager().o0() > 1 && this.imageBrowser != null && fragmentActivity.getSupportFragmentManager().j0("ForwardMessageFragment") == null) {
            ImageBrowser imageBrowser = this.imageBrowser;
            if (imageBrowser != null) {
                ImageAnimation.Companion.closeImageBrowser(imageBrowser, false);
                closeImageBrowser();
            }
            this.imageBrowser = null;
        } else {
            if (fragmentActivity.getSupportFragmentManager().o0() <= 1 || fragmentActivity.getSupportFragmentManager().j0("ForwardMessageFragment") == null) {
                if (fragmentActivity.getSupportFragmentManager().o0() <= 1 || fragmentActivity.getSupportFragmentManager().H0()) {
                    return false;
                }
                try {
                    fragmentActivity.getSupportFragmentManager().Z0();
                    return false;
                } catch (Exception unused) {
                    return false;
                }
            }
            if (!fragmentActivity.getSupportFragmentManager().H0()) {
                try {
                    FragmentManager supportFragmentManager = fragmentActivity.getSupportFragmentManager();
                    kotlin.jvm.internal.k.e(supportFragmentManager, "supportFragmentManager");
                    Fragment j0 = supportFragmentManager.j0("ForwardMessageFragment");
                    if (j0 != null) {
                        supportFragmentManager.n().p(j0).j();
                        fragmentActivity.getSupportFragmentManager().Z0();
                        if (ExtensionsKt.isShow(getExtandedBar())) {
                            setStatusBarColor(ColorsManger.status_bar_gray_color);
                        }
                    }
                } catch (Exception unused2) {
                    fragmentActivity.onBackPressed();
                }
            }
        }
        return true;
    }

    @Override
    public void infoLinkClick() {
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(getString(2131887326)));
        if (intent.resolveActivity(MainApplication.Companion.getMainContext().getPackageManager()) != null) {
            startActivity(intent);
        }
    }

    public final void initAlphaAnimationDateFooter() {
        AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
        this.alphaAnimationHideDateFooter = alphaAnimation;
        alphaAnimation.setDuration(500L);
        AlphaAnimation alphaAnimation2 = this.alphaAnimationHideDateFooter;
        AlphaAnimation alphaAnimation3 = null;
        if (alphaAnimation2 == null) {
            kotlin.jvm.internal.k.q("alphaAnimationHideDateFooter");
            alphaAnimation2 = null;
        }
        alphaAnimation2.setStartOffset(800L);
        AlphaAnimation alphaAnimation4 = this.alphaAnimationHideDateFooter;
        if (alphaAnimation4 == null) {
            kotlin.jvm.internal.k.q("alphaAnimationHideDateFooter");
        } else {
            alphaAnimation3 = alphaAnimation4;
        }
        alphaAnimation3.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationEnd(Animation animation) {
                ConversationScreen conversationScreen = ConversationView.this.getConversationScreen();
                TextView dateFooterView = conversationScreen != null ? conversationScreen.getDateFooterView() : null;
                if (dateFooterView == null) {
                    return;
                }
                dateFooterView.setVisibility(8);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }

            @Override
            public void onAnimationStart(Animation animation) {
            }
        });
    }

    public final boolean isActionsBottomSheetOpened() {
        return this.isActionsBottomSheetOpened;
    }

    public final boolean isBlocked() {
        return this.isBlocked;
    }

    @Override
    public void isChangeWithAnimation(boolean z) {
        ConversationTitleView conversationTitleView = this.conversationTitleView;
        if (conversationTitleView == null) {
            return;
        }
        conversationTitleView.setChangeWithAnimation(z);
    }

    public boolean isConversationInSearchMode() {
        return this.isInSearchMode;
    }

    public final void isDisabledMenuCallButton(boolean z, int i) {
        MenuItem menuItem = this.callMenuItem;
        if (menuItem != null) {
            menuItem.setCheckable(!z);
        }
        MenuItem menuItem2 = this.callMenuItem;
        if (menuItem2 != null) {
            menuItem2.setEnabled(!z);
        }
        MenuItem menuItem3 = this.callMenuItem;
        if (menuItem3 != null) {
            menuItem3.setIcon(i);
        }
    }

    public final boolean isForceDeleteReplyView() {
        return this.isForceDeleteReplyView;
    }

    public final boolean isForwardMode() {
        return this.isForwardMode;
    }

    public final boolean isFragmentVisible() {
        FragmentManager supportFragmentManager;
        FragmentActivity activity = getActivity();
        if (activity == null || (supportFragmentManager = activity.getSupportFragmentManager()) == null) {
            return false;
        }
        if (supportFragmentManager.o0() != 0) {
            return kotlin.jvm.internal.k.b(supportFragmentManager.j0(supportFragmentManager.n0(supportFragmentManager.o0() - 1).getName()), this) && this.isInFront;
        }
        FragmentActivity activity2 = getActivity();
        Boolean bool = null;
        if (activity2 != null && !activity2.isFinishing() && isAdded()) {
            bool = Boolean.TRUE;
        }
        return kotlin.jvm.internal.k.b(bool, Boolean.TRUE) && this.isInFront;
    }

    public final boolean isInSearchMode() {
        return this.isInSearchMode;
    }

    public final boolean isRtl() {
        return this.isRtl;
    }

    public final void isShowCopyButton(boolean z) {
        if (this.appBar == null) {
            return;
        }
        getExtandedBar().isShowInfoOrCopyOrReplyButton(z, ConversationViewExtendBarTags.COPY_BUTTON.getValue());
    }

    public final void isShowInfoButton(boolean z) {
        if (this.appBar == null) {
            return;
        }
        getExtandedBar().isShowInfoOrCopyOrReplyButton(z, ConversationViewExtendBarTags.INFO_BUTTON.getValue());
    }

    public final void isShowReplyButton(boolean z) {
        if (this.appBar == null) {
            return;
        }
        getExtandedBar().isShowInfoOrCopyOrReplyButton(z, ConversationViewExtendBarTags.REPLY_BUTTON.getValue());
    }

    public boolean isUserOnline() {
        Conversation conversation = this.conversation;
        boolean z = false;
        if (conversation != null && conversation.isGroup()) {
            z = true;
        }
        if (z) {
            return true;
        }
        return this.isUserOnline;
    }

    @Override
    public void kickBottomonClick() {
        c.a alertDialog = AlertDialogUtils.getAlertDialog(getContext());
        alertDialog.i(getString(2131886473));
        alertDialog.d(true);
        String string = getString(2131886274);
        kotlin.jvm.internal.k.e(string, "getString(R.string.cancel)");
        String upperCase = string.toUpperCase();
        kotlin.jvm.internal.k.e(upperCase, "this as java.lang.String).toUpperCase()");
        alertDialog.k(upperCase, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                ConversationView.kickBottomonClick$lambda$46(dialogInterface, i);
            }
        });
        String string2 = getString(2131886472);
        kotlin.jvm.internal.k.e(string2, "getString(R.string.delet…group_button_action_text)");
        String upperCase2 = string2.toUpperCase();
        kotlin.jvm.internal.k.e(upperCase2, "this as java.lang.String).toUpperCase()");
        alertDialog.p(upperCase2, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                ConversationView.kickBottomonClick$lambda$47(ConversationView.this, dialogInterface, i);
            }
        });
        androidx.appcompat.app.c a = alertDialog.a();
        kotlin.jvm.internal.k.e(a, "builder.create()");
        a.show();
        Window window = a.getWindow();
        kotlin.jvm.internal.k.c(window);
        window.setLayout(AlertDialogUtils.getAlertSize(), -2);
        AlertDialogUtils.setCurrentDialog(a);
    }

    @Override
    public void leavedFromConversation() {
        Conversation conversation = this.conversation;
        if (conversation != null) {
            kotlin.jvm.internal.k.c(conversation);
            if (conversation.getGroup() != null) {
                Conversation conversation2 = this.conversation;
                kotlin.jvm.internal.k.c(conversation2);
                Group group = conversation2.getGroup();
                kotlin.jvm.internal.k.c(group);
                if (group.getActualMembers() != null) {
                    Conversation conversation3 = this.conversation;
                    kotlin.jvm.internal.k.c(conversation3);
                    Group group2 = conversation3.getGroup();
                    kotlin.jvm.internal.k.c(group2);
                    if (group2.getActualMembers().contains(new GroupMember(getUsername(), MemberRole.OWNER))) {
                        ConversationScreen conversationScreen = this.conversationScreen;
                        if (conversationScreen != null) {
                            conversationScreen.isVisibleKickBottomLayout(false);
                            return;
                        }
                        return;
                    }
                    ConversationScreen conversationScreen2 = this.conversationScreen;
                    if (conversationScreen2 != null) {
                        conversationScreen2.isVisibleKickBottomLayout(true);
                    }
                }
            }
        }
    }

    @Override
    public void mediaFileConverte(final ZangiMessagingService.MediaFileState mediaFileState, final int i, final String str, final long j) {
        kotlin.jvm.internal.k.f(mediaFileState, "state");
        kotlin.jvm.internal.k.f(str, "msgId");
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public final void run() {
                ConversationView.mediaFileConverte$lambda$37(ConversationView.this, str, mediaFileState, i, j);
            }
        });
    }

    @Override
    public void memoryIsFull() {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public final void run() {
                ConversationView.memoryIsFull$lambda$36(ConversationView.this);
            }
        });
    }

    @Override
    public void messageDeleted(String str) {
        kotlin.jvm.internal.k.f(str, "msgId");
        RecalculateMessageWidthTask recalculateMessageWidthTask = new RecalculateMessageWidthTask(this);
        ThreadPoolExecutor mainExecutor2 = MainApplication.Companion.getMainExecutor2();
        ZangiMessage[] zangiMessageArr = new ZangiMessage[1];
        IConversationPresenter iConversationPresenter = this.presenter;
        zangiMessageArr[0] = iConversationPresenter != null ? iConversationPresenter.getMessageById(str) : null;
        recalculateMessageWidthTask.executeOnExecutor(mainExecutor2, zangiMessageArr);
    }

    @Override
    public void messageEdited(final ZangiMessage zangiMessage) {
        kotlin.jvm.internal.k.f(zangiMessage, "message");
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public final void run() {
                ConversationView.messageEdited$lambda$41(ConversationView.this, zangiMessage);
            }
        });
    }

    @Override
    public void messageRecived(final ZangiMessage zangiMessage) {
        kotlin.jvm.internal.k.f(zangiMessage, "message");
        MainApplication.Companion.getMainHandler().post(new Runnable() {
            @Override
            public final void run() {
                ConversationView.messageRecived$lambda$31(ConversationView.this, zangiMessage);
            }
        });
    }

    @Override
    public void messageSent(final ZangiMessage zangiMessage) {
        kotlin.jvm.internal.k.f(zangiMessage, "message");
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public final void run() {
                ConversationView.messageSent$lambda$77(ConversationView.this, zangiMessage);
            }
        });
    }

    @Override
    public void notZangiUser(ZangiMessage zangiMessage) {
    }

    @Override
    public void onActivityResult(int i, int i7, Intent intent) {
        super.onActivityResult(i, i7, intent);
        if (i == BaseScreen.REQUEST_CODE_BROWS_FILE && i7 == -1) {
            if ((intent != null ? intent.getData() : null) != null) {
                Uri data = intent.getData();
                kotlin.jvm.internal.k.c(data);
                sendUriAsDocument(data);
                return;
            }
            if ((intent != null ? intent.getClipData() : null) != null) {
                ClipData clipData = intent.getClipData();
                kotlin.jvm.internal.k.c(clipData);
                int itemCount = clipData.getItemCount();
                for (int i8 = 0; i8 < itemCount; i8++) {
                    Uri uri = clipData.getItemAt(i8).getUri();
                    kotlin.jvm.internal.k.e(uri, "clipData.getItemAt(i).uri");
                    sendUriAsDocument(uri);
                }
            }
        }
    }

    public final void onBack() {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.onBack():void");
    }

    @Override
    public void onClearButtonClik() {
        this.searchBy = SearchBy.MESSAGE;
        Log.info("CHAT_SEARCH ", new String[]{"onClearButtonClik "});
    }

    @Override
    public void onCloseImageViewClick() {
        onStealthModeNegativeCallback();
    }

    public void onConfigurationChanged(android.content.res.Configuration r6) {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.onConfigurationChanged(android.content.res.Configuration):void");
    }

    @Override
    public void onCreate(android.os.Bundle r7) {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.onCreate(android.os.Bundle):void");
    }

    public Animator onCreateAnimator(int i, boolean z, int i7) {
        View findViewById;
        if (!z || this.withoutAnimator) {
            return null;
        }
        ValueAnimator ofFloat = ValueAnimator.ofFloat(1.0f, 0.0f);
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen != null) {
            conversationScreen.setLayerType(2, null);
        }
        ofFloat.setInterpolator(new l0.c());
        FragmentActivity activity = getActivity();
        final int width = (activity == null || (findViewById = activity.findViewById(2131362423)) == null) ? 0 : findViewById.getWidth();
        ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public final void onAnimationUpdate(ValueAnimator valueAnimator) {
                ConversationView.onCreateAnimator$lambda$71$lambda$70(ConversationView.this, width, valueAnimator);
            }
        });
        ofFloat.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationCancel(Animator animator) {
                kotlin.jvm.internal.k.f(animator, "animation");
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                kotlin.jvm.internal.k.f(animator, "animation");
                ConversationScreen conversationScreen2 = ConversationView.this.getConversationScreen();
                if (conversationScreen2 != null) {
                    conversationScreen2.setLayerType(0, null);
                }
            }

            @Override
            public void onAnimationRepeat(Animator animator) {
                kotlin.jvm.internal.k.f(animator, "animation");
            }

            @Override
            public void onAnimationStart(Animator animator) {
                kotlin.jvm.internal.k.f(animator, "animation");
            }
        });
        ofFloat.setDuration(250L);
        return ofFloat;
    }

    public android.view.View onCreateView(android.view.LayoutInflater r6, android.view.ViewGroup r7, android.os.Bundle r8) {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle):android.view.View");
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        ZKeyboardHeightProvider zKeyboardHeightProvider = this.keyboardHeightProvider;
        if (zKeyboardHeightProvider != null) {
            zKeyboardHeightProvider.close();
        }
        Constants.SHOW_MENU = true;
        invalidateDidApearTimer();
        deInitBroadcastReceiveres();
        ConversationManager conversationManager = ConversationManager.INSTANCE;
        conversationManager.setMReplyMessage(null);
        RoomManager.INSTANCE.setConversation((Conversation) null);
        conversationManager.setHasVoiceDraft(false);
    }

    public void onDestroyView() {
        super.onDestroyView();
        ConversationManager.INSTANCE.turnONScreenRecord(getActivity());
        if (!(getActivity() instanceof CallingFragmentActivity)) {
            VoiceManager.INSTANCE.stopManager();
        }
        ConversationAvatar.Companion.getAvatarDrawableMap().clear();
        deInitBroadcastReceiveres();
        ZangiGalleryServiceImpl.getInstance().clearItems();
        MessageCalculation.Companion.removeAll();
        ConversationCellProgressManager.INSTANCE.cleareAll();
        MainApplication.Companion.setConversationViewContext((Context) null);
        ZReactionMenuManager.INSTANCE.reset();
        ZReactionSelectedMemberListManager.INSTANCE.reset();
    }

    public void onGifLongPress(GiphyResult giphyResult) {
        if (giphyResult != null) {
            openGifPreview(giphyResult);
        }
    }

    @Override
    public void onGifLongPressFromGifLinearLayout(GiphyResult giphyResult) {
        kotlin.jvm.internal.k.f(giphyResult, "giphyResult");
        openGifPreview(giphyResult);
    }

    @Override
    public void onHideJoinViewIfNeeded() {
        String activeGroupId = ConferenceManager.INSTANCE.getActiveGroupId();
        Conversation conversation = this.conversation;
        if (kotlin.jvm.internal.k.b(activeGroupId, conversation != null ? conversation.getConversationId() : null)) {
            hideOrShowJoinView(8, false);
        }
    }

    @Override
    public void onJoinViewClick() {
        if (SystemClock.elapsedRealtime() - this.mLastClickTime < 1000) {
            return;
        }
        this.mLastClickTime = SystemClock.elapsedRealtime();
        MediaAutoPlayNextManager.INSTANCE.cancelVoice();
        Conversation conversation = this.conversation;
        if (conversation != null) {
            if ((conversation != null ? conversation.getCallId() : null) != null) {
                Conversation conversation2 = this.conversation;
                kotlin.jvm.internal.k.c(conversation2);
                if (conversation2.hasConferenceCall()) {
                    ConferenceManager conferenceManager = ConferenceManager.INSTANCE;
                    if (!kotlin.jvm.internal.k.b(conferenceManager.getActiveGroupId(), "")) {
                        Conversation conversation3 = this.conversation;
                        if (kotlin.jvm.internal.k.b(conversation3 != null ? conversation3.getConversationId() : null, conferenceManager.getActiveGroupId())) {
                            BaseScreen.getScreenService().showCallScreen();
                            return;
                        } else {
                            BaseScreen.showCustomToast(getContext(), 2131886705);
                            return;
                        }
                    }
                    if (ZangiPermissionUtils.hasPermission(getContext(), 1001, true, new ZangiPermissionUtils.OnPermissionResult() {
                        public final void onResult(ArrayList arrayList, boolean z) {
                            ConversationView.onJoinViewClick$lambda$27(ConversationView.this, arrayList, z);
                        }
                    })) {
                        Conversation conversation4 = this.conversation;
                        kotlin.jvm.internal.k.c(conversation4);
                        String conversationId = conversation4.getConversationId();
                        Conversation conversation5 = this.conversation;
                        conferenceManager.joinCall(conversationId, conversation5 != null ? conversation5.getCallId() : null);
                    }
                }
            }
        }
    }

    public void onKeyboardHeightChanged(int i, int i7) {
        ZReactionMenuManager.INSTANCE.hide();
        changeFloatingActionButtonPosition(i);
    }

    public final void onManuReplyButtonClick(boolean z, ZangiMessage zangiMessage) {
        AppCompatEditText messageInput;
        Map smiliesMap;
        if (zangiMessage == null) {
            return;
        }
        ConversationManager conversationManager = ConversationManager.INSTANCE;
        if (!conversationManager.stealthModeExpiredGoToPremiumScreen() && conversationManager.getVoiceRecordingEnabled()) {
            hideOpened(false);
            BottomSheet bottomSheet = this.bottomSheet;
            if (bottomSheet != null) {
                bottomSheet.deleteReplyView();
            }
            if (z) {
                if (zangiMessage.getZangiMessageInfo() != null) {
                    ZangiMessageInfo zangiMessageInfo = zangiMessage.getZangiMessageInfo();
                    kotlin.jvm.internal.k.c(zangiMessageInfo);
                    if (zangiMessageInfo.getHasSmile() == 0) {
                        BottomSheet bottomSheet2 = this.bottomSheet;
                        if (bottomSheet2 != null) {
                            Context context = getContext();
                            String msg = zangiMessage.getMsg();
                            kotlin.jvm.internal.k.c(msg);
                            bottomSheet2.initReplyView(context, zangiMessage, msg);
                        }
                    }
                }
                ConversationAdapter conversationAdapter = this.conversationAdapter;
                if ((conversationAdapter == null || (smiliesMap = conversationAdapter.getSmiliesMap()) == null || smiliesMap.containsKey(zangiMessage.getMsgId())) ? false : true) {
                    String msg2 = zangiMessage.getMsg();
                    StringBuilder sb = new StringBuilder();
                    if (SmileGetterItem.Companion.parseEmojisResult(msg2, sb)) {
                        String sb2 = sb.toString();
                        Context context2 = getContext();
                        Spanned fromHtml = Html.fromHtml(sb2, new SmileGetterItem(context2 != null ? context2.getResources() : null, false), null);
                        int length = sb.length();
                        kotlin.jvm.internal.k.e(fromHtml, "smsg");
                        UiUtilKt.setCentredSpan(length, fromHtml);
                        BottomSheet bottomSheet3 = this.bottomSheet;
                        if (bottomSheet3 != null) {
                            bottomSheet3.initReplyView(getContext(), zangiMessage, fromHtml);
                        }
                    } else {
                        BottomSheet bottomSheet4 = this.bottomSheet;
                        if (bottomSheet4 != null) {
                            Context context3 = getContext();
                            kotlin.jvm.internal.k.c(msg2);
                            bottomSheet4.initReplyView(context3, zangiMessage, msg2);
                        }
                    }
                } else {
                    BottomSheet bottomSheet5 = this.bottomSheet;
                    if (bottomSheet5 != null) {
                        Context context4 = getContext();
                        ConversationAdapter conversationAdapter2 = this.conversationAdapter;
                        kotlin.jvm.internal.k.c(conversationAdapter2);
                        Map smiliesMap2 = conversationAdapter2.getSmiliesMap();
                        kotlin.jvm.internal.k.c(smiliesMap2);
                        Object obj = smiliesMap2.get(zangiMessage.getMsgId());
                        kotlin.jvm.internal.k.c(obj);
                        bottomSheet5.initReplyView(context4, zangiMessage, (CharSequence) obj);
                    }
                }
            }
            BottomSheet bottomSheet6 = this.bottomSheet;
            if (bottomSheet6 != null) {
                bottomSheet6.setReplyViewShow(true);
            }
            BottomSheet bottomSheet7 = this.bottomSheet;
            if (bottomSheet7 == null || (messageInput = bottomSheet7.getMessageInput()) == null) {
                return;
            }
            messageInput.requestFocus();
        }
    }

    public void onMessageClick(List<Integer> list, Object obj, Contact contact, ContactNumber contactNumber) {
        if (this.isOutgoinSMS) {
            return;
        }
        hideKeyBoardInConversationViewClick();
        initActionMenuFragment(list, obj, contact, contactNumber);
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        final String conversationJid;
        BottomSheet bottomSheet;
        ReplyView mReplyView;
        kotlin.jvm.internal.k.f(menuItem, "item");
        int itemId = menuItem.getItemId();
        if (itemId == 16908332) {
            ConversationManager.INSTANCE.navigate(getContext(), new ConversationView$onOptionsItemSelected$1(this));
        } else {
            boolean z = false;
            if (itemId == MenuIds.CALL_MENU_ID.getValue()) {
                callMenuClick(false);
            } else if (itemId == MenuIds.VIDEO_CALL_MENU_ID.getValue()) {
                videoCallMenuClick();
            } else if (itemId == MenuIds.SHARED_MEDIA_MENU_ID.getValue()) {
                ConversationManager.INSTANCE.navigate(getContext(), new ConversationView$onOptionsItemSelected$2(this));
            } else if (itemId == MenuIds.ADD_CONTACT_MENU_ID.getValue()) {
                ConversationManager.INSTANCE.navigate(getContext(), new ConversationView$onOptionsItemSelected$3(this));
            } else if (itemId == MenuIds.ARROW_UP_MENU_ID.getValue()) {
                IChatSearchHolder iChatSearchHolder = this.chatSearchHolder;
                if (iChatSearchHolder != null) {
                    iChatSearchHolder.goToPrev();
                }
            } else if (itemId == MenuIds.ARROW_DOWN_MENU_ID.getValue()) {
                IChatSearchHolder iChatSearchHolder2 = this.chatSearchHolder;
                if (iChatSearchHolder2 != null) {
                    iChatSearchHolder2.goToNext();
                }
            } else {
                if (itemId == MenuIds.SEARCH_MENU_ID.getValue()) {
                    VoiceManager voiceManager = VoiceManager.INSTANCE;
                    if (voiceManager.isRecording()) {
                        voiceManager.stopRecordAndPreparePlayer();
                    }
                    this.isInSearchMode = true;
                    setSearchTheme();
                    if (this.toolbarSearchView == null) {
                        Context requireContext = requireContext();
                        kotlin.jvm.internal.k.e(requireContext, "requireContext()");
                        ToolbarSearchView toolbarSearchView = new ToolbarSearchView(requireContext);
                        this.toolbarSearchView = toolbarSearchView;
                        kotlin.jvm.internal.k.c(toolbarSearchView);
                        toolbarSearchView.setDelegate(new WeakReference<>(this));
                    }
                    ConversationManager conversationManager = ConversationManager.INSTANCE;
                    if (conversationManager.getActivity() != null) {
                        ToolbarSearchView toolbarSearchView2 = this.toolbarSearchView;
                        kotlin.jvm.internal.k.c(toolbarSearchView2);
                        toolbarSearchView2.getSearchEditText().enableInput(true);
                        ToolbarSearchView toolbarSearchView3 = this.toolbarSearchView;
                        kotlin.jvm.internal.k.c(toolbarSearchView3);
                        toolbarSearchView3.getSearchEditText().setText("");
                        ToolbarSearchView toolbarSearchView4 = this.toolbarSearchView;
                        kotlin.jvm.internal.k.c(toolbarSearchView4);
                        conversationManager.showToolbarSearchView(toolbarSearchView4.getSearchBar());
                    }
                    createSearchHolder();
                    showSearchBottomView();
                    GroupMemberTagChooseViewController groupMemberTagChooseViewController = (GroupMemberTagChooseViewController) GroupMemberTagChooseViewController.Companion.getMap().get(this.conversation);
                    if (groupMemberTagChooseViewController != null) {
                        groupMemberTagChooseViewController.closeGroupMemberPicker();
                    }
                    ToolbarSearchView toolbarSearchView5 = this.toolbarSearchView;
                    showKeyPad(toolbarSearchView5 != null ? toolbarSearchView5.getSearchEditText() : null);
                    BottomSheet bottomSheet2 = this.bottomSheet;
                    if (bottomSheet2 != null && (mReplyView = bottomSheet2.getMReplyView()) != null && mReplyView.getVisibility() == 0) {
                        z = true;
                    }
                    if (z && (bottomSheet = this.bottomSheet) != null) {
                        bottomSheet.replyCancelButtonClick();
                    }
                } else if (itemId == MenuIds.STEALTH_MODE_ID.getValue()) {
                    if (PremiumManager.INSTANCE.isPremium()) {
                        ConversationManager.showStealthModeCurrentDialog$default(ConversationManager.INSTANCE, this.conversation, null, new ConversationView$onOptionsItemSelected$4(this), new ConversationView$onOptionsItemSelected$5(this), 2, null);
                    } else {
                        Conversation conversation = this.conversation;
                        if (conversation != null && conversation.isStealthModeOn()) {
                            Conversation conversation2 = this.conversation;
                            if (conversation2 != null && conversation2.isMeInitiatorStealthMode()) {
                                z = true;
                            }
                            if (z) {
                                ConversationManager.INSTANCE.stealthModeExpiredGoToPremiumScreen();
                            }
                        }
                        ConversationManager.showStealthModeOpenPremiumActivityDialog$default(ConversationManager.INSTANCE, null, 1, null);
                    }
                } else if (itemId == MenuIds.SET_CHAT_BACKGROUND_ID.getValue()) {
                    Conversation conversation3 = this.conversation;
                    if (conversation3 == null || (conversationJid = conversation3.getConversationJid()) == null) {
                        return false;
                    }
                    if (ZangiPermissionUtils.hasPermission(getActivity(), 1007, true, new ZangiPermissionUtils.OnPermissionResult() {
                        public final void onResult(ArrayList arrayList, boolean z6) {
                            ConversationView.onOptionsItemSelected$lambda$21(ConversationView.this, conversationJid, arrayList, z6);
                        }
                    })) {
                        chatBackground(conversationJid);
                    }
                } else if (itemId == MenuIds.SCREEN_SHOTE_MENU_ID.getValue()) {
                    Conversation conversation4 = this.conversation;
                    if (conversation4 != null && conversation4.isStealthModeOn()) {
                        return false;
                    }
                    if (PremiumManager.INSTANCE.isPremium()) {
                        ConversationManager.showPreventCaptureModeCurrentDialog$default(ConversationManager.INSTANCE, this.conversation, null, 2, null);
                    } else {
                        Conversation conversation5 = this.conversation;
                        if (conversation5 != null && conversation5.isPreventCaptureModeOn()) {
                            z = true;
                        }
                        if (z) {
                            ConversationManager.preventCaptureModeOff$default(ConversationManager.INSTANCE, this.conversation, null, 2, null);
                        } else {
                            ConversationManager.showPreventCaptureOpenPremiumActivityDialog$default(ConversationManager.INSTANCE, null, 1, null);
                        }
                    }
                }
            }
        }
        return true;
    }

    @Override
    public void onPause() {
        FragmentActivity fragmentActivity;
        ChatSensor chatSensor;
        RecyclerView recyclerView;
        BottomSheet bottomSheet;
        VoiceAudioPlayerView audioPlayerView;
        super.onPause();
        if (VoiceManager.INSTANCE.getState() == VoiceManagerState.player && (bottomSheet = this.bottomSheet) != null && (audioPlayerView = bottomSheet.getAudioPlayerView()) != null) {
            audioPlayerView.pause();
        }
        if (BaseScreen.getRecordService().isMediaPlaying()) {
            BaseScreen.getRecordService().stopMedia();
        }
        ZKeyboardHeightProvider zKeyboardHeightProvider = this.keyboardHeightProvider;
        if (zKeyboardHeightProvider != null) {
            zKeyboardHeightProvider.setKeyboardHeightObserver((ZKeyboardHeightObserver) null);
        }
        boolean z = false;
        this.isInFront = false;
        ConversationTitleView conversationTitleView = this.conversationTitleView;
        if (conversationTitleView != null) {
            conversationTitleView.setChangeWithAnimation(false);
        }
        ConversationTitleView conversationTitleView2 = this.conversationTitleView;
        if (conversationTitleView2 != null) {
            conversationTitleView2.cancelAnimation();
        }
        BottomSheet bottomSheet2 = this.bottomSheet;
        hideKeyPad(bottomSheet2 != null ? bottomSheet2.getMessageInput() : null);
        hideOpened(true);
        View view = this.searchView;
        if (view != null) {
            if (view != null && view.getVisibility() == 8) {
                View view2 = this.searchView;
                if (view2 != null) {
                    view2.setVisibility(0);
                }
                backFromSearchMode();
            }
        }
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen != null && (recyclerView = conversationScreen.getRecyclerView()) != null) {
            recyclerView.clearDisappearingChildren();
        }
        Conversation conversation = this.conversation;
        if (((conversation == null || conversation.isNew()) ? false : true) && (chatSensor = this.chatSensor) != null) {
            if (chatSensor != null && !chatSensor.getProximityStarted()) {
                z = true;
            }
            if (z) {
                ChatSensor chatSensor2 = this.chatSensor;
                if (chatSensor2 != null) {
                    chatSensor2.stopRaiseToEarSensors();
                }
                this.chatSensor = null;
            }
        }
        ChatSensor chatSensor3 = this.chatSensor;
        if (chatSensor3 != null) {
            kotlin.jvm.internal.k.c(chatSensor3);
            if (!chatSensor3.isNear() && BaseScreen.getRecordService().getMediaPlayState() == MediaRecordAndPlay.MediaState.IN_PLAY) {
                isScreenAwake();
            }
        }
        if (isTablet(getContext())) {
            WeakReference<FragmentActivity> activity = ConversationManager.INSTANCE.getActivity();
            fragmentActivity = activity != null ? activity.get() : null;
            if (fragmentActivity != null) {
                fragmentActivity.setRequestedOrientation(-1);
            }
        } else {
            WeakReference<FragmentActivity> activity2 = ConversationManager.INSTANCE.getActivity();
            fragmentActivity = activity2 != null ? activity2.get() : null;
            if (fragmentActivity != null) {
                fragmentActivity.setRequestedOrientation(1);
            }
        }
        ZReactionSelectedMemberListManager.INSTANCE.reset();
    }

    public void onPrepareOptionsMenu(android.view.Menu r8) {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.onPrepareOptionsMenu(android.view.Menu):void");
    }

    @Override
    public void onQueryTextChanged(String str, int i) {
        BottomSearchView bottomSearchView;
        ImageView clearButton;
        Filter filter;
        kotlin.jvm.internal.k.f(str, "query");
        Log.info("CHAT_SEARCH ", new String[]{"onQueryTextChanged ", str + ", searchBy " + this.searchBy});
        boolean z = (str.length() == 0) && i >= str.length();
        if (!(str.length() == 0) || z) {
            if ((str.length() == 0) || z) {
                this.searchBy = SearchBy.MESSAGE;
            }
            int i7 = WhenMappings.$EnumSwitchMapping$2[this.searchBy.ordinal()];
            if (i7 != 1) {
                if (i7 == 2) {
                    ConversationScreen conversationScreen = this.conversationScreen;
                    ListView contactFilterListView = conversationScreen != null ? conversationScreen.getContactFilterListView() : null;
                    if (contactFilterListView != null) {
                        contactFilterListView.setVisibility(0);
                    }
                    FilterableContactsAdapter filterableContactsAdapter = this.filterableContactsAdapter;
                    if (filterableContactsAdapter != null && filterableContactsAdapter != null && (filter = filterableContactsAdapter.getFilter()) != null) {
                        filter.filter(str);
                    }
                }
            } else if (this.chatSearchHolder != null) {
                BottomSheet bottomSheet = this.bottomSheet;
                if (bottomSheet != null) {
                    bottomSheet.showBottomSearchView();
                }
                IChatSearchHolder iChatSearchHolder = this.chatSearchHolder;
                if (iChatSearchHolder != null) {
                    iChatSearchHolder.setCurrentSearchKey(z ? "" : str, true, this.searchBy);
                }
            }
            if (!(str.length() == 0) && !z) {
                ToolbarSearchView toolbarSearchView = this.toolbarSearchView;
                clearButton = toolbarSearchView != null ? toolbarSearchView.getClearButton() : null;
                if (clearButton != null) {
                    clearButton.setVisibility(0);
                }
                closeSearchByLayout(true);
                return;
            }
            ToolbarSearchView toolbarSearchView2 = this.toolbarSearchView;
            if ((toolbarSearchView2 != null ? toolbarSearchView2.getClearButton() : null) != null) {
                ToolbarSearchView toolbarSearchView3 = this.toolbarSearchView;
                clearButton = toolbarSearchView3 != null ? toolbarSearchView3.getClearButton() : null;
                kotlin.jvm.internal.k.c(clearButton);
                clearButton.setVisibility(8);
            }
            setCurrentSearchedMessageId(-1L);
            ConversationAdapter conversationAdapter = this.conversationAdapter;
            if (conversationAdapter != null) {
                conversationAdapter.setSearchKey("", this.searchBy);
            }
            BottomSheet bottomSheet2 = this.bottomSheet;
            if (bottomSheet2 != null && (bottomSearchView = bottomSheet2.getBottomSearchView()) != null) {
                bottomSearchView.disableSearchArrowButtons();
            }
            ConversationAdapter conversationAdapter2 = this.conversationAdapter;
            if (conversationAdapter2 != null) {
                conversationAdapter2.updateAllList();
            }
            openSearchByLayout();
        }
    }

    public void onReactionMenuButtonClick(String str) {
        kotlin.jvm.internal.k.f(str, "emoji");
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.onReactionMenuButtonClick(str);
        }
    }

    public void onReceiveContactsOnlineStatuses(ArrayList<LastActivity> arrayList) {
        kotlin.jvm.internal.k.f(arrayList, "activities");
    }

    public void onReciveStatus(ArrayList<LastActivity> arrayList) {
        ConversationScreen conversationScreen;
        kotlin.jvm.internal.k.f(arrayList, "activities");
        Conversation conversation = this.conversation;
        if ((conversation != null && conversation.isPersonal()) || getActivity() == null) {
            return;
        }
        BlockContactServiceImpl blockContactServiceImpl = BlockContactServiceImpl.getInstance();
        Conversation conversation2 = this.conversation;
        if (blockContactServiceImpl.getZangiBlockNumber(conversation2 != null ? conversation2.getE164number() : null) != null) {
            return;
        }
        Iterator<LastActivity> it = arrayList.iterator();
        while (it.hasNext()) {
            final LastActivity next = it.next();
            Conversation conversation3 = this.conversation;
            if (kotlin.jvm.internal.k.b(conversation3 != null ? conversation3.getE164number() : null, ZangiEngineUtils.getNumberFromJid(next.getId())) && (conversationScreen = this.conversationScreen) != null) {
                conversationScreen.post(new Runnable() {
                    @Override
                    public final void run() {
                        ConversationView.onReciveStatus$lambda$29(ConversationView.this, next);
                    }
                });
            }
        }
    }

    @Override
    public void onResume() {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.onResume():void");
    }

    @Override
    public void onSaveInstanceState(Bundle bundle) {
        kotlin.jvm.internal.k.f(bundle, "outState");
        super.onSaveInstanceState(bundle);
        Conversation conversation = this.conversation;
        if (conversation != null) {
            bundle.putSerializable("conversationId", conversation != null ? conversation.getConversationJid() : null);
            if (this.imageBrowser != null) {
                bundle.putSerializable("isOpenedImageBrowser", Boolean.TRUE);
            }
        }
    }

    @Override
    public void onSearchButtonClik() {
        Log.info("CHAT_SEARCH ", new String[]{"onSearchButtonClik "});
        IChatSearchHolder iChatSearchHolder = this.chatSearchHolder;
        if (iChatSearchHolder != null) {
            iChatSearchHolder.goToPrev();
        }
    }

    public void onSearchContactClick(String str) {
        if (this.chatSearchHolder != null) {
            ConversationScreen conversationScreen = this.conversationScreen;
            ListView contactFilterListView = conversationScreen != null ? conversationScreen.getContactFilterListView() : null;
            if (contactFilterListView != null) {
                contactFilterListView.setVisibility(8);
            }
            IChatSearchHolder iChatSearchHolder = this.chatSearchHolder;
            if (iChatSearchHolder != null) {
                iChatSearchHolder.setCurrentSearchKey(str, true, this.searchBy);
            }
        }
    }

    public void onSetSearchedContact(Object obj) {
        kotlin.jvm.internal.k.f(obj, "contact");
        if (this.chatSearchHolder != null) {
            this.searchedContact = obj instanceof Pair ? (Pair) obj : null;
        }
    }

    @Override
    public void onShowJoinViewIfNeeded() {
        String activeGroupId = ConferenceManager.INSTANCE.getActiveGroupId();
        Conversation conversation = this.conversation;
        if (kotlin.jvm.internal.k.b(activeGroupId, conversation != null ? conversation.getConversationId() : null)) {
            hideOrShowJoinView(0, true);
        }
    }

    public void onStart() {
        super.onStart();
        ConversationManager.INSTANCE.selectedMessagesCountChanged(getCount());
    }

    public void onStop() {
        PasteEditText messageInput;
        ChatSmilesView chatSmilesView;
        BottomBar bottomBar;
        PasteEditText messageInput2;
        super.onStop();
        Conversation conversation = this.conversation;
        BottomSheet bottomSheet = this.bottomSheet;
        Editable editable = null;
        boolean z = false;
        saveIncompleteAndDraftText(conversation, String.valueOf((bottomSheet == null || (messageInput2 = bottomSheet.getMessageInput()) == null) ? null : messageInput2.getText()), false);
        BottomSheet bottomSheet2 = this.bottomSheet;
        if (((bottomSheet2 == null || bottomSheet2.isVoiceViewVisible()) ? false : true) && !this.isInSearchMode) {
            isScreenAwake();
            BottomSheet bottomSheet3 = this.bottomSheet;
            if (((bottomSheet3 == null || (chatSmilesView = bottomSheet3.getChatSmilesView()) == null || (bottomBar = chatSmilesView.getBottomBar()) == null) ? null : bottomBar.getBottomBarState()) == BottomBar.BottomBarState.GIF) {
                BottomSheet bottomSheet4 = this.bottomSheet;
                if (bottomSheet4 != null && bottomSheet4.isGifLayoutEdited()) {
                    z = true;
                }
                if (z) {
                    BottomSheet bottomSheet5 = this.bottomSheet;
                    if (bottomSheet5 != null && (messageInput = bottomSheet5.getMessageInput()) != null) {
                        editable = messageInput.getText();
                    }
                    this.gifSearchText = String.valueOf(editable);
                }
            }
            this.gifSearchText = null;
        }
        BottomSheet bottomSheet6 = this.bottomSheet;
        if (bottomSheet6 != null) {
            bottomSheet6.setLastText("");
        }
        GroupMemberTagChooseViewController.Companion companion = GroupMemberTagChooseViewController.Companion;
        GroupMemberTagChooseViewController groupMemberTagChooseViewController = (GroupMemberTagChooseViewController) companion.getMap().get(this.conversation);
        if (groupMemberTagChooseViewController != null) {
            groupMemberTagChooseViewController.ressetController();
        }
        companion.getMap().remove(this.conversation);
    }

    @Override
    public void onToolBarLayoutClick() {
        ConversationManager.INSTANCE.navigate(getContext(), new ConversationView$onToolBarLayoutClick$1(this));
    }

    @Override
    public void onToolBarLayoutLongClick() {
        Conversation conversation = this.conversation;
        boolean z = false;
        if (conversation != null && !conversation.isPersonal()) {
            z = true;
        }
        if (z) {
            if (PremiumManager.INSTANCE.isPremium()) {
                ConversationManager.showStealthModeCurrentDialog$default(ConversationManager.INSTANCE, this.conversation, null, new ConversationView$onToolBarLayoutLongClick$1(this), new ConversationView$onToolBarLayoutLongClick$2(this), 2, null);
            } else {
                ConversationManager.showStealthModeOpenPremiumActivityDialog$default(ConversationManager.INSTANCE, null, 1, null);
            }
        }
    }

    public final boolean onTouchSwipeRefreshConversationListFragment(View view, MotionEvent motionEvent) {
        ViewPropertyAnimator animate;
        ViewPropertyAnimator listener;
        ViewPropertyAnimator duration;
        ViewPropertyAnimator animate2;
        ViewPropertyAnimator duration2;
        ViewPropertyAnimator animate3;
        ViewPropertyAnimator duration3;
        CGPoint cGPoint = new CGPoint(motionEvent != null ? motionEvent.getX() : 0.0f, motionEvent != null ? motionEvent.getY() : 0.0f);
        VoiceManager voiceManager = VoiceManager.INSTANCE;
        ConversationScreen conversationScreen = this.conversationScreen;
        AlphaAnimation alphaAnimation = null;
        if (voiceManager.checkViewTouch(cGPoint, (conversationScreen != null ? conversationScreen.getPhoneOrEmailStatus() : null) != null && getPhoneOrEmailStatus().getVisibility() == 0) != null) {
            return true;
        }
        if (voiceManager.getState() != VoiceManagerState.none) {
            return false;
        }
        if (motionEvent != null && motionEvent.getAction() == 0) {
            hideOpened(false);
            hideKeyBoardInVideoScreen();
        }
        if (!ScreenVideoCall.Companion.getChatFragmentIsVisible() && !this.notScrollBack) {
            Integer valueOf = motionEvent != null ? Integer.valueOf(motionEvent.getAction()) : null;
            if ((valueOf != null && valueOf.intValue() == 0) || (valueOf != null && valueOf.intValue() == 5)) {
                this.xStart = motionEvent.getRawX();
                this.yStart = motionEvent.getRawY();
                if (isDataFooterOnDateBubble()) {
                    changeDateFooterVisibility(false);
                } else {
                    changeDateFooterVisibility(true);
                }
            } else {
                if ((valueOf != null && valueOf.intValue() == 2) || (valueOf != null && valueOf.intValue() == 7)) {
                    float rawX = motionEvent.getRawX() - this.xStart;
                    float rawY = motionEvent.getRawY() - this.yStart;
                    if (isDataFooterOnDateBubble()) {
                        changeDateFooterVisibility(false);
                    } else {
                        changeDateFooterVisibility(true);
                    }
                    if (this.scrollStart) {
                        if (rawY <= rawX) {
                            float f = this.MAX_DELTA_FOR_SCROLL_Y;
                            if (rawY <= f && rawY >= (-f)) {
                                ConversationScreen conversationScreen2 = this.conversationScreen;
                                kotlin.jvm.internal.k.c(conversationScreen2);
                                conversationScreen2.setX(motionEvent.getRawX() - this.xStart);
                            }
                        }
                        this.scrollStart = false;
                        kotlin.jvm.internal.k.c(this.conversationScreen);
                        this.xStart = r9.getWidth();
                        ConversationScreen conversationScreen3 = this.conversationScreen;
                        if (conversationScreen3 != null && (animate3 = conversationScreen3.animate()) != null) {
                            ConversationScreen conversationScreen4 = this.conversationScreen;
                            kotlin.jvm.internal.k.c(conversationScreen4);
                            ViewPropertyAnimator translationXBy = animate3.translationXBy(-conversationScreen4.getX());
                            if (translationXBy != null && (duration3 = translationXBy.setDuration(200L)) != null) {
                                duration3.start();
                            }
                        }
                        return false;
                    }
                    if (rawX > this.DELTA_FOR_SCROLL_START) {
                        this.xStart = motionEvent.getRawX();
                        this.yStart = motionEvent.getRawY();
                        this.scrollStart = true;
                    }
                    ConversationScreen conversationScreen5 = this.conversationScreen;
                    kotlin.jvm.internal.k.c(conversationScreen5);
                    if (conversationScreen5.getX() < 0.0f) {
                        ConversationScreen conversationScreen6 = this.conversationScreen;
                        kotlin.jvm.internal.k.c(conversationScreen6);
                        conversationScreen6.setX(0.0f);
                    }
                } else {
                    if (((valueOf != null && valueOf.intValue() == 1) || (valueOf != null && valueOf.intValue() == 3)) || (valueOf != null && valueOf.intValue() == 6)) {
                        if (!(this.date.length() > 0)) {
                            changeDateFooterVisibility(false);
                        } else if (isDataFooterOnDateBubble()) {
                            changeDateFooterVisibility(false);
                        } else {
                            ConversationScreen conversationScreen7 = this.conversationScreen;
                            TextView dateFooterView = conversationScreen7 != null ? conversationScreen7.getDateFooterView() : null;
                            kotlin.jvm.internal.k.c(dateFooterView);
                            AlphaAnimation alphaAnimation2 = this.alphaAnimationHideDateFooter;
                            if (alphaAnimation2 == null) {
                                kotlin.jvm.internal.k.q("alphaAnimationHideDateFooter");
                            } else {
                                alphaAnimation = alphaAnimation2;
                            }
                            dateFooterView.startAnimation(alphaAnimation);
                        }
                        if (!this.scrollStart) {
                            this.xStart = 0.0f;
                            this.yStart = 0.0f;
                            return false;
                        }
                        this.scrollStart = false;
                        ConversationScreen conversationScreen8 = this.conversationScreen;
                        kotlin.jvm.internal.k.c(conversationScreen8);
                        float x = conversationScreen8.getX();
                        kotlin.jvm.internal.k.c(this.conversationScreen);
                        if (x < (r10.getWidth() - this.xStart) / 4) {
                            ConversationScreen conversationScreen9 = this.conversationScreen;
                            if (conversationScreen9 != null && (animate2 = conversationScreen9.animate()) != null) {
                                ConversationScreen conversationScreen10 = this.conversationScreen;
                                kotlin.jvm.internal.k.c(conversationScreen10);
                                ViewPropertyAnimator translationXBy2 = animate2.translationXBy(-conversationScreen10.getX());
                                if (translationXBy2 != null && (duration2 = translationXBy2.setDuration(200L)) != null) {
                                    duration2.start();
                                }
                            }
                        } else {
                            ConversationScreen conversationScreen11 = this.conversationScreen;
                            if (conversationScreen11 != null && (animate = conversationScreen11.animate()) != null && (listener = animate.setListener(new ConversationView$onTouchSwipeRefreshConversationListFragment$1(this))) != null) {
                                kotlin.jvm.internal.k.c(this.conversationScreen);
                                ViewPropertyAnimator translationXBy3 = listener.translationXBy(r10.getWidth());
                                if (translationXBy3 != null && (duration = translationXBy3.setDuration(200L)) != null) {
                                    duration.start();
                                }
                            }
                        }
                        this.xStart = 0.0f;
                        this.yStart = 0.0f;
                    }
                }
            }
        }
        return false;
    }

    public void openForwardMessageFragment(List<String> list) {
        openForwardMessage(list);
    }

    public void openInfoPageOfReaction(String str, String str2) {
        if (!zb.f.l(str, AppUserManager.INSTANCE.getUserNumber(), false, 2, (Object) null)) {
            openInfoPage(str, str2);
            return;
        }
        if (str == null) {
            str = "";
        }
        openPersonalSharedMedia(str);
    }

    public void openNativeFiles() {
        Intent intent = new Intent("android.intent.action.OPEN_DOCUMENT");
        intent.putExtra("android.intent.extra.ALLOW_MULTIPLE", true);
        intent.setType("*/*");
        intent.addCategory("android.intent.category.OPENABLE");
        intent.putExtra("android.intent.extra.LOCAL_ONLY", false);
        FragmentActivity activity = getActivity();
        if (activity == null || activity.isFinishing() || !isAdded()) {
            return;
        }
        startActivityForResult(intent, BaseScreen.REQUEST_CODE_BROWS_FILE);
    }

    public void openPhotoCamera() {
        takePhotoclickListener();
    }

    public void openSmilesViewForReaction() {
        ZReactionMenuManager zReactionMenuManager = ZReactionMenuManager.INSTANCE;
        zReactionMenuManager.setWaitForEmojiFromChatSmileView(true);
        zReactionMenuManager.hide();
        BottomSheet bottomSheet = this.bottomSheet;
        if (bottomSheet != null) {
            bottomSheet.onSmileButtonClick(SmileTag.REACTION);
        }
    }

    public void openVideoCamera() {
        takeVideoClickListener();
    }

    @Override
    public void phoneOrEmailStatusClick() {
        if (SystemClock.elapsedRealtime() - this.mLastClickTime < 1000) {
            return;
        }
        this.mLastClickTime = SystemClock.elapsedRealtime();
        Conversation conversation = this.conversation;
        boolean z = false;
        if (conversation != null && !conversation.isGroup()) {
            z = true;
        }
        if (z) {
            Conversation conversation2 = this.conversation;
            String displayNumber = conversation2 != null ? conversation2.getDisplayNumber() : null;
            Conversation conversation3 = this.conversation;
            addContact(displayNumber, conversation3 != null ? conversation3.getDisplayEmail() : null, "");
        }
    }

    @Override
    public void profileChanged(String str) {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public final void run() {
                ConversationView.profileChanged$lambda$44(ConversationView.this);
            }
        });
    }

    public final void recordStateChanged(MediaRecordAndPlay.MediaState mediaState) {
        kotlin.jvm.internal.k.f(mediaState, "type");
        if (WhenMappings.$EnumSwitchMapping$3[mediaState.ordinal()] == 1 && this.showScrollButton) {
            ConversationScreen conversationScreen = this.conversationScreen;
            ImageView scrollButton = conversationScreen != null ? conversationScreen.getScrollButton() : null;
            if (scrollButton == null) {
                return;
            }
            scrollButton.setVisibility(0);
        }
    }

    @Override
    public void registrationEvent(RegistrationEventArgs registrationEventArgs) {
        if (registrationEventArgs == null) {
            Log.e(this.TAG, "Invalid event args");
        }
        Log.i(this.TAG, "ScreenChat Signal Receive " + registrationEventArgs.getEventType() + "!!!!!!!!!!");
        RegistrationEventTypes eventType = registrationEventArgs.getEventType();
        switch (eventType == null ? -1 : WhenMappings.$EnumSwitchMapping$1[eventType.ordinal()]) {
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
                MainApplication.Companion.getMainHandler().post(new Runnable() {
                    @Override
                    public final void run() {
                        ConversationView.registrationEvent$lambda$38(ConversationView.this);
                    }
                });
                break;
            case 7:
                MainApplication.Companion.getMainHandler().post(new Runnable() {
                    @Override
                    public final void run() {
                        ConversationView.registrationEvent$lambda$40(ConversationView.this);
                    }
                });
                break;
        }
    }

    public void removeGifLayout() {
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen != null) {
            conversationScreen.removeGifLayout();
        }
    }

    @Override
    public void replaceMessage(String str, final String str2, String str3) {
        Conversation conversation;
        kotlin.jvm.internal.k.f(str2, "msgId1");
        kotlin.jvm.internal.k.f(str3, "msgId2");
        if (str == null || (conversation = this.conversation) == null) {
            return;
        }
        kotlin.jvm.internal.k.c(conversation);
        if (conversation.getConversationJid() != null) {
            Conversation conversation2 = this.conversation;
            kotlin.jvm.internal.k.c(conversation2);
            if (kotlin.jvm.internal.k.b(conversation2.getConversationJid(), str)) {
                IConversationPresenter iConversationPresenter = this.presenter;
                final ZangiMessage messageById = iConversationPresenter != null ? iConversationPresenter.getMessageById(str3) : null;
                if (messageById != null) {
                    MainApplication.Companion.getMainHandler().post(new Runnable() {
                        @Override
                        public final void run() {
                            ConversationView.replaceMessage$lambda$42(ConversationView.this, str2, messageById);
                        }
                    });
                }
            }
        }
    }

    public final void requestOnlineStatus() {
        Conversation conversation = this.conversation;
        boolean z = false;
        if (conversation != null && conversation.isGroup()) {
            z = true;
        }
        if (z) {
            return;
        }
        Conversation conversation2 = this.conversation;
        if ((conversation2 != null ? conversation2.getConversationJid() : null) == null) {
            return;
        }
        ArrayList arrayList = new ArrayList();
        Conversation conversation3 = this.conversation;
        kotlin.jvm.internal.k.c(conversation3);
        String conversationJid = conversation3.getConversationJid();
        kotlin.jvm.internal.k.c(conversationJid);
        arrayList.add(conversationJid);
        MessagingService.INSTANCE.requestUsersOnlineStatuses(arrayList);
    }

    public void saveIncompleteAndDraftText() {
        PasteEditText messageInput;
        if (this.isViewAppeard) {
            Conversation conversation = this.conversation;
            if (kotlin.jvm.internal.k.b(conversation != null ? conversation.getConversationJid() : null, "zangi")) {
                return;
            }
            Conversation conversation2 = this.conversation;
            if (kotlin.jvm.internal.k.b(conversation2 != null ? conversation2.getConversationJid() : null, "zangi")) {
                return;
            }
            DraftTextManager draftTextManager = DraftTextManager.INSTANCE;
            BottomSheet bottomSheet = this.bottomSheet;
            draftTextManager.saveIncompleteAndDraftText((bottomSheet == null || (messageInput = bottomSheet.getMessageInput()) == null) ? null : messageInput.getText(), this.conversation, this.presenter);
            Conversation conversation3 = this.conversation;
            updateConversationWithMessage(null, conversation3 != null ? conversation3.getConversationJid() : null);
        }
    }

    @Override
    public void scrollButtonClick() {
        scrollDown();
    }

    public final void scrollByMsgId(final long j) {
        if (this.mScrollMsgID >= 0) {
            final ConversationScreen conversationScreen = this.conversationScreen;
            if (conversationScreen != null) {
                conversationScreen.getRecyclerView().post(new Runnable() {
                    @Override
                    public final void run() {
                        ConversationView.scrollByMsgId$lambda$86$lambda$85(ConversationView.this, j, conversationScreen);
                    }
                });
            }
            this.mScrollMsgID = -1L;
        }
    }

    public final void scrollToMsgId() {
        Long l = this.mSearchedMsgId;
        if (l != null) {
            kotlin.jvm.internal.k.c(l);
            setScrollMsgID(l.longValue());
            Long l7 = this.mSearchedMsgId;
            kotlin.jvm.internal.k.c(l7);
            scrollByMsgId(l7.longValue());
            this.mSearchedMsgId = null;
        }
    }

    public final void scrollToVoiceItem(Long l) {
        RecyclerView recyclerView;
        if (l == null) {
            return;
        }
        ConversationScreen conversationScreen = this.conversationScreen;
        if (((conversationScreen == null || (recyclerView = conversationScreen.getRecyclerView()) == null) ? null : recyclerView.getLayoutManager()) != null) {
            setScrollMsgID(l.longValue());
            scrollByMsgId(l.longValue());
        }
    }

    @Override
    public void searchByContactClick() {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.searchByContactClick():void");
    }

    @Override
    public void searchByDateClick() {
        this.searchBy = SearchBy.DATE;
        Calendar calendar = Calendar.getInstance();
        DatePickerDialog datePickerDialog = new DatePickerDialog(requireContext(), 2131951925, this.onDateSetListener, calendar.get(1), calendar.get(2), calendar.get(5));
        datePickerDialog.setButton(-1, getResources().getString(2131886760), datePickerDialog);
        datePickerDialog.setOnShowListener(this.datePickerDialogShowListener);
        datePickerDialog.setOnCancelListener(this.datePickerDialogCancelListener);
        datePickerDialog.show();
        int c = androidx.core.content.a.c(MainApplication.Companion.getMainContext(), 2131099794);
        datePickerDialog.getButton(-2).setTextColor(c);
        datePickerDialog.getButton(-1).setTextColor(c);
    }

    public void seekTo(AudioWaveView audioWaveView) {
        kotlin.jvm.internal.k.f(audioWaveView, "audioWaveView");
        BaseScreen.getRecordService().seekToPos(BaseScreen.getRecordService().getOutPutFileName(), this.MSG_ID, audioWaveView, (int) audioWaveView.getProgress());
    }

    public void sendButtonClick(List<ImageVideoTransferModel> list) {
        kotlin.jvm.internal.k.f(list, "selectedItems");
        Log.i(this.TAG, "confe -> sendButtonClick");
        if (this.conversation == null && list.size() == 0) {
            Log.i(this.TAG, "confe -> conversation == null && selectedItems.size == 0");
        } else {
            sendSingleMessage(list);
        }
    }

    public void sendEditedMessage() {
        PasteEditText messageInput;
        BottomSheet bottomSheet = this.bottomSheet;
        Editable editable = null;
        ZangiMessage editedMessage = bottomSheet != null ? bottomSheet.getEditedMessage() : null;
        kotlin.jvm.internal.k.c(editedMessage);
        BottomSheet bottomSheet2 = this.bottomSheet;
        if (bottomSheet2 != null && (messageInput = bottomSheet2.getMessageInput()) != null) {
            editable = messageInput.getText();
        }
        sendEditedMessage(editedMessage, String.valueOf(editable));
    }

    public final void sendLocation(double d, double d7) {
        ZangiMessage zangiMessage;
        IConversationPresenter iConversationPresenter = this.presenter;
        if (iConversationPresenter != null) {
            StringBuilder sb = new StringBuilder();
            sb.append(d);
            sb.append('*');
            sb.append(d7);
            String sb2 = sb.toString();
            Conversation conversation = this.conversation;
            kotlin.jvm.internal.k.c(conversation);
            zangiMessage = iConversationPresenter.sendLocation(sb2, conversation.isGroup(), "", ConversationManager.INSTANCE.getMReplyMessage());
        } else {
            zangiMessage = null;
        }
        ConversationManager.INSTANCE.setMReplyMessage(null);
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.addItem(zangiMessage);
        }
    }

    public final void sendMessageFromChatScreen(int i, ZangiMessage zangiMessage, String str, int i7, String str2, String str3, double d, double d7) {
        PasteEditText messageInput;
        AppCompatEditText messageInput2;
        kotlin.jvm.internal.k.f(str, "filePath");
        kotlin.jvm.internal.k.f(str2, "msgId");
        kotlin.jvm.internal.k.f(str3, "key");
        if (i == -1) {
            kotlin.jvm.internal.k.c(zangiMessage);
            String numberFromJid = ZangiEngineUtils.getNumberFromJid(zangiMessage.getTo());
            kotlin.jvm.internal.k.e(numberFromJid, "getNumberFromJid(_zangiMessage!!.to)");
            String msg = zangiMessage.getMsg();
            kotlin.jvm.internal.k.c(msg);
            String msgId = zangiMessage.getMsgId();
            kotlin.jvm.internal.k.c(msgId);
            sendSMStoGSM(numberFromJid, msg, msgId);
            return;
        }
        if (i != 0) {
            if (i == 1) {
                sendFile(zangiMessage);
                return;
            }
            if (i == 2) {
                sendAudioMessage(str, i7, str2);
                return;
            } else if (i == 3) {
                sendSticker(str3);
                return;
            } else {
                if (i != 4) {
                    return;
                }
                sendLocation(d, d7);
                return;
            }
        }
        BottomSheet bottomSheet = this.bottomSheet;
        if (((bottomSheet == null || (messageInput2 = bottomSheet.getMessageInput()) == null) ? 0 : messageInput2.length()) > 15000) {
            Toast.makeText(getContext(), getResources().getString(2131886290), 0).show();
            return;
        }
        BottomSheet bottomSheet2 = this.bottomSheet;
        if (bottomSheet2 != null) {
            kotlin.jvm.internal.k.c(bottomSheet2);
            if (bottomSheet2.isEditMode()) {
                BottomSheet bottomSheet3 = this.bottomSheet;
                Editable editable = null;
                if ((bottomSheet3 != null ? bottomSheet3.getEditedMessage() : null) != null) {
                    BottomSheet bottomSheet4 = this.bottomSheet;
                    ZangiMessage editedMessage = bottomSheet4 != null ? bottomSheet4.getEditedMessage() : null;
                    kotlin.jvm.internal.k.c(editedMessage);
                    BottomSheet bottomSheet5 = this.bottomSheet;
                    if (bottomSheet5 != null && (messageInput = bottomSheet5.getMessageInput()) != null) {
                        editable = messageInput.getText();
                    }
                    sendEditedMessage(editedMessage, String.valueOf(editable));
                    return;
                }
            }
        }
        sendMessage1();
    }

    @Override
    public void sendMessageSeen() {
        IConversationPresenter iConversationPresenter;
        Conversation conversation = this.conversation;
        if (conversation != null) {
            if ((conversation != null ? conversation.getConversationJid() : null) == null || (iConversationPresenter = this.presenter) == null) {
                return;
            }
            Conversation conversation2 = this.conversation;
            kotlin.jvm.internal.k.c(conversation2);
            String conversationJid = conversation2.getConversationJid();
            kotlin.jvm.internal.k.c(conversationJid);
            iConversationPresenter.sendMessagesSeen(conversationJid);
        }
    }

    public void sendStickerMessage(String str) {
        kotlin.jvm.internal.k.f(str, "name");
        sendMessageFromChatScreen(3, null, "", 0, "", str, 0.0d, 0.0d);
    }

    public void sendTextMessage() {
        sendMessage1();
    }

    @Override
    public void sendVoice(VoiceTransferModelParametrs voiceTransferModelParametrs) {
        ConversationView conversationView;
        BottomSheet bottomSheet;
        ZangiMessage mReplyMessage;
        kotlin.jvm.internal.k.f(voiceTransferModelParametrs, "voiceParamtrs");
        VoiceTransferModel voiceTransferModel = new VoiceTransferModel();
        voiceTransferModel.setVoiceParametrs(voiceTransferModelParametrs);
        Conversation conversation = this.conversation;
        kotlin.jvm.internal.k.c(conversation);
        voiceTransferModel.setConversationId(conversation.getConversationId());
        WeakReference<ConversationView> conversationScreenRef = ConversationManager.INSTANCE.getConversationScreenRef();
        voiceTransferModel.setReplyId((conversationScreenRef == null || (conversationView = conversationScreenRef.get()) == null || (bottomSheet = conversationView.bottomSheet) == null || (mReplyMessage = bottomSheet.getMReplyMessage()) == null) ? null : mReplyMessage.getMsgId());
        voiceTransferModel.createMessageToDBAndSendFile();
    }

    public final void setActionsBottomSheetOpened(boolean z) {
        this.isActionsBottomSheetOpened = z;
    }

    public final void setAppBarHeight(int i) {
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen == null) {
            return;
        }
        conversationScreen.setAppBarHeight(i);
    }

    public final void setBlocked(boolean z) {
        this.isBlocked = z;
    }

    public final void setBottomSheet(BottomSheet bottomSheet) {
        this.bottomSheet = bottomSheet;
    }

    public final void setChatSensor(ChatSensor chatSensor) {
        this.chatSensor = chatSensor;
    }

    public final void setConversation(Conversation conversation) {
        this.conversation = conversation;
    }

    public final void setConversationScreen(ConversationScreen conversationScreen) {
        this.conversationScreen = conversationScreen;
    }

    public final void setConversationTitleView(ConversationTitleView conversationTitleView) {
        this.conversationTitleView = conversationTitleView;
    }

    public final void setCount(int r9) {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.setCount(int):void");
    }

    public final void setForceDeleteReplyView(boolean z) {
        this.isForceDeleteReplyView = z;
    }

    public final void setForwardMode(boolean z) {
        this.isForwardMode = z;
    }

    public final void setInSearchMode(boolean z) {
        this.isInSearchMode = z;
    }

    public final void setInVisibleMenuFromImageBrowser(boolean z) {
        this.inVisibleMenuFromImageBrowser = z;
    }

    public void setInvisiblyConversationViewMenu(boolean z) {
        this.inVisibleMenuFromImageBrowser = z;
    }

    public final void setLeftHandedMode(boolean z) {
        this.leftHandedMode = z;
    }

    @Override
    public void setOnlineStatus(ConversationTitleView.OnlineStatusEnum onlineStatusEnum, Object obj) {
        ConversationTitleView conversationTitleView;
        if (onlineStatusEnum == null || obj == null || (conversationTitleView = this.conversationTitleView) == null) {
            return;
        }
        ConversationTitleView.setOnlineStatus$default(conversationTitleView, onlineStatusEnum, obj, null, null, null, 28, null);
    }

    public final void setRtl(boolean z) {
        this.isRtl = z;
    }

    public final void setScrollMsgID(long j) {
        this.mScrollMsgID = j;
    }

    public final void setScrollStart(boolean z) {
        this.scrollStart = z;
    }

    @Override
    public void setSwipingEnabled(boolean z) {
    }

    @Override
    public void setTitle(String str) {
        SimpleTextView titleView;
        if (str != null) {
            if (!(str.length() == 0) && getContext() != null) {
                ConversationTitleView conversationTitleView = this.conversationTitleView;
                if (conversationTitleView != null) {
                    conversationTitleView.setConversationTitle(str);
                }
                ConversationTitleView conversationTitleView2 = this.conversationTitleView;
                titleView = conversationTitleView2 != null ? conversationTitleView2.getTitleView() : null;
                if (titleView != null) {
                    titleView.setVisibility(0);
                }
                this.isRtl = OrientationManager.INSTANCE.isRtl();
                return;
            }
        }
        ConversationTitleView conversationTitleView3 = this.conversationTitleView;
        titleView = conversationTitleView3 != null ? conversationTitleView3.getTitleView() : null;
        if (titleView == null) {
            return;
        }
        titleView.setVisibility(8);
    }

    public final void setXStart(float f) {
        this.xStart = f;
    }

    public final void setYStart(float f) {
        this.yStart = f;
    }

    public final void setYoutubeVideoPlayingMode(boolean z) {
        this.youtubeVideoPlayingMode = z;
    }

    public final void showContactList() {
        FragmentActivity activity;
        FragmentManager supportFragmentManager;
        androidx.fragment.app.r n;
        synchronized (this) {
            ScreenTabContacts screenTabContacts = new ScreenTabContacts();
            this.contactsListFragment = screenTabContacts;
            screenTabContacts.registerItemClicksCallBack(this.mClickCallBacksObj);
            ScreenTabContacts screenTabContacts2 = this.contactsListFragment;
            if (screenTabContacts2 != null) {
                screenTabContacts2.setListener(new WeakReference<>(this));
            }
            Conversation conversation = this.conversation;
            Boolean valueOf = conversation != null ? Boolean.valueOf(conversation.isGroupCall()) : null;
            kotlin.jvm.internal.k.c(valueOf);
            if (valueOf.booleanValue()) {
                ScreenTabContacts screenTabContacts3 = this.contactsListFragment;
                if (screenTabContacts3 != null) {
                    screenTabContacts3.setForWhichScreen(ScreenTabContacts.ForWhichScreen.GROUP_CALL, null);
                }
            } else {
                ScreenTabContacts screenTabContacts4 = this.contactsListFragment;
                if (screenTabContacts4 != null) {
                    screenTabContacts4.setForWhichScreen(ScreenTabContacts.ForWhichScreen.CONTACTS_TAB_With_BUTTONS, null);
                }
            }
            ConversationScreen conversationScreen = this.conversationScreen;
            if ((conversationScreen != null ? (LinearLayout) conversationScreen.findViewById(2131362282) : null) != null && (activity = getActivity()) != null && (supportFragmentManager = activity.getSupportFragmentManager()) != null && (n = supportFragmentManager.n()) != null) {
                ScreenTabContacts screenTabContacts5 = this.contactsListFragment;
                kotlin.jvm.internal.k.c(screenTabContacts5);
                androidx.fragment.app.r r = n.r(2131362282, screenTabContacts5, BaseScreen.SCREEN_TYPE.TAB_CONTACTS.toString());
                if (r != null) {
                    r.j();
                }
            }
        }
    }

    public void showGifLayout() {
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen != null) {
            conversationScreen.showGifLayout();
        }
    }

    public void showKeyPadFromBottomSheet(View view) {
        showKeyPad(view);
    }

    public final void showLockView() {
        BottomSheet bottomSheet = this.bottomSheet;
        if (bottomSheet != null) {
            bottomSheet.setClipChildren(false);
        }
        ZAnimationView lottieAnimationView = getLottieAnimationView();
        if (lottieAnimationView != null) {
            lottieAnimationView.setVisibility(0);
        }
        ObjectAnimator translateYAnimation = UiUtilKt.translateYAnimation(getLottieAnimationView(), 100.0f, 0.0f, 100L);
        if (translateYAnimation != null) {
            translateYAnimation.start();
        }
    }

    public final void showToolbarSearchView(View view) {
        kotlin.jvm.internal.k.f(view, "searchView");
        this.searchView = view;
        RelativeLayout relativeLayout = this.toolBarRLayout;
        kotlin.jvm.internal.k.c(relativeLayout);
        relativeLayout.removeView(view);
        view.setVisibility(0);
        RelativeLayout relativeLayout2 = this.toolBarRLayout;
        kotlin.jvm.internal.k.c(relativeLayout2);
        relativeLayout2.addView(view);
    }

    public final void showVisualizerView() {
        RelativeLayout visualizerBackground;
        ViewPropertyAnimator animate;
        ViewPropertyAnimator duration;
        ViewPropertyAnimator translationY;
        ViewPropertyAnimator interpolator;
        ViewPropertyAnimator listener;
        ConversationManager.INSTANCE.setVoiceRecordingEnabled(false);
        ConversationScreen conversationScreen = this.conversationScreen;
        if (conversationScreen == null || (visualizerBackground = conversationScreen.getVisualizerBackground()) == null || (animate = visualizerBackground.animate()) == null || (duration = animate.setDuration(100L)) == null || (translationY = duration.translationY(0.0f)) == null || (interpolator = translationY.setInterpolator(new AccelerateDecelerateInterpolator())) == null || (listener = interpolator.setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animator) {
                kotlin.jvm.internal.k.f(animator, "animation");
                ConversationScreen conversationScreen2 = ConversationView.this.getConversationScreen();
                RelativeLayout visualizerBackground2 = conversationScreen2 != null ? conversationScreen2.getVisualizerBackground() : null;
                if (visualizerBackground2 == null) {
                    return;
                }
                visualizerBackground2.setVisibility(0);
            }
        })) == null) {
            return;
        }
        listener.start();
    }

    public final void showVoicePanelOrChangePlayOrPauseMode(ZangiMessage zangiMessage, int i) {
        if (!kotlin.jvm.internal.k.b(getVoiceItemTopPanel().getVoiceId(), zangiMessage != null ? zangiMessage.getMsgId() : null)) {
            VoiceItemTopPanel.showWithAnimation$default(getVoiceItemTopPanel(), 0L, null, null, 7, null);
            getVoiceItemTopPanel().setVoiceId(zangiMessage != null ? zangiMessage.getMsgId() : null);
            getVoiceItemTopPanel().setMsg(zangiMessage);
            getVoiceItemTopPanel().setUserName(zangiMessage != null ? zangiMessage.getFrom() : null, zangiMessage != null ? zangiMessage.getEmail() : null);
        }
        changeVoicePanelPlayPauseMode(i);
    }

    @Override
    public void showWaitingNetwork(Boolean bool) {
        if (bool == null) {
            return;
        }
        Log.i("ConversationTitleView", "connectionStatusChanged -> from on show waiting for network function");
        ConversationTitleView conversationTitleView = this.conversationTitleView;
        if (conversationTitleView != null) {
            conversationTitleView.connectionStatusChanged(!bool.booleanValue());
        }
    }

    @Override
    public void singleStickerDownloaded(boolean z, final ZangiMessage zangiMessage) {
        kotlin.jvm.internal.k.f(zangiMessage, "zangiMessage");
        if (z) {
            new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public final void run() {
                    ConversationView.singleStickerDownloaded$lambda$32(ConversationView.this, zangiMessage);
                }
            });
        }
    }

    @Override
    public void startRecording() {
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.updatePlayItems();
        }
    }

    @Override
    public void stopButtonClick() {
    }

    @Override
    public void stopRecording(String str, long j) {
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.updatePlayItems();
        }
        if (str != null) {
            if (str.length() == 0) {
                return;
            }
            sendMessageFromChatScreen(2, null, str, (int) j, System.currentTimeMillis() + "", "", 0.0d, 0.0d);
        }
    }

    @Override
    public void tarnsferIdCreated(String str, ZangiMessage zangiMessage) {
        kotlin.jvm.internal.k.f(str, "conversationId");
        kotlin.jvm.internal.k.f(zangiMessage, "message");
        Conversation conversation = this.conversation;
        zb.f.l(conversation != null ? conversation.getConversationJid() : null, str, false, 2, (Object) null);
    }

    @Override
    public void updateConversationWithMessage(final ZangiMessage zangiMessage, String str) {
        Conversation conversation = this.conversation;
        if (kotlin.jvm.internal.k.b(conversation != null ? conversation.getConversationJid() : null, str)) {
            new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public final void run() {
                    ConversationView.updateConversationWithMessage$lambda$43(zangiMessage, this);
                }
            });
        }
    }

    public final void updateDurationInPanel(String str, long j) {
        kotlin.jvm.internal.k.f(str, "duration");
        ZLabel durationLabelUI = getVoiceItemTopPanel().getDurationLabelUI();
        if (durationLabelUI != null) {
            durationLabelUI.setText(str);
        }
        getVoiceItemTopPanel().changeProgress(j);
    }

    public final void updateItem(ZangiMessage zangiMessage) {
        if (zangiMessage == null) {
            Log.i(this.TAG, "!!!!!Update Message is null");
            return;
        }
        Conversation conversation = this.conversation;
        if (conversation != null) {
            kotlin.jvm.internal.k.c(conversation);
            if (!conversation.isGroup()) {
                Conversation conversation2 = this.conversation;
                kotlin.jvm.internal.k.c(conversation2);
                if (TextUtils.isEmpty(conversation2.getDisplayEmail()) && !TextUtils.isEmpty(zangiMessage.getEmail()) && zangiMessage.isIncoming()) {
                    Conversation conversation3 = this.conversation;
                    kotlin.jvm.internal.k.c(conversation3);
                    conversation3.setDisplayEmail(zangiMessage.getEmail());
                    StorageService.INSTANCE.updateConversation(this.conversation);
                }
            }
        }
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.updateItem(zangiMessage);
        }
    }

    public final void updateItemStatus(ZangiMessage zangiMessage) {
        if (zangiMessage == null) {
            Log.i(this.TAG, "!!!!!Update Message is null");
            return;
        }
        ConversationAdapter conversationAdapter = this.conversationAdapter;
        if (conversationAdapter != null) {
            conversationAdapter.updateItemStatus(zangiMessage);
        }
    }

    @Override
    public void updateMessageItem(final ZangiMessage zangiMessage) {
        kotlin.jvm.internal.k.f(zangiMessage, "message");
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public final void run() {
                ConversationView.updateMessageItem$lambda$84(ConversationView.this, zangiMessage);
            }
        });
    }

    @Override
    public void updateMessageStatus(ZangiMessage zangiMessage, String str) {
        Conversation conversation = this.conversation;
        if (kotlin.jvm.internal.k.b(conversation != null ? conversation.getConversationJid() : null, str)) {
            updateItemStatus(zangiMessage);
        }
    }

    public final void updateOrAddMessageInfo(ZangiMessage zangiMessage) {
        kotlin.jvm.internal.k.f(zangiMessage, "message");
        StringBuilder sb = new StringBuilder();
        boolean parseEmojisResult = SmileGetterItem.Companion.parseEmojisResult(zangiMessage.getMsg(), sb);
        Spanned fromHtml = Html.fromHtml(sb.toString(), new SmileGetterItem(getResources(), false), null);
        int length = sb.length();
        kotlin.jvm.internal.k.e(fromHtml, "smsg");
        UiUtilKt.setCentredSpan(length, fromHtml);
        if (zangiMessage.getZangiMessageInfo() == null) {
            ZangiMessageInfo zangiMessageInfo = new ZangiMessageInfo();
            if (parseEmojisResult) {
                zangiMessageInfo.setHasSmile(1);
            } else {
                zangiMessageInfo.setHasSmile(0);
            }
            zangiMessageInfo.setHasLink(-1);
            zangiMessageInfo.setWidth(-1.0f);
            zangiMessageInfo.setlWidth(-1.0f);
            zangiMessageInfo.setMsgId(zangiMessage.getMsgId());
            StorageService storageService = StorageService.INSTANCE;
            storageService.addMessageInfo(zangiMessageInfo);
            zangiMessage.setZangiMessageInfo(zangiMessageInfo);
            storageService.updateMessage(zangiMessage);
        } else {
            if (parseEmojisResult) {
                ZangiMessageInfo zangiMessageInfo2 = zangiMessage.getZangiMessageInfo();
                if (zangiMessageInfo2 != null) {
                    zangiMessageInfo2.setHasSmile(1);
                }
            } else {
                ZangiMessageInfo zangiMessageInfo3 = zangiMessage.getZangiMessageInfo();
                if (zangiMessageInfo3 != null) {
                    zangiMessageInfo3.setHasSmile(0);
                }
            }
            ZangiMessageInfo zangiMessageInfo4 = zangiMessage.getZangiMessageInfo();
            if (zangiMessageInfo4 != null) {
                zangiMessageInfo4.setHasLink(-1);
            }
            ZangiMessageInfo zangiMessageInfo5 = zangiMessage.getZangiMessageInfo();
            if (zangiMessageInfo5 != null) {
                zangiMessageInfo5.setWidth(-1.0f);
            }
            ZangiMessageInfo zangiMessageInfo6 = zangiMessage.getZangiMessageInfo();
            if (zangiMessageInfo6 != null) {
                zangiMessageInfo6.setlWidth(-1.0f);
            }
            StorageService.INSTANCE.updateMessageInfo(zangiMessage.getZangiMessageInfo());
        }
        StorageService.INSTANCE.saveLinkIfMessageContainsLink(zangiMessage);
    }

    public final void updateUIWithConversation(com.beint.project.core.model.sms.Conversation r24, boolean r25) {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.screens.sms.ConversationView.updateUIWithConversation(com.beint.project.core.model.sms.Conversation, boolean):void");
    }

    public final void updateVoiceItemIfNeeded(long j, boolean z, boolean z6) {
        bc.g.d(bc.l1.a, bc.y0.b(), (bc.l0) null, new ConversationView$updateVoiceItemIfNeeded$1(this, j, z6, z, null), 2, (Object) null);
    }

    public final void viewDidAppear() {
        ChatSensor chatSensor;
        ContactNumber contactNumber;
        Conversation conversation = this.conversation;
        if (!(conversation != null && conversation.isGroup())) {
            Conversation conversation2 = this.conversation;
            if (!(conversation2 != null && conversation2.isPersonal()) && this.didAppearTimer != null) {
                Conversation conversation3 = this.conversation;
                if (((conversation3 == null || (contactNumber = conversation3.getContactNumber()) == null) ? null : contactNumber.getFirstContact()) == null) {
                    new Handler(Looper.getMainLooper()).post(new Runnable() {
                        @Override
                        public final void run() {
                            ConversationView.viewDidAppear$lambda$19(ConversationView.this);
                        }
                    });
                }
            }
        }
        if (this.chatSensor == null) {
            AVSession.Companion companion = AVSession.Companion;
            if (companion.getActiveSession() != null) {
                Conversation conversation4 = this.conversation;
                if ((conversation4 == null || conversation4.isNew()) ? false : true) {
                    AVSession activeSession = companion.getActiveSession();
                    if ((activeSession == null || activeSession.isCallStartFromVideo()) ? false : true) {
                        createSensor();
                    }
                }
            } else {
                Conversation conversation5 = this.conversation;
                if ((conversation5 == null || conversation5.isNew()) ? false : true) {
                    createSensor();
                }
            }
        }
        ChatSensor chatSensor2 = this.chatSensor;
        if ((chatSensor2 != null ? chatSensor2.getPresenterListener() : null) == null && this.chatSensorListener != null && (chatSensor = this.chatSensor) != null) {
            ChatSensorPresenterListener chatSensorPresenterListener = this.chatSensorListener;
            kotlin.jvm.internal.k.c(chatSensorPresenterListener);
            chatSensor.startRaiseToEarSensors(new WeakReference<>(chatSensorPresenterListener), new WeakReference<>(this));
        }
        SoundService soundService = SoundService.INSTANCE;
        soundService.initOpenPanelSound(2131820555);
        soundService.initChatButtonsSound(2131820546);
        soundService.initClosePanelSound(2131820547);
        ZangiGalleryServiceImpl.getInstance().loadItems();
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public final void run() {
                ConversationView.viewDidAppear$lambda$20(ConversationView.this);
            }
        });
        if (!this.isOptimizedConversation) {
            Conversation conversation6 = this.conversation;
            if (!(conversation6 != null && conversation6.isPersonal())) {
                Conversation conversation7 = this.conversation;
                new ZangiProfileServiceImpl.GetUserProfileFromServerAsync(conversation7 != null ? conversation7.getE164number() : null, new ProfileUpdatedListener() {
                    public void update() {
                    }
                }).executeOnExecutor(MainApplication.Companion.getRequestServiceExecutor(), new Object[0]);
            }
        }
        Conversation conversation8 = this.conversation;
        if (!(conversation8 != null && conversation8.isKicked())) {
            Conversation conversation9 = this.conversation;
            if ((conversation9 != null ? conversation9.getLastMessage() : null) != null) {
                Conversation conversation10 = this.conversation;
                if (conversation10 != null && conversation10.isGroup()) {
                    ZangiMessagingService zangiMessagingService = ZangiMessagingService.getInstance();
                    Conversation conversation11 = this.conversation;
                    zangiMessagingService.updateGroupInfo(conversation11 != null ? conversation11.getConversationJid() : null);
                }
            }
        }
        if (Constants.IS_STICKER_MARKET_ENABLED) {
            ZangiStickerServiceImpl.getInstance().loadFeaturedStickers();
        }
    }

    private final void sendEditedMessage(ZangiMessage zangiMessage, String str) {
        ConversationAdapterHelper conversationAdapterHelper;
        Map<String, Spanned> mSmileysMap;
        if (str != null) {
            int length = str.length() - 1;
            int i = 0;
            boolean z = false;
            while (i <= length) {
                boolean z6 = kotlin.jvm.internal.k.g(str.charAt(!z ? i : length), 32) <= 0;
                if (z) {
                    if (!z6) {
                        break;
                    } else {
                        length--;
                    }
                } else if (z6) {
                    i++;
                } else {
                    z = true;
                }
            }
            str.subSequence(i, length + 1).toString();
        }
        BottomSheet bottomSheet = this.bottomSheet;
        if (bottomSheet != null) {
            bottomSheet.setText("");
        }
        BottomSheet bottomSheet2 = this.bottomSheet;
        if (bottomSheet2 != null) {
            bottomSheet2.changeSendButtonVisability(false);
        }
        BottomSheet bottomSheet3 = this.bottomSheet;
        if (bottomSheet3 != null) {
            bottomSheet3.setEditedMessage((ZangiMessage) null);
        }
        if (kotlin.jvm.internal.k.b(str, zangiMessage.getMsg())) {
            ConversationAdapter conversationAdapter = this.conversationAdapter;
            if (conversationAdapter != null) {
                conversationAdapter.finishEdit();
                return;
            }
            return;
        }
        zangiMessage.setMsg(str == null ? "" : str);
        zangiMessage.setEdited(true);
        ZangiMessageInfo zangiMessageInfo = zangiMessage.getZangiMessageInfo();
        if (zangiMessageInfo != null) {
            zangiMessageInfo.setWidth(-1.0f);
        }
        if (zangiMessageInfo != null) {
            zangiMessageInfo.setlWidth(-1.0f);
        }
        if (zangiMessageInfo != null) {
            zangiMessageInfo.setHasSmile(-1);
        }
        if (zangiMessageInfo != null) {
            zangiMessageInfo.setHasLink(0);
        }
        StorageService storageService = StorageService.INSTANCE;
        storageService.updateMessageInfo(zangiMessageInfo);
        zangiMessage.setImageUrl((String) null);
        zangiMessage.setExtra("");
        zangiMessage.setTitle("");
        zangiMessage.setDescription("");
        zangiMessage.setCannonicalUrl((String) null);
        ConversationAdapter conversationAdapter2 = this.conversationAdapter;
        if (conversationAdapter2 != null && (conversationAdapterHelper = conversationAdapter2.conversationAdapterHelper) != null && (mSmileysMap = conversationAdapterHelper.getMSmileysMap()) != null) {
        }
        storageService.deleteMessageLink(zangiMessage.getMsgId());
        ConversationAdapter conversationAdapter3 = this.conversationAdapter;
        if (conversationAdapter3 != null) {
            conversationAdapter3.updateItem(zangiMessage);
        }
        storageService.updateMessage(zangiMessage);
        ZangiMessage zangiMessage2 = new ZangiMessage();
        Conversation conversation = this.conversation;
        kotlin.jvm.internal.k.c(conversation);
        zangiMessage2.setTo(conversation.getConversationJid());
        Conversation conversation2 = this.conversation;
        kotlin.jvm.internal.k.c(conversation2);
        zangiMessage2.setChat(conversation2.getConversationJid());
        zangiMessage2.setFrom(getUsername());
        zangiMessage2.setIncoming(false);
        Conversation conversation3 = this.conversation;
        kotlin.jvm.internal.k.c(conversation3);
        zangiMessage2.setGroup(conversation3.isGroup());
        if (str == null) {
            str = "";
        }
        zangiMessage2.setMsg(str);
        zangiMessage2.setMessageType(MessageType.edit);
        zangiMessage2.setMsgInfo("");
        zangiMessage2.setRel(zangiMessage.getMsgId());
        zangiMessage2.setMsgId("msgId" + System.currentTimeMillis());
        zangiMessage2.setTime(zangiMessage.getTime());
        zangiMessage2.setConvId(zangiMessage.getConvId());
        Conversation conversation4 = this.conversation;
        kotlin.jvm.internal.k.c(conversation4);
        zangiMessage2.setPersonal(kotlin.jvm.internal.k.b(conversation4.getConversationJid(), getUsername()));
        zangiMessage2.setImageUrl((String) null);
        recalculateWidthMessage(zangiMessage);
        ZangiMessagingService.getInstance().storeOutgoingMessage(zangiMessage2, CryptType.NEED_TO_ENCRYPT);
        if (!zangiMessage2.isPersonal()) {
            ZangiMessagingService.getInstance().sendMessagePacket(zangiMessage2);
        }
        ConversationAdapter conversationAdapter4 = this.conversationAdapter;
        if (conversationAdapter4 != null) {
            conversationAdapter4.finishEdit();
        }
        Conversation conversation5 = this.conversation;
        kotlin.jvm.internal.k.c(conversation5);
        ZangiMessage lastMessage = storageService.getLastMessage(conversation5.getConversationJid());
        if (lastMessage != null && lastMessage.getId() == zangiMessage.getId()) {
            storageService.setConversationLastMessage(this.conversation, zangiMessage, (SQLiteDatabase) null);
            updateConversationWithMessage(zangiMessage, zangiMessage.getChat());
            Intent intent = new Intent();
            Conversation conversation6 = this.conversation;
            kotlin.jvm.internal.k.c(conversation6);
            intent.putExtra("com.beint.project.c_jid", conversation6.getConversationJid());
            NotificationCenter.INSTANCE.postNotificationName(NotificationCenter.NotificationType.CONVERSATION_CHANGED, intent);
        }
    }

    public AnimatorView getCurrentThumbView(long j, long j7) {
        RecyclerView recyclerView;
        ConversationScreen conversationScreen = this.conversationScreen;
        RecyclerView.p layoutManager = (conversationScreen == null || (recyclerView = conversationScreen.getRecyclerView()) == null) ? null : recyclerView.getLayoutManager();
        if (layoutManager != null) {
            ConversationAdapter conversationAdapter = this.conversationAdapter;
            ConversationItemView findViewByPosition = layoutManager.findViewByPosition(conversationAdapter != null ? conversationAdapter.getPositionById(j) : 0);
            if (findViewByPosition instanceof ConversationItemView) {
                ConversationItemView conversationItemView = findViewByPosition;
                if (conversationItemView.getImageVideoItem() != null) {
                    ImageVideoItem imageVideoItem = conversationItemView.getImageVideoItem();
                    kotlin.jvm.internal.k.c(imageVideoItem);
                    return imageVideoItem.getCurrentAnimationView(j7);
                }
            }
        }
        return null;
    }

    private final void contactItemClickFunctional(String str, final String str2) {
        final Contact contactByNumber = ContactsManager.INSTANCE.getContactByNumber(str);
        final ArrayList arrayList = new ArrayList();
        boolean z = false;
        if (contactByNumber != null) {
            Iterator it = contactByNumber.getContactNumbers().iterator();
            while (it.hasNext()) {
                ContactNumber contactNumber = (ContactNumber) it.next();
                String number = contactNumber.getNumber();
                if (!(number == null || number.length() == 0)) {
                    String number2 = contactNumber.getNumber();
                    kotlin.jvm.internal.k.c(number2);
                    arrayList.add(number2);
                }
            }
        } else {
            arrayList.add(str);
        }
        if (!arrayList.isEmpty()) {
            if (arrayList.size() == 1) {
                if (updateConversationWithNumber((String) arrayList.get(0), str2, contactByNumber)) {
                    hideContactList();
                    return;
                } else {
                    BaseScreen.showCustomToast((Context) getActivity(), 2131886728);
                    return;
                }
            }
            FragmentActivity activity = getActivity();
            Conversation conversation = this.conversation;
            if (conversation != null && conversation.isNew()) {
                z = true;
            }
            AledtDialogAdapter aledtDialogAdapter = new AledtDialogAdapter(activity, contactByNumber, z ? AledtDialogAdapter.LOAD_TYPE.ALL : AledtDialogAdapter.LOAD_TYPE.ZANGI_CONTACTS);
            c.a alertDialog = AlertDialogUtils.getAlertDialog(getActivity());
            alertDialog.r(2131886310);
            alertDialog.c(aledtDialogAdapter, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    ConversationView.contactItemClickFunctional$lambda$64(ConversationView.this, arrayList, str2, contactByNumber, dialogInterface, i);
                }
            });
            androidx.appcompat.app.c a = alertDialog.a();
            kotlin.jvm.internal.k.e(a, "builder.create()");
            a.setCanceledOnTouchOutside(true);
            a.show();
            Window window = a.getWindow();
            kotlin.jvm.internal.k.c(window);
            window.setLayout(AlertDialogUtils.getAlertSize(), -2);
            a.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public final void onDismiss(DialogInterface dialogInterface) {
                    AlertDialogUtils.dismissCurrentDialog();
                }
            });
            AlertDialogUtils.setCurrentDialog(a);
        }
    }

    private final void saveIncompleteAndDraftText(Conversation conversation, CharSequence charSequence, boolean z) {
        ZangiMessage editedMessage;
        ZangiMessage mReplyMessage;
        ChatSmilesView chatSmilesView;
        BottomBar bottomBar;
        if (this.isViewAppeard) {
            Long l = null;
            if (kotlin.jvm.internal.k.b(conversation != null ? conversation.getConversationJid() : null, "zangi")) {
                return;
            }
            if (kotlin.jvm.internal.k.b(conversation != null ? conversation.getConversationJid() : null, "zangi")) {
                return;
            }
            BottomSheet bottomSheet = this.bottomSheet;
            if (((bottomSheet == null || (chatSmilesView = bottomSheet.getChatSmilesView()) == null || (bottomBar = chatSmilesView.getBottomBar()) == null) ? null : bottomBar.getBottomBarState()) != BottomBar.BottomBarState.GIF || z) {
                Conversation conversation2 = this.conversation;
                if (conversation2 != null) {
                    BottomSheet bottomSheet2 = this.bottomSheet;
                    conversation2.setReplyMessageId((bottomSheet2 == null || (mReplyMessage = bottomSheet2.getMReplyMessage()) == null) ? null : Long.valueOf(mReplyMessage.getId()));
                }
                Conversation conversation3 = this.conversation;
                if (conversation3 != null) {
                    BottomSheet bottomSheet3 = this.bottomSheet;
                    if (bottomSheet3 != null && (editedMessage = bottomSheet3.getEditedMessage()) != null) {
                        l = Long.valueOf(editedMessage.getId());
                    }
                    conversation3.setEditMessageId(l);
                }
                DraftTextManager.INSTANCE.saveIncompleteAndDraftText(charSequence, conversation, this.presenter);
            }
        }
    }
}